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