]> git.uio.no Git - u/mrichter/AliRoot.git/blame - HLT/TPCLib/AliHLTTPCTransform.h
Record changes.
[u/mrichter/AliRoot.git] / HLT / TPCLib / AliHLTTPCTransform.h
CommitLineData
a6c02c85 1// @(#) $Id$
4aa41877 2// Original: AliHLTTransform.h,v 1.37 2005/06/14 10:55:21 cvetan
a6c02c85 3
4#ifndef ALIHLTTPCTRANSFORM_H
5#define ALIHLTTPCTRANSFORM_H
6
7#ifdef use_aliroot
8 class AliRunLoader;
9#endif
10
11#include "AliHLTTPCRootTypes.h"
12
13class AliHLTTPCTransform {
14
15 public:
600e6a1b 16 AliHLTTPCTransform();
a6c02c85 17 enum VersionType { kVdefault=0, kVdeprecated=1, kValiroot=10, kVcosmics=100};
18
19 private:
20 static const Double_t fgkBFACT; //bfield
21 static const Double_t fgkPi; //pi
22 static const Double_t fgkPi2; //2pi
23 static const Double_t fgk2Pi; //pi/2
24 static const Double_t fgkAnodeWireSpacing; //anode wire spacing
25 static const Double_t fgkToDeg; //rad to deg
26
27 static Int_t fgNPatches; //6 (dont change this)
28 static Int_t fgRows[6][2]; //rows per patch
29 static Int_t fgNRows[6]; //rows per patch
30
31 static Double_t fgBField; //field
32 static Double_t fgBFieldFactor; //field
33 static Double_t fgSolenoidBField; //field
34 static Int_t fgNTimeBins; //ntimebins
35 static Int_t fgNRowLow; //nrows
36 static Int_t fgNRowUp; //nrows
37 static Int_t fgNRowUp1; //nrows
38 static Int_t fgNRowUp2; //nrows
39 static Int_t fgNSectorLow; //nsector
40 static Int_t fgNSectorUp; //nsector
41 static Int_t fgSlice2Sector[36][2]; //nslice
42 static Int_t fgSector2Slice[72]; //nslice
43 static Int_t fgSectorLow[72]; //nsector
44 static Double_t fgPadPitchWidthLow; //pad pitch
45 static Double_t fgPadPitchWidthUp; //pad pitch
46 static Double_t fgZWidth; //width
47 static Double_t fgZSigma; //sigma
48 static Double_t fgZLength; //length
49 static Double_t fgZOffset; //offset
50 static Int_t fgNSector; //72 (dont change this)
51 static Int_t fgNSlice; //36 (dont change this)
52 static Int_t fgNRow; //159 (dont change this)
53 static Double_t fgNRotShift; //Rotation shift (eg. 0.5 for 10 degrees)
54 static Int_t fgNPads[159]; //fill this following Init and fVersion
55 static Double_t fgX[159]; //X position in local coordinates
56 static Int_t fgVersion; //flags the version
57 static Double_t fgDiffT; //Transversal diffusion constant
58 static Double_t fgDiffL; //Longitudinal diffusion constant
59 static Double_t fgOmegaTau; //ExB effects
60 static Double_t fgInnerPadLength; //innner pad length
61 static Double_t fgOuter1PadLength; //outer pad length
62 static Double_t fgOuter2PadLength; //outer pad length
63 static Double_t fgInnerPRFSigma; //inner pad response function
64 static Double_t fgOuter1PRFSigma; //outer pad response function
65 static Double_t fgOuter2PRFSigma; //outer pad response function
66 static Double_t fgTimeSigma; //Minimal longitudinal width
67 static Int_t fgADCSat; //ADC Saturation (1024 = 10 bit)
68 static Int_t fgZeroSup; //Zero suppression threshold
69 static Double_t fgCos[36]; //stores the cos value for local to global rotations
70 static Double_t fgSin[36]; //stores the sin value for local to global rotations
71
72 public:
73 virtual ~AliHLTTPCTransform() {}
74#ifdef use_aliroot
75 static Bool_t Init(AliRunLoader *runLoader); //init transformer params using a run loader
76#endif
77 static Bool_t Init(Char_t* path,Bool_t UseAliTPCParam=kFALSE); //init transformer settings (versions)
78 static Bool_t MakeInitFile(Char_t *rootfilename,Char_t *filename); //create the init file from rootfile
79 static Bool_t ReadInit(Char_t *path); //read init (possibly from root file)
80 static Bool_t ReadInitFile(Char_t *path); //read init from text file
81 static Bool_t SaveInitFile(Char_t *filename); //save parameters in init file
82
83 //setters
84 static void SetNPatches(Int_t i){fgNPatches = i;}
85 static void SetNRows(Int_t s[6]){for(Int_t i=0;i<fgNPatches;i++) fgNRows[i] = s[i];}
86 static void SetRows(Int_t s[6][2]){
87 for(Int_t i=0;i<fgNPatches;i++){
88 fgRows[i][0] = s[i][0];
89 fgRows[i][1] = s[i][1];
90 }
91 }
92 static void SetBField(Double_t f) {fgBField = f;} //careful, these 3 are not independent!
93 static void SetBFieldFactor(Double_t f) {
94 fgBFieldFactor = f;
95 fgBField=fgBFieldFactor*fgSolenoidBField*0.1;
96 }
97 static void SetSolenoidBField(Double_t f){
98 fgSolenoidBField = f;
99 fgBField=fgBFieldFactor*fgSolenoidBField*0.1;
100 }
42a3bb88 101 static void SetNTimeBins(Int_t i){fgNTimeBins = i; if (fgNTimeBins>0) {fgZWidth = fgZLength / (Double_t)fgNTimeBins;}}
a6c02c85 102 static void SetNRowLow(Int_t i){fgNRowLow = i;}
103 static void SetNRowUp(Int_t i){fgNRowUp = i;}
104 static void SetNRowUp1(Int_t i){fgNRowUp1 = i;}
105 static void SetNRowUp2(Int_t i){fgNRowUp2 = i;}
106 static void SetSlice2Sector(Int_t s[36][2]){
107 for(Int_t i=0;i<fgNSlice;i++){
108 fgSlice2Sector[i][0] = s[i][0];
109 fgSlice2Sector[i][1] = s[i][1];
110 }
111 }
112 static void SetSector2Slice(Int_t s[72]){
113 for(Int_t i=0;i<fgNSector;i++) fgSector2Slice[i] = s[i];}
114 static void SetSectorLow(Int_t s[72]){
115 for(Int_t i=0;i<fgNSector;i++) fgSectorLow[i] = s[i];}
116 static void SetNSectorLow(Int_t i){fgNSectorLow = i;}
117 static void SetNSectorUp(Int_t i){fgNSectorUp = i;}
118 static void SetPadPitchWidthLow(Double_t f){fgPadPitchWidthLow = f;}
119 static void SetPadPitchWidthUp(Double_t f){fgPadPitchWidthUp = f;}
42a3bb88 120 // Matthias 21.09.2007
121 // zwidth is given by zlength and no of timebins and should not be set
122 // otherwise. Was never used
123 //static void SetZWidth(Double_t f){fgZWidth = f;}
a6c02c85 124 static void SetZSigma(Double_t f){fgZSigma = f;}
125 static void SetZLength(Double_t f){fgZLength = f;}
126 static void SetZOffset(Double_t f){fgZOffset = f;}
127 static void SetNSector(Int_t i){fgNSector = i;}
128 static void SetNSlice(Int_t i){fgNSlice = i;}
129 static void SetNRow(Int_t i){fgNRow = i;}
130 static void SetNRotShift(Double_t f){fgNRotShift = f;}
131 static void SetNPads(Int_t pads[159]){
132 for(Int_t i=0;i<fgNRow;i++) fgNPads[i] = pads[i];}
133 static void SetX(Double_t xs[159]){
134 for(Int_t i=0;i<fgNRow;i++) fgX[i] = xs[i];}
135 static void SetVersion(Int_t i){fgVersion = i;}
136 static void SetDiffT(Double_t f){fgDiffT = f;}
137 static void SetDiffL(Double_t f){fgDiffL = f;}
138 static void SetOmegaTau(Double_t f){fgOmegaTau = f;}
139 static void SetInnerPadLength(Double_t f){fgInnerPadLength = f;}
140 static void SetOuter1PadLength(Double_t f){fgOuter1PadLength = f;}
141 static void SetOuter2PadLength(Double_t f){fgOuter2PadLength = f;}
142 static void SetInnerPRFSigma(Double_t f){fgInnerPRFSigma = f;}
143 static void SetOuter1PRFSigma(Double_t f){fgOuter1PRFSigma = f;}
144 static void SetOuter2PRFSigma(Double_t f){fgOuter2PRFSigma = f;}
145 static void SetTimeSigma(Double_t f){fgTimeSigma = f;}
146 static void SetADCSat(Int_t i) {fgADCSat = i;}
147 static void SetZeroSup(Int_t i) {fgZeroSup = i;}
148
149 //getters
150 static const Char_t* GetParamName() {return "75x40_100x60_150x60";}
151 static Double_t Pi() {return fgkPi;}
152 static Double_t PiHalf() {return fgkPi2;}
153 static Double_t TwoPi() {return fgk2Pi;}
154 static Double_t GetAnodeWireSpacing() {return fgkAnodeWireSpacing;}
155 static Double_t GetBFact() {return fgkBFACT;}
156 static Double_t ToRad() {return 1./fgkToDeg;}
157 static Double_t ToDeg() {return fgkToDeg;}
158
84645eb0 159 static Int_t GetNumberOfPatches();
a6c02c85 160 static Int_t GetFirstRow(Int_t patch);
161 static Int_t GetLastRow(Int_t patch);
162 static Int_t GetFirstRowOnDDL(Int_t patch);
163 static Int_t GetLastRowOnDDL(Int_t patch);
164 static Int_t GetNRows(Int_t patch);
165 static Int_t GetPatch(Int_t padrow);
166 static Int_t GetNRows() {return fgNRow;}
167 static Int_t GetNRowLow() {return fgNRowLow;}
168 static Int_t GetNRowUp1() {return fgNRowUp1;}
169 static Int_t GetNRowUp2() {return fgNRowUp2;}
170 static Int_t GetPadRow(Float_t x);
171 static Int_t GetNPatches() {return fgNPatches;}
172 static Int_t GetNPads(Int_t row);
173 static Int_t GetNTimeBins(){return fgNTimeBins;}
174 static Double_t GetBField() {return fgBField;}
175 static Double_t GetSolenoidField() {return fgSolenoidBField;}
176 static Double_t GetBFactFactor() {return fgBFieldFactor;}
177 static Double_t GetBFieldValue() {return (fgBField*fgkBFACT);}
178 static Float_t Deg2Rad(Float_t angle) {return angle/fgkToDeg;}
179 static Float_t Rad2Deg(Float_t angle) {return angle*fgkToDeg;}
180 static Int_t GetVersion(){return fgVersion;}
181 static Double_t GetPadPitchWidthLow() {return fgPadPitchWidthLow;}
182 static Double_t GetPadPitchWidthUp() {return fgPadPitchWidthUp;}
183 static Double_t GetPadPitchWidth(Int_t patch);
184 static Double_t GetZWidth() {return fgZWidth;}
185 static Double_t GetZLength() {return fgZLength;}
186 static Double_t GetZOffset() {return fgZOffset;}
187 static Double_t GetDiffT() {return fgDiffT;}
188 static Double_t GetDiffL() {return fgDiffL;}
189 static Double_t GetParSigmaY2(Int_t padrow,Float_t z,Float_t angle);
190 static Double_t GetParSigmaZ2(Int_t padrow,Float_t z,Float_t tgl);
191 static Double_t GetOmegaTau() {return fgOmegaTau;}
192 static Double_t GetPadLength(Int_t padrow);
193 static Double_t GetPRFSigma(Int_t padrow);
194 static Double_t GetTimeSigma() {return fgTimeSigma;}
195 static Double_t GetZSigma() {return fgZSigma;}
196 static Int_t GetADCSat() {return fgADCSat;}
197 static Int_t GetZeroSup() {return fgZeroSup;}
198 static Int_t GetNSlice() {return fgNSlice;}
199 static Int_t GetNSector() {return fgNSector;}
200 static Int_t GetNSectorLow() {return fgNSectorLow;}
201 static Int_t GetNSectorUp() {return fgNSectorUp;}
202
203 static Bool_t Slice2Sector(Int_t slice, Int_t slicerow, Int_t &sector, Int_t &row);
204 static Bool_t Sector2Slice(Int_t &slice, Int_t sector);
205 static Bool_t Sector2Slice(Int_t &slice, Int_t &slicerow, Int_t sector, Int_t row);
206
207 static Double_t Row2X(Int_t slicerow);
208 static Double_t GetMaxY(Int_t slicerow);
209 static Double_t GetEta(Float_t *xyz);
210 static Double_t GetEta(Int_t slice,Int_t padrow, Int_t pad, Int_t time);
211 static Double_t GetPhi(Float_t *xyz);
212 static Double_t GetZFast(Int_t slice, Int_t time, Float_t vertex=0.);
213
214 static void XYZtoRPhiEta(Float_t *rpe, Float_t *xyz);
215 static void Local2Global(Float_t *xyz, Int_t slice);
216 static void Local2GlobalAngle(Float_t *angle, Int_t slice);
217 static void Global2LocalAngle(Float_t *angle, Int_t slice);
218
219 //we have 3 different system: Raw : row, pad, time
220 // Local : x,y and global z
221 // Global: global x,y and global z
222 //the methods with HLT in the name differ from the other
223 //as you specify slice and slicerow, instead of sector
224 //and sector row. In that way we safe "a few ifs"
225 static void Raw2Local(Float_t *xyz, Int_t sector, Int_t row, Float_t pad, Float_t time);
226 static void RawHLT2Local(Float_t *xyz,Int_t slice,Int_t slicerow,Float_t pad,Float_t time);
227 static void Raw2Local(Float_t *xyz, Int_t sector, Int_t row, Int_t pad, Int_t time);
228 static void RawHLT2Local(Float_t *xyz,Int_t slice,Int_t slicerow,Int_t pad,Int_t time);
229 static void Local2Global(Float_t *xyz, Int_t sector, Int_t row);
230 static void LocHLT2Global(Float_t *xyz, Int_t slice, Int_t slicerow);
231 static void Global2Local(Float_t *xyz, Int_t sector);
232 static void Global2LocHLT(Float_t *xyz, Int_t slice);
233 static void Raw2Global(Float_t *xyz, Int_t sector, Int_t row, Float_t pad, Float_t time);
738c049f 234 static void RawHLT2Global(Float_t *xyz, Int_t slice, Int_t slicerow, Float_t pad, Float_t time);
a6c02c85 235 static void Raw2Global(Float_t *xyz, Int_t sector, Int_t row, Int_t pad, Int_t time);
236 static void RawHLT2Global(Float_t *xyz, Int_t slice,
237 Int_t slicerow, Int_t pad, Int_t time);
238 static void Local2Raw(Float_t *xyz, Int_t sector, Int_t row);
239 static void LocHLT2Raw(Float_t *xyz, Int_t slice, Int_t slicerow);
240 static void Global2Raw(Float_t *xyz, Int_t sector, Int_t row);
241 static void Global2HLT(Float_t *xyz, Int_t slice, Int_t slicerow);
242
243 static void PrintCompileOptions();
244
245 ClassDef(AliHLTTPCTransform,1)
246};
247#endif