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