]> git.uio.no Git - u/mrichter/AliRoot.git/blob - STEER/AliESDtrack.h
Introducing the possibility to refit an ESD track to an arbitrary ESD vertex (Yu...
[u/mrichter/AliRoot.git] / STEER / AliESDtrack.h
1 #ifndef ALIESDTRACK_H
2 #define ALIESDTRACK_H
3 /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4  * See cxx source for full Copyright notice                               */
5
6 /* $Id$ */
7
8 //-------------------------------------------------------------------------
9 //                          Class AliESDtrack
10 //   This is the class to deal with during the physics analysis of data
11 //      
12 //         Origin: Iouri Belikov, CERN, Jouri.Belikov@cern.ch 
13 //-------------------------------------------------------------------------
14 /*****************************************************************************
15  *  Use GetExternalParameters() and GetExternalCovariance() to access the    *
16  *      track information regardless of its internal representation.         *
17  * This formation is now fixed in the following way:                         *
18  *      external param0:   local Y-coordinate of a track (cm)                *
19  *      external param1:   local Z-coordinate of a track (cm)                *
20  *      external param2:   local sine of the track momentum azimuthal angle  *
21  *      external param3:   tangent of the track momentum dip angle           *
22  *      external param4:   1/pt (1/(GeV/c))                                  *
23  *****************************************************************************/
24
25 #include <TBits.h>
26 #include "AliExternalTrackParam.h"
27 #include "AliPID.h"
28 #include <TVector3.h>
29
30 class AliESDVertex;
31 class AliKalmanTrack;
32 class AliTrackPointArray;
33
34 const Int_t kNPlane = 6;
35
36 class AliESDtrack : public AliExternalTrackParam {
37 public:
38   AliESDtrack();
39   AliESDtrack(const AliESDtrack& track);
40   virtual ~AliESDtrack();
41   void MakeMiniESDtrack();
42   void SetID(Int_t id) { fID =id;}
43   Int_t GetID(){ return fID;}
44   void SetStatus(ULong_t flags) {fFlags|=flags;}
45   void ResetStatus(ULong_t flags) {fFlags&=~flags;}
46   Bool_t UpdateTrackParams(const AliKalmanTrack *t, ULong_t flags);
47   void SetIntegratedLength(Double_t l) {fTrackLength=l;}
48   void SetIntegratedTimes(const Double_t *times);
49   void SetESDpid(const Double_t *p);
50   void GetESDpid(Double_t *p) const;
51   
52   ULong_t GetStatus() const {return fFlags;}
53   Int_t GetLabel() const {return fLabel;}
54   void SetLabel(Int_t label) {fLabel = label;}
55
56   void GetExternalParameters(Double_t &x, Double_t p[5]) const;
57   void GetExternalCovariance(Double_t cov[15]) const;
58
59   Double_t GetIntegratedLength() const {return fTrackLength;}
60   void GetIntegratedTimes(Double_t *times) const;
61   Double_t GetMass() const;
62   TVector3 P3() const {Double_t p[3]; GetPxPyPz(p); return TVector3(p[0],p[1],p[2]);} //running track momentum
63   TVector3 X3() const {Double_t x[3]; GetXYZ(x); return TVector3(x[0],x[1],x[2]);}    //running track position 
64
65
66   Bool_t GetConstrainedPxPyPz(Double_t *p) const {
67     if (!fCp) return kFALSE;
68     return fCp->GetPxPyPz(p);
69   }
70   Bool_t GetConstrainedXYZ(Double_t *r) const {
71     if (!fCp) return kFALSE;
72     return fCp->GetXYZ(r);
73   }
74   Bool_t GetConstrainedExternalParameters
75               (Double_t &alpha, Double_t &x, Double_t p[5]) const;
76   Bool_t GetConstrainedExternalCovariance(Double_t cov[15]) const;
77   Double_t GetConstrainedChi2() const {return fCchi2;}
78
79
80   Bool_t GetInnerPxPyPz(Double_t *p) const {
81     if (!fIp) return kFALSE;
82     return fIp->GetPxPyPz(p);
83   }
84   Bool_t GetInnerXYZ(Double_t *r) const {
85     if (!fIp) return kFALSE;
86     return fIp->GetXYZ(r);
87   }
88   Bool_t GetInnerExternalParameters
89         (Double_t &alpha, Double_t &x, Double_t p[5]) const;
90   Bool_t GetInnerExternalCovariance(Double_t cov[15]) const;
91  
92
93   Bool_t GetOuterPxPyPz(Double_t *p) const {
94     if (!fOp) return kFALSE;
95     return fOp->GetPxPyPz(p);
96   }
97   Bool_t GetOuterXYZ(Double_t *r) const {
98     if (!fOp) return kFALSE;
99     return fOp->GetXYZ(r);
100   }
101   Bool_t GetOuterExternalParameters
102         (Double_t &alpha, Double_t &x, Double_t p[5]) const;
103   Bool_t GetOuterExternalCovariance(Double_t cov[15]) const;
104
105
106   Int_t GetNcls(Int_t idet) const;
107   Int_t GetClusters(Int_t idet, UInt_t *idx) const;
108  
109   void SetITSpid(const Double_t *p);
110   void SetITSChi2MIP(const Float_t *chi2mip);
111   void SetITStrack(AliKalmanTrack * track){fITStrack=track;}
112   void GetITSpid(Double_t *p) const;
113   Float_t GetITSsignal() const {return fITSsignal;}
114   Float_t GetITSchi2() const {return fITSchi2;}
115   Int_t GetITSclusters(UInt_t *idx) const;
116   Int_t GetITSLabel() const {return fITSLabel;}
117   Float_t GetITSFakeRatio() const {return fITSFakeRatio;}
118   AliKalmanTrack * GetITStrack(){return fITStrack;}
119
120   void SetTPCpid(const Double_t *p);
121   void GetTPCpid(Double_t *p) const;
122   void SetTPCPoints(Float_t points[4]){for (Int_t i=0;i<4;i++) fTPCPoints[i]=points[i];}
123   Float_t GetTPCPoints(Int_t i){return fTPCPoints[i];}
124   void SetKinkIndexes(Int_t points[3]) {for (Int_t i=0;i<3;i++) fKinkIndexes[i] = points[i];}
125   void SetV0Indexes(Int_t points[3]) {for (Int_t i=0;i<3;i++) fV0Indexes[i] = points[i];}
126   Float_t GetTPCsignal() const {return fTPCsignal;}
127   Float_t GetTPCchi2() const {return fTPCchi2;}
128   Int_t GetTPCclusters(Int_t *idx) const;
129   Float_t GetTPCdensity(Int_t row0, Int_t row1) const;
130   Int_t GetTPCLabel() const {return fTPCLabel;}
131   Int_t GetKinkIndex(Int_t i) const { return fKinkIndexes[i];}
132   Int_t GetV0Index(Int_t i) const { return fV0Indexes[i];}
133   const TBits& GetTPCClusterMap() const {return fTPCClusterMap;}
134   
135   void SetTRDpid(const Double_t *p);
136   void     SetTRDQuality(Float_t quality){fTRDQuality=quality;}
137   Float_t  GetTRDQuality()const {return fTRDQuality;}
138   void     SetTRDBudget(Float_t budget){fTRDBudget=budget;}
139   Float_t  GetTRDBudget()const {return fTRDBudget;}
140   void SetTRDtrack(AliKalmanTrack * track){fTRDtrack=track;}
141   void SetTRDsignals(Float_t dedx, Int_t i) {fTRDsignals[i]=dedx;}
142   void SetTRDTimBin(Int_t timbin, Int_t i) {fTRDTimBin[i]=timbin;}
143   void GetTRDpid(Double_t *p) const;
144   Float_t GetTRDsignal() const {return fTRDsignal;}
145   Float_t GetTRDsignals(Int_t i) const {return fTRDsignals[i];}
146   Int_t GetTRDTimBin(Int_t i) const {return fTRDTimBin[i];}
147   Float_t GetTRDchi2() const {return fTRDchi2;}
148   Int_t GetTRDclusters(UInt_t *idx) const;
149   Int_t GetTRDncls() const {return fTRDncls;}
150   void    SetTRDpid(Int_t iSpecies, Float_t p);
151   Float_t GetTRDpid(Int_t iSpecies) const;
152   Int_t GetTRDLabel() const {return fTRDLabel;}
153
154
155   AliKalmanTrack * GetTRDtrack(){return fTRDtrack;}
156
157   void SetTOFsignal(Double_t tof) {fTOFsignal=tof;}
158   Float_t GetTOFsignal() const {return fTOFsignal;}
159   Float_t GetTOFchi2() const {return fTOFchi2;}
160   void    SetTOFpid(const Double_t *p);
161   void    SetTOFLabel(const Int_t *p);
162   void    GetTOFpid(Double_t *p) const;
163   void    GetTOFLabel(Int_t *p) const;
164   void    GetTOFInfo(Float_t *info) const;
165   void    SetTOFInfo(Float_t *info);
166   UInt_t  GetTOFcluster() const {return fTOFindex;}
167   void  SetTOFcluster(UInt_t index) {fTOFindex=index;}
168   
169   void    SetRICHsignal(Double_t beta) {fRICHsignal=beta;}
170   Float_t GetRICHsignal() const {return fRICHsignal;}
171   void    SetRICHpid(const Double_t *p);
172   void    GetRICHpid(Double_t *p) const;
173   void    SetRICHchi2(Double_t chi2) {fRICHchi2=chi2;}
174   Float_t GetRICHchi2() const {return fRICHchi2;}
175   void    SetRICHcluster(UInt_t index) {fRICHindex=index;}
176   UInt_t  GetRICHcluster() const {return fRICHindex;}
177   void    SetRICHnclusters(Int_t n) {fRICHncls=n;}
178   Int_t   GetRICHnclusters() const {return fRICHncls;}
179   void    SetRICHthetaPhi(Double_t theta, Double_t phi) {
180     fRICHtheta=theta; fRICHphi=phi;
181   }
182   void    GetRICHthetaPhi(Double_t &theta, Double_t &phi) const {
183     theta=fRICHtheta; phi=fRICHphi;
184   }
185   void    SetRICHdxdy(Double_t dx, Double_t dy) {
186     fRICHdx=dx; fRICHdy=dy;
187   }
188   void    GetRICHdxdy(Double_t &dx, Double_t &dy) const {
189     dx=fRICHdx; dy=fRICHdy;
190   }
191   
192   void SetPHOSposition(const Double_t *pos)  {
193     fPHOSpos[0] = pos[0]; fPHOSpos[1]=pos[1]; fPHOSpos[2]=pos[2];
194   }
195   void SetPHOSsignal(Double_t ene) {fPHOSsignal = ene; }
196   void SetPHOSpid(const Double_t *p);
197   void GetPHOSposition(Double_t *pos) const {
198     pos[0]=fPHOSpos[0]; pos[1]=fPHOSpos[1]; pos[2]=fPHOSpos[2];
199   }
200   Float_t GetPHOSsignal() const {return fPHOSsignal;}
201   void GetPHOSpid(Double_t *p) const;  
202
203   void SetEMCALposition(const Double_t *pos)  {
204     fEMCALpos[0] = pos[0]; fEMCALpos[1]=pos[1]; fEMCALpos[2]=pos[2];
205   }
206   void SetEMCALsignal(Double_t ene) {fEMCALsignal = ene; }
207   void SetEMCALpid(const Double_t *p);
208   void GetEMCALposition(Double_t *pos) const {
209     pos[0]=fEMCALpos[0]; pos[1]=fEMCALpos[1]; pos[2]=fEMCALpos[2];
210   }
211   Float_t GetEMCALsignal() const {return fEMCALsignal;}
212   void GetEMCALpid(Double_t *p) const;  
213
214   Bool_t IsOn(Int_t mask) const {return (fFlags&mask)>0;}
215   Bool_t IsRICH()  const {return fFlags&kRICHpid;}
216   Bool_t IsPHOS()  const {return fFlags&kPHOSpid;}
217   Bool_t IsEMCAL() const {return fFlags&kEMCALpid;}
218
219   void   SetTrackPointArray(AliTrackPointArray *points) { fPoints = points; }
220   AliTrackPointArray *GetTrackPointArray() const { return fPoints; }
221
222   Bool_t 
223     RelateToVertex(const AliESDVertex *vtx, Double_t b, Double_t maxd);
224   void GetImpactParameters(Float_t &xy,Float_t &z) const {xy=fD; z=fZ;}
225   void GetImpactParameters(Float_t p[2], Float_t cov[3]) const {
226     p[0]=fD; p[1]=fZ; cov[0]=fCdd; cov[1]=fCdz; cov[2]=fCzz;
227   }
228   virtual void Print(Option_t * opt) const ; 
229
230   enum {
231     kITSin=0x0001,kITSout=0x0002,kITSrefit=0x0004,kITSpid=0x0008,
232     kTPCin=0x0010,kTPCout=0x0020,kTPCrefit=0x0040,kTPCpid=0x0080,
233     kTRDin=0x0100,kTRDout=0x0200,kTRDrefit=0x0400,kTRDpid=0x0800,
234     kTOFin=0x1000,kTOFout=0x2000,kTOFrefit=0x4000,kTOFpid=0x8000,
235     kPHOSpid=0x10000, kRICHpid=0x20000, kEMCALpid=0x40000,
236     kTRDbackup=0x80000,
237     kTRDStop=0x20000000,
238     kESDpid=0x40000000,
239     kTIME=0x80000000
240   }; 
241 protected:
242   
243   //AliESDtrack & operator=(const AliESDtrack & );
244
245   ULong_t   fFlags;         // Reconstruction status flags 
246   Int_t     fLabel;         // Track label
247   Int_t     fID;            // Unique ID of the track
248   Float_t   fTrackLength;   // Track length
249   Float_t   fD;             // Impact parameter in XY plane
250   Float_t   fZ;             // Impact parameter in Z
251   Float_t   fCdd,fCdz,fCzz; // Covariance matrix of the impact parameters 
252   Float_t   fTrackTime[AliPID::kSPECIES]; // TOFs estimated by the tracking
253   Float_t   fR[AliPID::kSPECIES]; // combined "detector response probability"
254
255   Int_t   fStopVertex;  // Index of the stop vertex
256
257 //Track parameters constrained to the primary vertex
258   AliExternalTrackParam *fCp; 
259   Double_t fCchi2; //chi2 at the primary vertex
260
261 //Track parameters at the inner wall of the TPC
262   AliExternalTrackParam *fIp;
263
264 //Track parameters at the inner wall of the TRD 
265   AliExternalTrackParam *fOp;
266
267   // ITS related track information
268   Float_t fITSchi2;        // chi2 in the ITS
269   Float_t fITSchi2MIP[12];     // chi2s in the ITS
270   Int_t   fITSncls;        // number of clusters assigned in the ITS
271   UInt_t  fITSindex[6];    //! indices of the assigned ITS clusters
272   Float_t fITSsignal;      // detector's PID signal
273   Float_t fITSr[AliPID::kSPECIES]; // "detector response probabilities" (for the PID)
274   Int_t   fITSLabel;       // label according TPC
275   Float_t fITSFakeRatio;   // ration of fake tracks
276   AliKalmanTrack * fITStrack; //! OWNER: pointer to the ITS track -- currently for debug purpose
277   
278   // TPC related track information
279   Float_t fTPCchi2;        // chi2 in the TPC
280   Int_t   fTPCncls;        // number of clusters assigned in the TPC
281   Int_t  fTPCindex[180];  //! indices of the assigned TPC clusters
282   TBits   fTPCClusterMap;  // Map of clusters, one bit per padrow; 1 if has a cluster on given padrow
283   Float_t fTPCsignal;      // detector's PID signal
284   Float_t fTPCr[AliPID::kSPECIES]; // "detector response probabilities" (for the PID)
285   Int_t   fTPCLabel;       // label according TPC
286   Float_t fTPCPoints[4];   // TPC points -first, max. dens, last and max density
287   Int_t   fKinkIndexes[3]; // array of indexes of posible kink candidates 
288   Int_t   fV0Indexes[3]; // array of indexes of posible kink candidates 
289
290   // TRD related track information
291   Float_t fTRDchi2;        // chi2 in the TRD
292   Int_t   fTRDncls;        // number of clusters assigned in the TRD
293   Int_t   fTRDncls0;       // number of clusters assigned in the TRD before first material cross
294   UInt_t  fTRDindex[130];   //! indices of the assigned TRD clusters
295   Float_t fTRDsignal;      // detector's PID signal
296   Float_t fTRDsignals[kNPlane];  // TRD signals from all six planes
297   Int_t fTRDTimBin[kNPlane];     // Time bin of Max cluster from all six planes
298   Float_t fTRDr[AliPID::kSPECIES]; // "detector response probabilities" (for the PID)
299   Int_t   fTRDLabel;       // label according TRD
300   Float_t fTRDQuality;     //trd quality factor for TOF
301   Float_t fTRDBudget;     //trd material budget
302   AliKalmanTrack * fTRDtrack; //! OWNER: pointer to the TRD track -- currently for debug purpose
303
304   // TOF related track information
305   Float_t fTOFchi2;        // chi2 in the TOF
306   UInt_t  fTOFindex;       // index of the assigned TOF cluster
307   Float_t fTOFsignal;      // detector's PID signal
308   Float_t fTOFr[AliPID::kSPECIES]; // "detector response probabilities" (for the PID)
309   Int_t   fTOFLabel[3];       // TOF label 
310   Float_t fTOFInfo[10];       //! TOF informations
311
312   // PHOS related track information 
313   Float_t fPHOSpos[3]; // position localised by PHOS in global coordinate system
314   Float_t fPHOSsignal; // energy measured by PHOS
315   Float_t fPHOSr[AliPID::kSPECIESN]; // PID information from PHOS
316
317   // EMCAL related track information 
318   Float_t fEMCALpos[3]; //position localised by EMCAL in global coordinate system
319   Float_t fEMCALsignal; // energy measured by EMCAL
320   Float_t fEMCALr[AliPID::kSPECIESN]; // PID information from EMCAL
321
322   // HMPID related track information
323   Float_t fRICHchi2;       // chi2 in the RICH
324   Int_t   fRICHncls;       // number of photon clusters
325   UInt_t  fRICHindex;      // index of the assigned MIP cluster
326   Float_t fRICHsignal;     // RICH PID signal
327   Float_t fRICHr[AliPID::kSPECIES];// "detector response probabilities" (for the PID)
328   Float_t fRICHtheta;      // theta of the track extrapolated to the RICH
329   Float_t fRICHphi;        // phi of the track extrapolated to the RICH
330   Float_t fRICHdx;         // x of the track impact minus x of the MIP
331   Float_t fRICHdy;         // y of the track impact minus y of the MIP
332
333   AliTrackPointArray *fPoints; // Array which contains the track space points in the global frame
334
335   ClassDef(AliESDtrack,21)  //ESDtrack 
336 };
337
338 #endif 
339