HighLAND
WeightType.hxx
1 #ifndef WeightType_hxx
2 #define WeightType_hxx
3 
4 #include "BasicTypes.hxx"
5 
6 class WeightType{
7 public:
8 
9  WeightType(Float_t w=1) {Correction= Systematic=w;}
10  WeightType(Float_t c, Float_t s){Correction=c;Systematic=s;}
11 
12  Float_t Correction;
13  Float_t Systematic;
14 
15  WeightType operator *(const WeightType& w){return WeightType(Correction*w.Correction, Systematic*w.Systematic);}
16  WeightType operator /(const WeightType& w){return WeightType(Correction/w.Correction, Systematic/w.Systematic);}
17  WeightType operator +(const WeightType& w){return WeightType(Correction+w.Correction, Systematic+w.Systematic);}
18  WeightType operator -(const WeightType& w){return WeightType(Correction-w.Correction, Systematic-w.Systematic);}
19 
20  WeightType operator *(Float_t a){return WeightType(Correction*a, Systematic*a);}
21  WeightType operator /(Float_t a){return WeightType(Correction/a, Systematic/a);}
22  WeightType operator -(Float_t a){return WeightType(Correction-a, Systematic-a);}
23  WeightType operator +(Float_t a){return WeightType(Correction+a, Systematic+a);}
24 
25  WeightType& operator *=(const WeightType& w){Correction*=w.Correction; Systematic*=w.Systematic; return *this;}
26  WeightType& operator /=(const WeightType& w){Correction/=w.Correction; Systematic/=w.Systematic; return *this;}
27 
28  WeightType& operator +=(const WeightType& w){Correction += w.Correction; Systematic += w.Systematic; return *this;}
29  WeightType& operator -=(const WeightType& w){Correction -= w.Correction; Systematic -= w.Systematic; return *this;}
30 
31  WeightType& operator *=(Float_t a){Correction*=a; Systematic*=a; return *this;}
32  WeightType& operator /=(Float_t a){Correction/=a; Systematic/=a; return *this;}
33 
34 
35  WeightType& operator +=(Float_t a){Correction += a; Systematic += a; return *this;}
36  WeightType& operator -=(Float_t a){Correction -= a; Systematic -= a; return *this;}
37 
38 
39  bool operator ==(const WeightType& w){return (Correction==w.Correction && Systematic==w.Systematic);}
40  bool operator !=(const WeightType& w){return (Correction!=w.Correction || Systematic!=w.Systematic);}
41 
42  bool operator ==(Float_t a){return (Systematic==a);}
43  bool operator !=(Float_t a){return (Systematic!=a);}
44 
45 
46 
47 };
48 
49 WeightType operator -(Float_t a, const WeightType& w);
50 WeightType operator *(Float_t a, const WeightType& w);
51 
52 std::ostream& operator<<(std::ostream &os, const WeightType& w);
53 
54 
55 //typedef Float_t Weight_h;
56 typedef WeightType Weight_h;
57 
58 
59 #endif