]>
Commit | Line | Data |
---|---|---|
62e60107 | 1 | #ifndef ALIL3FFLOAT_H |
2 | #define ALIL3FFLOAT_H | |
3 | ||
4 | #include "AliL3RootTypes.h" | |
5 | ||
24dbb695 | 6 | #ifndef USEFFLOAT |
7 | typedef Float_t AliL3FFloat; | |
8 | #else | |
499dd465 | 9 | |
24dbb695 | 10 | //use Ints times Digits instead of Floats |
11 | #define USEINTS | |
12 | ||
62e60107 | 13 | #define DEFDIG 100 |
14 | #define DEFMIN -1000000 | |
15 | #define DEFMAX 1000000 | |
16 | ||
24dbb695 | 17 | #ifdef USEINTS |
18 | ||
19 | //ROOT does not know about 64 bit integer | |
20 | #ifdef no_root | |
21 | typedef long long int Fnt_t; | |
22 | #else | |
23 | typedef Int_t Fnt_t; | |
24 | #endif | |
27835353 | 25 | |
62e60107 | 26 | class AliL3FFloat { |
27 | public: | |
24dbb695 | 28 | AliL3FFloat(const Double_t val=0) {Set(val);} |
27835353 | 29 | AliL3FFloat(const AliL3FFloat &f) {Set(f);} |
30 | virtual ~AliL3FFloat(); | |
31 | ||
32 | AliL3FFloat& operator = (const AliL3FFloat &f) {Set(f); return *this;} | |
33 | AliL3FFloat& operator = (const Double_t f) {Set(f); return *this;} | |
62e60107 | 34 | |
62e60107 | 35 | operator const Double_t () const {return fVal;} |
27835353 | 36 | operator const Float_t () const {return (Float_t)fVal;} |
24dbb695 | 37 | #ifdef no_root |
38 | operator const Fnt_t () const {return (Fnt_t)fVal;} | |
39 | #endif | |
40 | operator const Int_t () const {return (Int_t)fVal;} | |
41 | ||
27835353 | 42 | |
62e60107 | 43 | friend ostream& operator<<(ostream &os, const AliL3FFloat &f); |
27835353 | 44 | |
62e60107 | 45 | friend AliL3FFloat operator + (const AliL3FFloat &f1,const AliL3FFloat &f2); |
46 | friend AliL3FFloat operator + (const AliL3FFloat &f1,const Double_t f2); | |
47 | friend AliL3FFloat operator + (const Double_t f1, const AliL3FFloat &f2); | |
48 | friend AliL3FFloat operator + (const AliL3FFloat &f1); | |
49 | friend AliL3FFloat operator - (const AliL3FFloat &f1,const AliL3FFloat &f2); | |
50 | friend AliL3FFloat operator - (const AliL3FFloat &f1,const Double_t f2); | |
51 | friend AliL3FFloat operator - (const Double_t f1, const AliL3FFloat &f2); | |
52 | friend AliL3FFloat operator - (const AliL3FFloat &f1); | |
53 | friend AliL3FFloat operator * (const AliL3FFloat &f1,const AliL3FFloat &f2); | |
27835353 | 54 | friend AliL3FFloat operator * (const AliL3FFloat &f1,const Double_t f2); |
55 | friend AliL3FFloat operator * (const Double_t f1, const AliL3FFloat &f2); | |
62e60107 | 56 | friend AliL3FFloat operator / (const AliL3FFloat &f1,const AliL3FFloat &f2); |
27835353 | 57 | friend AliL3FFloat operator / (const AliL3FFloat &f1,const Double_t f2); |
58 | friend AliL3FFloat operator / (const Double_t f1, const AliL3FFloat &f2); | |
62e60107 | 59 | |
60 | AliL3FFloat& operator += (const AliL3FFloat &f); | |
61 | AliL3FFloat& operator += (const Double_t f); | |
62 | AliL3FFloat& operator -= (const AliL3FFloat &f); | |
63 | AliL3FFloat& operator -= (const Double_t f); | |
64 | AliL3FFloat& operator *= (const AliL3FFloat &f); | |
65 | AliL3FFloat& operator *= (const Double_t f); | |
66 | AliL3FFloat& operator /= (const AliL3FFloat &f); | |
67 | AliL3FFloat& operator /= (const Double_t f); | |
24dbb695 | 68 | //==,!=,>=, ... |
69 | //++,-- | |
70 | ||
71 | static void PrintStat(); | |
72 | static void SetParams(Int_t dig=DEFDIG,Int_t min=DEFMIN,Int_t max=DEFMAX); | |
73 | void Set(const Double_t f=0); | |
74 | void Set(const AliL3FFloat &f); | |
75 | inline Double_t GetVal() const {return fVal;} | |
76 | inline Double_t GetExactVal() const {return fExactVal;} | |
77 | inline Fnt_t GetValInt() const {return fVali;} | |
78 | ||
79 | private: | |
80 | ||
81 | void Round(Double_t f); | |
82 | Bool_t CheckUpperBound(); | |
83 | Bool_t CheckLowerBound(); | |
84 | Bool_t CheckBounds() {return (CheckUpperBound() && CheckLowerBound());} | |
85 | ||
86 | Fnt_t fVali; | |
87 | Double_t fVal; | |
88 | Double_t fExactVal; | |
89 | ||
90 | static Int_t fDigits; | |
91 | static Int_t fMax; | |
92 | static Int_t fMin; | |
93 | ||
94 | #ifdef CALCSTATS | |
95 | static Int_t fN; | |
96 | static Int_t fNRounded; | |
97 | static Int_t fNOpAdds; | |
98 | static Int_t fNOpMults; | |
99 | static Int_t fNOpDivs; | |
100 | static Int_t fNOpSubs; | |
101 | static Int_t fNOverFlow; | |
102 | static Int_t fNUnderFlow; | |
103 | static Double_t fNDiff; | |
104 | #endif | |
105 | ||
106 | ClassDef(AliL3FFloat,1) | |
107 | }; | |
108 | ||
109 | #else | |
62e60107 | 110 | |
24dbb695 | 111 | class AliL3FFloat { |
112 | public: | |
113 | AliL3FFloat(const Double_t val=0) {Set(val);} | |
114 | AliL3FFloat(const AliL3FFloat &f) {Set(f);} | |
115 | virtual ~AliL3FFloat(); | |
116 | ||
117 | AliL3FFloat& operator = (const AliL3FFloat &f) {Set(f); return *this;} | |
118 | AliL3FFloat& operator = (const Double_t f) {Set(f); return *this;} | |
119 | ||
120 | operator const Double_t () const {return fVal;} | |
121 | operator const Float_t () const {return (Float_t)fVal;} | |
122 | operator const Int_t () const {return (Int_t)fVal;} | |
123 | ||
124 | friend ostream& operator<<(ostream &os, const AliL3FFloat &f); | |
125 | ||
126 | friend AliL3FFloat operator + (const AliL3FFloat &f1,const AliL3FFloat &f2); | |
127 | friend AliL3FFloat operator + (const AliL3FFloat &f1,const Double_t f2); | |
128 | friend AliL3FFloat operator + (const Double_t f1, const AliL3FFloat &f2); | |
129 | friend AliL3FFloat operator + (const AliL3FFloat &f1); | |
130 | friend AliL3FFloat operator - (const AliL3FFloat &f1,const AliL3FFloat &f2); | |
131 | friend AliL3FFloat operator - (const AliL3FFloat &f1,const Double_t f2); | |
132 | friend AliL3FFloat operator - (const Double_t f1, const AliL3FFloat &f2); | |
133 | friend AliL3FFloat operator - (const AliL3FFloat &f1); | |
134 | friend AliL3FFloat operator * (const AliL3FFloat &f1,const AliL3FFloat &f2); | |
135 | friend AliL3FFloat operator * (const AliL3FFloat &f1,const Double_t f2); | |
136 | friend AliL3FFloat operator * (const Double_t f1, const AliL3FFloat &f2); | |
137 | friend AliL3FFloat operator / (const AliL3FFloat &f1,const AliL3FFloat &f2); | |
138 | friend AliL3FFloat operator / (const AliL3FFloat &f1,const Double_t f2); | |
139 | friend AliL3FFloat operator / (const Double_t f1, const AliL3FFloat &f2); | |
140 | ||
141 | AliL3FFloat& operator += (const AliL3FFloat &f); | |
142 | AliL3FFloat& operator += (const Double_t f); | |
143 | AliL3FFloat& operator -= (const AliL3FFloat &f); | |
144 | AliL3FFloat& operator -= (const Double_t f); | |
145 | AliL3FFloat& operator *= (const AliL3FFloat &f); | |
146 | AliL3FFloat& operator *= (const Double_t f); | |
147 | AliL3FFloat& operator /= (const AliL3FFloat &f); | |
148 | AliL3FFloat& operator /= (const Double_t f); | |
27835353 | 149 | //==,!=,>=, ... |
150 | //++,-- | |
151 | ||
62e60107 | 152 | static void PrintStat(); |
153 | static void SetParams(Int_t dig=DEFDIG,Int_t min=DEFMIN,Int_t max=DEFMAX); | |
24dbb695 | 154 | void Set(const Double_t f=0); |
155 | void Set(const AliL3FFloat &f); | |
62e60107 | 156 | inline Double_t GetVal() const {return fVal;} |
157 | inline Double_t GetExactVal() const {return fExactVal;} | |
158 | ||
159 | private: | |
160 | ||
161 | Double_t Round(Double_t f); | |
162 | Bool_t CheckUpperBound(); | |
163 | Bool_t CheckLowerBound(); | |
164 | Bool_t CheckBounds() {return (CheckUpperBound() && CheckLowerBound());} | |
165 | ||
166 | Double_t fVal; | |
167 | Double_t fExactVal; | |
168 | ||
169 | static Int_t fDigits; | |
27835353 | 170 | static Char_t fQuery[10]; |
62e60107 | 171 | static Int_t fMax; |
172 | static Int_t fMin; | |
173 | ||
27835353 | 174 | #ifdef CALCSTATS |
62e60107 | 175 | static Int_t fN; |
176 | static Int_t fNRounded; | |
177 | static Int_t fNOpAdds; | |
178 | static Int_t fNOpMults; | |
179 | static Int_t fNOpDivs; | |
180 | static Int_t fNOpSubs; | |
181 | static Int_t fNOverFlow; | |
182 | static Int_t fNUnderFlow; | |
27835353 | 183 | static Double_t fNDiff; |
184 | #endif | |
62e60107 | 185 | |
186 | ClassDef(AliL3FFloat,1) | |
187 | }; | |
188 | ||
189 | #endif | |
24dbb695 | 190 | #endif |
191 | #endif | |
62e60107 | 192 | |
193 | ||
194 | ||
195 |