]>
Commit | Line | Data |
---|---|---|
7e914051 | 1 | // $Id$ |
ff2f0f94 | 2 | |
892210c7 | 3 | //************************************************************************** |
4 | //* This file is property of and copyright by the ALICE HLT Project * | |
5 | //* ALICE Experiment at CERN, All rights reserved. * | |
6 | //* * | |
7 | //* Primary Authors: Anders Vestbo, maintained by * | |
8 | //* Matthias Richter <Matthias.Richter@ift.uib.no> * | |
9 | //* for The ALICE HLT Project. * | |
10 | //* * | |
11 | //* Permission to use, copy, modify and distribute this software and its * | |
12 | //* documentation strictly for non-commercial purposes is hereby granted * | |
13 | //* without fee, provided that the above copyright notice appears in all * | |
14 | //* copies and that both the copyright notice and this permission notice * | |
15 | //* appear in the supporting documentation. The authors make no claims * | |
16 | //* about the suitability of this software for any purpose. It is * | |
17 | //* provided "as is" without express or implied warranty. * | |
18 | //************************************************************************** | |
ff2f0f94 | 19 | |
20 | /** @file AliHLTTPCCompDataCompressorHelper.cxx | |
21 | @author Anders Vestbo | |
22 | @date 30-11-2006 | |
23 | @brief The Data Compressor helper for the Vestbo-compression for the TPC | |
24 | */ | |
25 | ||
26 | #include "AliHLTStdIncludes.h" | |
27 | ||
28 | #include "AliHLTTPCTransform.h" | |
29 | ||
30 | #include "AliHLTTPCCompDataCompressorHelper.h" | |
31 | ||
32 | #if __GNUC__ >= 3 | |
33 | using namespace std; | |
34 | #endif | |
35 | ||
36 | //_____________________________________________________________ | |
37 | // | |
38 | // AliHLTTPCCompDataCompression | |
39 | // | |
40 | // Interface class; binary <-> AliROOT handling of TPC data compression classes. | |
41 | // | |
42 | ||
43 | ||
44 | ClassImp(AliHLTTPCCompDataCompressorHelper) | |
45 | ||
7e914051 | 46 | AliHLTTPCCompDataCompressorHelper::AliHLTTPCCompDataCompressorHelper() |
47 | { | |
48 | } | |
49 | ||
ff2f0f94 | 50 | // see header file for more documentation |
51 | // used variables for compression | |
52 | Int_t AliHLTTPCCompDataCompressorHelper::fgNumTimeBits = 12; | |
53 | Int_t AliHLTTPCCompDataCompressorHelper::fgNumPadBits = 12; | |
54 | Int_t AliHLTTPCCompDataCompressorHelper::fgNumChargeBits = 14; | |
55 | Int_t AliHLTTPCCompDataCompressorHelper::fgNumShapeBits = 14; | |
56 | Float_t AliHLTTPCCompDataCompressorHelper::fgXYResidualStep1 = 0.03; | |
57 | Float_t AliHLTTPCCompDataCompressorHelper::fgXYResidualStep2 = 0.03; | |
58 | Float_t AliHLTTPCCompDataCompressorHelper::fgXYResidualStep3 = 0.03; | |
59 | Float_t AliHLTTPCCompDataCompressorHelper::fgZResidualStep1 = 0.05; | |
60 | Float_t AliHLTTPCCompDataCompressorHelper::fgZResidualStep2 = 0.05; | |
61 | Float_t AliHLTTPCCompDataCompressorHelper::fgZResidualStep3 = 0.05; | |
62 | Float_t AliHLTTPCCompDataCompressorHelper::fgXYWidthStep = 0.005; | |
63 | Float_t AliHLTTPCCompDataCompressorHelper::fgZWidthStep = 0.005; | |
64 | Int_t AliHLTTPCCompDataCompressorHelper::fgClusterCharge = 100; | |
65 | Int_t AliHLTTPCCompDataCompressorHelper::fgNumPadBitsRemaining = 18; | |
66 | Int_t AliHLTTPCCompDataCompressorHelper::fgNumTimeBitsRemaining = 19; | |
67 | Int_t AliHLTTPCCompDataCompressorHelper::fgNumShapeBitsRemaining = 11; | |
68 | ||
69 | void AliHLTTPCCompDataCompressorHelper::SetBitNumbers(Int_t pad,Int_t time,Int_t charge,Int_t shape) | |
70 | { | |
71 | // see header file for class documentation | |
72 | // sets the numbers of bits | |
73 | fgNumPadBits = pad; | |
74 | fgNumTimeBits = time; | |
75 | fgNumChargeBits = charge; | |
76 | fgNumShapeBits = shape; | |
77 | } | |
78 | ||
79 | void AliHLTTPCCompDataCompressorHelper::SetTransverseResolutions(Float_t res1,Float_t res2,Float_t res3,Float_t width) | |
80 | { | |
81 | // see header file for class documentation | |
82 | // sets the transverse resolution | |
83 | fgXYResidualStep1 = res1; | |
84 | fgXYResidualStep2 = res2; | |
85 | fgXYResidualStep3 = res3; | |
86 | fgXYWidthStep = width; | |
87 | } | |
88 | ||
89 | void AliHLTTPCCompDataCompressorHelper::SetLongitudinalResolutions(Float_t res1,Float_t res2,Float_t res3,Float_t width) | |
90 | { | |
91 | // see header file for class documentation | |
92 | // sets the longitudinal resolution | |
93 | fgZResidualStep1 = res1; | |
94 | fgZResidualStep2 = res2; | |
95 | fgZResidualStep3 = res3; | |
96 | fgZWidthStep = width; | |
97 | } | |
98 | ||
99 | void AliHLTTPCCompDataCompressorHelper::SetRemainingBitNumbers(Int_t pad,Int_t time,Int_t shape) | |
100 | { | |
101 | // see header file for class documentation | |
102 | // sets the numbers of remaining bits | |
103 | fgNumPadBitsRemaining = pad; | |
104 | fgNumTimeBitsRemaining = time; | |
105 | fgNumShapeBitsRemaining = shape; | |
106 | } | |
107 | ||
108 | Float_t AliHLTTPCCompDataCompressorHelper::GetXYResidualStep(Int_t row) | |
109 | { | |
110 | // see header file for class documentation | |
111 | // gets the XY residual step | |
112 | if(row < AliHLTTPCTransform::GetNRowLow()) | |
113 | return fgXYResidualStep1; | |
114 | else if(row < AliHLTTPCTransform::GetNRowLow() + AliHLTTPCTransform::GetNRowUp1()) | |
115 | return fgXYResidualStep2; | |
116 | else if(row < AliHLTTPCTransform::GetNRowLow() + AliHLTTPCTransform::GetNRowUp1() + AliHLTTPCTransform::GetNRowUp2()) | |
117 | return fgXYResidualStep3; | |
118 | else | |
119 | { | |
120 | cerr<<"AliHLTTPCCompDataCompressorHelper::GetXYResidualStep : Wrong row number "<<row<<endl; | |
121 | return -1; | |
122 | } | |
123 | } | |
124 | ||
125 | Float_t AliHLTTPCCompDataCompressorHelper::GetZResidualStep(Int_t row) | |
126 | { | |
127 | // see header file for class documentation | |
128 | // gets the Z residual step | |
129 | if(row < AliHLTTPCTransform::GetNRowLow()) | |
130 | return fgZResidualStep1; | |
131 | else if(row < AliHLTTPCTransform::GetNRowLow() + AliHLTTPCTransform::GetNRowUp1()) | |
132 | return fgZResidualStep2; | |
133 | else if(row < AliHLTTPCTransform::GetNRowLow() + AliHLTTPCTransform::GetNRowUp1() + AliHLTTPCTransform::GetNRowUp2()) | |
134 | return fgZResidualStep3; | |
135 | else | |
136 | { | |
137 | cerr<<"AliHLTTPCCompDataCompressorHelper::GetXYResidualStep : Wrong row number "<<row<<endl; | |
138 | return -1; | |
139 | } | |
140 | } | |
141 | ||
142 | Float_t AliHLTTPCCompDataCompressorHelper::GetPadPrecisionFactor() | |
143 | { | |
144 | // see header file for class documentation | |
145 | // gets pad precision factor | |
146 | Int_t nbits = fgNumPadBitsRemaining; | |
147 | if(nbits >=21) | |
148 | return 10000; | |
149 | if(nbits >= 18) | |
150 | return 1000; | |
151 | if(nbits >= 14) | |
152 | return 100; | |
153 | if(nbits >= 11) | |
154 | return 10; | |
155 | if(nbits >= 8) | |
156 | return 1; | |
157 | else | |
158 | { | |
159 | cerr<<"AliHLTTPCCompDataCompressorHelper::GetRemainingPadFactor : Too few bits for the pad direction: "<<nbits<<endl; | |
160 | return 1; | |
161 | } | |
162 | } | |
163 | ||
164 | Float_t AliHLTTPCCompDataCompressorHelper::GetTimePrecisionFactor() | |
165 | { | |
166 | // see header file for class documentation | |
167 | // gest time precision factor | |
168 | Int_t nbits = fgNumTimeBitsRemaining; | |
169 | if(nbits >=23) | |
170 | return 10000; | |
171 | if(nbits >= 19) | |
172 | return 1000; | |
173 | if(nbits >= 16) | |
174 | return 100; | |
175 | if(nbits >= 13) | |
176 | return 10; | |
177 | if(nbits >= 9) | |
178 | return 1; | |
179 | else | |
180 | { | |
181 | cerr<<"AliHLTTPCCompDataCompressorHelper::GetRemainingPadFactor : Too few bits for the pad direction: "<<nbits<<endl; | |
182 | return 1; | |
183 | } | |
184 | } | |
185 | ||
186 | ||
187 | Int_t AliHLTTPCCompDataCompressorHelper::Nint(Double_t x) | |
188 | { | |
189 | // see header file for class documentation | |
190 | // Round to nearest integer. Rounds half integers | |
191 | // to the nearest even integer. | |
192 | ||
193 | Int_t i=0; | |
194 | if (x >= 0) { | |
195 | i = Int_t(x + 0.5); | |
196 | if (x + 0.5 == Double_t(i) && i & 1) i--; | |
197 | } else { | |
198 | i = Int_t(x - 0.5); | |
199 | if (x - 0.5 == Double_t(i) && i & 1) i++; | |
200 | ||
201 | } | |
202 | return i; | |
203 | } |