]> git.uio.no Git - u/mrichter/AliRoot.git/blob - TPC/CalibMacros/AliTPCDistortions.h
Distortion macros - very preliminary version
[u/mrichter/AliRoot.git] / TPC / CalibMacros / AliTPCDistortions.h
1 #ifndef ALI_TPC_DISTORTIONS_H
2 #define ALI_TPC_DISTORTIONS_H
3
4 #include <TObject.h>
5
6 class AliMagF;
7
8 class AliTPCDistortions : public TObject {
9 public:
10   AliTPCDistortions();
11   virtual ~AliTPCDistortions() {};
12   
13   void UndoTwistDistortion(        const Double_t x[],Double_t xprime[],Int_t roc);
14   void UndoIFCShiftDistortion(     const Double_t x[],Double_t xprime[],Int_t roc);
15   void UndoGGVoltErrorDistortion(  const Double_t x[],Double_t xprime[],Int_t roc);
16   void UndoExBShapeDistortion(     const Double_t x[],Double_t xprime[],Int_t roc);
17
18   // common setters and getters for ExB
19   void SetOmegaTau(Double_t omegaTau) {fOmegaTau=omegaTau;RecalculateCs();}
20   void SetT1(Double_t t1) {fT1=t1;RecalculateCs();}
21   void SetT2(Double_t t2) {fT2=t2;RecalculateCs();}
22   void SetC0(Double_t c0) {fC0=c0;}
23   void SetC1(Double_t c1) {fC1=c1;}
24   void SetC2(Double_t c2) {fC2=c2;}
25   Double_t GetOmegaTau() const {return fOmegaTau;}
26   Double_t GetT1() const {return fT1;}
27   Double_t GetT2() const {return fT2;}
28   Double_t GetC0() const {return fC0;}
29   Double_t GetC1() const {return fC1;}
30   Double_t GetC2() const {return fC2;}
31
32   // setters and getters for twist
33   void SetXTwist(Double_t xTwist) {fXTwist=xTwist;}
34   void SetYTwist(Double_t yTwist) {fYTwist=yTwist;}
35   Double_t GetXTwist() const {return fXTwist;}
36   Double_t GetYTwist() const {return fYTwist;}
37
38   // setter and getter for IFC
39   void SetIFCShift(Double_t ifcShift) {fIFCShift=ifcShift;}
40   Double_t GetIFCshift() const {return fIFCShift;}
41
42   // setters and getters for GG
43   void SetDeltaVGGA(Double_t deltaVGGA) {fDeltaVGGA=deltaVGGA;}
44   void SetDeltaVGGC(Double_t deltaVGGC) {fDeltaVGGC=deltaVGGC;}
45   Double_t GetDeltaVGGA() const {return fDeltaVGGA;}
46   Double_t GetDeltaVGGC() const {return fDeltaVGGC;}
47
48   // setter and getter for B field shape
49   void SetBField(AliMagF *bField) {fBField=bField;}
50   AliMagF* GetBField() const {return fBField;}
51   static AliTPCDistortions*   Instance();
52   static AliTPCDistortions*   fgInstance; //! Instance of this class (singleton implementation)
53 private:
54   enum {kNR=   92};              // Number of R points in table
55   enum {kNZ=  270};              // Number of Z points in the tables for interpolating distortion data
56   enum {kNPhi= 19};              // Number of Phi points in table ( plus one extra for 360 == 0 )
57   void RecalculateCs();
58   void InitIFCShiftDistortion();
59   void InitGGVoltErrorDistortion();
60
61   void Interpolate2DEdistortion( const Int_t order, const Double_t r, const Double_t z, 
62                                  const Double_t er[kNZ][kNR], Double_t &er_value );
63   Double_t Interpolate( const Double_t xArray[], const Double_t yArray[], 
64                        const Int_t order, const Double_t x );
65   void Search( const Int_t n, const Double_t xArray[], const Double_t x, Int_t &low );
66
67   static const Double_t fgkIFCRadius;   // Mean Radius of the Inner Field Cage ( 82.43 min,  83.70 max) (cm)
68   static const Double_t fgkOFCRadius;   // Mean Radius of the Outer Field Cage (252.55 min, 256.45 max) (cm)
69   static const Double_t fgkTPC_Z0;      // Z location of TPC Gated Grid (cm)
70   static const Double_t fgkZOffSet;     // Offset from CE: calculate all distortions closer to CE as if at this point
71   static const Double_t fgkCathodeV;    // Cathode Voltage (volts)
72   static const Double_t fgkGG;          // Gating Grid voltage (volts)
73   static const Double_t fgkAliceDriftV; // Drift Velocity (cm/microSec) Magnitude
74   static const Double_t fgkRList[kNR];
75   static const Double_t fgkPhiList[kNPhi];
76   static const Double_t fgkZList[kNZ];
77
78   Double_t fOmegaTau;             // omega tau factor               (compare Jim Thomas's notes for definitions)
79   Double_t fT1;                   // 1st tensor term for omega tau  (compare Jim Thomas's notes for definitions)
80   Double_t fT2;                   // 2nd tensor term for omega tau  (compare Jim Thomas's notes for definitions)
81   Double_t fC0;                   // coefficient C0                 (compare Jim Thomas's notes for definitions)
82   Double_t fC1;                   // coefficient C1                 (compare Jim Thomas's notes for definitions)
83   Double_t fC2;                   // coefficient C2                 (compare Jim Thomas's notes for definitions)
84   AliMagF *fBField;              // Magnetic field map for ExB shape distortions due to B field
85   Double_t fXTwist;               // Twist of E to B filed in X-Z [rad]
86   Double_t fYTwist;               // Twist of E to B filed in Y-Z [rad]
87   Double_t fIFCShift;             // Shift of inner field cage [cm]
88   Double_t fDeltaVGGA;            // Missmatch of gating grid voltage on A-side [V]
89   Double_t fDeltaVGGC;            // Missmatch of gating grid voltage on C-side [V]
90   Double_t  fShiftER[kNZ][kNR];       // Array to store electric field for IFCShift calcualtion
91   Double_t  fSpaceER[kNZ][kNR];       // Array to store electric field for SpaceCharge calculation
92   Double_t  fShortER[kNZ][kNR];       // Array to store electric field for ShortedRing calculation
93   Double_t  fGGVoltErrorER[kNZ][kNR]; // Array to store electric field for GGVoltError calculation
94   Int_t fJLow;
95   Int_t fKLow;
96
97   ClassDef(AliTPCDistortions,1);
98 };
99
100 #endif