Line data Source code
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 :
8 : /// \class AliTPCTransform
9 : /// \brief Class for tranformation of the coordinate frame
10 : ///
11 : /// Transformation
12 : /// local coordinate frame (sector, padrow, pad, timebine) ==>
13 : /// rotated global (tracking) cooridnate frame (sector, lx,ly,lz)
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 :
23 : class AliTPCTransform:public AliTransform {
24 : public:
25 : AliTPCTransform();
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 SetPrimVertex(Double_t *vtx);
32 : void Local2RotatedGlobal(Int_t sec, Double_t *x) const;
33 : void RotatedGlobal2Global(Int_t sector,Double_t *x) const;
34 : void Global2RotatedGlobal(Int_t sector,Double_t *x) const;
35 : void GetCosAndSin(Int_t sector,Double_t &cos,Double_t &sin) const;
36 9720 : time_t GetCurrentTimeStamp() const { return fCurrentTimeStamp;}
37 140712 : const AliTPCRecoParam * GetCurrentRecoParam() const {return fCurrentRecoParam;}
38 0 : AliTPCRecoParam * GetCurrentRecoParamNonConst() const {return fCurrentRecoParam;}
39 9728 : UInt_t GetCurrentRunNumber() const { return fCurrentRun;}
40 0 : AliTPCChebCorr* GetCorrMapCacheRef() const {return fCorrMapCacheRef;}
41 0 : AliTPCChebCorr* GetCorrMapCache0() const {return fCorrMapCache0;}
42 0 : AliTPCChebCorr* GetCorrMapCache1() const {return fCorrMapCache1;}
43 : //
44 : static TObjArray* LoadCorrectionMaps(Bool_t refMap=kFALSE);
45 : static AliTPCChebCorr* LoadFieldDependendStaticCorrectionMap(Bool_t ref,TObjArray* mapsArrProvided=0);
46 : Double_t ErrY2Syst(const AliTPCclusterMI * cl, const double tgAngPhi);
47 : Double_t ErrZ2Syst(const AliTPCclusterMI * cl, const double tgAngLam);
48 : void ErrY2Z2Syst(const AliTPCclusterMI * cl, const double tgPhi, const double tgLam,double &serry2, double &serrz2);
49 :
50 : void LoadCorrectionMapsForTimeBin(TObjArray* mapsArrProvided=0);
51 : // set current values
52 : //
53 58 : void SetCurrentRecoParam(AliTPCRecoParam* param){fCurrentRecoParam=param;}
54 46 : void SetCurrentRun(Int_t run){fCurrentRun=run;}
55 : void SetCurrentTimeStamp(time_t timeStamp);
56 : void ApplyTransformations(Double_t *xyz, Int_t volID);
57 : //
58 : // new correction maps
59 : Bool_t UpdateTimeDependentCache();
60 : void ApplyCorrectionMap(int roc, int row, double xyzSect[3]);
61 : void ApplyDistortionMap(int roc, double xyzLab[3]);
62 : void EvalCorrectionMap(int roc, int row, const double xyz[3], float *res, Bool_t ref=kFALSE);
63 : Float_t EvalCorrectionMap(int roc, int row, const double xyz[3], int dimOut, Bool_t ref=kFALSE);
64 : Float_t GetCorrMapComponent(int roc, int row, const double xyz[3], int dimOut);
65 : void EvalDistortionMap(int roc, const double xyzSector[3], float res[3]);
66 129896 : const Float_t* GetLastMapCorrection() const {return fLastCorr;}
67 129896 : const Float_t* GetLastMapCorrectionRef() const {return fLastCorrRef;}
68 0 : Float_t GetCurrentMapScaling() const {return fCurrentMapScaling;}
69 : //
70 : static void RotateToSectorUp(float *x, int& idROC);
71 : static void RotateToSectorDown(float *x, int& idROC);
72 : static void RotateToSectorUp(double *x, int& idROC);
73 : static void RotateToSectorDown(double *x, int& idROC);
74 : static int SectorUp(int idROC);
75 : static int SectorDown(int idROC);
76 129896 : static double GetMaxY2X() {return fgkMaxY2X;}
77 0 : void SetDebugStreamer(TTreeSRedirector * pcstream){fDebugStreamer=pcstream;}
78 0 : TTreeSRedirector *GetDebugStreemer() const { return fDebugStreamer;} //!debug streamer
79 :
80 : //
81 : private:
82 : AliTPCTransform& operator=(const AliTPCTransform&); // not implemented
83 : Float_t fLastCorr[4]; ///!<! last correction from the map, 4th param is dispersion
84 : Float_t fLastCorrRef[4]; ///!<! last reference correction from the map, 4th param is dispersion
85 : Double_t fCoss[18]; ///< cache the transformation
86 : Double_t fSins[18]; ///< cache the transformation
87 : Double_t fPrimVtx[3];///< position of the primary vertex - needed for TOF correction
88 : AliTPCRecoParam * fCurrentRecoParam; //!<! current reconstruction parameters
89 : AliTPCChebCorr* fCorrMapCacheRef; //!<! reference (low-IR) correction map
90 : AliTPCChebCorr* fCorrMapCache0; //!<! current correction map0 (for 1st time bin if time-dependent)
91 : AliTPCChebCorr* fCorrMapCache1; //!<! current correction map1 (for 2nd time bin if time-dependent)
92 : Float_t fCurrentMapScaling; //!<! scaling factor for current correction map
93 : Float_t fCorrMapLumiCOG; //!<! COG of lumi for current time bin
94 : TGraph* fLumiGraphRun; //!<! graph for current run luminosity, owned by the class
95 : TGraph* fLumiGraphMap; //!<! graph for current map luminosity (may be different from current run), owned by the class
96 : Int_t fCurrentRun; //!<! current run
97 : time_t fCurrentTimeStamp; //!<! current time stamp
98 : Bool_t fTimeDependentUpdated; //!<! flag successful update of time dependent stuff
99 : /// \cond CLASSIMP
100 : static const Double_t fgkSin20; // sin(20)
101 : static const Double_t fgkCos20; // sin(20)
102 : static const Double_t fgkMaxY2X; // tg(10)
103 : TTreeSRedirector *fDebugStreamer; //!debug streamer
104 : //
105 24 : ClassDef(AliTPCTransform,4)
106 : /// \endcond
107 : };
108 :
109 : //_________________________________________________
110 : inline void AliTPCTransform::RotateToSectorUp(float *x, int& idROC)
111 : {
112 : // rotate point in sector coordinates to sector+1
113 0 : idROC += ((idROC%18)==17) ? -17 : 1;
114 0 : float tmp = x[0];
115 0 : x[0] = fgkCos20*tmp - fgkSin20*x[1];
116 0 : x[1] = fgkSin20*tmp + fgkCos20*x[1];
117 0 : }
118 :
119 : //_________________________________________________
120 : inline void AliTPCTransform::RotateToSectorDown(float *x, int& idROC)
121 : {
122 : // rotate point in sector coordinates to sector-1
123 0 : idROC += ((idROC%18)== 0) ? 17 : -1; // change to the lower sector
124 0 : float tmp = x[0];
125 0 : x[0] = fgkCos20*tmp + fgkSin20*x[1];
126 0 : x[1] =-fgkSin20*tmp + fgkCos20*x[1];
127 0 : }
128 :
129 : //_________________________________________________
130 : inline void AliTPCTransform::RotateToSectorUp(double *x, int& idROC)
131 : {
132 : // rotate point in sector coordinates to sector+1
133 0 : idROC += ((idROC%18)==17) ? -17 : 1;
134 0 : double tmp = x[0];
135 0 : x[0] = fgkCos20*tmp - fgkSin20*x[1];
136 0 : x[1] = fgkSin20*tmp + fgkCos20*x[1];
137 0 : }
138 :
139 : //_________________________________________________
140 : inline void AliTPCTransform::RotateToSectorDown(double *x, int& idROC)
141 : {
142 : // rotate point in sector coordinates to sector-1
143 0 : idROC += ((idROC%18)== 0) ? 17 : -1; // change to the lower sector
144 0 : double tmp = x[0];
145 0 : x[0] = fgkCos20*tmp + fgkSin20*x[1];
146 0 : x[1] =-fgkSin20*tmp + fgkCos20*x[1];
147 0 : }
148 :
149 : //_________________________________________________
150 : inline int AliTPCTransform::SectorUp(int idROC)
151 : {
152 : // sector+1
153 0 : return idROC + (((idROC%18)==17) ? -17 : 1);
154 : }
155 :
156 : //_________________________________________________
157 : inline int AliTPCTransform::SectorDown(int idROC)
158 : {
159 : // sector-1
160 0 : return idROC + (((idROC%18)== 0) ? 17 : -1); // change to the lower sector
161 : }
162 :
163 :
164 : #endif
|