]>
Commit | Line | Data |
---|---|---|
94685752 | 1 | /* |
2 | ||
3 | Class AliTPCtransformation: | |
4 | Should represent general non linear transformation. Currently tune for TPConly. | |
5 | To be used: | |
6 | 1. Simulation-Digitization | |
7 | 2. Reconstruction - AliTPCTransform | |
8 | 3. Calibration/Alignment (KalmanFilter, Milipedde) | |
9 | 4. Set of transformation to be stored/retrieved as OCDB entry | |
10 | ||
11 | Base functionality: | |
12 | ||
13 | 1. Double_t GetDeltaXYZ(Int_t coord, Int_t volID, Double_t param, Double_t x, Double_t y, Double_t z) | |
14 | Get correction - return the delta of coordinate coord dx or dy or dz for given volID for point at point (x,y,z) | |
15 | All coordinates are global | |
16 | ||
17 | 2. The transformation should work only for given volIDs and detector IDs | |
18 | Currently Bitmask is used for filtering | |
19 | ||
20 | ||
3649eec1 | 21 | Transformation - naming convention: |
22 | // | |
23 | XXX(local)YYYZZZ | |
24 | TPClocaldLxdGX | |
25 | XXX - detector if detector specific | |
26 | local - if local transforamtion | |
27 | YYY - type of transformation | |
28 | ZZZ - return type of transformation | |
94685752 | 29 | |
30 | */ | |
31 | ||
32 | #include <string.h> | |
33 | #include "TRandom.h" | |
34 | #include "TMath.h" | |
35 | #include "TBits.h" | |
36 | #include "TFormula.h" | |
37 | #include "TF1.h" | |
38 | #include "TLinearFitter.h" | |
39 | #include "TFile.h" | |
40 | #include "TObjString.h" | |
41 | ||
42 | #include "TTreeStream.h" | |
43 | #include "AliTrackPointArray.h" | |
44 | #include "AliLog.h" | |
45 | #include "AliTPCTransformation.h" | |
46 | ||
47 | ClassImp(AliTPCTransformation) | |
48 | ||
49 | ||
50 | AliTPCTransformation::GenFuncG AliTPCTransformation::fgFormulas[10000]; | |
51 | TObjArray* AliTPCTransformation::fgFormulasName = new TObjArray(10000); | |
52 | ||
53 | ||
54 | void AliTPCTransformation::RegisterFormula(const char * name, GenFuncG formula){ | |
55 | // | |
56 | // Add Formula to the list of formulas | |
57 | // | |
58 | Int_t last= fgFormulasName->GetEntries(); | |
59 | fgFormulasName->AddLast(new TObjString(name)); | |
60 | fgFormulas[last]=formula; | |
61 | } | |
62 | ||
63 | Int_t AliTPCTransformation::BuildBasicFormulas(){ | |
64 | // | |
6d438146 | 65 | |
66 | // | |
67 | //build list of basic TPC formulas - corrections | |
94685752 | 68 | // |
69 | RegisterFormula("TPCscalingRPol",(GenFuncG)(AliTPCTransformation::TPCscalingRPol)); | |
6d438146 | 70 | RegisterFormula("TPCscalingRIFC",(GenFuncG)(AliTPCTransformation::TPCscalingRIFC)); |
71 | RegisterFormula("TPCscalingROFC",(GenFuncG)(AliTPCTransformation::TPCscalingROFC)); | |
72 | // | |
1bc126e3 | 73 | RegisterFormula("TPCscalingZDr",(GenFuncG)(AliTPCTransformation::TPCscalingZDrift)); |
74 | RegisterFormula("TPCscalingZDrGy",(GenFuncG)(AliTPCTransformation::TPCscalingZDriftGy)); | |
75 | RegisterFormula("TPCscalingZDriftT0",(GenFuncG)(AliTPCTransformation::TPCscalingZDriftT0)); | |
94685752 | 76 | RegisterFormula("TPCscalingPhiLocal",(GenFuncG)(AliTPCTransformation::TPCscalingPhiLocal)); |
1bc126e3 | 77 | RegisterFormula("TPClocalRPhiEdge",(GenFuncG)(AliTPCTransformation::TPClocalRPhiEdge)); |
0e9efcbe | 78 | // |
3649eec1 | 79 | // TPC Local X and Y misalignment + rotation |
0e9efcbe | 80 | // |
81 | RegisterFormula("TPClocaldLxdGX",(GenFuncG)(AliTPCTransformation::TPClocaldLxdGX)); | |
82 | RegisterFormula("TPClocaldLxdGY",(GenFuncG)(AliTPCTransformation::TPClocaldLxdGY)); | |
83 | RegisterFormula("TPClocaldLydGX",(GenFuncG)(AliTPCTransformation::TPClocaldLydGX)); | |
84 | RegisterFormula("TPClocaldLydGY",(GenFuncG)(AliTPCTransformation::TPClocaldLydGY)); | |
3649eec1 | 85 | RegisterFormula("TPClocaldRzdGX",(GenFuncG)(AliTPCTransformation::TPClocaldRzdGX)); |
86 | RegisterFormula("TPClocaldRzdGY",(GenFuncG)(AliTPCTransformation::TPClocaldRzdGY)); | |
87 | ||
0e9efcbe | 88 | // |
89 | // Z offset | |
90 | // | |
91 | RegisterFormula("TPCDeltaZ",(GenFuncG)(AliTPCTransformation::TPCDeltaZ)); | |
92 | RegisterFormula("TPCDeltaZMediumLong",(GenFuncG)(AliTPCTransformation::TPCDeltaZMediumLong)); | |
93 | RegisterFormula("TPCTiltingZ",(GenFuncG)(AliTPCTransformation::TPCTiltingZ)); | |
94685752 | 94 | return 0; |
95 | } | |
96 | ||
97 | AliTPCTransformation::GenFuncG AliTPCTransformation::FindFormula(const char * name){ | |
98 | // | |
99 | // find formula - if registered | |
100 | // | |
101 | if (fgFormulasName->FindObject(name)==0) return 0; | |
102 | Int_t entries = fgFormulasName->GetEntries(); | |
103 | for (Int_t i=0;i<entries;i++){ | |
104 | if (strcmp(fgFormulasName->At(i)->GetName(), name)==0){ | |
105 | return fgFormulas[i]; | |
106 | } | |
107 | } | |
108 | return 0; | |
109 | } | |
110 | ||
111 | Double_t AliTPCTransformation::Eval(const char * name, const Double_t*x,const Double_t*par){ | |
112 | // | |
113 | // Only for test purposes - very slow | |
114 | // | |
115 | GenFuncG fun = FindFormula(name); | |
116 | if (!fun) return 0; | |
117 | return fun(x,par); | |
118 | } | |
119 | ||
120 | ||
121 | AliTPCTransformation::AliTPCTransformation(): | |
122 | TNamed(), | |
123 | fNameX(0), // x formula name | |
124 | fNameY(0), // y formula name | |
125 | fNameZ(0), // z formula name | |
126 | // | |
127 | fBitMask(0), // bitmaps - transformation only for specified volID | |
128 | fCoordSystem(0), // coord system of output deltas | |
129 | fParam(0), // free parameter of transformation | |
130 | fSigma(0), // uncertainty of the parameter | |
6d438146 | 131 | fSigma2Time(0), // change of the error in time - (For kalman filter) |
94685752 | 132 | fFixedParam(0), // fixed parameters of tranformation |
0e9efcbe | 133 | fIsActive(kTRUE), // swith - On/Off |
94685752 | 134 | // |
135 | fInit(kFALSE), // initialization flag - set to kTRUE if corresponding formulas found | |
136 | fFormulaX(0), // x formula - pointer to the function | |
137 | fFormulaY(0), // y formula - pointer to the function | |
138 | fFormulaZ(0) // z formula - pointer to the function | |
139 | // | |
140 | { | |
141 | // | |
142 | // default constructor | |
143 | // | |
144 | } | |
145 | ||
146 | ||
147 | ||
6d438146 | 148 | AliTPCTransformation::AliTPCTransformation(const char *name, TBits *mask, const char *fx, const char *fy, const char *fz, Int_t coordSystem): |
94685752 | 149 | TNamed(name,name), |
150 | fNameX(0), // x formula name | |
151 | fNameY(0), // y formula name | |
152 | fNameZ(0), // z formula name | |
153 | fBitMask(mask), // bitmaps - transformation only for specified volID | |
154 | fCoordSystem(coordSystem), // coordinate system of output deltas | |
6d438146 | 155 | fParam(0), // free parameter of transformation |
156 | fSigma(0), | |
157 | fSigma2Time(0), // change of sigma in time | |
94685752 | 158 | fFixedParam(0), // fixed parameters of tranformation |
0e9efcbe | 159 | fIsActive(kTRUE), // swith - On/Off |
94685752 | 160 | // |
161 | fInit(kFALSE), // initialization flag - set to kTRUE if corresponding formulas found | |
162 | fFormulaX(0), // x formula - pointer to the function | |
163 | fFormulaY(0), // y formula - pointer to the function | |
164 | fFormulaZ(0) // z formula - pointer to the function | |
165 | { | |
166 | // | |
167 | // non default constructor | |
168 | // | |
169 | if (fx) fNameX= new TString(fx); | |
170 | if (fy) fNameY= new TString(fy); | |
171 | if (fz) fNameZ= new TString(fz); | |
94685752 | 172 | Init(); |
173 | } | |
174 | ||
6d438146 | 175 | AliTPCTransformation::AliTPCTransformation(const AliTPCTransformation&trafo): |
176 | TNamed(trafo), | |
177 | fNameX(0), // x formula name | |
178 | fNameY(0), // y formula name | |
179 | fNameZ(0), // z formula name | |
180 | // | |
181 | fBitMask(0), // bitmaps - transformation only for specified volID | |
182 | fCoordSystem(0), // coord system of output deltas | |
183 | fParam(trafo.fParam), // free parameter of transformation | |
184 | fSigma(trafo.fSigma), // uncertainty of the parameter | |
185 | fSigma2Time(trafo.fSigma2Time), // change of the error in time - (For kalman filter) | |
e55e5512 | 186 | fFixedParam(0), // fixed parameters of tranformation |
187 | fIsActive(trafo.fIsActive), // swith - On/Off | |
6d438146 | 188 | // |
189 | fInit(kFALSE), // initialization flag - set to kTRUE if corresponding formulas found | |
190 | fFormulaX(0), // x formula - pointer to the function | |
191 | fFormulaY(0), // y formula - pointer to the function | |
192 | fFormulaZ(0) // z formula - pointer to the function | |
193 | { | |
194 | if (trafo.fNameX) fNameX = new TString(*(trafo.fNameX)); | |
195 | if (trafo.fNameY) fNameY = new TString(*(trafo.fNameY)); | |
196 | if (trafo.fNameZ) fNameZ = new TString(*(trafo.fNameZ)); | |
197 | if (trafo.fBitMask) fBitMask = new TBits(*(trafo.fBitMask)); | |
198 | } | |
199 | ||
200 | AliTPCTransformation::~AliTPCTransformation(){ | |
201 | // | |
202 | // destructor | |
203 | // | |
204 | delete fNameX; | |
205 | delete fNameY; | |
206 | delete fNameZ; | |
207 | delete fBitMask; | |
208 | delete fFixedParam; | |
209 | } | |
210 | void AliTPCTransformation::SetParams(Double_t param, Double_t sigma, Double_t sigma2Time, TVectorD* fixedParams){ | |
211 | // | |
212 | // Set parameters of transformation | |
213 | // | |
214 | fParam = param; | |
215 | fSigma = sigma; | |
216 | fSigma2Time = sigma2Time; | |
217 | if (fFixedParam) delete fFixedParam; | |
218 | fFixedParam = new TVectorD(*fixedParams); | |
219 | Init(); | |
220 | } | |
94685752 | 221 | |
222 | ||
223 | Bool_t AliTPCTransformation::Init(){ | |
224 | // | |
225 | // associate formulas with pointer to the function | |
226 | // | |
227 | Bool_t isOK=kTRUE; | |
228 | if (fNameX) { | |
229 | fFormulaX=FindFormula(fNameX->Data()); | |
230 | if (fFormulaX==0) isOK=kFALSE; | |
231 | } | |
232 | if (fNameY) { | |
233 | fFormulaY=FindFormula(fNameY->Data()); | |
234 | if (fFormulaY==0) isOK=kFALSE; | |
235 | } | |
236 | if (fNameZ) { | |
237 | fFormulaZ=FindFormula(fNameZ->Data()); | |
238 | if (!fFormulaZ) isOK=kFALSE; | |
239 | } | |
240 | return isOK; | |
241 | } | |
242 | ||
0e9efcbe | 243 | |
244 | ||
94685752 | 245 | TBits * AliTPCTransformation::BitsSide(Bool_t aside){ |
246 | // | |
247 | TBits * bits = new TBits(72); | |
248 | for (Int_t i=0; i<72;i++){ | |
249 | if (i%36<18 && aside) (*bits)[i]=kTRUE; | |
250 | if (i%36<18 && (!aside)) (*bits)[i]=kFALSE; | |
251 | if (i%36>=18 && aside) (*bits)[i]=kFALSE; | |
252 | if (i%36>=18 && (!aside)) (*bits)[i]=kTRUE; | |
253 | } | |
254 | return bits; | |
255 | } | |
256 | ||
257 | TBits * AliTPCTransformation::BitsAll(){ | |
258 | // | |
259 | // | |
260 | // | |
261 | TBits * bits = new TBits(72); | |
262 | for (Int_t i=0; i<72;i++){ | |
263 | (*bits)[i]=kTRUE; | |
264 | } | |
265 | return bits; | |
266 | } | |
267 | ||
268 | Double_t AliTPCTransformation::GetDeltaXYZ(Int_t coord, Int_t volID, Double_t param, Double_t x, Double_t y, Double_t z){ | |
269 | // | |
270 | // | |
3649eec1 | 271 | // coord - type of coordinate |
272 | // - 0 -X | |
273 | // 1 -Y | |
274 | // 2 -Z | |
275 | // 3 -R | |
276 | // 4 -RPhi | |
0e9efcbe | 277 | if (!fIsActive) return 0; |
94685752 | 278 | if (fBitMask && (!(*fBitMask)[volID])) return 0; |
0e9efcbe | 279 | Double_t xyz[5]={x,y,z, param,volID}; |
94685752 | 280 | if (fCoordSystem==0){ |
281 | // cartezian system | |
282 | if (coord==0 && fFormulaX) return fFormulaX(xyz,fFixedParam->GetMatrixArray()); | |
283 | if (coord==1 && fFormulaY) return fFormulaY(xyz,fFixedParam->GetMatrixArray()); | |
0e9efcbe | 284 | if (coord==2 && fFormulaZ) return fFormulaZ(xyz,fFixedParam->GetMatrixArray()); |
94685752 | 285 | } |
286 | if (fCoordSystem==1){ | |
287 | // cylindrical system | |
288 | if (coord==2) { | |
289 | if (fFormulaZ==0) return 0; | |
290 | return fFormulaZ(xyz,fFixedParam->GetMatrixArray()); | |
291 | } | |
292 | Double_t rrphiz[3]={0,0,0}; | |
293 | if (fFormulaX) rrphiz[0] = fFormulaX(xyz,fFixedParam->GetMatrixArray()); | |
294 | if (fFormulaY) rrphiz[1] = fFormulaY(xyz,fFixedParam->GetMatrixArray()); | |
295 | Double_t alpha = TMath::ATan2(y,x); | |
296 | Double_t ca = TMath::Cos(alpha); | |
297 | Double_t sa = TMath::Sin(alpha); | |
298 | if (coord==0) return ca*rrphiz[0]-sa*rrphiz[1]; | |
299 | if (coord==1) return sa*rrphiz[0]+ca*rrphiz[1]; | |
300 | } | |
301 | return 0; | |
302 | } | |
303 | ||
304 | Double_t AliTPCTransformation::TPCscalingRPol(Double_t *xyz, Double_t * param){ | |
305 | // | |
306 | // Scaling and shift of TPC radius | |
307 | // xyz[0..2] - global xyz of point | |
308 | // xyz[3] - scale parameter | |
6d438146 | 309 | // param[0] - radial scaling power |
310 | // param[1] - drift scaling power | |
311 | // radius from -1(at rInner) to 1 (rOuter) | |
312 | // driftM from -1(at 0 drift) to 1 (250 cm drift) | |
313 | ||
314 | Double_t rInner=78.8; | |
315 | Double_t rOuter=258.0; | |
316 | Double_t deltaR = rOuter-rInner; | |
317 | Double_t radius = (TMath::Sqrt(xyz[0]*xyz[0]+xyz[1]*xyz[1])-rInner)*2./deltaR; | |
318 | Double_t driftM = (0.5 - TMath::Abs(xyz[2]/250.))*2.0; | |
319 | Double_t delta = TMath::Power(radius,param[0])*TMath::Power(driftM,param[1]); | |
320 | return delta*xyz[3]; | |
94685752 | 321 | } |
322 | ||
323 | ||
1bc126e3 | 324 | Double_t AliTPCTransformation::TPCscalingZDrift(Double_t *xyz, Double_t * param){ |
94685752 | 325 | // |
326 | // | |
327 | // Scaling and shift of TPC radius | |
328 | // xyz[0..2] - global xyz of point | |
329 | // xyz[3] - scale parameter | |
330 | Double_t driftP = TMath::Power(1. - TMath::Abs(xyz[2]/250.), param[0]); | |
1bc126e3 | 331 | Int_t sector = TMath::Nint(xyz[4]); |
332 | Double_t deltaZ = (sector%36<18) ? -driftP : driftP; | |
94685752 | 333 | return deltaZ*xyz[3]; |
334 | } | |
335 | ||
1bc126e3 | 336 | Double_t AliTPCTransformation::TPCscalingZDriftT0(Double_t *xyz, Double_t * /*param*/){ |
337 | // | |
338 | // | |
339 | // Z shift because time 0 offset | |
340 | // opposite on A and C side | |
341 | // | |
342 | // xyz[0..2] - global xyz of point | |
343 | // xyz[3] - scale parameter | |
344 | Int_t sector = TMath::Nint(xyz[4]); | |
345 | Double_t sign = (sector%36<18) ? -1 : 1; | |
346 | return sign*xyz[3]; | |
347 | } | |
348 | ||
ddf81107 | 349 | |
1bc126e3 | 350 | Double_t AliTPCTransformation::TPCscalingZDriftGy(Double_t *xyz, Double_t * param){ |
ddf81107 | 351 | // |
352 | // | |
353 | // Scaling and shift of TPC radius | |
354 | // xyz[0..2] - global xyz of point | |
355 | // xyz[3] - scale parameter | |
356 | Double_t driftP = TMath::Power(1. - TMath::Abs(xyz[2]/250.), param[0]); | |
357 | Double_t gy = xyz[1]/250.; | |
1bc126e3 | 358 | Int_t sector = TMath::Nint(xyz[4]); |
359 | Double_t deltaZ = (sector%36<18) ? -driftP : driftP; | |
ddf81107 | 360 | return deltaZ*xyz[3]*gy; |
361 | } | |
362 | ||
363 | ||
364 | ||
94685752 | 365 | Double_t AliTPCTransformation::TPCscalingPhiLocal(Double_t *xyz, Double_t * param){ |
366 | // | |
367 | // | |
368 | // Scaling if the local y -phi | |
369 | // xyz[0..2] - global xyz of point | |
370 | // xyz[3] - scale parameter | |
6d438146 | 371 | // value = 1 for ful drift length and parameter 1 |
94685752 | 372 | Double_t alpha = TMath::ATan2(xyz[1],xyz[0]); |
373 | Double_t sector = TMath::Nint(9*alpha/TMath::Pi()-0.5); | |
374 | Double_t localAlpha = (alpha-(sector+0.5)*TMath::Pi()/9.); | |
375 | Double_t radius = TMath::Sqrt(xyz[0]*xyz[0]+xyz[1]*xyz[1])/250.; | |
6d438146 | 376 | // |
377 | Double_t deltaAlpha = radius*TMath::Power(2.*9.*localAlpha/TMath::Pi(),param[0]); | |
94685752 | 378 | return deltaAlpha*xyz[3]; |
379 | } | |
380 | ||
1bc126e3 | 381 | Double_t AliTPCTransformation::TPClocalRPhiEdge(Double_t *xyz, Double_t * param){ |
382 | // | |
383 | // | |
384 | // Scaling if the local y -phi | |
385 | // xyz[0..2] - global xyz of point | |
386 | // xyz[3] - scale parameter | |
387 | // param[0] - dedge offset - should be around gap size/2. | |
388 | // param[1] - dedge factor - should be around gap size/2. | |
389 | Double_t alpha = TMath::ATan2(xyz[1],xyz[0]); | |
390 | Double_t sector = TMath::Nint(9*alpha/TMath::Pi()-0.5); | |
391 | Double_t localAlpha = (alpha-(sector+0.5)*TMath::Pi()/9.); | |
392 | Double_t radius = TMath::Sqrt(xyz[0]*xyz[0]+xyz[1]*xyz[1]); | |
393 | Double_t deltaAlpha = TMath::Pi()/18.-TMath::Abs(localAlpha); | |
394 | Double_t distEdge = (deltaAlpha*radius); | |
395 | Double_t factor = 1./(1.+(distEdge-param[0])/param[1]); | |
396 | return factor*xyz[3]*((localAlpha>0)? -1.:1.); | |
397 | } | |
398 | ||
94685752 | 399 | |
6d438146 | 400 | Double_t AliTPCTransformation::TPCscalingRIFC(Double_t *xyz, Double_t * param){ |
401 | // | |
402 | // inner field cage r distorion - proportinal to 1 over distance to the IFC | |
403 | // param[0] - drift polynom order | |
404 | // distortion at first pad row - is normalized to | |
405 | Double_t rInner=78.8; | |
406 | Double_t rFirst=85.2; | |
407 | Double_t deltaR = rFirst-rInner; | |
408 | Double_t ndistR = (TMath::Sqrt(xyz[0]*xyz[0]+xyz[1]*xyz[1])-rInner)/deltaR; | |
409 | Double_t driftM = (0.5 - TMath::Abs(xyz[2]/250.))*2.; | |
410 | Double_t value = TMath::Power(driftM,param[0])/ndistR; | |
411 | return xyz[3]*value; | |
412 | } | |
413 | ||
414 | Double_t AliTPCTransformation::TPCscalingROFC(Double_t *xyz, Double_t * param){ | |
415 | // | |
416 | // outer field cage r distorion - proportinal to 1 over distance to the OFC | |
417 | // param[0] - drift polynom order | |
418 | // driftM - from -1 to 1 | |
419 | // | |
420 | Double_t rLast=245.8; | |
421 | Double_t rOuter=258.0; | |
422 | Double_t deltaR = rOuter-rLast; | |
423 | Double_t ndistR = (rOuter-TMath::Sqrt(xyz[0]*xyz[0]+xyz[1]*xyz[1]))/deltaR; | |
424 | Double_t driftM = (0.5 - TMath::Abs(xyz[2]/250.))*2.; | |
425 | Double_t value = TMath::Power(driftM,param[0])/ndistR; | |
426 | return xyz[3]*value; | |
427 | } | |
0e9efcbe | 428 | |
429 | ||
430 | // | |
431 | // TPC sector local misalignment | |
432 | // | |
3649eec1 | 433 | // |
434 | // | |
435 | Double_t AliTPCTransformation:: TPClocaldLxdGX(Double_t *xyz, Double_t * param){ | |
0e9efcbe | 436 | // |
437 | // xyz - [0..2] - position | |
438 | // [3] - scale parameter | |
439 | // [4] - volID | |
3649eec1 | 440 | // param[0]= n - cos(n *alpha) |
441 | // param[1]= n - sin(n *alpha) | |
442 | // param[2] - indication - 0 - the same for IROC OROC 1 - opposite | |
0e9efcbe | 443 | // return delta in global coordiante system |
444 | // | |
445 | Int_t sector = TMath::Nint(xyz[4]); | |
446 | Double_t alpha = TMath::Pi()*(sector+0.5)/9; | |
447 | Double_t ca = TMath::Cos(alpha); | |
3649eec1 | 448 | // Double_t sa = TMath::Sin(alpha); |
449 | const Double_t xIROCOROC = 133.4; | |
450 | Double_t factor = xyz[3]; | |
451 | if (param[0]>0) factor*=TMath::Cos(alpha*param[0]); | |
452 | if (param[1]>0) factor*=TMath::Sin(alpha*param[1]); | |
453 | if (param[2]>0.5 && TMath::Sqrt(xyz[1]*xyz[1]+xyz[0]*xyz[0])>xIROCOROC) factor*=-1; | |
454 | return ca*factor; | |
0e9efcbe | 455 | } |
456 | ||
3649eec1 | 457 | Double_t AliTPCTransformation::TPClocaldLxdGY(Double_t *xyz, Double_t * param){ |
0e9efcbe | 458 | // |
459 | // xyz - [0..2] - position | |
460 | // [3] - scale parameter | |
461 | // [4] - volID | |
3649eec1 | 462 | // param[0]= n - cos(n *alpha) |
463 | // param[1]= n - sin(n *alpha) | |
464 | // param[2] - indication - 0 - the same for IROC OROC 1 - opposite | |
0e9efcbe | 465 | // return delta in global coordiante system |
466 | // | |
467 | Int_t sector = TMath::Nint(xyz[4]); | |
468 | Double_t alpha = TMath::Pi()*(sector+0.5)/9; | |
469 | //Double_t ca = TMath::Cos(alpha); | |
470 | Double_t sa = TMath::Sin(alpha); | |
3649eec1 | 471 | const Double_t xIROCOROC = 133.4; |
472 | Double_t factor = xyz[3]; | |
473 | if (param[0]>0) factor*=TMath::Cos(alpha*param[0]); | |
474 | if (param[1]>0) factor*=TMath::Sin(alpha*param[1]); | |
475 | if (param[2]>0.5 && TMath::Sqrt(xyz[1]*xyz[1]+xyz[0]*xyz[0])>xIROCOROC) factor*=-1; | |
476 | return sa*factor; | |
0e9efcbe | 477 | } |
478 | ||
3649eec1 | 479 | Double_t AliTPCTransformation:: TPClocaldLydGX(Double_t *xyz, Double_t * param){ |
0e9efcbe | 480 | // |
481 | // xyz - [0..2] - position | |
482 | // [3] - scale parameter | |
483 | // [4] - volID | |
3649eec1 | 484 | // param[0]= n - cos(n *alpha) |
485 | // param[1]= n - sin(n *alpha) | |
486 | // param[2] - indication - 0 - the same for IROC OROC 1 - opposite | |
0e9efcbe | 487 | // return delta in global coordiante system |
488 | // | |
489 | Int_t sector = TMath::Nint(xyz[4]); | |
490 | Double_t alpha = TMath::Pi()*(sector+0.5)/9; | |
491 | //Double_t ca = TMath::Cos(alpha); | |
492 | Double_t sa = TMath::Sin(alpha); | |
3649eec1 | 493 | const Double_t xIROCOROC = 133.4; |
494 | Double_t factor = xyz[3]; | |
495 | if (param[0]>0) factor*=TMath::Cos(alpha*param[0]); | |
496 | if (param[1]>0) factor*=TMath::Sin(alpha*param[1]); | |
497 | if (param[2]>0.5 && TMath::Sqrt(xyz[1]*xyz[1]+xyz[0]*xyz[0])>xIROCOROC) factor*=-1; | |
498 | return -sa*factor; | |
0e9efcbe | 499 | } |
500 | ||
3649eec1 | 501 | Double_t AliTPCTransformation::TPClocaldLydGY(Double_t *xyz, Double_t * param){ |
0e9efcbe | 502 | // |
503 | // xyz - [0..2] - position | |
504 | // [3] - scale parameter | |
505 | // [4] - volID | |
3649eec1 | 506 | // param[0]= n - cos(n *alpha) |
507 | // param[1]= n - sin(n *alpha) | |
508 | // param[2] - indication - 0 - the same for IROC OROC 1 - opposite | |
0e9efcbe | 509 | // return delta in global coordiante system |
510 | // | |
511 | Int_t sector = TMath::Nint(xyz[4]); | |
512 | Double_t alpha = TMath::Pi()*(sector+0.5)/9; | |
513 | Double_t ca = TMath::Cos(alpha); | |
514 | //Double_t sa = TMath::Sin(alpha); | |
3649eec1 | 515 | const Double_t xIROCOROC = 133.4; |
516 | Double_t factor = xyz[3]; | |
517 | if (param[0]>0) factor*=TMath::Cos(alpha*param[0]); | |
518 | if (param[1]>0) factor*=TMath::Sin(alpha*param[1]); | |
519 | if (param[2]>0.5 && TMath::Sqrt(xyz[1]*xyz[1]+xyz[0]*xyz[0])>xIROCOROC) factor*=-1; | |
520 | return ca*factor; | |
521 | } | |
522 | ||
523 | ||
524 | Double_t AliTPCTransformation::TPClocaldRzdGX(Double_t *xyz, Double_t * param){ | |
525 | // | |
526 | // xyz - [0..2] - position | |
527 | // [3] - scale parameter - rotation angle in mrad | |
528 | // [4] - volID | |
529 | // param[0]= n - cos(n *alpha) | |
530 | // param[1]= n - sin(n *alpha) | |
531 | // param[2] - indication - 0 - the same for IROC OROC 1 - opposite | |
532 | // return delta in global coordiante system | |
533 | // | |
534 | Int_t sector = TMath::Nint(xyz[4]); | |
535 | Double_t alpha = TMath::Pi()*(sector+0.5)/9; | |
536 | Double_t ca = TMath::Cos(alpha); | |
537 | Double_t sa = TMath::Sin(alpha); | |
538 | Double_t lx = xyz[0]*ca + xyz[1]*sa; | |
539 | Double_t ly = -xyz[0]*sa + xyz[1]*ca; | |
540 | // | |
541 | const Double_t xIROCOROC = 133.4; | |
542 | lx-=xIROCOROC; | |
543 | Double_t rot = xyz[3]*0.001; // rotation in mrad | |
544 | if (param[0]>0) rot*=TMath::Cos(alpha*param[0]); | |
545 | if (param[1]>0) rot*=TMath::Sin(alpha*param[1]); | |
546 | if (param[2]>0.5 && lx>0) rot*=-1; | |
547 | // | |
548 | Double_t dlxR = - ly*rot; | |
549 | Double_t dlyR = lx*rot; | |
550 | Double_t dgxR = dlxR*ca - dlyR*sa; | |
551 | //Double_t dgyR = dlxR*sa + dlyR*ca; | |
552 | return dgxR; | |
553 | } | |
554 | ||
555 | Double_t AliTPCTransformation::TPClocaldRzdGY(Double_t *xyz, Double_t * param){ | |
556 | // | |
557 | // xyz - [0..2] - position | |
558 | // [3] - scale parameter - rotation angle in mrad | |
559 | // [4] - volID | |
560 | // param[0]= n - cos(n *alpha) | |
561 | // param[1]= n - sin(n *alpha) | |
562 | // param[2] - indication - 0 - the same for IROC OROC 1 - opposite | |
563 | // return delta in global coordiante system | |
564 | // | |
565 | Int_t sector = TMath::Nint(xyz[4]); | |
566 | Double_t alpha = TMath::Pi()*(sector+0.5)/9; | |
567 | Double_t ca = TMath::Cos(alpha); | |
568 | Double_t sa = TMath::Sin(alpha); | |
569 | Double_t lx = xyz[0]*ca + xyz[1]*sa; | |
570 | Double_t ly = -xyz[0]*sa + xyz[1]*ca; | |
571 | // | |
572 | const Double_t xIROCOROC = 133.4; | |
573 | lx-=xIROCOROC; | |
574 | Double_t rot = xyz[3]*0.001; // rotation in mrad | |
575 | if (param[0]>0) rot*=TMath::Cos(alpha*param[0]); | |
576 | if (param[1]>0) rot*=TMath::Sin(alpha*param[1]); | |
577 | if (param[2]>0.5 && lx>0) rot*=-1; | |
578 | Double_t dlxR = - ly*rot; | |
579 | Double_t dlyR = lx*rot; | |
580 | //Double_t dgxR = dlxR*ca - dlyR*sa; | |
581 | Double_t dgyR = dlxR*sa + dlyR*ca; | |
582 | return dgyR; | |
0e9efcbe | 583 | } |
584 | ||
585 | ||
ddf81107 | 586 | |
587 | Double_t AliTPCTransformation::TPCDeltaZMediumLong(Double_t *xyz, Double_t * /*param*/){ | |
0e9efcbe | 588 | // |
589 | // xyz - [0..2] - position | |
590 | // [3] - scale parameter | |
591 | // [4] - volID | |
ddf81107 | 592 | // return delta in global coordinate system |
0e9efcbe | 593 | // |
594 | Int_t sector = TMath::Nint(xyz[4]); | |
595 | Double_t signZ = (sector%36<18) ? 1: -1; // drift direction | |
ddf81107 | 596 | if (sector<36) return 0; |
597 | // | |
598 | const Double_t radiusLong = 198.1; | |
599 | // | |
600 | Double_t alpha = TMath::Pi()*(sector+0.5)/9; | |
601 | Double_t ca = TMath::Cos(alpha); | |
602 | Double_t sa = TMath::Sin(alpha); | |
603 | Double_t lx = xyz[0]*ca + xyz[1]*sa; | |
604 | Double_t sign = (lx<radiusLong) ? 1:-1; | |
605 | return xyz[3]*sign*signZ; | |
0e9efcbe | 606 | } |
607 | ||
ddf81107 | 608 | Double_t AliTPCTransformation::TPCDeltaZ(Double_t *xyz, Double_t * param){ |
0e9efcbe | 609 | // |
610 | // xyz - [0..2] - position | |
611 | // [3] - scale parameter | |
612 | // [4] - volID | |
ddf81107 | 613 | // return delta in global coordiante system |
0e9efcbe | 614 | // |
615 | Int_t sector = TMath::Nint(xyz[4]); | |
ddf81107 | 616 | Double_t delta = (sector%36<18) ? 1: -1; // drift direction |
617 | Double_t alpha = TMath::Pi()*(sector+0.5)/9; | |
618 | Double_t ca = TMath::Cos(alpha); | |
619 | Double_t sa = TMath::Sin(alpha); | |
620 | Double_t lx = xyz[0]*ca + xyz[1]*sa; | |
0e9efcbe | 621 | // |
ddf81107 | 622 | const Double_t xIROCOROC = 133.4; |
623 | if (param[0]>0) delta *= TMath::Cos(param[0]*alpha); | |
624 | if (param[1]>0) delta *= TMath::Sin(param[1]*alpha); | |
625 | if (param[2]>0.5 && lx >xIROCOROC) delta *=-1; | |
626 | return delta*xyz[3]; // IROC shift | |
0e9efcbe | 627 | } |
628 | ||
ddf81107 | 629 | |
0e9efcbe | 630 | Double_t AliTPCTransformation::TPCTiltingZ(Double_t *xyz, Double_t * param){ |
631 | // xyz - [0..2] - position | |
632 | // [3] - scale parameter | |
633 | // [4] - volID | |
634 | // param[0] - n for cos | |
635 | // param[1] - n for sin | |
ddf81107 | 636 | // param[2] - IROC-ORC relative (if >0.5 ) |
0e9efcbe | 637 | // return delta in global coordinate system |
0e9efcbe | 638 | const Double_t rFirst=85.2; |
639 | const Double_t rLast =245.8; | |
ddf81107 | 640 | const Double_t xIROCOROC = 133.4; |
641 | // | |
642 | Int_t sector = TMath::Nint(xyz[4]); | |
643 | Double_t alpha = TMath::Pi()*(sector+0.5)/9; | |
644 | Double_t ca = TMath::Cos(alpha); | |
645 | Double_t sa = TMath::Sin(alpha); | |
646 | Double_t lx = xyz[0]*ca + xyz[1]*sa; | |
647 | Double_t deltaR = 2.0*(lx-xIROCOROC)/(rLast-rFirst); | |
0e9efcbe | 648 | if (param[0]>0) deltaR *= TMath::Cos(param[0]*alpha); |
649 | if (param[1]>0) deltaR *= TMath::Sin(param[1]*alpha); | |
ddf81107 | 650 | if (param[2]>0.5 && lx >xIROCOROC) deltaR *=-1; |
0e9efcbe | 651 | return deltaR*xyz[3]; |
652 | } | |
653 |