FairRoot/PandaRoot
RhoDoubleErr.cxx
Go to the documentation of this file.
1 // //
3 // RhoDoubleErr //
4 // //
5 // Double w/ error //
6 // //
7 // Author: Marcel Kunze, RUB, Nov. 99 //
8 // Copyright (C) 1999-2001, Ruhr-University Bochum. //
9 // Ralf Kliemt, HIM/GSI Feb.2013 (Cleanup & Restructuring) //
10 // //
12 
13 #include "RhoDoubleErr.h"
14 #include "TBuffer.h"
15 #include <math.h>
16 
18 
19 TBuffer& operator>> ( TBuffer& buf, RhoDoubleErr *&obj )
20 {
21  obj = ( RhoDoubleErr* ) buf.ReadObject ( RhoDoubleErr::Class() );
22  return buf;
23 }
24 
25 #include <iostream>
26 using namespace std;
27 
28 static const char rscid[] = "$Id: TDoubleErr.cxx,v 1.3 2002-02-01 22:34:57 marcel Exp $";
29 
31 TObject(original)
32 {
33  *this = original;
34 }
35 
37 {
38  fValue = original.fValue;
39  fCovariance = original.fCovariance;
40  return *this;
41 }
42 
45 {
46  if ( 0 >= fCovariance ) {
47  return -1.;
48  } else {
49  Double_t diff = ( ref - fValue );
50  return ( diff * diff ) / fCovariance;
51  }
52 }
53 
55 {
56  return RhoDoubleErr ( -fValue, fCovariance );
57 }
58 
60 {
61  return RhoDoubleErr ( fValue - bde.fValue, fCovariance - bde.fCovariance );
62 }
63 
65 {
66  return RhoDoubleErr ( fValue + bde.fValue, fCovariance + bde.fCovariance );
67 }
68 
70 {
71  return RhoDoubleErr ( fValue * bde.fValue,
72  fCovariance * bde.fValue * bde.fValue +
73  bde.fCovariance * fValue * fValue );
74 }
75 
77 {
78  Double_t bde2 = bde.fValue * bde.fValue;
79 
80  return RhoDoubleErr ( fValue / bde.fValue,
81  fCovariance / bde2 +
82  bde.fCovariance * fValue * fValue / ( bde2 * bde2 ) );
83 }
84 
86 {
87  *this = *this + bde;
88  return *this;
89 }
90 
92 {
93  *this = *this - bde;
94  return *this;
95 }
96 
98 {
99  *this = *this * bde;
100  return *this;
101 }
102 
104 {
105  *this = *this / bde;
106  return *this;
107 }
108 
110 {
111  stream << "value: " << bde.Value()
112  << " covariance: " << bde.Covariance();
113 
114  return stream;
115 }
116 
RhoDoubleErr operator+(const RhoDoubleErr &)
std::ostream & operator<<(std::ostream &o, const PndEventInfo &a)
RhoDoubleErr & operator*=(const RhoDoubleErr &)
RhoDoubleErr & operator+=(const RhoDoubleErr &)
Double_t fCovariance
Definition: RhoDoubleErr.h:97
Double_t Covariance() const
Definition: RhoDoubleErr.h:55
Double_t
RhoDoubleErr operator*(const RhoDoubleErr &)
Double_t fValue
Definition: RhoDoubleErr.h:96
RhoDoubleErr operator/(const RhoDoubleErr &)
Double_t DetermineChisq(Double_t ref) const
static const char rscid[]
RhoDoubleErr operator-()
RhoDoubleErr & operator-=(const RhoDoubleErr &)
ClassImp(PndAnaContFact)
RhoDoubleErr & operator/=(const RhoDoubleErr &)
Double_t Value() const
Definition: RhoDoubleErr.h:52
RhoDoubleErr & operator=(const RhoDoubleErr &)