1 /// \class AliTPCTransformation
2 /// \brief Should represent general non linear transformation.
4 /// Currently tune for TPConly.
7 /// 1. Simulation-Digitization
8 /// 2. Reconstruction - AliTPCTransform
9 /// 3. Calibration/Alignment (KalmanFilter, Milipedde)
10 /// 4. Set of transformation to be stored/retrieved as OCDB entry
12 /// Base functionality:
14 /// 1. Double_t GetDeltaXYZ(Int_t coord, Int_t volID, Double_t param, Double_t x, Double_t y, Double_t z)
15 /// Get correction - return the delta of coordinate coord dx or dy or dz for given volID for point at point (x,y,z)
16 /// All coordinates are global
18 /// 2. The transformation should work only for given volIDs and detector IDs
19 /// Currently Bitmask is used for filtering
21 /// Transformation - naming convention:
25 /// XXX - detector if detector specific
26 /// local - if local transforamtion
27 /// YYY - type of transformation
28 /// ZZZ - return type of transformation
36 #include "TLinearFitter.h"
38 #include "TObjString.h"
40 #include "TTreeStream.h"
41 #include "AliTrackPointArray.h"
43 #include "AliTPCTransformation.h"
46 ClassImp(AliTPCTransformation)
49 AliTPCTransformation::GenFuncG AliTPCTransformation::fgFormulas[10000];
50 TObjArray* AliTPCTransformation::fgFormulasName = new TObjArray(10000);
53 void AliTPCTransformation::RegisterFormula(const char * name, GenFuncG formula){
54 /// Add Formula to the list of formulas
56 Int_t last= fgFormulasName->GetEntries();
57 fgFormulasName->AddLast(new TObjString(name));
58 fgFormulas[last]=formula;
61 Int_t AliTPCTransformation::BuildBasicFormulas(){
65 //build list of basic TPC formulas - corrections
67 RegisterFormula("TPCscalingRPol",(GenFuncG)(AliTPCTransformation::TPCscalingRPol));
68 RegisterFormula("TPCscalingRIFC",(GenFuncG)(AliTPCTransformation::TPCscalingRIFC));
69 RegisterFormula("TPCscalingROFC",(GenFuncG)(AliTPCTransformation::TPCscalingROFC));
71 RegisterFormula("TPCdeltaFCROC",(GenFuncG)(AliTPCTransformation::TPCdeltaFCROC));
72 RegisterFormula("TPCdeltaFCCE",(GenFuncG)(AliTPCTransformation::TPCdeltaFCCE));
74 RegisterFormula("TPCscalingZDr",(GenFuncG)(AliTPCTransformation::TPCscalingZDrift));
75 RegisterFormula("TPCscalingZDrGy",(GenFuncG)(AliTPCTransformation::TPCscalingZDriftGy));
76 RegisterFormula("TPCscalingZDriftT0",(GenFuncG)(AliTPCTransformation::TPCscalingZDriftT0));
77 RegisterFormula("TPCscalingPhiLocal",(GenFuncG)(AliTPCTransformation::TPCscalingPhiLocal));
78 RegisterFormula("TPClocalRPhiEdge",(GenFuncG)(AliTPCTransformation::TPClocalRPhiEdge));
80 // TPC Local X and Y misalignment + rotation
82 RegisterFormula("TPClocaldLxdGX",(GenFuncG)(AliTPCTransformation::TPClocaldLxdGX));
83 RegisterFormula("TPClocaldLxdGY",(GenFuncG)(AliTPCTransformation::TPClocaldLxdGY));
84 RegisterFormula("TPClocaldLydGX",(GenFuncG)(AliTPCTransformation::TPClocaldLydGX));
85 RegisterFormula("TPClocaldLydGY",(GenFuncG)(AliTPCTransformation::TPClocaldLydGY));
86 RegisterFormula("TPClocaldRzdGX",(GenFuncG)(AliTPCTransformation::TPClocaldRzdGX));
87 RegisterFormula("TPClocaldRzdGY",(GenFuncG)(AliTPCTransformation::TPClocaldRzdGY));
92 RegisterFormula("TPCDeltaZ",(GenFuncG)(AliTPCTransformation::TPCDeltaZ));
93 RegisterFormula("TPCDeltaZMediumLong",(GenFuncG)(AliTPCTransformation::TPCDeltaZMediumLong));
94 RegisterFormula("TPCTiltingZ",(GenFuncG)(AliTPCTransformation::TPCTiltingZ));
98 AliTPCTransformation::GenFuncG AliTPCTransformation::FindFormula(const char * name){
99 /// find formula - if registered
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];
111 Double_t AliTPCTransformation::Eval(const char * name, const Double_t*x,const Double_t*par){
112 /// Only for test purposes - very slow
114 GenFuncG fun = FindFormula(name);
120 AliTPCTransformation::AliTPCTransformation():
122 fNameX(0), // x formula name
123 fNameY(0), // y formula name
124 fNameZ(0), // z formula name
126 fBitMask(0), // bitmaps - transformation only for specified volID
127 fCoordSystem(0), // coord system of output deltas
128 fParam(0), // free parameter of transformation
129 fSigma(0), // uncertainty of the parameter
130 fSigmaMax(0), //maximal sigma (Not allowed to increase in propagate time by bigger factor)
131 fSigma2Time(0), // change of the error in time - (For kalman filter)
132 fFixedParam(0), // fixed parameters of tranformation
133 fIsActive(kTRUE), // swith - On/Off
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
141 /// default constructor
147 AliTPCTransformation::AliTPCTransformation(const char *name, TBits *mask, const char *fx, const char *fy, const char *fz, Int_t coordSystem):
149 fNameX(0), // x formula name
150 fNameY(0), // y formula name
151 fNameZ(0), // z formula name
152 fBitMask(mask), // bitmaps - transformation only for specified volID
153 fCoordSystem(coordSystem), // coordinate system of output deltas
154 fParam(0), // free parameter of transformation
156 fSigmaMax(0), //maximal sigma (Not allowed to increase in propagate time by bigger factor)
157 fSigma2Time(0), // change of sigma in time
158 fFixedParam(0), // fixed parameters of tranformation
159 fIsActive(kTRUE), // swith - On/Off
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
166 /// non default constructor
168 if (fx) fNameX= new TString(fx);
169 if (fy) fNameY= new TString(fy);
170 if (fz) fNameZ= new TString(fz);
174 AliTPCTransformation::AliTPCTransformation(const AliTPCTransformation&trafo):
176 fNameX(0), // x formula name
177 fNameY(0), // y formula name
178 fNameZ(0), // z formula name
180 fBitMask(0), // bitmaps - transformation only for specified volID
181 fCoordSystem(0), // coord system of output deltas
182 fParam(trafo.fParam), // free parameter of transformation
183 fSigma(trafo.fSigma), // uncertainty of the parameter
184 fSigmaMax(trafo.fSigma), //maximal sigma (Not allowed to increase in propagate time by bigger factor)
185 fSigma2Time(trafo.fSigma2Time), // change of the error in time - (For kalman filter)
186 fFixedParam(0), // fixed parameters of tranformation
187 fIsActive(trafo.fIsActive), // swith - On/Off
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
194 /// comment are above
196 if (trafo.fNameX) fNameX = new TString(*(trafo.fNameX));
197 if (trafo.fNameY) fNameY = new TString(*(trafo.fNameY));
198 if (trafo.fNameZ) fNameZ = new TString(*(trafo.fNameZ));
199 if (trafo.fBitMask) fBitMask = new TBits(*(trafo.fBitMask));
202 AliTPCTransformation::~AliTPCTransformation(){
211 void AliTPCTransformation::SetParams(Double_t param, Double_t sigma, Double_t sigma2Time, const TVectorD *const fixedParams){
212 /// Set parameters of transformation
217 fSigma2Time = sigma2Time;
218 if (fFixedParam) delete fFixedParam;
219 fFixedParam = new TVectorD(*fixedParams);
224 Bool_t AliTPCTransformation::Init(){
225 /// associate formulas with pointer to the function
229 fFormulaX=FindFormula(fNameX->Data());
230 if (fFormulaX==0) isOK=kFALSE;
233 fFormulaY=FindFormula(fNameY->Data());
234 if (fFormulaY==0) isOK=kFALSE;
237 fFormulaZ=FindFormula(fNameZ->Data());
238 if (!fFormulaZ) isOK=kFALSE;
245 TBits * AliTPCTransformation::BitsSide(Bool_t aside){
246 /// Set bits for given side
248 TBits * bits = new TBits(72);
249 for (Int_t i=0; i<72;i++){
250 if (i%36<18 && aside) (*bits)[i]=kTRUE;
251 if (i%36<18 && (!aside)) (*bits)[i]=kFALSE;
252 if (i%36>=18 && aside) (*bits)[i]=kFALSE;
253 if (i%36>=18 && (!aside)) (*bits)[i]=kTRUE;
258 TBits * AliTPCTransformation::BitsAll(){
259 /// Set all bits to kTRUE
261 TBits * bits = new TBits(72);
262 for (Int_t i=0; i<72;i++){
268 // Double_t AliTPCTransformation::GetDeltaXYZ(Int_t coord, Int_t volID, Double_t param, Double_t x, Double_t y, Double_t z){
271 // // coord - type of coordinate
277 // if (!fIsActive) return 0;
278 // if (fBitMask && (!(*fBitMask)[volID])) return 0;
279 // Double_t xyz[5]={x,y,z, param,volID};
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());
284 // if (coord==2 && fFormulaZ) return fFormulaZ(xyz,fFixedParam->GetMatrixArray());
286 // if (fCoordSystem==1){
287 // // cylindrical system
289 // if (fFormulaZ==0) return 0;
290 // return fFormulaZ(xyz,fFixedParam->GetMatrixArray());
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];
305 Double_t AliTPCTransformation::GetDeltaXYZ(Int_t coord, Int_t volID, Double_t param, Double_t x, Double_t y, Double_t z){
306 /// coord - type of coordinate
314 if (!fIsActive) return 0;
315 if (fBitMask && (!(*fBitMask)[volID])) return 0;
316 Double_t xyz[5]={x,y,z, param,volID};
317 Double_t alpha = TMath::ATan2(y,x);
318 Double_t ca = TMath::Cos(alpha);
319 Double_t sa = TMath::Sin(alpha);
321 if (fCoordSystem==0){
323 Double_t dxdydz[3]={0,0,0};
324 if(fFormulaX) dxdydz[0]=fFormulaX(xyz,fFixedParam->GetMatrixArray());
325 if(fFormulaY) dxdydz[1]=fFormulaY(xyz,fFixedParam->GetMatrixArray());
326 if(fFormulaZ) dxdydz[2]=fFormulaZ(xyz,fFixedParam->GetMatrixArray());
328 if (coord==0) return dxdydz[0];
329 if (coord==1) return dxdydz[1];
330 if (coord==2) return dxdydz[2];
331 if (coord==3) return dxdydz[0]*ca+dxdydz[1]*sa;
332 if (coord==4) return -dxdydz[0]*sa+dxdydz[1]*ca;
333 if (coord==5) return dxdydz[2];
335 if (fCoordSystem==1){
336 // cylindrical system
337 if (coord==2||coord==5) {
338 if (fFormulaZ==0) return 0;
339 return fFormulaZ(xyz,fFixedParam->GetMatrixArray());
341 Double_t rrphiz[3]={0,0,0};
342 if (fFormulaX) rrphiz[0] = fFormulaX(xyz,fFixedParam->GetMatrixArray());
343 if (fFormulaY) rrphiz[1] = fFormulaY(xyz,fFixedParam->GetMatrixArray());
344 alpha = TMath::ATan2(y,x);
345 ca = TMath::Cos(alpha);
346 sa = TMath::Sin(alpha);
347 if (coord==0) return ca*rrphiz[0]-sa*rrphiz[1];
348 if (coord==1) return sa*rrphiz[0]+ca*rrphiz[1];
349 if (coord==3) return rrphiz[0];
350 if (coord==4) return rrphiz[1];
357 Double_t AliTPCTransformation::TPCscalingRPol(Double_t *xyz, const Double_t * const param){
358 /// Scaling and shift of TPC radius
359 /// xyz[0..2] - global xyz of point
360 /// xyz[3] - scale parameter
361 /// param[0] - radial scaling power
362 /// param[1] - drift scaling power
363 /// radius from -1(at rInner) to 1 (rOuter)
364 /// driftM from -1(at 0 drift) to 1 (250 cm drift)
366 Double_t rInner=78.8;
367 Double_t rOuter=258.0;
368 Double_t deltaR = rOuter-rInner;
369 Double_t radius = (TMath::Sqrt(xyz[0]*xyz[0]+xyz[1]*xyz[1])-rInner)*2./deltaR;
370 Double_t driftM = (0.5 - TMath::Abs(xyz[2]/250.))*2.0;
371 Double_t delta = TMath::Power(radius,param[0])*TMath::Power(driftM,param[1]);
376 Double_t AliTPCTransformation::TPCscalingZDrift(Double_t *xyz, const Double_t * const param){
377 /// Scaling and shift of TPC radius
378 /// xyz[0..2] - global xyz of point
379 /// xyz[3] - scale parameter
381 Double_t driftP = TMath::Power(1. - TMath::Abs(xyz[2]/250.), param[0]);
382 Int_t sector = TMath::Nint(xyz[4]);
383 Double_t deltaZ = (sector%36<18) ? -driftP : driftP;
384 return deltaZ*xyz[3];
387 Double_t AliTPCTransformation::TPCscalingZDriftT0(Double_t *xyz, const Double_t * const /*param*/){
388 /// Z shift because time 0 offset
389 /// opposite on A and C side
391 /// xyz[0..2] - global xyz of point
392 /// xyz[3] - scale parameter
394 Int_t sector = TMath::Nint(xyz[4]);
395 Double_t sign = (sector%36<18) ? -1 : 1;
400 Double_t AliTPCTransformation::TPCscalingZDriftGy(Double_t *xyz, const Double_t * const param){
401 /// Scaling and shift of TPC radius
402 /// xyz[0..2] - global xyz of point
403 /// xyz[3] - scale parameter
405 Double_t driftP = TMath::Power(1. - TMath::Abs(xyz[2]/250.), param[0]);
406 Double_t gy = xyz[1]/250.;
407 Int_t sector = TMath::Nint(xyz[4]);
408 Double_t deltaZ = (sector%36<18) ? -driftP : driftP;
409 return deltaZ*xyz[3]*gy;
414 Double_t AliTPCTransformation::TPCscalingPhiLocal(Double_t *xyz, const Double_t * const param){
415 /// Scaling if the local y -phi
416 /// xyz[0..2] - global xyz of point
417 /// xyz[3] - scale parameter
418 /// value = 1 for ful drift length and parameter 1
420 Double_t alpha = TMath::ATan2(xyz[1],xyz[0]);
421 Double_t sector = TMath::Nint(9*alpha/TMath::Pi()-0.5);
422 Double_t localAlpha = (alpha-(sector+0.5)*TMath::Pi()/9.);
423 Double_t radius = TMath::Sqrt(xyz[0]*xyz[0]+xyz[1]*xyz[1])/250.;
425 Double_t deltaAlpha = radius*TMath::Power(2.*9.*localAlpha/TMath::Pi(),param[0]);
426 return deltaAlpha*xyz[3];
429 Double_t AliTPCTransformation::TPClocalRPhiEdge(Double_t *xyz, const Double_t *const param){
430 /// Scaling if the local y -phi
431 /// xyz[0..2] - global xyz of point
432 /// xyz[3] - scale parameter
433 /// param[0] - dedge offset - should be around gap size/2.
434 /// param[1] - dedge factor - should be around gap size/2.
436 Double_t alpha = TMath::ATan2(xyz[1],xyz[0]);
437 Double_t sector = TMath::Nint(9*alpha/TMath::Pi()-0.5);
438 Double_t localAlpha = (alpha-(sector+0.5)*TMath::Pi()/9.);
439 Double_t radius = TMath::Sqrt(xyz[0]*xyz[0]+xyz[1]*xyz[1]);
440 Double_t deltaAlpha = TMath::Pi()/18.-TMath::Abs(localAlpha);
441 Double_t distEdge = (deltaAlpha*radius);
442 Double_t factor = 1./(1.+(distEdge-param[0])/param[1]);
443 return factor*xyz[3]*((localAlpha>0)? -1.:1.);
447 Double_t AliTPCTransformation::TPCscalingRIFC(Double_t *xyz, const Double_t * const param){
448 /// inner field cage r distorion - proportinal to 1 over distance to the IFC
449 /// param[0] - drift polynom order
450 /// distortion at first pad row - is normalized to
452 Double_t rInner=78.8;
453 Double_t rFirst=85.2;
454 Double_t deltaR = rFirst-rInner;
455 Double_t ndistR = (TMath::Sqrt(xyz[0]*xyz[0]+xyz[1]*xyz[1])-rInner)/deltaR;
456 Double_t driftM = (0.5 - TMath::Abs(xyz[2]/250.))*2.;
457 Double_t value = TMath::Power(driftM,param[0])/ndistR;
461 Double_t AliTPCTransformation::TPCscalingROFC(Double_t *xyz, const Double_t * const param){
462 /// outer field cage r distorion - proportinal to 1 over distance to the OFC
463 /// param[0] - drift polynom order
464 /// driftM - from -1 to 1
466 Double_t rLast=245.8;
467 Double_t rOuter=258.0;
468 Double_t deltaR = rOuter-rLast;
469 Double_t ndistR = (rOuter-TMath::Sqrt(xyz[0]*xyz[0]+xyz[1]*xyz[1]))/deltaR;
470 Double_t driftM = (0.5 - TMath::Abs(xyz[2]/250.))*2.;
471 Double_t value = TMath::Power(driftM,param[0])/ndistR;
476 Double_t AliTPCTransformation::TPCdeltaFCROC(Double_t *xyz, const Double_t *const param){
477 /// delta R(Z) ROC induced
478 /// param[0] - switch 0 - use distance to IFC - 1 - distance to IFC
479 /// param[1] - kFC scaling factor (multiplication factor of (OFC-IFC))
480 /// param[2] - kROC scaling factor
481 /// parameters [1] and [2] should be obtained from the electric field
484 Double_t rInner=78.8;
485 Double_t rFirst=85.2;
486 Double_t rLast=245.8;
487 Double_t rOuter=258.0;
489 Double_t radius = TMath::Sqrt(xyz[0]*xyz[0]+xyz[1]*xyz[1]);
490 //calculate distance to the FC - inner or outer
491 Double_t deltaFC = (param[0]<0.5)? TMath::Abs(radius-rFirst) : TMath::Abs(radius-rLast);
492 deltaFC/=(rOuter-rInner);
493 Double_t scalingFC = 1./(1.+deltaFC/(param[1]));
495 Double_t drift = 1.-TMath::Abs(xyz[2]/250.); // normalized drift length
496 Double_t scalingROC = (1.-1./(1.+drift/param[2]));
498 return xyz[3]*scalingFC*scalingROC;
502 Double_t AliTPCTransformation::TPCdeltaFCCE(Double_t *xyz, const Double_t *const param){
503 /// delta R(Z) CE (central electrode) induced
504 /// param[0] - switch 0 - use distance to IFC - 1 - distance to IFC
505 /// param[1] - kFC scaling factor (multiplication factor of (OFC-IFC))
506 /// param[2] - kCE scaling factor
507 /// parameters [1] and [2] should be obtained from the electric field
510 Double_t rInner=78.8;
511 Double_t rFirst=85.2;
512 Double_t rLast =245.8;
513 Double_t rOuter=258.0;
515 Double_t radius = TMath::Sqrt(xyz[0]*xyz[0]+xyz[1]*xyz[1]);
516 //calculate distance to the FC - inner or outer
517 Double_t deltaFC = (param[0]<0.5)? TMath::Abs(radius-rFirst) : TMath::Abs(radius-rLast);
518 deltaFC/=(rOuter-rInner);
519 Double_t scalingFC = 1./(1.+deltaFC/(param[1]));
521 Double_t drift = 1.-TMath::Abs(xyz[2]/250.); // normalized drift length
522 Double_t scalingCE = 1/(1.+(1.-drift)/param[2]); //
524 return xyz[3]*scalingFC*scalingCE;
534 // TPC sector local misalignment
538 Double_t AliTPCTransformation:: TPClocaldLxdGX(Double_t *xyz, const Double_t *const param){
539 /// xyz - [0..2] - position
540 /// [3] - scale parameter
542 /// param[0]= n - cos(n *alpha)
543 /// param[1]= n - sin(n *alpha)
544 /// param[2] - indication - 0 - the same for IROC OROC 1 - opposite
545 /// return delta in global coordiante system
547 Int_t sector = TMath::Nint(xyz[4]);
548 Double_t alpha = TMath::Pi()*(sector+0.5)/9;
549 Double_t ca = TMath::Cos(alpha);
550 // Double_t sa = TMath::Sin(alpha);
551 const Double_t xIROCOROC = 133.4;
552 Double_t factor = xyz[3];
553 if (param[0]>0) factor*=TMath::Cos(alpha*param[0]);
554 if (param[1]>0) factor*=TMath::Sin(alpha*param[1]);
555 if (param[2]>0.5 && TMath::Sqrt(xyz[1]*xyz[1]+xyz[0]*xyz[0])>xIROCOROC) factor*=-1;
559 Double_t AliTPCTransformation::TPClocaldLxdGY(Double_t *xyz, const Double_t *const param){
560 /// xyz - [0..2] - position
561 /// [3] - scale parameter
563 /// param[0]= n - cos(n *alpha)
564 /// param[1]= n - sin(n *alpha)
565 /// param[2] - indication - 0 - the same for IROC OROC 1 - opposite
566 /// return delta in global coordiante system
568 Int_t sector = TMath::Nint(xyz[4]);
569 Double_t alpha = TMath::Pi()*(sector+0.5)/9;
570 //Double_t ca = TMath::Cos(alpha);
571 Double_t sa = TMath::Sin(alpha);
572 const Double_t xIROCOROC = 133.4;
573 Double_t factor = xyz[3];
574 if (param[0]>0) factor*=TMath::Cos(alpha*param[0]);
575 if (param[1]>0) factor*=TMath::Sin(alpha*param[1]);
576 if (param[2]>0.5 && TMath::Sqrt(xyz[1]*xyz[1]+xyz[0]*xyz[0])>xIROCOROC) factor*=-1;
580 Double_t AliTPCTransformation:: TPClocaldLydGX(Double_t *xyz, const Double_t *const param){
581 /// xyz - [0..2] - position
582 /// [3] - scale parameter
584 /// param[0]= n - cos(n *alpha)
585 /// param[1]= n - sin(n *alpha)
586 /// param[2] - indication - 0 - the same for IROC OROC 1 - opposite
587 /// return delta in global coordiante system
589 Int_t sector = TMath::Nint(xyz[4]);
590 Double_t alpha = TMath::Pi()*(sector+0.5)/9;
591 //Double_t ca = TMath::Cos(alpha);
592 Double_t sa = TMath::Sin(alpha);
593 const Double_t xIROCOROC = 133.4;
594 Double_t factor = xyz[3];
595 if (param[0]>0) factor*=TMath::Cos(alpha*param[0]);
596 if (param[1]>0) factor*=TMath::Sin(alpha*param[1]);
597 if (param[2]>0.5 && TMath::Sqrt(xyz[1]*xyz[1]+xyz[0]*xyz[0])>xIROCOROC) factor*=-1;
601 Double_t AliTPCTransformation::TPClocaldLydGY(Double_t *xyz, const Double_t *const param){
602 /// xyz - [0..2] - position
603 /// [3] - scale parameter
605 /// param[0]= n - cos(n *alpha)
606 /// param[1]= n - sin(n *alpha)
607 /// param[2] - indication - 0 - the same for IROC OROC 1 - opposite
608 /// return delta in global coordiante system
610 Int_t sector = TMath::Nint(xyz[4]);
611 Double_t alpha = TMath::Pi()*(sector+0.5)/9;
612 Double_t ca = TMath::Cos(alpha);
613 //Double_t sa = TMath::Sin(alpha);
614 const Double_t xIROCOROC = 133.4;
615 Double_t factor = xyz[3];
616 if (param[0]>0) factor*=TMath::Cos(alpha*param[0]);
617 if (param[1]>0) factor*=TMath::Sin(alpha*param[1]);
618 if (param[2]>0.5 && TMath::Sqrt(xyz[1]*xyz[1]+xyz[0]*xyz[0])>xIROCOROC) factor*=-1;
623 Double_t AliTPCTransformation::TPClocaldRzdGX(Double_t *xyz, const Double_t *const param){
624 /// xyz - [0..2] - position
625 /// [3] - scale parameter - rotation angle in mrad
627 /// param[0]= n - cos(n *alpha)
628 /// param[1]= n - sin(n *alpha)
629 /// param[2] - indication - 0 - the same for IROC OROC 1 - opposite
630 /// return delta in global coordiante system
632 Int_t sector = TMath::Nint(xyz[4]);
633 Double_t alpha = TMath::Pi()*(sector+0.5)/9;
634 Double_t ca = TMath::Cos(alpha);
635 Double_t sa = TMath::Sin(alpha);
636 Double_t lx = xyz[0]*ca + xyz[1]*sa;
637 Double_t ly = -xyz[0]*sa + xyz[1]*ca;
639 const Double_t xIROCOROC = 133.4;
641 Double_t rot = xyz[3]*0.001; // rotation in mrad
642 if (param[0]>0) rot*=TMath::Cos(alpha*param[0]);
643 if (param[1]>0) rot*=TMath::Sin(alpha*param[1]);
644 if (param[2]>0.5 && lx>0) rot*=-1;
646 Double_t dlxR = - ly*rot;
647 Double_t dlyR = lx*rot;
648 Double_t dgxR = dlxR*ca - dlyR*sa;
649 //Double_t dgyR = dlxR*sa + dlyR*ca;
653 Double_t AliTPCTransformation::TPClocaldRzdGY(Double_t *xyz, const Double_t *const param){
654 /// xyz - [0..2] - position
655 /// [3] - scale parameter - rotation angle in mrad
657 /// param[0]= n - cos(n *alpha)
658 /// param[1]= n - sin(n *alpha)
659 /// param[2] - indication - 0 - the same for IROC OROC 1 - opposite
660 /// return delta in global coordiante system
662 Int_t sector = TMath::Nint(xyz[4]);
663 Double_t alpha = TMath::Pi()*(sector+0.5)/9;
664 Double_t ca = TMath::Cos(alpha);
665 Double_t sa = TMath::Sin(alpha);
666 Double_t lx = xyz[0]*ca + xyz[1]*sa;
667 Double_t ly = -xyz[0]*sa + xyz[1]*ca;
669 const Double_t xIROCOROC = 133.4;
671 Double_t rot = xyz[3]*0.001; // rotation in mrad
672 if (param[0]>0) rot*=TMath::Cos(alpha*param[0]);
673 if (param[1]>0) rot*=TMath::Sin(alpha*param[1]);
674 if (param[2]>0.5 && lx>0) rot*=-1;
675 Double_t dlxR = - ly*rot;
676 Double_t dlyR = lx*rot;
677 //Double_t dgxR = dlxR*ca - dlyR*sa;
678 Double_t dgyR = dlxR*sa + dlyR*ca;
684 Double_t AliTPCTransformation::TPCDeltaZMediumLong(Double_t *xyz, Double_t * /*param*/){
685 /// xyz - [0..2] - position
686 /// [3] - scale parameter
688 /// return delta in global coordinate system
690 Int_t sector = TMath::Nint(xyz[4]);
691 Double_t signZ = (sector%36<18) ? 1: -1; // drift direction
692 if (sector<36) return 0;
694 const Double_t radiusLong = 198.1;
696 Double_t alpha = TMath::Pi()*(sector+0.5)/9;
697 Double_t ca = TMath::Cos(alpha);
698 Double_t sa = TMath::Sin(alpha);
699 Double_t lx = xyz[0]*ca + xyz[1]*sa;
700 Double_t sign = (lx<radiusLong) ? 1:-1;
701 return xyz[3]*sign*signZ;
704 Double_t AliTPCTransformation::TPCDeltaZ(Double_t *xyz, const Double_t *const param){
705 /// xyz - [0..2] - position
706 /// [3] - scale parameter
708 /// return delta in global coordiante system
710 Int_t sector = TMath::Nint(xyz[4]);
711 Double_t delta = (sector%36<18) ? 1: -1; // drift direction
712 Double_t alpha = TMath::Pi()*(sector+0.5)/9;
713 Double_t ca = TMath::Cos(alpha);
714 Double_t sa = TMath::Sin(alpha);
715 Double_t lx = xyz[0]*ca + xyz[1]*sa;
717 const Double_t xIROCOROC = 133.4;
718 if (param[0]>0) delta *= TMath::Cos(param[0]*alpha);
719 if (param[1]>0) delta *= TMath::Sin(param[1]*alpha);
720 if (param[2]>0.5 && lx >xIROCOROC) delta *=-1;
721 return delta*xyz[3]; // IROC shift
725 Double_t AliTPCTransformation::TPCTiltingZ(Double_t *xyz, const Double_t *const param){
726 /// xyz - [0..2] - position
727 /// [3] - scale parameter
729 /// param[0] - n for cos
730 /// param[1] - n for sin
731 /// param[2] - IROC-ORC relative (if >0.5 )
732 /// return delta in global coordinate system
734 const Double_t rFirst=85.2;
735 const Double_t rLast =245.8;
736 const Double_t xIROCOROC = 133.4;
738 Int_t sector = TMath::Nint(xyz[4]);
739 Double_t alpha = TMath::Pi()*(sector+0.5)/9;
740 Double_t ca = TMath::Cos(alpha);
741 Double_t sa = TMath::Sin(alpha);
742 Double_t lx = xyz[0]*ca + xyz[1]*sa;
743 Double_t deltaR = 2.0*(lx-xIROCOROC)/(rLast-rFirst);
744 if (param[0]>0) deltaR *= TMath::Cos(param[0]*alpha);
745 if (param[1]>0) deltaR *= TMath::Sin(param[1]*alpha);
746 if (param[2]>0.5 && lx >xIROCOROC) deltaR *=-1;
747 return deltaR*xyz[3];