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