]> git.uio.no Git - u/mrichter/AliRoot.git/blob - STEER/AliESDtrack.h
Bug fix in AliESDtrack::PropagateTo and moving it to AliTracker::PropagateTrackTo
[u/mrichter/AliRoot.git] / STEER / AliESDtrack.h
1
2 #ifndef ALIESDTRACK_H
3 #define ALIESDTRACK_H
4 /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
5  * See cxx source for full Copyright notice                               */
6
7 /* $Id$ */
8
9 //-------------------------------------------------------------------------
10 //                          Class AliESDtrack
11 //   This is the class to deal with during the physics analysis of data
12 //      
13 //         Origin: Iouri Belikov, CERN, Jouri.Belikov@cern.ch 
14 //-------------------------------------------------------------------------
15 /*****************************************************************************
16  *  Use GetExternalParameters() and GetExternalCovariance() to access the    *
17  *      track information regardless of its internal representation.         *
18  * This formation is now fixed in the following way:                         *
19  *      external param0:   local Y-coordinate of a track (cm)                *
20  *      external param1:   local Z-coordinate of a track (cm)                *
21  *      external param2:   local sine of the track momentum azimuthal angle  *
22  *      external param3:   tangent of the track momentum dip angle           *
23  *      external param4:   1/pt (1/(GeV/c))                                  *
24  *****************************************************************************/
25
26 #include <TBits.h>
27 #include "AliExternalTrackParam.h"
28 #include "AliPID.h"
29 #include "AliESDfriendTrack.h"
30
31 class TParticle;
32 class AliESDVertex;
33 class AliKalmanTrack;
34 class AliTrackPointArray;
35
36 class AliESDtrack : public AliExternalTrackParam {
37 public:
38   AliESDtrack();
39   AliESDtrack(const AliESDtrack& track);
40   AliESDtrack(TParticle * part);
41   virtual ~AliESDtrack();
42   const AliESDfriendTrack *GetFriendTrack() const {return fFriendTrack;}
43   void SetFriendTrack(const AliESDfriendTrack *t) {
44     delete fFriendTrack; fFriendTrack=new AliESDfriendTrack(*t);
45     // CKB
46   }
47   void AddCalibObject(TObject * object);     // add calib object to the list
48   TObject *  GetCalibObject(Int_t index);    // return calib objct at given position
49   void MakeMiniESDtrack();
50   void SetID(Int_t id) { fID =id;}
51   Int_t GetID() const { return fID;}
52   void SetStatus(ULong_t flags) {fFlags|=flags;}
53   void ResetStatus(ULong_t flags) {fFlags&=~flags;}
54   Bool_t UpdateTrackParams(const AliKalmanTrack *t, ULong_t flags);
55   void SetIntegratedLength(Double_t l) {fTrackLength=l;}
56   void SetIntegratedTimes(const Double_t *times);
57   void SetESDpid(const Double_t *p);
58   void GetESDpid(Double_t *p) const;
59   
60   Bool_t IsOn(Int_t mask) const {return (fFlags&mask)>0;}
61   ULong_t GetStatus() const {return fFlags;}
62   Int_t GetLabel() const {return fLabel;}
63   void SetLabel(Int_t label) {fLabel = label;}
64
65   void GetExternalParameters(Double_t &x, Double_t p[5]) const;
66   void GetExternalCovariance(Double_t cov[15]) const;
67
68   Double_t GetIntegratedLength() const {return fTrackLength;}
69   void GetIntegratedTimes(Double_t *times) const;
70   Double_t GetMass() const;
71
72   Bool_t GetConstrainedPxPyPz(Double_t *p) const {
73     if (!fCp) return kFALSE;
74     return fCp->GetPxPyPz(p);
75   }
76   Bool_t GetConstrainedXYZ(Double_t *r) const {
77     if (!fCp) return kFALSE;
78     return fCp->GetXYZ(r);
79   }
80   const AliExternalTrackParam *GetConstrainedParam() const {return fCp;}
81   Bool_t GetConstrainedExternalParameters
82               (Double_t &alpha, Double_t &x, Double_t p[5]) const;
83   Bool_t GetConstrainedExternalCovariance(Double_t cov[15]) const;
84   Double_t GetConstrainedChi2() const {return fCchi2;}
85   //
86     
87
88
89   Bool_t GetInnerPxPyPz(Double_t *p) const {
90     if (!fIp) return kFALSE;
91     return fIp->GetPxPyPz(p);
92   }
93   const AliExternalTrackParam * GetInnerParam() const { return fIp;}
94   const AliExternalTrackParam * GetTPCInnerParam() const {return fTPCInner;}
95   Bool_t GetInnerXYZ(Double_t *r) const {
96     if (!fIp) return kFALSE;
97     return fIp->GetXYZ(r);
98   }
99   Bool_t GetInnerExternalParameters
100         (Double_t &alpha, Double_t &x, Double_t p[5]) const;
101   Bool_t GetInnerExternalCovariance(Double_t cov[15]) const;
102  
103   const AliExternalTrackParam * GetOuterParam() const { return fOp;}
104   Bool_t GetOuterPxPyPz(Double_t *p) const {
105     if (!fOp) return kFALSE;
106     return fOp->GetPxPyPz(p);
107   }
108   Bool_t GetOuterXYZ(Double_t *r) const {
109     if (!fOp) return kFALSE;
110     return fOp->GetXYZ(r);
111   }
112   Bool_t GetOuterExternalParameters
113         (Double_t &alpha, Double_t &x, Double_t p[5]) const;
114   Bool_t GetOuterExternalCovariance(Double_t cov[15]) const;
115
116
117   Int_t GetNcls(Int_t idet) const;
118   Int_t GetClusters(Int_t idet, Int_t *idx) const;
119  
120   void    SetITSpid(const Double_t *p);
121   void    GetITSpid(Double_t *p) const;
122   Float_t GetITSsignal() const {return fITSsignal;}
123   Float_t GetITSchi2() const {return fITSchi2;}
124   Int_t   GetITSclusters(Int_t *idx) const;
125   UChar_t GetITSClusterMap() const {return fITSClusterMap;}
126   Int_t   GetITSLabel() const {return fITSLabel;}
127   void    SetITStrack(AliKalmanTrack * track){
128      fFriendTrack->SetITStrack(track);
129   }
130   AliKalmanTrack *GetITStrack(){
131      return fFriendTrack->GetITStrack();
132   }
133
134   void    SetTPCpid(const Double_t *p);
135   void    GetTPCpid(Double_t *p) const;
136   void    SetTPCPoints(Float_t points[4]){
137      for (Int_t i=0;i<4;i++) fTPCPoints[i]=points[i];
138   }
139   void    SetTPCPointsF(UChar_t  findable){fTPCnclsF = findable;}
140   Int_t   GetTPCNcls() const { return fTPCncls;}
141   Int_t   GetTPCNclsF() const { return fTPCnclsF;}
142   Float_t GetTPCPoints(Int_t i) const {return fTPCPoints[i];}
143   void    SetKinkIndexes(Int_t points[3]) {
144      for (Int_t i=0;i<3;i++) fKinkIndexes[i] = points[i];
145   }
146   void    SetV0Indexes(Int_t points[3]) {
147      for (Int_t i=0;i<3;i++) fV0Indexes[i] = points[i];
148   }
149   void    SetTPCsignal(Float_t signal, Float_t sigma, UChar_t npoints){ 
150      fTPCsignal = signal; fTPCsignalS = sigma; fTPCsignalN = npoints;
151   }
152   Float_t GetTPCsignal() const {return fTPCsignal;}
153   Float_t GetTPCsignalSigma() const {return fTPCsignalS;}
154   UShort_t GetTPCsignalN() const {return fTPCsignalN;}
155   Float_t GetTPCchi2() const {return fTPCchi2;}
156   Int_t   GetTPCclusters(Int_t *idx) const;
157   Float_t GetTPCdensity(Int_t row0, Int_t row1) const;
158   Int_t   GetTPCLabel() const {return fTPCLabel;}
159   Int_t   GetKinkIndex(Int_t i) const { return fKinkIndexes[i];}
160   Int_t   GetV0Index(Int_t i) const { return fV0Indexes[i];}
161   const TBits& GetTPCClusterMap() const {return fTPCClusterMap;}
162   const TBits& GetTPCSharedMap() const {return fTPCSharedMap;}
163   void    SetTPCClusterMap(const TBits amap) {fTPCClusterMap = amap;}
164   void    SetTPCSharedMap(const TBits amap) {fTPCSharedMap = amap;}
165   void    SetTRDpid(const Double_t *p);
166   
167 // A.Bercuci
168   void    SetTRDpidQuality(UChar_t q){fTRDpidQuality = q;}
169   UChar_t GetTRDpidQuality() const {return fTRDpidQuality;}
170 // end A.Bercuci
171         
172         void    SetTRDQuality(Float_t quality){fTRDQuality=quality;}
173   Float_t GetTRDQuality()const {return fTRDQuality;}
174   void    SetTRDBudget(Float_t budget){fTRDBudget=budget;}
175   Float_t GetTRDBudget()const {return fTRDBudget;}
176   void    SetTRDsignals(Float_t dedx, Int_t i, Int_t j) {fTRDsignals[i][j]=dedx;}
177   void    SetTRDTimBin(Int_t timbin, Int_t i) {fTRDTimBin[i]=timbin;}
178   void    GetTRDpid(Double_t *p) const;
179   Float_t GetTRDsignal() const {return fTRDsignal;}
180   Float_t GetTRDsignals(Int_t iPlane, Int_t iSlice=-1) const { if (iSlice == -1) 
181     return (fTRDsignals[iPlane][0] + fTRDsignals[iPlane][1] + fTRDsignals[iPlane][2])/3.0;
182     return fTRDsignals[iPlane][iSlice];
183   }
184   Int_t   GetTRDTimBin(Int_t i) const {return fTRDTimBin[i];}
185   Float_t GetTRDchi2() const {return fTRDchi2;}
186   Int_t   GetTRDclusters(Int_t *idx) const;
187   Int_t   GetTRDncls() const {return fTRDncls;}
188   void    SetTRDpid(Int_t iSpecies, Float_t p);
189   Float_t GetTRDpid(Int_t iSpecies) const;
190   Int_t   GetTRDLabel() const {return fTRDLabel;}
191
192   void    SetTRDtrack(AliKalmanTrack * track){
193      fFriendTrack->SetTRDtrack(track);
194   }
195   AliKalmanTrack *GetTRDtrack(){
196      return fFriendTrack->GetTRDtrack();
197   }
198
199   void    SetTOFsignal(Double_t tof) {fTOFsignal=tof;}
200   Float_t GetTOFsignal() const {return fTOFsignal;}
201   void    SetTOFsignalToT(Double_t ToT) {fTOFsignalToT=ToT;}
202   Float_t GetTOFsignalToT() const {return fTOFsignalToT;}
203   void    SetTOFsignalRaw(Double_t tof) {fTOFsignalRaw=tof;}
204   Float_t GetTOFsignalRaw() const {return fTOFsignalRaw;}
205   void    SetTOFsignalDz(Double_t dz) {fTOFsignalDz=dz;}
206   Float_t GetTOFsignalDz() const {return fTOFsignalDz;}
207   Float_t GetTOFchi2() const {return fTOFchi2;}
208   void    SetTOFpid(const Double_t *p);
209   void    SetTOFLabel(const Int_t *p);
210   void    GetTOFpid(Double_t *p) const;
211   void    GetTOFLabel(Int_t *p) const;
212   void    GetTOFInfo(Float_t *info) const;
213   void    SetTOFInfo(Float_t *info);
214   Int_t   GetTOFCalChannel() const {return fTOFCalChannel;}
215   Int_t   GetTOFcluster() const {return fTOFindex;}
216   void    SetTOFcluster(Int_t index) {fTOFindex=index;}
217   void    SetTOFCalChannel(Int_t index) {fTOFCalChannel=index;}
218
219 // HMPID methodes +++++++++++++++++++++++++++++++++ (kir)
220   void    SetHMPIDsignal(Double_t theta) {fHMPIDsignal=theta;}
221   Float_t GetHMPIDsignal() const {return fHMPIDsignal;}
222   void    SetHMPIDpid(const Double_t *p);
223   void    GetHMPIDpid(Double_t *p) const;  
224   void    SetHMPIDchi2(Double_t chi2) {fHMPIDchi2=chi2;}
225   Float_t GetHMPIDchi2() const {return fHMPIDchi2;}
226   void    SetHMPIDcluster(Int_t index) {fHMPIDcluIdx=index;}
227   Int_t   GetHMPIDcluster() const {return fHMPIDcluIdx;}
228   void    SetHMPIDcluIdx(Int_t ch,Int_t idx) {fHMPIDcluIdx=ch*1000000+idx;}
229   Int_t   GetHMPIDcluIdx() const {return fHMPIDcluIdx;}
230   void    SetHMPIDtrk(Float_t  x, Float_t  y, Float_t  th, Float_t  ph) {
231      fHMPIDtrkX=x; fHMPIDtrkY=y; fHMPIDtrkTheta=th; fHMPIDtrkPhi=ph;
232   }
233   void    GetHMPIDtrk(Float_t &x, Float_t &y, Float_t &th, Float_t &ph) const {
234      x=fHMPIDtrkX; y=fHMPIDtrkY; th=fHMPIDtrkTheta; ph=fHMPIDtrkPhi;
235   }
236   void    SetHMPIDmip(Float_t  x, Float_t  y, Int_t q, Int_t nph=0) {
237      fHMPIDmipX=x; fHMPIDmipY=y; fHMPIDqn=1000000*q+nph;
238   }
239   void    GetHMPIDmip(Float_t &x,Float_t &y,Int_t &q,Int_t &nph) const {
240      x=fHMPIDmipX; y=fHMPIDmipY; q=fHMPIDqn/1000000; nph=fHMPIDqn%1000000;
241   }
242   Bool_t  IsHMPID() const {return fFlags&kHMPIDpid;}
243
244
245   Int_t GetEMCALcluster() {return fEMCALindex;}
246   void SetEMCALcluster(Int_t index) {fEMCALindex=index;}
247   Bool_t IsEMCAL() const {return fFlags&kEMCALmatch;}
248
249   void SetTrackPointArray(AliTrackPointArray *points) {
250     fFriendTrack->SetTrackPointArray(points);
251   }
252   const AliTrackPointArray *GetTrackPointArray() const {
253     return fFriendTrack->GetTrackPointArray(); 
254   }
255   Bool_t RelateToVertex(const AliESDVertex *vtx, Double_t b, Double_t maxd);
256   void GetImpactParameters(Float_t &xy,Float_t &z) const {xy=fD; z=fZ;}
257   void GetImpactParameters(Float_t p[2], Float_t cov[3]) const {
258     p[0]=fD; p[1]=fZ; cov[0]=fCdd; cov[1]=fCdz; cov[2]=fCzz;
259   }
260   virtual void Print(Option_t * opt) const ; 
261
262   enum {
263     kITSin=0x0001,kITSout=0x0002,kITSrefit=0x0004,kITSpid=0x0008,
264     kTPCin=0x0010,kTPCout=0x0020,kTPCrefit=0x0040,kTPCpid=0x0080,
265     kTRDin=0x0100,kTRDout=0x0200,kTRDrefit=0x0400,kTRDpid=0x0800,
266     kTOFin=0x1000,kTOFout=0x2000,kTOFrefit=0x4000,kTOFpid=0x8000,
267     kHMPIDpid=0x20000,
268     kEMCALmatch=0x40000,
269     kTRDbackup=0x80000,
270     kTRDStop=0x20000000,
271     kESDpid=0x40000000,
272     kTIME=0x80000000
273   }; 
274   enum {
275     kNPlane = 6,
276     kNSlice = 3,
277     kEMCALNoMatch = -999999999
278   };
279 protected:
280   
281
282   ULong_t   fFlags;         // Reconstruction status flags 
283   Int_t     fLabel;         // Track label
284   Int_t     fID;            // Unique ID of the track
285   Float_t   fTrackLength;   // Track length
286   Float_t   fD;             // Impact parameter in XY plane
287   Float_t   fZ;             // Impact parameter in Z
288   Float_t   fCdd,fCdz,fCzz; // Covariance matrix of the impact parameters 
289   Float_t   fTrackTime[AliPID::kSPECIES]; // TOFs estimated by the tracking
290   Float_t   fR[AliPID::kSPECIES]; // combined "detector response probability"
291
292   Int_t   fStopVertex;  // Index of the stop vertex
293
294   AliExternalTrackParam *fCp; // Track parameters constrained to the primary vertex
295   Double32_t fCchi2; // chi2 at the primary vertex
296
297
298   AliExternalTrackParam *fIp; // Track parameters at the first measured point (TPC)
299   AliExternalTrackParam *fTPCInner; // Track parameters at the first measured point (TPC) - first itteration
300
301
302   AliExternalTrackParam *fOp; // Track parameters at the last measured point (TPC or TRD) 
303
304   // ITS related track information
305   Float_t fITSchi2;        // chi2 in the ITS
306   Int_t   fITSncls;        // number of clusters assigned in the ITS
307   UChar_t fITSClusterMap;  // map of clusters, one bit per a layer 
308   Float_t fITSsignal;      // detector's PID signal
309   Float_t fITSr[AliPID::kSPECIES]; // "detector response probabilities" (for the PID)
310   Int_t   fITSLabel;       // label according TPC
311
312   // TPC related track information
313   Float_t  fTPCchi2;       // chi2 in the TPC
314   Int_t    fTPCncls;       // number of clusters assigned in the TPC
315   UShort_t fTPCnclsF;      // number of findable clusters in the TPC
316   TBits    fTPCClusterMap; // Map of clusters, one bit per padrow; 1 if has a cluster on given padrow
317   TBits    fTPCSharedMap;  // Map of clusters, one bit per padrow; 1 if has a shared cluster on given padrow
318   Float_t  fTPCsignal;     // detector's PID signal
319   UShort_t fTPCsignalN;    // number of points used for dEdx
320   Float_t  fTPCsignalS;    // RMS of dEdx measurement
321   Float_t  fTPCr[AliPID::kSPECIES]; // "detector response probabilities" (for the PID)
322   Int_t    fTPCLabel;      // label according TPC
323   Float_t  fTPCPoints[4];  // TPC points -first, max. dens, last and max density
324   Int_t    fKinkIndexes[3];// array of indexes of posible kink candidates 
325   Int_t    fV0Indexes[3];  // array of indexes of posible kink candidates 
326
327   // TRD related track information
328   Float_t fTRDchi2;        // chi2 in the TRD
329   UChar_t fTRDncls;        // number of clusters assigned in the TRD
330   UChar_t fTRDncls0;       // number of clusters assigned in the TRD before first material cross
331   Float_t fTRDsignal;      // detector's PID signal
332   Float_t fTRDsignals[kNPlane][kNSlice];  // TRD signals from all six planes in 3 slices each
333   Int_t   fTRDTimBin[kNPlane];   // Time bin of Max cluster from all six planes
334   Float_t fTRDr[AliPID::kSPECIES]; // "detector response probabilities" (for the PID)
335         // A.Bercuci
336         UChar_t fTRDpidQuality;   // TRD PID quality according to number of planes. 6 is the best
337   Int_t   fTRDLabel;       // label according TRD
338   Float_t fTRDQuality;     // trd quality factor for TOF
339   Float_t fTRDBudget;      // trd material budget
340
341
342   // TOF related track information
343   Float_t fTOFchi2;        // chi2 in the TOF
344   Int_t   fTOFindex;       // index of the assigned TOF cluster
345   Int_t   fTOFCalChannel;  // Channel Index of the TOF Signal 
346   Float_t fTOFsignal;      // detector's PID signal
347   Float_t fTOFsignalToT;   // detector's ToT signal
348   Float_t fTOFsignalRaw;   // detector's uncorrected time signal
349   Float_t fTOFsignalDz;    // local z  of track's impact on the TOF pad 
350   Float_t fTOFr[AliPID::kSPECIES]; // "detector response probabilities" (for the PID)
351   Int_t   fTOFLabel[3];    // TOF label 
352   Float_t fTOFInfo[10];    //! TOF informations
353
354   // HMPID related track information                 (kir)
355   Float_t fHMPIDchi2;       // chi2 in the HMPID
356   Int_t   fHMPIDqn;         // 1000000*QDC + number of photon clusters
357   Int_t   fHMPIDcluIdx;     // 1000000*chamber id + cluster idx of the assigned MIP cluster
358   Float_t fHMPIDsignal;     // HMPID PID signal (Theta ckov, rad)
359   Float_t fHMPIDr[AliPID::kSPECIES];// "detector response probabilities" (for the PID)
360   Float_t fHMPIDtrkTheta;   // theta of the track extrapolated to the HMPID, LORS
361   Float_t fHMPIDtrkPhi;     // phi of the track extrapolated to the HMPID, LORS
362   Float_t fHMPIDtrkX;       // x of the track impact, LORS 
363   Float_t fHMPIDtrkY;       // y of the track impact, LORS 
364   Float_t fHMPIDmipX;       // x of the MIP in LORS
365   Float_t fHMPIDmipY;       // y of the MIP in LORS
366   
367   // EMCAL related track information
368   Int_t fEMCALindex;   // index of associated EMCAL cluster (AliESDCaloCluster)
369
370   AliESDfriendTrack *fFriendTrack; //! All the complementary information
371
372  private:
373
374   AliESDtrack & operator=(const AliESDtrack & ) {return *this;}
375
376   ClassDef(AliESDtrack,39)  //ESDtrack 
377 };
378
379 #endif 
380