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