]> git.uio.no Git - u/mrichter/AliRoot.git/blob - HLT/src/AliL3Transform.h
315160c54d2480dd7dc4b34b874da630ed75482a
[u/mrichter/AliRoot.git] / HLT / src / AliL3Transform.h
1 // @(#) $Id$
2
3 #ifndef ALIL3TRANSFORM_H
4 #define ALIL3TRANSFORM_H
5
6 #include "AliL3RootTypes.h"
7
8 class AliL3Transform {
9
10  public:
11   enum VersionType { fV_default=0, fV_deprecated=1, fV_aliroot=10, fV_cosmics=100};
12
13  private:
14   const static Double_t fBFACT;
15   const static Double_t fPi;
16   const static Double_t fAnodeWireSpacing; 
17
18   static Int_t fNPatches; //6 (dont change this) 
19   static Int_t fRows[6][2];
20   static Int_t fNRows[6];
21
22   static Double_t fBField;
23   static Double_t fBFieldFactor;
24   static Double_t fSolenoidBField;
25   static Int_t fNTimeBins;
26   static Int_t fNRowLow;
27   static Int_t fNRowUp;
28   static Int_t fNRowUp1;
29   static Int_t fNRowUp2;
30   static Int_t fNSectorLow;
31   static Int_t fNSectorUp;
32   static Int_t fSlice2Sector[36][2];
33   static Int_t fSector2Slice[72];
34   static Int_t fSectorLow[72];
35   static Double_t fPadPitchWidthLow;
36   static Double_t fPadPitchWidthUp;
37   static Double_t fZWidth;
38   static Double_t fZSigma;
39   static Double_t fZLength;
40   static Double_t fZOffset;
41   static Int_t fNSector; //72  (dont change this)
42   static Int_t fNSlice;  //36  (dont change this)
43   static Int_t fNRow;    //159 (dont change this)
44   static Double_t fNRotShift; //Rotation shift (eg. 0.5 for 10 degrees)
45   static Int_t fNPads[159]; //fill this following Init and fVersion
46   static Double_t fX[159];  //X position in local coordinates
47   static Int_t fVersion;  //flags the version
48   static Double_t fDiffT; //Transversal diffusion constant
49   static Double_t fDiffL; //Longitudinal diffusion constant
50   static Double_t fOmegaTau; //ExB effects
51   static Double_t fInnerPadLength;
52   static Double_t fOuter1PadLength;
53   static Double_t fOuter2PadLength;
54   static Double_t fInnerPRFSigma;
55   static Double_t fOuter1PRFSigma;
56   static Double_t fOuter2PRFSigma;
57   static Double_t fTimeSigma; //Minimal longitudinal width
58   static Int_t fADCSat; //ADC Saturation (1024 = 10 bit)
59   static Int_t fZeroSup; //Zero suppression threshold
60   static Double_t fCos[36]; //stores the cos value for local to global rotations  
61   static Double_t fSin[36]; //stores the sin value for local to global rotations  
62
63  public:
64   static Bool_t Init(Char_t* path,Bool_t UseAliTPCParam=kFALSE); //init transformer settings (versions)
65   static Bool_t MakeInitFile(Char_t *rootfilename,Char_t *filename); //create the init file from rootfile
66   static Bool_t ReadInit(Char_t *path);         //read init (possibly from root file)
67   static Bool_t ReadInitFile(Char_t *path);     //read init from text file 
68   static Bool_t SaveInitFile(Char_t *filename); //save parameters in init file
69
70   //setters
71   static void SetNPatches(Int_t i){fNPatches = i;}
72   static void SetNRows(Int_t s[6]){for(Int_t i=0;i<fNPatches;i++) fNRows[i] = s[i];}
73   static void SetRows(Int_t s[6][2]){
74     for(Int_t i=0;i<fNPatches;i++){
75       fRows[i][0] = s[i][0];
76       fRows[i][1] = s[i][1];
77     }
78   }
79   static void SetBField(Double_t f) {fBField = f;} //careful, these 3 are not independent!
80   static void SetBFieldFactor(Double_t f) {fBFieldFactor = f;fBField=fBFieldFactor*fSolenoidBField*0.1;}
81   static void SetSolenoidBField(Double_t f){fSolenoidBField = f;fBField=fBFieldFactor*fSolenoidBField*0.1;}
82   static void SetNTimeBins(Int_t i){fNTimeBins = i;}
83   static void SetNRowLow(Int_t i){fNRowLow = i;}
84   static void SetNRowUp(Int_t i){fNRowUp = i;}
85   static void SetNRowUp1(Int_t i){fNRowUp1 = i;}
86   static void SetNRowUp2(Int_t i){fNRowUp2 = i;}
87   static void SetSlice2Sector(Int_t s[36][2]){
88     for(Int_t i=0;i<fNSlice;i++){
89       fSlice2Sector[i][0] = s[i][0];
90       fSlice2Sector[i][1] = s[i][1];
91     }
92   }
93   static void SetSector2Slice(Int_t s[72]){for(Int_t i=0;i<fNSector;i++) fSector2Slice[i] = s[i];}
94   static void SetSectorLow(Int_t s[72]){for(Int_t i=0;i<fNSector;i++) fSectorLow[i] = s[i];}
95   static void SetNSectorLow(Int_t i){fNSectorLow = i;}
96   static void SetNSectorUp(Int_t i){fNSectorUp = i;}
97   static void SetPadPitchWidthLow(Double_t f){fPadPitchWidthLow = f;}
98   static void SetPadPitchWidthUp(Double_t f){fPadPitchWidthUp = f;}
99   static void SetZWidth(Double_t f){fZWidth = f;}
100   static void SetZSigma(Double_t f){fZSigma = f;}
101   static void SetZLength(Double_t f){fZLength = f;}
102   static void SetZOffset(Double_t f){fZOffset = f;}
103   static void SetNSector(Int_t i){fNSector = i;}
104   static void SetNSlice(Int_t i){fNSlice = i;}
105   static void SetNRow(Int_t i){fNRow = i;}
106   static void SetNRotShift(Double_t f){fNRotShift = f;}
107   static void SetNPads(Int_t pads[159]){for(Int_t i=0;i<fNRow;i++) fNPads[i] = pads[i];}
108   static void SetX(Double_t xs[159]){for(Int_t i=0;i<fNRow;i++) fX[i] = xs[i];}
109   static void SetVersion(Int_t i){fVersion = i;}
110   static void SetDiffT(Double_t f){fDiffT = f;}
111   static void SetDiffL(Double_t f){fDiffL = f;}
112   static void SetOmegaTau(Double_t f){fOmegaTau = f;}
113   static void SetInnerPadLength(Double_t f){fInnerPadLength = f;}
114   static void SetOuter1PadLength(Double_t f){fOuter1PadLength = f;}
115   static void SetOuter2PadLength(Double_t f){fOuter2PadLength = f;}
116   static void SetInnerPRFSigma(Double_t f){fInnerPRFSigma = f;}
117   static void SetOuter1PRFSigma(Double_t f){fOuter1PRFSigma = f;}
118   static void SetOuter2PRFSigma(Double_t f){fOuter2PRFSigma = f;}
119   static void SetTimeSigma(Double_t f){fTimeSigma = f;}
120   static void SetADCSat(Int_t i) {fADCSat = i;}
121   static void SetZeroSup(Int_t i) {fZeroSup = i;}
122
123   //getters
124   static const Char_t* GetParamName() {return "75x40_100x60_150x60";}
125
126   static Int_t GetFirstRow(Int_t patch);
127   static Int_t GetLastRow(Int_t patch);
128   static Int_t GetNRows(Int_t patch);
129   static Int_t GetPatch(Int_t padrow);
130   static Int_t GetNRows() {return fNRow;}
131   static Int_t GetNRowLow() {return fNRowLow;}
132   static Int_t GetNRowUp1() {return fNRowUp1;}
133   static Int_t GetNRowUp2() {return fNRowUp2;}
134   static Int_t GetPadRow(Float_t x);
135   static Int_t GetNPatches() {return fNPatches;}
136   static Int_t GetNPads(Int_t row);
137   static Int_t GetNTimeBins(){return fNTimeBins;}
138   static Double_t GetBField() {return fBField;}
139   static Double_t GetSolenoidField() {return fSolenoidBField;}
140   static Double_t GetBFact() {return fBFACT;}
141   static Double_t GetBFactFactor() {return fBFieldFactor;}
142   static Double_t GetBFieldValue() {return (fBField*fBFACT);}
143   static Float_t Deg2Rad(Float_t angle) {return angle*fPi/180;}
144   static Double_t Pi() {return fPi;}
145   static Int_t GetVersion(){return fVersion;}
146   static Double_t GetPadPitchWidthLow() {return fPadPitchWidthLow;}
147   static Double_t GetPadPitchWidthUp() {return fPadPitchWidthUp;}
148   static Double_t GetPadPitchWidth(Int_t patch);
149   static Double_t GetZWidth() {return fZWidth;}
150   static Double_t GetZLength() {return fZLength;}
151   static Double_t GetZOffset() {return fZOffset;}
152   static Double_t GetDiffT() {return fDiffT;}
153   static Double_t GetDiffL() {return fDiffL;}
154   static Double_t GetParSigmaY2(Int_t padrow,Float_t z,Float_t angle);
155   static Double_t GetParSigmaZ2(Int_t padrow,Float_t z,Float_t tgl);
156   static Double_t GetOmegaTau() {return fOmegaTau;}
157   static Double_t GetAnodeWireSpacing() {return fAnodeWireSpacing;}
158   static Double_t GetPadLength(Int_t padrow);
159   static Double_t GetPRFSigma(Int_t padrow);
160   static Double_t GetTimeSigma() {return fTimeSigma;}
161   static Double_t GetZSigma() {return fZSigma;}
162   static Int_t GetADCSat() {return fADCSat;}
163   static Int_t GetZeroSup() {return fZeroSup;}
164   static Int_t GetNSlice() {return fNSlice;}
165   static Int_t GetNSector() {return fNSector;}
166   static Int_t GetNSectorLow() {return fNSectorLow;}
167   static Int_t GetNSectorUp() {return fNSectorUp;}
168   
169   static Bool_t Slice2Sector(Int_t slice, Int_t slicerow, Int_t &sector, Int_t &row);
170   static Bool_t Sector2Slice(Int_t &slice, Int_t sector);
171   static Bool_t Sector2Slice(Int_t &slice, Int_t &slicerow, Int_t sector, Int_t row);
172
173   static Double_t Row2X(Int_t slicerow);
174   static Double_t GetMaxY(Int_t slicerow);
175   static Double_t GetEta(Float_t *xyz);
176   static Double_t GetEta(Int_t slice,Int_t padrow, Int_t pad, Int_t time);
177   static Double_t GetPhi(Float_t *xyz);
178
179   static void XYZtoRPhiEta(Float_t *rpe, Float_t *xyz);
180   static void Local2Global(Float_t *xyz, Int_t slice);
181   static void Local2GlobalAngle(Float_t *angle, Int_t slice);
182   static void Global2LocalAngle(Float_t *angle, Int_t slice);
183
184   static void Raw2Local(Float_t *xyz, Int_t sector, Int_t row, Float_t pad, Float_t time);
185   static void Local2Global(Float_t *xyz, Int_t sector, Int_t row);
186   static void Global2Local(Float_t *xyz, Int_t sector, Bool_t isSlice=kFALSE);
187   static void Raw2Global(Float_t *xyz, Int_t sector, Int_t row, Float_t pad, Float_t time);
188   static void Local2Raw(Float_t *xyz, Int_t sector, Int_t row);
189   static void Global2Raw(Float_t *xyz, Int_t sector, Int_t row);
190
191   static void PrintCompileOptions();
192   
193   ClassDef(AliL3Transform,1)
194 };
195 #endif