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