]> git.uio.no Git - u/mrichter/AliRoot.git/blame - TPC/AliTPCCorrection.h
Adding some macros to check corrections, implementing PID cross check proposed by...
[u/mrichter/AliRoot.git] / TPC / AliTPCCorrection.h
CommitLineData
0116859c 1#ifndef ALI_TPC_CORRECTION_H
2#define ALI_TPC_CORRECTION_H
3
4/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
5 * See cxx source for full Copyright notice */
6
b4caed64 7
0116859c 8////////////////////////////////////////////////////////////////////////////////
0116859c 9// AliTPCCorrection class //
0116859c 10////////////////////////////////////////////////////////////////////////////////
11
12
13#include <TNamed.h>
1b923461 14#include "TMatrixD.h"
0116859c 15class TH2F;
e527a1b9 16class TTimeStamp;
0116859c 17class TCollection;
cf5b0aa0 18class TTreeSRedirector;
19class AliExternalTrackParam;
ffab0c37 20class TTree;
8b63d99c 21class THnSparse;
ca58ed4e 22class AliESDVertex;
1b923461 23
24
0116859c 25class AliTPCCorrection : public TNamed {
26public:
27 enum CompositionType {kParallel,kQueue};
28
29 AliTPCCorrection();
30 AliTPCCorrection(const char *name,const char *title);
31 virtual ~AliTPCCorrection();
32
33
34 // functions to correct a space point
35 void CorrectPoint ( Float_t x[],const Short_t roc);
36 void CorrectPoint (const Float_t x[],const Short_t roc,Float_t xp[]);
37 virtual void GetCorrection(const Float_t x[],const Short_t roc,Float_t dx[]);
38
39 // functions to distort a space point
40 void DistortPoint ( Float_t x[],const Short_t roc);
41 void DistortPoint (const Float_t x[],const Short_t roc,Float_t xp[]);
42 virtual void GetDistortion(const Float_t x[],const Short_t roc,Float_t dx[]);
43
e527a1b9 44 // initialization and update functions
0116859c 45 virtual void Init();
e527a1b9 46 virtual void Update(const TTimeStamp &timeStamp);
0116859c 47
48 // convenience functions
49 virtual void Print(Option_t* option="") const;
50
51 TH2F* CreateHistoDRinXY (Float_t z=10.,Int_t nx=100,Int_t ny=100);
52 TH2F* CreateHistoDRPhiinXY(Float_t z=10.,Int_t nx=100,Int_t nphi=100);
c9cbd2f2 53 TH2F* CreateHistoDZinXY (Float_t z=10.,Int_t nx=100,Int_t ny=100);
54
0116859c 55 TH2F* CreateHistoDRinZR (Float_t phi=0.,Int_t nZ=100,Int_t nR=100);
56 TH2F* CreateHistoDRPhiinZR(Float_t phi=0.,Int_t nZ=100,Int_t nR=100);
c9cbd2f2 57 TH2F* CreateHistoDZinZR (Float_t phi=0.,Int_t nZ=100,Int_t nR=100);
58
59
ffab0c37 60 TTree* CreateDistortionTree(Double_t step=5);
8b63d99c 61 static void MakeDistortionMap(THnSparse * his0, TTreeSRedirector *pcstream, const char* hname, Int_t run);
0116859c 62 // normally called directly in the correction classes which inherit from this class
63 virtual void SetOmegaTauT1T2(Float_t omegaTau,Float_t t1,Float_t t2);
be67055b 64 AliExternalTrackParam * FitDistortedTrack(AliExternalTrackParam & trackIn, Double_t refX, Int_t dir,TTreeSRedirector *pcstream);
ffab0c37 65 void StoreInOCDB(Int_t startRun, Int_t endRun, const char *comment=0);
b1f0a2a5 66 static void MakeTrackDistortionTree(TTree *tinput, Int_t dtype, Int_t ptype, const TObjArray * corrArray, Int_t step=1, Bool_t debug=0);
7f4cb119 67 static void MakeLaserDistortionTree(TTree* tree, TObjArray *corrArray, Int_t itype);
f1817479 68
69 void FastSimDistortedVertex(Double_t orgVertex[3], Int_t nTracks, AliESDVertex &aV, AliESDVertex &avOrg, AliESDVertex &cV, AliESDVertex &cvOrg, TTreeSRedirector * const pcstream, Double_t etaCuts);
70
71 static void AddVisualCorrection(AliTPCCorrection* corr, Int_t position);
287fbdfa 72 static Double_t GetCorrSector(Double_t sector, Double_t r, Double_t kZ, Int_t axisType, Int_t corrType=0);
f1817479 73 static Double_t GetCorrXYZ(Double_t gx, Double_t gy, Double_t gz, Int_t axisType, Int_t corrType=0);
ca58ed4e 74
0116859c 75protected:
76 TH2F* CreateTH2F(const char *name,const char *title,
77 const char *xlabel,const char *ylabel,const char *zlabel,
78 Int_t nbinsx,Double_t xlow,Double_t xup,
79 Int_t nbinsy,Double_t ylow,Double_t yup);
80
c9cbd2f2 81 static const Double_t fgkTPCZ0; // nominal gating grid position
0116859c 82 static const Double_t fgkIFCRadius; // Mean Radius of the Inner Field Cage ( 82.43 min, 83.70 max) (cm)
83 static const Double_t fgkOFCRadius; // Mean Radius of the Outer Field Cage (252.55 min, 256.45 max) (cm)
84 static const Double_t fgkZOffSet; // Offset from CE: calculate all distortions closer to CE as if at this point
85 static const Double_t fgkCathodeV; // Cathode Voltage (volts)
86 static const Double_t fgkGG; // Gating Grid voltage (volts)
c9cbd2f2 87 static const Double_t fgkdvdE; // [cm/V] drift velocity dependency on the E field (from Magboltz for NeCO2N2 at standard environment)
88 static const Double_t fgkEM; // charge/mass in [C/kg]
89 static const Double_t fgke0; // vacuum permittivity [A·s/(V·m)]
0116859c 90
c9cbd2f2 91
35ae345f 92 enum {kNR= 72 }; // Number of R points in the table for interpolating distortion data
93 enum {kNPhi= 18*10+1}; // Number of Phi points in the table for interpolating distortion data ( plus one extra for 360 == 0 )
94 enum {kNZ= 166}; // Number of Z points in the table for interpolating distortion data
c9cbd2f2 95
35ae345f 96 Double_t fgkRList[kNR]; // points in the radial direction (for the lookup table)
c9cbd2f2 97 Double_t fgkPhiList[kNPhi]; // points in the phi direction (for the lookup table)
35ae345f 98 Double_t fgkZList[kNZ]; // points in the z direction (for the lookup table)
0116859c 99
100 // Simple Interpolation functions: e.g. with tricubic interpolation (not yet in TH3)
c9cbd2f2 101 Int_t fILow, fJLow, fKLow; // variable to help in the interpolation
0116859c 102 void Interpolate2DEdistortion( const Int_t order, const Double_t r, const Double_t z,
b1f0a2a5 103 const Double_t er[kNZ][kNR], Double_t &erValue );
c9cbd2f2 104 void Interpolate3DEdistortion( const Int_t order, const Double_t r, const Float_t phi, const Double_t z,
35ae345f 105 const Double_t er[kNZ][kNPhi][kNR], const Double_t ephi[kNZ][kNPhi][kNR],
106 const Double_t ez[kNZ][kNPhi][kNR],
c9cbd2f2 107 Double_t &erValue, Double_t &ephiValue, Double_t &ezValue);
108 Double_t Interpolate2DTable( const Int_t order, const Double_t x, const Double_t y,
109 const Int_t nx, const Int_t ny, const Double_t xv[], const Double_t yv[],
110 const TMatrixD &array );
111 Double_t Interpolate3DTable( const Int_t order, const Double_t x, const Double_t y, const Double_t z,
112 const Int_t nx, const Int_t ny, const Int_t nz,
113 const Double_t xv[], const Double_t yv[], const Double_t zv[],
114 TMatrixD **arrayofArrays );
0116859c 115 Double_t Interpolate( const Double_t xArray[], const Double_t yArray[],
116 const Int_t order, const Double_t x );
117 void Search( const Int_t n, const Double_t xArray[], const Double_t x, Int_t &low );
710bda39 118 virtual Int_t IsPowerOfTwo ( Int_t i ) const ;
1b923461 119
c9cbd2f2 120
121
122 // Algorithms to solve the laplace or poisson equation
123 void PoissonRelaxation2D(TMatrixD &arrayV, TMatrixD &chargeDensity,
124 TMatrixD &arrayErOverEz, TMatrixD &arrayDeltaEz,
125 const Int_t rows, const Int_t columns, const Int_t iterations,
126 const Bool_t rocDisplacement = kTRUE);
127
128 void PoissonRelaxation3D( TMatrixD **arrayofArrayV, TMatrixD **arrayofChargeDensities,
129 TMatrixD **arrayofEroverEz, TMatrixD **arrayofEPhioverEz, TMatrixD **arrayofEz,
130 const Int_t rows, const Int_t columns, const Int_t phislices,
131 const Float_t deltaphi, const Int_t iterations, const Int_t summetry,
132 const Bool_t rocDisplacement = kTRUE);
133
534fd34a 134protected:
135 Double_t fT1; // tensor term of wt - T1
136 Double_t fT2; // tensor term of wt - T2
f1817479 137 static TObjArray *fgVisualCorrection; // array of orrection for visualization
7f4cb119 138private:
c9cbd2f2 139 AliTPCCorrection(const AliTPCCorrection &); // not implemented
140 AliTPCCorrection &operator=(const AliTPCCorrection &); // not implemented
141
35ae345f 142 void InitLookUpfulcrums(); // to initialize the grid of the look up table
143
144 ClassDef(AliTPCCorrection,4);
0116859c 145};
146
147#endif