AliRoot Core  d69033e (d69033e)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
AliTPCTransform.h
Go to the documentation of this file.
1 #ifndef ALITPCTRANSFORM_H
2 #define ALITPCTRANSFORM_H
3 
4 /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
5  * See cxx source for full Copyright notice */
6 
7 
14 
15 class AliTPCRecoParam;
16 class TTreeSRedirector;
17 class TGraph;
18 class AliTPCclusterMI;
19 #include "AliTPCChebCorr.h"
20 #include "AliTransform.h"
21 #include <time.h>
22 
24 public:
26  AliTPCTransform(const AliTPCTransform& transform);
27 
28  virtual ~AliTPCTransform();
29  virtual void Transform(Double_t *x,Int_t *i,UInt_t time,
30  Int_t coordinateType);
31  void ResetCache();
32  void SetPrimVertex(Double_t *vtx);
33  void Local2RotatedGlobal(Int_t sec, Double_t *x) const;
34  void RotatedGlobal2Global(Int_t sector,Double_t *x) const;
35  void Global2RotatedGlobal(Int_t sector,Double_t *x) const;
36  void GetCosAndSin(Int_t sector,Double_t &cos,Double_t &sin) const;
37  time_t GetCurrentTimeStamp() const { return fCurrentTimeStamp;}
40  UInt_t GetCurrentRunNumber() const { return fCurrentRun;}
44  //
45  Double_t TimeBin2Z(double t, int sector, double yLab) const;
46  Double_t Z2TimeBin(double t, int sector, double yLab) const;
47  //
48  static TObjArray* LoadCorrectionMaps(Bool_t refMap, Bool_t corrMode=kTRUE);
49  static AliTPCChebCorr* LoadFieldDependendStaticCorrectionMap(Bool_t ref,Bool_t corrMode=kTRUE,TObjArray* mapsArrProvided=0);
50  void CleanCorrectionMaps();
51  Double_t ErrY2Syst(const AliTPCclusterMI * cl, const double tgAngPhi);
52  Double_t ErrZ2Syst(const AliTPCclusterMI * cl, const double tgAngLam);
53  void ErrY2Z2Syst(const AliTPCclusterMI * cl, const double tgPhi, const double tgLam,double &serry2, double &serrz2);
54 
55  void LoadCorrectionMapsForTimeBin(TObjArray* mapsArrProvided=0);
56  // set current values
57  //
59  void SetCurrentRun(Int_t run){fCurrentRun=run;}
60  void SetCurrentTimeStamp(time_t timeStamp);
61  void ApplyTransformations(Double_t *xyz, Int_t volID);
62  //
63  // new correction maps
64  Bool_t UpdateTimeDependentCache();
65  void ApplyCorrectionMap(int roc, int row, double xyzSect[3]);
66  void ApplyDistortionMap(int roc, double xyzLab[3]);
67  void EvalCorrectionMap(int roc, int row, const double xyz[3], float *res, Bool_t ref=kFALSE);
68  Float_t EvalCorrectionMap(int roc, int row, const double xyz[3], int dimOut, Bool_t ref=kFALSE);
69  Float_t GetCorrMapComponent(int roc, int row, const double xyz[3], int dimOut);
70  void EvalDistortionMap(int roc, const double xyzSector[3], float *res, Bool_t ref=kFALSE);
71  const Float_t* GetLastMapCorrection() const {return fLastCorr;}
72  const Float_t* GetLastMapCorrectionRef() const {return fLastCorrRef;}
73  Float_t GetCurrentMapScaling() const {return fCurrentMapScaling;}
76  void SetCorrectionMapMode(Bool_t v=kTRUE);
77  Bool_t GetCorrectionMapMode() const {return fCorrMapMode;}
78  //
79  static void RotateToSectorUp(float *x, int& idROC);
80  static void RotateToSectorDown(float *x, int& idROC);
81  static void RotateToSectorUp(double *x, int& idROC);
82  static void RotateToSectorDown(double *x, int& idROC);
83  static int SectorUp(int idROC);
84  static int SectorDown(int idROC);
85  static double GetMaxY2X() {return fgkMaxY2X;}
86  void SetDebugStreamer(TTreeSRedirector * pcstream){fDebugStreamer=pcstream;}
87  TTreeSRedirector *GetDebugStreemer() const { return fDebugStreamer;}
88 
89  //
90 private:
91  enum { // time tolerances for various cache updates
92  kMaxTDiffVDCorrVaria=3, // +-time update for minor vdrift corrections
93  kMaxTDiffVDCorrPT=60, // +-time update for vdrift PT correction
94  kMaxTDiffCorrMap=3 // +-time update for SP corrections
95  };
96 
97  AliTPCTransform& operator=(const AliTPCTransform&); // not implemented
98  Float_t fLastCorr[4];
99  Float_t fLastCorrRef[4];
100  Double_t fCoss[18];
101  Double_t fSins[18];
102  Double_t fPrimVtx[3];
109  Float_t fCorrMapLumiCOG;
110  TGraph* fLumiGraphRun;
111  TGraph* fLumiGraphMap;
112  Int_t fCurrentRun;
115  Bool_t fCorrMapMode;
116  //
117  // vdrift corrections cache
118  Double_t fVDCorrectionTime;
120  Double_t fTime0CorrTime;
121  Double_t fDeltaZCorrTime;
122  Double_t fDriftCorrPT;
123  Double_t fTBinOffset;
124  //
125  // last cache update times
129  //
131  static const Double_t fgkSin20; // sin(20)
132  static const Double_t fgkCos20; // sin(20)
133  static const Double_t fgkMaxY2X; // tg(10)
134  TTreeSRedirector *fDebugStreamer;
135  //
136  ClassDef(AliTPCTransform,5)
138 };
139 
140 //_________________________________________________
141 inline void AliTPCTransform::RotateToSectorUp(float *x, int& idROC)
142 {
143  // rotate point in sector coordinates to sector+1
144  idROC += ((idROC%18)==17) ? -17 : 1;
145  float tmp = x[0];
146  x[0] = fgkCos20*tmp - fgkSin20*x[1];
147  x[1] = fgkSin20*tmp + fgkCos20*x[1];
148 }
149 
150 //_________________________________________________
151 inline void AliTPCTransform::RotateToSectorDown(float *x, int& idROC)
152 {
153  // rotate point in sector coordinates to sector-1
154  idROC += ((idROC%18)== 0) ? 17 : -1; // change to the lower sector
155  float tmp = x[0];
156  x[0] = fgkCos20*tmp + fgkSin20*x[1];
157  x[1] =-fgkSin20*tmp + fgkCos20*x[1];
158 }
159 
160 //_________________________________________________
161 inline void AliTPCTransform::RotateToSectorUp(double *x, int& idROC)
162 {
163  // rotate point in sector coordinates to sector+1
164  idROC += ((idROC%18)==17) ? -17 : 1;
165  double tmp = x[0];
166  x[0] = fgkCos20*tmp - fgkSin20*x[1];
167  x[1] = fgkSin20*tmp + fgkCos20*x[1];
168 }
169 
170 //_________________________________________________
171 inline void AliTPCTransform::RotateToSectorDown(double *x, int& idROC)
172 {
173  // rotate point in sector coordinates to sector-1
174  idROC += ((idROC%18)== 0) ? 17 : -1; // change to the lower sector
175  double tmp = x[0];
176  x[0] = fgkCos20*tmp + fgkSin20*x[1];
177  x[1] =-fgkSin20*tmp + fgkCos20*x[1];
178 }
179 
180 //_________________________________________________
181 inline int AliTPCTransform::SectorUp(int idROC)
182 {
183  // sector+1
184  return idROC + (((idROC%18)==17) ? -17 : 1);
185 }
186 
187 //_________________________________________________
188 inline int AliTPCTransform::SectorDown(int idROC)
189 {
190  // sector-1
191  return idROC + (((idROC%18)== 0) ? 17 : -1); // change to the lower sector
192 }
193 
194 
195 #endif
void ApplyCorrectionMap(int roc, int row, double xyzSect[3])
Bool_t GetCorrectionMapMode() const
Float_t GetCurrentMapScaling() const
Bool_t fCorrMapMode
! correction or distortion map mode
static int SectorDown(int idROC)
Bool_t UpdateTimeDependentCache()
AliTPCChebCorr * fCorrMapCache0
! current correction map0 (for 1st time bin if time-dependent)
#define TObjArray
void EvalCorrectionMap(int roc, int row, const double xyz[3], float *res, Bool_t ref=kFALSE)
Double_t fVDCorrectionTimeGY
! VD correction due to pressure gradient
Implementation of the TPC transformation class.
void SetPrimVertex(Double_t *vtx)
TFile f("CalibObjects.root")
void ApplyTransformations(Double_t *xyz, Int_t volID)
time_t fCurrentTimeStamp
! current time stamp
TTreeSRedirector * pcstream
Double_t fTime0CorrTime
! time0 offset correction (in cm)
const AliTPCRecoParam * GetCurrentRecoParam() const
virtual void Transform(Double_t *x, Int_t *i, UInt_t time, Int_t coordinateType)
void GetCosAndSin(Int_t sector, Double_t &cos, Double_t &sin) const
Float_t fLastCorrRef[4]
!<! last correction from the map, 4th param is dispersion
void ErrY2Z2Syst(const AliTPCclusterMI *cl, const double tgPhi, const double tgLam, double &serry2, double &serrz2)
void SetCurrentRun(Int_t run)
void Global2RotatedGlobal(Int_t sector, Double_t *x) const
const Float_t * GetLastMapCorrectionRef() const
void ApplyDistortionMap(int roc, double xyzLab[3])
virtual ~AliTPCTransform()
void EvalDistortionMap(int roc, const double xyzSector[3], float *res, Bool_t ref=kFALSE)
void SetCurrentMapFluctStrenght(float s=0.f)
AliTPCChebCorr * GetCorrMapCacheRef() const
static void RotateToSectorDown(float *x, int &idROC)
AliTPCRecoParam * GetCurrentRecoParamNonConst() const
void SetCurrentTimeStamp(time_t timeStamp)
AliTPCTransform & operator=(const AliTPCTransform &)
time_t GetCurrentTimeStamp() const
Implementation of the TPC cluser.
Float_t GetCorrMapComponent(int roc, int row, const double xyz[3], int dimOut)
AliTPCRecoParam * fCurrentRecoParam
! current reconstruction parameters
Double_t fTBinOffset
! offset of time bin (e.g. tbin for 0 drift)
void LoadCorrectionMapsForTimeBin(TObjArray *mapsArrProvided=0)
Double_t TimeBin2Z(double t, int sector, double yLab) const
Float_t GetCurrentMapFluctStrenght() const
Double_t fDeltaZCorrTime
! global Z correction
static int SectorUp(int idROC)
Double_t fVDCorrectionTime
! global time-dependent VD correction
Int_t fCurrentRun
! current run
AliTPCChebCorr * GetCorrMapCache1() const
UInt_t GetCurrentRunNumber() const
Double_t fDriftCorrPT
! correction for relative P/T change
Double_t Z2TimeBin(double t, int sector, double yLab) const
const Float_t * GetLastMapCorrection() const
AliTPCChebCorr * fCorrMapCacheRef
! reference (low-IR) correction map
AliTPCChebCorr * fCorrMapCache1
! current correction map1 (for 2nd time bin if time-dependent)
TTreeSRedirector * GetDebugStreemer() const
static TObjArray * LoadCorrectionMaps(Bool_t refMap, Bool_t corrMode=kTRUE)
Float_t fCurrentMapScaling
! scaling factor for current correction map
time_t fLastTimeStampVDCorrVaria
! for orhter VDrift corrections
Double_t fSins[18]
cache the transformation
void SetCorrectionMapMode(Bool_t v=kTRUE)
static double GetMaxY2X()
TGraph * fLumiGraphRun
! graph for current run luminosity, owned by the class
void SetDebugStreamer(TTreeSRedirector *pcstream)
Double_t ErrZ2Syst(const AliTPCclusterMI *cl, const double tgAngLam)
Float_t fCurrentMapFluctStrenght
! fluctuation strenght for current event
Float_t fCorrMapLumiCOG
! COG of lumi for current time bin
Double_t fPrimVtx[3]
position of the primary vertex - needed for TOF correction
Class with TPC reconstruction parameters.
void SetCurrentRecoParam(AliTPCRecoParam *param)
void RotatedGlobal2Global(Int_t sector, Double_t *x) const
AliTPCChebCorr * GetCorrMapCache0() const
static void RotateToSectorUp(float *x, int &idROC)
TGraph * fLumiGraphMap
! graph for current map luminosity (may be different from current run), owned by the class ...
time_t fLastTimeStampCorrMap
! for corr.map. update
static AliTPCChebCorr * LoadFieldDependendStaticCorrectionMap(Bool_t ref, Bool_t corrMode=kTRUE, TObjArray *mapsArrProvided=0)
time_t fLastTimeStampVDCorrPT
! for VDrift PT update
Double_t fCoss[18]
!<! last reference correction from the map, 4th param is dispersion
Double_t ErrY2Syst(const AliTPCclusterMI *cl, const double tgAngPhi)
Float_t fLastCorr[4]
void Local2RotatedGlobal(Int_t sec, Double_t *x) const
Bool_t fTimeDependentUpdated
! flag successful update of time dependent stuff