Added a method which loads TPC parameters in AliL3Transform through the runloader
[u/mrichter/AliRoot.git] / HLT / src / AliL3Transform.h
CommitLineData
3e87ef69 1// @(#) $Id$
2
108615fc 3#ifndef ALIL3TRANSFORM_H
4#define ALIL3TRANSFORM_H
5
108615fc 6#include "AliL3RootTypes.h"
108615fc 7
8class AliL3Transform {
494fad94 9
3e87ef69 10 public:
11 enum VersionType { fV_default=0, fV_deprecated=1, fV_aliroot=10, fV_cosmics=100};
12
108615fc 13 private:
1f1942b8 14 static const Double_t fBFACT;
15 static const Double_t fPi;
5a31e9df 16 static const Double_t fPi2;
17 static const Double_t f2Pi;
1f1942b8 18 static const Double_t fAnodeWireSpacing;
5a31e9df 19 static const Double_t fToDeg;
3e87ef69 20
21 static Int_t fNPatches; //6 (dont change this)
22 static Int_t fRows[6][2];
23 static Int_t fNRows[6];
24
ef79795d 25 static Double_t fBField;
3e87ef69 26 static Double_t fBFieldFactor;
27 static Double_t fSolenoidBField;
494fad94 28 static Int_t fNTimeBins;
29 static Int_t fNRowLow;
30 static Int_t fNRowUp;
5923e698 31 static Int_t fNRowUp1;
32 static Int_t fNRowUp2;
494fad94 33 static Int_t fNSectorLow;
34 static Int_t fNSectorUp;
3e87ef69 35 static Int_t fSlice2Sector[36][2];
36 static Int_t fSector2Slice[72];
37 static Int_t fSectorLow[72];
494fad94 38 static Double_t fPadPitchWidthLow;
39 static Double_t fPadPitchWidthUp;
40 static Double_t fZWidth;
41 static Double_t fZSigma;
494fad94 42 static Double_t fZLength;
43 static Double_t fZOffset;
3e87ef69 44 static Int_t fNSector; //72 (dont change this)
45 static Int_t fNSlice; //36 (dont change this)
46 static Int_t fNRow; //159 (dont change this)
47 static Double_t fNRotShift; //Rotation shift (eg. 0.5 for 10 degrees)
48 static Int_t fNPads[159]; //fill this following Init and fVersion
49 static Double_t fX[159]; //X position in local coordinates
50 static Int_t fVersion; //flags the version
768861a0 51 static Double_t fDiffT; //Transversal diffusion constant
52 static Double_t fDiffL; //Longitudinal diffusion constant
3e87ef69 53 static Double_t fOmegaTau; //ExB effects
768861a0 54 static Double_t fInnerPadLength;
5923e698 55 static Double_t fOuter1PadLength;
56 static Double_t fOuter2PadLength;
768861a0 57 static Double_t fInnerPRFSigma;
5923e698 58 static Double_t fOuter1PRFSigma;
59 static Double_t fOuter2PRFSigma;
768861a0 60 static Double_t fTimeSigma; //Minimal longitudinal width
3e87ef69 61 static Int_t fADCSat; //ADC Saturation (1024 = 10 bit)
62 static Int_t fZeroSup; //Zero suppression threshold
63 static Double_t fCos[36]; //stores the cos value for local to global rotations
64 static Double_t fSin[36]; //stores the sin value for local to global rotations
af99f571 65
3e87ef69 66 public:
cefeb80d 67#ifdef use_aliroot
68 static Bool_t Init(AliRunLoader *runLoader); //init transformer params using a run loader
69#endif
3e87ef69 70 static Bool_t Init(Char_t* path,Bool_t UseAliTPCParam=kFALSE); //init transformer settings (versions)
02f030e3 71 static Bool_t MakeInitFile(Char_t *rootfilename,Char_t *filename); //create the init file from rootfile
72 static Bool_t ReadInit(Char_t *path); //read init (possibly from root file)
73 static Bool_t ReadInitFile(Char_t *path); //read init from text file
74 static Bool_t SaveInitFile(Char_t *filename); //save parameters in init file
2220326f 75
3e87ef69 76 //setters
77 static void SetNPatches(Int_t i){fNPatches = i;}
78 static void SetNRows(Int_t s[6]){for(Int_t i=0;i<fNPatches;i++) fNRows[i] = s[i];}
79 static void SetRows(Int_t s[6][2]){
80 for(Int_t i=0;i<fNPatches;i++){
81 fRows[i][0] = s[i][0];
82 fRows[i][1] = s[i][1];
83 }
84 }
85 static void SetBField(Double_t f) {fBField = f;} //careful, these 3 are not independent!
86 static void SetBFieldFactor(Double_t f) {fBFieldFactor = f;fBField=fBFieldFactor*fSolenoidBField*0.1;}
87 static void SetSolenoidBField(Double_t f){fSolenoidBField = f;fBField=fBFieldFactor*fSolenoidBField*0.1;}
88 static void SetNTimeBins(Int_t i){fNTimeBins = i;}
89 static void SetNRowLow(Int_t i){fNRowLow = i;}
90 static void SetNRowUp(Int_t i){fNRowUp = i;}
91 static void SetNRowUp1(Int_t i){fNRowUp1 = i;}
92 static void SetNRowUp2(Int_t i){fNRowUp2 = i;}
93 static void SetSlice2Sector(Int_t s[36][2]){
94 for(Int_t i=0;i<fNSlice;i++){
95 fSlice2Sector[i][0] = s[i][0];
96 fSlice2Sector[i][1] = s[i][1];
97 }
98 }
99 static void SetSector2Slice(Int_t s[72]){for(Int_t i=0;i<fNSector;i++) fSector2Slice[i] = s[i];}
100 static void SetSectorLow(Int_t s[72]){for(Int_t i=0;i<fNSector;i++) fSectorLow[i] = s[i];}
101 static void SetNSectorLow(Int_t i){fNSectorLow = i;}
102 static void SetNSectorUp(Int_t i){fNSectorUp = i;}
103 static void SetPadPitchWidthLow(Double_t f){fPadPitchWidthLow = f;}
104 static void SetPadPitchWidthUp(Double_t f){fPadPitchWidthUp = f;}
105 static void SetZWidth(Double_t f){fZWidth = f;}
106 static void SetZSigma(Double_t f){fZSigma = f;}
107 static void SetZLength(Double_t f){fZLength = f;}
108 static void SetZOffset(Double_t f){fZOffset = f;}
109 static void SetNSector(Int_t i){fNSector = i;}
110 static void SetNSlice(Int_t i){fNSlice = i;}
111 static void SetNRow(Int_t i){fNRow = i;}
112 static void SetNRotShift(Double_t f){fNRotShift = f;}
113 static void SetNPads(Int_t pads[159]){for(Int_t i=0;i<fNRow;i++) fNPads[i] = pads[i];}
114 static void SetX(Double_t xs[159]){for(Int_t i=0;i<fNRow;i++) fX[i] = xs[i];}
115 static void SetVersion(Int_t i){fVersion = i;}
116 static void SetDiffT(Double_t f){fDiffT = f;}
117 static void SetDiffL(Double_t f){fDiffL = f;}
118 static void SetOmegaTau(Double_t f){fOmegaTau = f;}
119 static void SetInnerPadLength(Double_t f){fInnerPadLength = f;}
120 static void SetOuter1PadLength(Double_t f){fOuter1PadLength = f;}
121 static void SetOuter2PadLength(Double_t f){fOuter2PadLength = f;}
122 static void SetInnerPRFSigma(Double_t f){fInnerPRFSigma = f;}
123 static void SetOuter1PRFSigma(Double_t f){fOuter1PRFSigma = f;}
124 static void SetOuter2PRFSigma(Double_t f){fOuter2PRFSigma = f;}
125 static void SetTimeSigma(Double_t f){fTimeSigma = f;}
126 static void SetADCSat(Int_t i) {fADCSat = i;}
127 static void SetZeroSup(Int_t i) {fZeroSup = i;}
af99f571 128
3e87ef69 129 //getters
5e0f9911 130 static const Char_t* GetParamName() {return "75x40_100x60_150x60";}
5a31e9df 131 static const Double_t Pi() {return fPi;}
132 static const Double_t PiHalf() {return fPi2;}
133 static const Double_t TwoPi() {return f2Pi;}
134 static const Double_t GetAnodeWireSpacing() {return fAnodeWireSpacing;}
135 static const Double_t GetBFact() {return fBFACT;}
136 static const Double_t ToRad() {return 1./fToDeg;}
137 static const Double_t ToDeg() {return fToDeg;}
5e0f9911 138
e376e129 139 static Int_t GetFirstRow(Int_t patch);
140 static Int_t GetLastRow(Int_t patch);
141 static Int_t GetNRows(Int_t patch);
3e87ef69 142 static Int_t GetPatch(Int_t padrow);
f500b93b 143 static Int_t GetNRows() {return fNRow;}
3e87ef69 144 static Int_t GetNRowLow() {return fNRowLow;}
145 static Int_t GetNRowUp1() {return fNRowUp1;}
146 static Int_t GetNRowUp2() {return fNRowUp2;}
147 static Int_t GetPadRow(Float_t x);
9ca67380 148 static Int_t GetNPatches() {return fNPatches;}
3e87ef69 149 static Int_t GetNPads(Int_t row);
150 static Int_t GetNTimeBins(){return fNTimeBins;}
ef79795d 151 static Double_t GetBField() {return fBField;}
3e87ef69 152 static Double_t GetSolenoidField() {return fSolenoidBField;}
3e87ef69 153 static Double_t GetBFactFactor() {return fBFieldFactor;}
af99f571 154 static Double_t GetBFieldValue() {return (fBField*fBFACT);}
5a31e9df 155 static Float_t Deg2Rad(Float_t angle) {return angle/fToDeg;}
156 static Float_t Rad2Deg(Float_t angle) {return angle*fToDeg;}
494fad94 157 static Int_t GetVersion(){return fVersion;}
158 static Double_t GetPadPitchWidthLow() {return fPadPitchWidthLow;}
159 static Double_t GetPadPitchWidthUp() {return fPadPitchWidthUp;}
3e87ef69 160 static Double_t GetPadPitchWidth(Int_t patch);
494fad94 161 static Double_t GetZWidth() {return fZWidth;}
162 static Double_t GetZLength() {return fZLength;}
163 static Double_t GetZOffset() {return fZOffset;}
768861a0 164 static Double_t GetDiffT() {return fDiffT;}
165 static Double_t GetDiffL() {return fDiffL;}
3e87ef69 166 static Double_t GetParSigmaY2(Int_t padrow,Float_t z,Float_t angle);
167 static Double_t GetParSigmaZ2(Int_t padrow,Float_t z,Float_t tgl);
168 static Double_t GetOmegaTau() {return fOmegaTau;}
5923e698 169 static Double_t GetPadLength(Int_t padrow);
170 static Double_t GetPRFSigma(Int_t padrow);
768861a0 171 static Double_t GetTimeSigma() {return fTimeSigma;}
3e87ef69 172 static Double_t GetZSigma() {return fZSigma;}
6f3df1c8 173 static Int_t GetADCSat() {return fADCSat;}
3e87ef69 174 static Int_t GetZeroSup() {return fZeroSup;}
175 static Int_t GetNSlice() {return fNSlice;}
176 static Int_t GetNSector() {return fNSector;}
494fad94 177 static Int_t GetNSectorLow() {return fNSectorLow;}
178 static Int_t GetNSectorUp() {return fNSectorUp;}
95a00d93 179
494fad94 180 static Bool_t Slice2Sector(Int_t slice, Int_t slicerow, Int_t &sector, Int_t &row);
181 static Bool_t Sector2Slice(Int_t &slice, Int_t sector);
182 static Bool_t Sector2Slice(Int_t &slice, Int_t &slicerow, Int_t sector, Int_t row);
1727f1c9 183
494fad94 184 static Double_t Row2X(Int_t slicerow);
185 static Double_t GetMaxY(Int_t slicerow);
186 static Double_t GetEta(Float_t *xyz);
3ac82106 187 static Double_t GetEta(Int_t slice,Int_t padrow, Int_t pad, Int_t time);
494fad94 188 static Double_t GetPhi(Float_t *xyz);
5a31e9df 189 static Double_t GetZFast(Int_t slice, Int_t time, Float_t vertex=0.);
1727f1c9 190
494fad94 191 static void XYZtoRPhiEta(Float_t *rpe, Float_t *xyz);
192 static void Local2Global(Float_t *xyz, Int_t slice);
193 static void Local2GlobalAngle(Float_t *angle, Int_t slice);
194 static void Global2LocalAngle(Float_t *angle, Int_t slice);
108615fc 195
5a31e9df 196 //we have 3 different system: Raw : row, pad, time
197 // Local : x,y and global z
198 // Global: global x,y and global z
199 //the methods with HLT in the name differ from the other
200 //as you specify slice and slicerow, instead of sector
201 //and sector row. In that way we safe "a few ifs"
494fad94 202 static void Raw2Local(Float_t *xyz, Int_t sector, Int_t row, Float_t pad, Float_t time);
5a31e9df 203 static void RawHLT2Local(Float_t *xyz,Int_t slice,Int_t slicerow,Float_t pad,Float_t time);
204 static void Raw2Local(Float_t *xyz, Int_t sector, Int_t row, Int_t pad, Int_t time);
205 static void RawHLT2Local(Float_t *xyz,Int_t slice,Int_t slicerow,Int_t pad,Int_t time);
494fad94 206 static void Local2Global(Float_t *xyz, Int_t sector, Int_t row);
5a31e9df 207 static void LocHLT2Global(Float_t *xyz, Int_t slice, Int_t slicerow);
208 static void Global2Local(Float_t *xyz, Int_t sector);
209 static void Global2LocHLT(Float_t *xyz, Int_t slice);
494fad94 210 static void Raw2Global(Float_t *xyz, Int_t sector, Int_t row, Float_t pad, Float_t time);
5a31e9df 211 static void RawHLT2Global(Float_t *xyz, Int_t slice,
212 Int_t slicerow, Float_t pad, Float_t time);
213 static void Raw2Global(Float_t *xyz, Int_t sector, Int_t row, Int_t pad, Int_t time);
214 static void RawHLT2Global(Float_t *xyz, Int_t slice,
215 Int_t slicerow, Int_t pad, Int_t time);
494fad94 216 static void Local2Raw(Float_t *xyz, Int_t sector, Int_t row);
5a31e9df 217 static void LocHLT2Raw(Float_t *xyz, Int_t slice, Int_t slicerow);
494fad94 218 static void Global2Raw(Float_t *xyz, Int_t sector, Int_t row);
5a31e9df 219 static void Global2HLT(Float_t *xyz, Int_t slice, Int_t slicerow);
3e87ef69 220
221 static void PrintCompileOptions();
108615fc 222
4499ed26 223 ClassDef(AliL3Transform,1)
108615fc 224};
108615fc 225#endif