]> git.uio.no Git - u/mrichter/AliRoot.git/blob - HLT/comp/AliL3DataCompressorHelper.cxx
-Added protected copy constructors and assignment operators. -Public data members...
[u/mrichter/AliRoot.git] / HLT / comp / AliL3DataCompressorHelper.cxx
1 // @(#) $Id$
2
3 // Author: Anders Vestbo <mailto:vestbo@fi.uib.no>
4 //*-- Copyright &copy ALICE HLT Group
5
6 #include "AliL3StandardIncludes.h"
7
8 #include "AliL3RootTypes.h"
9 #include "AliL3Transform.h"
10
11 #include "AliL3DataCompressorHelper.h"
12
13 #if __GNUC__ == 3
14 using namespace std;
15 #endif
16
17 //_____________________________________________________________
18 //
19 //  AliL3DataCompression
20 //
21 // Interface class; binary <-> AliROOT handling of TPC data compression classes.
22 //
23
24
25 ClassImp(AliL3DataCompressorHelper)
26
27
28 Int_t AliL3DataCompressorHelper::fNumTimeBits = 12;
29 Int_t AliL3DataCompressorHelper::fNumPadBits = 12;
30 Int_t AliL3DataCompressorHelper::fNumChargeBits = 14;
31 Int_t AliL3DataCompressorHelper::fNumShapeBits = 14;
32 Float_t AliL3DataCompressorHelper::fXYResidualStep1 = 0.03;
33 Float_t AliL3DataCompressorHelper::fXYResidualStep2 = 0.03;
34 Float_t AliL3DataCompressorHelper::fXYResidualStep3 = 0.03;
35 Float_t AliL3DataCompressorHelper::fZResidualStep1 = 0.05;
36 Float_t AliL3DataCompressorHelper::fZResidualStep2 = 0.05;
37 Float_t AliL3DataCompressorHelper::fZResidualStep3 = 0.05;
38 Float_t AliL3DataCompressorHelper::fXYWidthStep = 0.005;
39 Float_t AliL3DataCompressorHelper::fZWidthStep = 0.005;
40 Int_t AliL3DataCompressorHelper::fClusterCharge = 100;
41 Int_t AliL3DataCompressorHelper::fNumPadBitsRemaining = 18;
42 Int_t AliL3DataCompressorHelper::fNumTimeBitsRemaining = 19;
43 Int_t AliL3DataCompressorHelper::fNumShapeBitsRemaining = 11;
44
45 void AliL3DataCompressorHelper::SetBitNumbers(Int_t pad,Int_t time,Int_t charge,Int_t shape)
46 {
47   fNumPadBits = pad;
48   fNumTimeBits = time;
49   fNumChargeBits = charge;
50   fNumShapeBits = shape;
51 }
52
53 void AliL3DataCompressorHelper::SetTransverseResolutions(Float_t res1,Float_t res2,Float_t res3,Float_t width)
54 {
55   fXYResidualStep1 = res1;
56   fXYResidualStep2 = res2;
57   fXYResidualStep3 = res3;
58   fXYWidthStep = width;
59 }
60
61 void AliL3DataCompressorHelper::SetLongitudinalResolutions(Float_t res1,Float_t res2,Float_t res3,Float_t width)
62 {
63   fZResidualStep1 = res1;
64   fZResidualStep2 = res2;
65   fZResidualStep3 = res3;
66   fZWidthStep = width;
67 }
68
69 void AliL3DataCompressorHelper::SetRemainingBitNumbers(Int_t pad,Int_t time,Int_t shape)
70 {
71   fNumPadBitsRemaining = pad;
72   fNumTimeBitsRemaining = time;
73   fNumShapeBitsRemaining = shape;
74 }
75
76 const Float_t AliL3DataCompressorHelper::GetXYResidualStep(Int_t row) 
77 {
78   if(row < AliL3Transform::GetNRowLow())
79     return fXYResidualStep1;
80   else if(row < AliL3Transform::GetNRowLow() + AliL3Transform::GetNRowUp1())
81     return fXYResidualStep2;
82   else if(row < AliL3Transform::GetNRowLow() + AliL3Transform::GetNRowUp1() + AliL3Transform::GetNRowUp2())
83     return fXYResidualStep3;
84   else
85     {
86       cerr<<"AliL3DataCompressorHelper::GetXYResidualStep : Wrong row number "<<row<<endl;
87       return -1;
88     }
89 }
90
91 const Float_t AliL3DataCompressorHelper::GetZResidualStep(Int_t row) 
92 {
93   if(row < AliL3Transform::GetNRowLow())
94     return fZResidualStep1;
95   else if(row < AliL3Transform::GetNRowLow() + AliL3Transform::GetNRowUp1())
96     return fZResidualStep2;
97   else if(row < AliL3Transform::GetNRowLow() + AliL3Transform::GetNRowUp1() + AliL3Transform::GetNRowUp2())
98     return fZResidualStep3;
99   else
100     {
101       cerr<<"AliL3DataCompressorHelper::GetXYResidualStep : Wrong row number "<<row<<endl;
102       return -1;
103     }
104 }
105
106 const Float_t AliL3DataCompressorHelper::GetPadPrecisionFactor()
107 {
108   Int_t nbits = fNumPadBitsRemaining;
109   if(nbits >=21)
110     return 10000;
111   if(nbits >= 18)
112     return 1000;
113   if(nbits >= 14) 
114     return 100;
115   if(nbits >= 11)
116     return 10;
117   if(nbits >= 8)
118     return 1;
119   else 
120     {
121       cerr<<"AliL3DataCompressorHelper::GetRemainingPadFactor : Too few bits for the pad direction: "<<nbits<<endl;
122       return 1;
123     }
124 }
125
126 const Float_t AliL3DataCompressorHelper::GetTimePrecisionFactor()
127 {
128   Int_t nbits = fNumTimeBitsRemaining;
129   if(nbits >=23)
130     return 10000;
131   if(nbits >= 19)
132     return 1000;
133   if(nbits >= 16) 
134     return 100;
135   if(nbits >= 13)
136     return 10;
137   if(nbits >= 9)
138     return 1;
139   else 
140     {
141       cerr<<"AliL3DataCompressorHelper::GetRemainingPadFactor : Too few bits for the pad direction: "<<nbits<<endl;
142       return 1;
143     }
144 }