]> git.uio.no Git - u/mrichter/AliRoot.git/blob - STEER/ESD/AliESDtrack.h
Fixed leak in reading ESD friends with AliESDInputHandler
[u/mrichter/AliRoot.git] / STEER / ESD / 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: AliESDtrack.h 64153 2013-09-09 09:33:47Z akalweit $ */
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  * The Get*Label() getters return the label of the associated MC particle.   *
25  * The absolute value of this label is the index of the particle within the  *
26  * MC stack. If the label is negative, this track was assigned a certain     *
27  * number of clusters that did not in fact belong to this track.             *
28  *****************************************************************************/
29
30 #include <TBits.h>
31 #include "AliExternalTrackParam.h"
32 #include "AliVTrack.h"
33 #include "AliESDTOFCluster.h"
34 #include "AliPID.h"
35 #include "AliESDfriendTrack.h"
36 #include "AliTPCdEdxInfo.h"
37
38 class TParticle;
39 class AliESDVertex;
40 class AliKalmanTrack;
41 class AliTrackPointArray;
42 class TPolyMarker3D;
43 class AliDetectorPID;
44 class TTreeSRedirector;
45 class AliESDEvent;
46
47 class AliESDtrack : public AliExternalTrackParam {
48 public:
49   //
50   enum {kNITSchi2Std=3};
51   //
52   AliESDtrack();
53   AliESDtrack(const AliESDtrack& track);
54   AliESDtrack(const AliVTrack* track);
55   AliESDtrack(TParticle * part);
56   virtual ~AliESDtrack();
57   virtual void Copy(TObject &obj) const;
58   const AliESDfriendTrack *GetFriendTrack() const {return fFriendTrack;}
59   void SetFriendTrack(const AliESDfriendTrack *t) {
60     delete fFriendTrack; fFriendTrack=new AliESDfriendTrack(*t);
61   }
62   void ReleaseESDfriendTrack() { delete fFriendTrack;  fFriendTrack=0; }
63   void AddCalibObject(TObject * object);     // add calib object to the list
64   TObject *  GetCalibObject(Int_t index);    // return calib objct at given position
65   void MakeMiniESDtrack();
66   void SetID(Short_t id);
67   Int_t GetID() const { return fID;}
68   void SetVertexID(Char_t id) { fVertexID=id;}
69   Char_t GetVertexID() const { return fVertexID;}
70   void SetStatus(ULong_t flags) {fFlags|=flags;}
71   void ResetStatus(ULong_t flags) {fFlags&=~flags;}
72   Bool_t UpdateTrackParams(const AliKalmanTrack *t, ULong_t flags);
73   void SetIntegratedLength(Double_t l) {fTrackLength=l;}
74   void SetIntegratedTimes(const Double_t *times);
75   void SetESDpid(const Double_t *p);
76   void GetESDpid(Double_t *p) const;
77   virtual const Double_t *PID() const { return fR; }
78
79   Bool_t IsOn(Int_t mask) const {return (fFlags&mask)>0;}
80   ULong_t GetStatus() const {return fFlags;}
81   Int_t GetLabel() const {return fLabel;}
82   void SetLabel(Int_t label) {fLabel = label;}
83
84   void GetExternalParameters(Double_t &x, Double_t p[5]) const;
85   void GetExternalCovariance(Double_t cov[15]) const;
86
87   Double_t GetIntegratedLength() const;
88   Double_t GetIntegratedLengthOld() const {return fTrackLength;}
89   void GetIntegratedTimes(Double_t *times, Int_t nspec=AliPID::kSPECIES) const;
90   Double_t GetIntegratedTimesOld(Int_t i) const {if(fTrackTime) return fTrackTime[i]; else return 0;};
91   Int_t    GetPID(Bool_t tpcOnly=kFALSE)  const;
92   Int_t    GetTOFBunchCrossing(Double_t b=0, Bool_t pidTPConly=kTRUE) const;
93   Double_t GetMass(Bool_t tpcOnly=kFALSE) const {return AliPID::ParticleMass(GetPID(tpcOnly));}
94   Double_t GetMassForTracking() const;
95   void     SetPIDForTracking(Int_t pid) {fPIDForTracking = pid;}
96   Int_t    GetPIDForTracking() const    {return fPIDForTracking;}
97   Double_t M() const;
98   Double_t E() const;
99   Double_t Y() const;
100
101   Bool_t GetConstrainedPxPyPz(Double_t *p) const {
102     if (!fCp) return kFALSE;
103     return fCp->GetPxPyPz(p);
104   }
105   Bool_t GetConstrainedXYZ(Double_t *r) const {
106     if (!fCp) return kFALSE;
107     return fCp->GetXYZ(r);
108   }
109   const AliExternalTrackParam *GetConstrainedParam() const {return fCp;}
110   Bool_t GetConstrainedExternalParameters
111               (Double_t &alpha, Double_t &x, Double_t p[5]) const;
112   Bool_t GetConstrainedExternalCovariance(Double_t cov[15]) const;
113   Double_t GetConstrainedChi2() const {return fCchi2;}
114   Double_t GetChi2TPCConstrainedVsGlobal(const AliESDVertex* vtx) const;
115   //
116   
117   // global track chi2
118   void SetGlobalChi2(Double_t chi2) {fGlobalChi2 = chi2;}
119   Double_t GetGlobalChi2() const {return fGlobalChi2;}
120
121   Bool_t GetInnerPxPyPz(Double_t *p) const {
122     if (!fIp) return kFALSE;
123     return fIp->GetPxPyPz(p);
124   }
125   const AliExternalTrackParam * GetInnerParam() const { return fIp;}
126   const AliExternalTrackParam * GetTPCInnerParam() const {return fTPCInner;}
127   Bool_t FillTPCOnlyTrack(AliESDtrack &track);
128   Bool_t GetInnerXYZ(Double_t *r) const {
129     if (!fIp) return kFALSE;
130     return fIp->GetXYZ(r);
131   }
132   Bool_t GetInnerExternalParameters
133         (Double_t &alpha, Double_t &x, Double_t p[5]) const;
134   Bool_t GetInnerExternalCovariance(Double_t cov[15]) const;
135  
136   void SetOuterParam(const AliExternalTrackParam *p, ULong_t flags);
137
138   void SetOuterHmpParam(const AliExternalTrackParam *p, ULong_t flags);
139
140   const AliExternalTrackParam * GetOuterParam() const { return fOp;}
141
142   const AliExternalTrackParam * GetOuterHmpParam() const { return fHMPIDp;}
143   
144   Bool_t GetOuterPxPyPz(Double_t *p) const {
145     if (!fOp) return kFALSE;
146     return fOp->GetPxPyPz(p);
147   }
148   Bool_t GetOuterHmpPxPyPz(Double_t *p) const {
149     if (!fHMPIDp) return kFALSE;
150     return fHMPIDp->GetPxPyPz(p);
151   }
152   
153   Bool_t GetOuterXYZ(Double_t *r) const {
154     if (!fOp) return kFALSE;
155     return fOp->GetXYZ(r);
156   }
157     Bool_t GetOuterHmpXYZ(Double_t *r) const {
158     if (!fHMPIDp) return kFALSE;
159     return fHMPIDp->GetXYZ(r);
160   }
161
162   Bool_t GetOuterExternalParameters
163         (Double_t &alpha, Double_t &x, Double_t p[5]) const;
164   Bool_t GetOuterExternalCovariance(Double_t cov[15]) const;
165
166   Bool_t GetOuterHmpExternalParameters
167         (Double_t &alpha, Double_t &x, Double_t p[5]) const;
168   Bool_t GetOuterHmpExternalCovariance(Double_t cov[15]) const;
169
170   
171   Int_t GetNcls(Int_t idet) const;
172   Int_t GetClusters(Int_t idet, Int_t *idx) const;
173  
174   void    SetITSpid(const Double_t *p);
175   void    GetITSpid(Double_t *p) const;
176
177   Double_t GetITSsignal() const {return fITSsignal;}
178   void    SetITSdEdxSamples(const Double_t s[4]);
179   void    GetITSdEdxSamples(Double_t s[4]) const;
180
181   Double_t GetITSchi2() const {return fITSchi2;}
182   Double_t GetITSchi2Std(Int_t step) const {return (step>-1&&step<kNITSchi2Std) ? fITSchi2Std[step] : -1;}
183   void     SetITSchi2Std(Double_t chi2, Int_t step)  { if (step>-1&&step<kNITSchi2Std) fITSchi2Std[step] = chi2;}
184   Char_t   GetITSclusters(Int_t *idx) const;
185   UChar_t GetITSClusterMap() const {return fITSClusterMap;}
186   void     SetITSClusterMap(UChar_t amap) {fITSClusterMap = amap;}
187
188   UChar_t GetITSSharedMap() const {return fITSSharedMap;}
189   void    SetITSSharedFlag(int lr) {fITSSharedMap |= 0x1<<lr;}
190   Bool_t  GetITSFakeFlag()   const {return (fITSSharedMap&BIT(7))!=0;}
191   void    SetITSFakeFlag(Bool_t v=kTRUE)  {if (v) fITSSharedMap|=BIT(7); else fITSSharedMap&=~BIT(7);}  
192   void    SetITSSharedMap(UChar_t map) {fITSSharedMap=map;}
193   void    SetITSModuleIndex(Int_t ilayer,Int_t idx) {fITSModule[ilayer]=idx;}
194   Int_t   GetITSModuleIndex(Int_t ilayer) const {return fITSModule[ilayer];}
195   Bool_t  GetITSModuleIndexInfo(Int_t ilayer,Int_t &idet,Int_t &status,
196                                 Float_t &xloc,Float_t &zloc) const;
197   Int_t   GetITSLabel() const {return fITSLabel;}
198   void    SetITSLabel(Int_t label) {fITSLabel = label;}
199   void    SetITStrack(AliKalmanTrack * track){
200     if (fFriendTrack) fFriendTrack->SetITStrack(track);
201   }
202   AliKalmanTrack *GetITStrack(){
203     return fFriendTrack!=NULL?fFriendTrack->GetITStrack():NULL;
204   }
205   Bool_t  HasPointOnITSLayer(Int_t i) const {return TESTBIT(fITSClusterMap,i);}
206   Bool_t  HasSharedPointOnITSLayer(Int_t i) const {return TESTBIT(fITSSharedMap,i);}
207
208   void    SetTPCpid(const Double_t *p);
209   void    GetTPCpid(Double_t *p) const;
210   void    SetTPCPoints(Float_t points[4]){
211      for (Int_t i=0;i<4;i++) fTPCPoints[i]=points[i];
212   }
213   void    SetTPCPointsF(UChar_t  findable){fTPCnclsF = findable;}
214   void    SetTPCPointsFIter1(UChar_t  findable){fTPCnclsFIter1 = findable;}
215   UShort_t   GetTPCNcls() const { return fTPCncls;}
216   UShort_t   GetTPCNclsF() const { return fTPCnclsF;}
217   UShort_t   GetTPCNclsIter1() const { return fTPCnclsIter1;}
218   UShort_t   GetTPCNclsFIter1() const { return fTPCnclsFIter1;}
219   UShort_t   GetTPCnclsS(Int_t i0=0,Int_t i1=159) const;
220   UShort_t   GetTPCncls(Int_t row0=0,Int_t row1=159) const;
221   Double_t GetTPCPoints(Int_t i) const {return fTPCPoints[i];}
222   void    SetKinkIndexes(Int_t points[3]) {
223      for (Int_t i=0;i<3;i++) fKinkIndexes[i] = points[i];
224   }
225   void    SetV0Indexes(Int_t points[3]) {
226      for (Int_t i=0;i<3;i++) fV0Indexes[i] = points[i];
227   }
228   void    SetTPCsignal(Float_t signal, Float_t sigma, UChar_t npoints){ 
229      fTPCsignal = signal; fTPCsignalS = sigma; fTPCsignalN = npoints;
230   }
231   void    SetTPCsignalTunedOnData(Float_t signal){
232       fTPCsignalTuned = signal;
233   }
234   void  SetTPCdEdxInfo(AliTPCdEdxInfo * dEdxInfo); 
235   Double_t  GetdEdxInfo(Int_t regionID, Int_t calibID, Int_t qID,Int_t valueID);
236
237   AliTPCdEdxInfo * GetTPCdEdxInfo() const {return fTPCdEdxInfo;}
238   Double_t GetTPCsignal() const {return fTPCsignal;}
239   Double_t GetTPCsignalTunedOnData() const {return fTPCsignalTuned;}
240   Double_t GetTPCsignalSigma() const {return fTPCsignalS;}
241   UShort_t GetTPCsignalN() const {return fTPCsignalN;}
242   Double_t GetTPCmomentum() const {return fIp?fIp->GetP():GetP();}
243   Double_t GetTPCTgl()      const {return fIp?fIp->GetTgl():GetTgl();}
244   Double_t GetTPCchi2() const {return fTPCchi2;}
245   Double_t GetTPCchi2Iter1() const {return fTPCchi2Iter1;}
246   UShort_t GetTPCclusters(Int_t *idx) const;
247   Double_t GetTPCdensity(Int_t row0, Int_t row1) const;
248   Int_t   GetTPCLabel() const {return fTPCLabel;}
249   Int_t   GetKinkIndex(Int_t i) const { return fKinkIndexes[i];}
250   Int_t   GetV0Index(Int_t i) const { return fV0Indexes[i];}
251   const TBits& GetTPCFitMap() const {return fTPCFitMap;}
252   const TBits* GetTPCFitMapPtr() const {return &fTPCFitMap;}
253   const TBits& GetTPCClusterMap() const {return fTPCClusterMap;}
254   const TBits* GetTPCClusterMapPtr() const {return &fTPCClusterMap;}
255   const TBits& GetTPCSharedMap() const {return fTPCSharedMap;}
256   const TBits* GetTPCSharedMapPtr() const {return &fTPCSharedMap;}
257   void    SetTPCFitMap(const TBits &amap) {fTPCFitMap = amap;}
258   void    SetTPCClusterMap(const TBits &amap) {fTPCClusterMap = amap;}
259   void    SetTPCSharedMap(const TBits &amap) {fTPCSharedMap = amap;}
260   Float_t GetTPCClusterInfo(Int_t nNeighbours=3, Int_t type=0, Int_t row0=0, Int_t row1=159, Int_t bitType=0 ) const;
261   Float_t GetTPCClusterDensity(Int_t nNeighbours=3, Int_t type=0, Int_t row0=0, Int_t row1=159, Int_t bitType=0 ) const;
262   Float_t GetTPCCrossedRows() const;
263   
264   void    SetTRDpid(const Double_t *p);
265   void    SetTRDsignal(Double_t sig) {fTRDsignal = sig;}
266   void    SetTRDNchamberdEdx(UChar_t nch) {fTRDNchamberdEdx = nch;}
267   void    SetTRDNclusterdEdx(UChar_t ncls){fTRDNclusterdEdx = ncls;}
268           
269 // A.Bercuci
270   void    SetTRDntracklets(UChar_t q){fTRDntracklets = q;}
271   UChar_t GetTRDntracklets() const {return (fTRDntracklets>>3)&7;}
272   UChar_t GetTRDntrackletsPID() const {return fTRDntracklets&7;}
273   // TEMPORARY alias asked by the HFE group to allow 
274   // reading of the v4-16-Release data with TRUNK related software (A.Bercuci@Apr 30th 09) 
275   UChar_t GetTRDpidQuality() const {return GetTRDntrackletsPID();}
276   UChar_t GetTRDtrkltOccupancy(Int_t ly) const { return ly<kTRDnPlanes && ly>=0 ? fTRDTimBin[ly] & 0x1F : 0; }
277   UChar_t GetTRDtrkltClCross(Int_t ly) const { return ly<kTRDnPlanes && ly>=0 ? (fTRDTimBin[ly] >> 5) & 0x03 : 0; }
278   Bool_t IsTRDtrkltChmbGood(Int_t ly) const { return ly<kTRDnPlanes && ly>=0 ? ((fTRDTimBin[ly] >> 7) & 0x01) == 1 : kFALSE;} 
279   // end A.Bercuci
280   
281   void     SetNumberOfTRDslices(Int_t n);
282   Int_t    GetNumberOfTRDslices() const;
283   void     SetTRDslice(Double_t q, Int_t plane, Int_t slice);
284   void     SetTRDmomentum(Double_t p, Int_t plane, Double_t *sp=0x0);
285   Double_t GetTRDslice(Int_t plane, Int_t slice=-1) const;
286   Double_t GetTRDmomentum(Int_t plane, Double_t *sp=0x0) const;
287         
288   void    SetTRDQuality(Float_t quality){fTRDQuality=quality;}
289   Double_t GetTRDQuality()const {return fTRDQuality;}
290   void    SetTRDBudget(Float_t budget){fTRDBudget=budget;}
291   Double_t GetTRDBudget()const {return fTRDBudget;}
292
293   void    SetTRDTimBin(Int_t timbin, Int_t i) {fTRDTimBin[i]=timbin;}
294   void    GetTRDpid(Double_t *p) const;
295   Double_t GetTRDsignal() const {return fTRDsignal;}
296   UChar_t GetTRDNchamberdEdx() const {return fTRDNchamberdEdx;}
297   UChar_t GetTRDNclusterdEdx() const {return fTRDNclusterdEdx;}
298   Char_t   GetTRDTimBin(Int_t i) const {return fTRDTimBin[i];}
299   Double_t GetTRDchi2() const {return fTRDchi2;}
300   UChar_t   GetTRDclusters(Int_t *idx) const;
301   UChar_t   GetTRDncls() const {return fTRDncls;}
302   UChar_t   GetTRDncls0() const {return fTRDncls0;}
303   UChar_t   GetTRDtracklets(Int_t *idx) const;
304   void    SetTRDpid(Int_t iSpecies, Float_t p);
305   Double_t GetTRDpid(Int_t iSpecies) const;
306   Int_t   GetTRDLabel() const {return fTRDLabel;}
307
308   void    SetTRDtrack(AliKalmanTrack * track){
309     if (fFriendTrack) fFriendTrack->SetTRDtrack(track);
310   }
311   AliKalmanTrack *GetTRDtrack(){
312     return fFriendTrack!=NULL?fFriendTrack->GetTRDtrack():NULL;
313   }
314
315   // this are methods for manipulating with TOF clusters/matches
316   void    SetTOFclusterArray(Int_t ncluster,Int_t *TOFcluster);
317   Int_t   *GetTOFclusterArray() const {return fTOFcluster;}
318   Int_t   GetNTOFclusters() const {return fNtofClusters;}
319   void    SuppressTOFMatches();
320   void    ReplaceTOFTrackID(int oldID, int newID);
321   void    ReplaceTOFClusterID(int oldID, int newID);
322   void    ReplaceTOFMatchID(int oldID, int newID);
323   void    AddTOFcluster(Int_t icl);
324   void    SortTOFcluster(); // RS? Not to be used?
325   void    ReMapTOFcluster(Int_t ncl,Int_t *mapping);  // RS? Not to be used?
326
327   void    SetTOFsignal(Double_t tof) {fTOFsignal=tof;}
328   Double_t GetTOFsignal() const;
329   void    SetTOFsignalToT(Double_t ToT) {fTOFsignalToT=ToT;}
330   Double_t GetTOFsignalToT() const;
331   void    SetTOFsignalRaw(Double_t tof) {fTOFsignalRaw=tof;}
332   Double_t GetTOFsignalRaw() const;
333   void    SetTOFsignalDz(Double_t dz) {fTOFsignalDz=dz;}
334   Double_t GetTOFsignalDz() const;
335   void    SetTOFsignalDx(Double_t dx) {fTOFsignalDx=dx;}
336   Double_t GetTOFsignalDx() const;
337   void     SetTOFDeltaBC(Short_t deltaBC) {fTOFdeltaBC=deltaBC;};
338   Short_t  GetTOFDeltaBC() const;
339   void     SetTOFL0L1(Short_t l0l1) {fTOFl0l1=l0l1;};
340   Short_t  GetTOFL0L1() const;
341   Double_t GetTOFchi2() const {return fTOFchi2;};
342   void    SetTOFpid(const Double_t *p);
343   void    SetTOFLabel(const Int_t *p);
344   void    GetTOFpid(Double_t *p) const;
345   void    GetTOFLabel(Int_t *p) const;
346   void    GetTOFInfo(Float_t *info) const;
347   void    SetTOFInfo(Float_t *info);
348   Int_t   GetTOFCalChannel() const;
349   Int_t   GetTOFcluster() const;
350   void    SetTOFcluster(Int_t index) {fTOFindex=index;}
351   void    SetTOFCalChannel(Int_t index) {fTOFCalChannel=index;}
352   Int_t   GetTOFclusterN() const;
353   Bool_t  IsTOFHitAlreadyMatched() const;
354   void    SetTOFsignalTunedOnData(Double_t signal){fTOFsignalTuned=signal;}
355   Double_t GetTOFsignalTunedOnData() const {return fTOFsignalTuned;}
356
357 // HMPID methodes +++++++++++++++++++++++++++++++++ (kir)
358   void    SetHMPIDsignal(Double_t theta) {fHMPIDsignal=theta;}
359   Double_t GetHMPIDsignal() const {if(fHMPIDsignal>0) return fHMPIDsignal - (Int_t)fHMPIDsignal; else return fHMPIDsignal;}
360   Double_t GetHMPIDoccupancy() const {return (Int_t)fHMPIDsignal/10.0;}
361   void    SetHMPIDpid(const Double_t *p);
362   void    GetHMPIDpid(Double_t *p) const;  
363   void    SetHMPIDchi2(Double_t chi2) {fHMPIDchi2=chi2;}
364   Double_t GetHMPIDchi2() const {return fHMPIDchi2;}
365   void    SetHMPIDcluIdx(Int_t ch,Int_t idx) {fHMPIDcluIdx=ch*1000000+idx;}
366   Int_t   GetHMPIDcluIdx() const {return fHMPIDcluIdx;}
367   void    SetHMPIDtrk(Float_t  x, Float_t  y, Float_t  th, Float_t  ph) {
368      fHMPIDtrkX=x; fHMPIDtrkY=y; fHMPIDtrkTheta=th; fHMPIDtrkPhi=ph;
369   }
370   void    GetHMPIDtrk(Float_t &x, Float_t &y, Float_t &th, Float_t &ph) const {
371      x=fHMPIDtrkX; y=fHMPIDtrkY; th=fHMPIDtrkTheta; ph=fHMPIDtrkPhi;
372   }
373   void    SetHMPIDmip(Float_t  x, Float_t  y, Int_t q, Int_t nph=0) {
374      fHMPIDmipX=x; fHMPIDmipY=y; fHMPIDqn=1000000*nph+q;
375   }
376   void    GetHMPIDmip(Float_t &x,Float_t &y,Int_t &q,Int_t &nph) const {
377      x=fHMPIDmipX; y=fHMPIDmipY; q=fHMPIDqn%1000000; nph=fHMPIDqn/1000000;
378   }
379   Bool_t  IsHMPID() const {return fFlags&kHMPIDpid;}
380   Bool_t  IsPureITSStandalone() const {return fFlags&kITSpureSA;}
381   Bool_t  IsMultPrimary() const {return !(fFlags&kMultSec);}
382   Bool_t  IsMultSecondary() const {return (fFlags&kMultSec);}
383
384   Int_t GetEMCALcluster() const {return fCaloIndex;}
385   void SetEMCALcluster(Int_t index) {fCaloIndex=index;}
386   Bool_t IsEMCAL() const {return fFlags&kEMCALmatch;}
387   
388   Double_t GetTrackPhiOnEMCal() const {return fTrackPhiOnEMCal;}
389   Double_t GetTrackEtaOnEMCal() const {return fTrackEtaOnEMCal;}
390   Double_t GetTrackPtOnEMCal() const {return fTrackPtOnEMCal;}
391   Double_t GetTrackPOnEMCal() const {return TMath::Abs(fTrackEtaOnEMCal) < 1 ? fTrackPtOnEMCal*TMath::CosH(fTrackEtaOnEMCal) : -999;}
392   void SetTrackPhiEtaPtOnEMCal(Double_t phi,Double_t eta,Double_t pt) {fTrackPhiOnEMCal=phi;fTrackEtaOnEMCal=eta;fTrackPtOnEMCal=pt;}
393
394   Int_t GetPHOScluster() const {return fCaloIndex;}
395   void SetPHOScluster(Int_t index) {fCaloIndex=index;}
396   Bool_t IsPHOS() const {return fFlags&kPHOSmatch;}
397   Double_t GetPHOSdx()const{return fCaloDx ;}
398   Double_t GetPHOSdz()const{return fCaloDz ;}
399   void SetPHOSdxdz(Double_t dx, Double_t dz){fCaloDx=dx,fCaloDz=dz;}
400
401
402   void SetTrackPointArray(AliTrackPointArray *points) {
403     if (fFriendTrack) fFriendTrack->SetTrackPointArray(points);
404   }
405   const AliTrackPointArray *GetTrackPointArray() const {
406     return fFriendTrack!=NULL?fFriendTrack->GetTrackPointArray():NULL; 
407   }
408   Bool_t RelateToVertexTPC(const AliESDVertex *vtx, Double_t b, Double_t maxd,
409                            AliExternalTrackParam *cParam=0);
410   Bool_t 
411   RelateToVertexTPCBxByBz(const AliESDVertex *vtx, Double_t b[3],Double_t maxd,
412                            AliExternalTrackParam *cParam=0);
413   void GetImpactParametersTPC(Float_t &xy,Float_t &z) const {xy=fdTPC; z=fzTPC;}
414   void GetImpactParametersTPC(Float_t p[2], Float_t cov[3]) const {
415     p[0]=fdTPC; p[1]=fzTPC; cov[0]=fCddTPC; cov[1]=fCdzTPC; cov[2]=fCzzTPC;
416   }
417   Double_t GetConstrainedChi2TPC() const {return fCchi2TPC;}
418
419   Bool_t RelateToVertex(const AliESDVertex *vtx, Double_t b, Double_t maxd,
420                         AliExternalTrackParam *cParam=0);
421   Bool_t 
422   RelateToVertexBxByBz(const AliESDVertex *vtx, Double_t b[3], Double_t maxd,
423                         AliExternalTrackParam *cParam=0);
424   void GetImpactParameters(Float_t &xy,Float_t &z) const {xy=fD; z=fZ;}
425   void GetImpactParameters(Float_t p[2], Float_t cov[3]) const {
426     p[0]=fD; p[1]=fZ; cov[0]=fCdd; cov[1]=fCdz; cov[2]=fCzz;
427   }
428   virtual void Print(Option_t * opt) const ;
429   const AliESDEvent* GetESDEvent() const {return fESDEvent;}
430   const AliTOFHeader* GetTOFHeader() const;
431   const AliVEvent* GetEvent() const {return (AliVEvent*)fESDEvent;}
432   void         SetESDEvent(const AliESDEvent* evt) {fESDEvent = evt;}
433
434   // Trasient PID object, is owned by the track
435   virtual void  SetDetectorPID(const AliDetectorPID *pid);
436   virtual const AliDetectorPID* GetDetectorPID() const { return fDetectorPID; }
437   
438   //
439   // visualization (M. Ivanov)
440   //
441   void FillPolymarker(TPolyMarker3D *pol, Float_t magf, Float_t minR, Float_t maxR, Float_t stepR);
442
443   //
444   // online mode Matthias.Richter@cern.ch
445   // in order to optimize AliESDtrack for usage in the online HLT,
446   // some functionality is disabled
447   // - creation of AliESDfriendTrack
448   // - set lengt of bit fields fTPCClusterMap and fTPCSharedMap to 0
449   static void OnlineMode(bool mode) {fgkOnlineMode=mode;}
450   static bool OnlineMode() {return fgkOnlineMode;}
451   static Double_t GetLengthInActiveZone(const AliExternalTrackParam  *paramT, Double_t deltaY, Double_t deltaZ, Double_t bz, Double_t exbPhi =0 , TTreeSRedirector * pcstream =0 );
452   Double_t GetLengthInActiveZone( Int_t mode, Double_t deltaY, Double_t deltaZ, Double_t bz, Double_t exbPhi =0 , TTreeSRedirector * pcstream =0 ) const;
453 protected:
454   
455   AliExternalTrackParam *fCp; // Track parameters constrained to the primary vertex
456   AliExternalTrackParam *fIp; // Track parameters estimated at the inner wall of TPC
457   AliExternalTrackParam *fTPCInner; // Track parameters estimated at the inner wall of TPC using the TPC stand-alone 
458   AliExternalTrackParam *fOp; // Track parameters estimated at the point of maximal radial coordinate reached during the tracking
459   AliExternalTrackParam *fHMPIDp; // Track parameters at HMPID
460   AliESDfriendTrack *fFriendTrack; //! All the complementary information
461
462   TBits    fTPCFitMap;     // Map of clusters, one bit per padrow; 1 if has a cluster on given padrow which is used in the fit
463   TBits    fTPCClusterMap; // Map of clusters, one bit per padrow; 1 if has a cluster on given padrow
464   TBits    fTPCSharedMap;  // Map of clusters, one bit per padrow; 1 if has a shared cluster on given padrow
465
466
467
468   ULong_t   fFlags;          // Reconstruction status flags 
469   Int_t     fID;             // Unique ID of the track
470   Int_t     fLabel;          // Track label
471   Int_t     fITSLabel;       // label according ITS
472   Int_t     fITSModule[12];  // modules crossed by the track in the ITS 
473   Int_t     fTPCLabel;       // label according TPC
474   Int_t     fTRDLabel;       // label according TRD
475   Int_t     *fTOFLabel;      //! TOF label 
476   Int_t     fTOFCalChannel;  //! Channel Index of the TOF Signal 
477   Int_t     fTOFindex;       // index of the assigned TOF cluster
478   Int_t     fHMPIDqn;         // 1000000*number of photon clusters + QDC
479   Int_t     fHMPIDcluIdx;     // 1000000*chamber id + cluster idx of the assigned MIP cluster
480   Int_t     fCaloIndex;       // index of associated EMCAL/PHOS cluster (AliESDCaloCluster)
481
482
483   Int_t     fKinkIndexes[3]; // array of indexes of posible kink candidates 
484   Int_t     fV0Indexes[3];   // array of indexes of posible kink candidates 
485
486   Double32_t   *fR; //! [0.,0.,8] combined "detector response probability"
487   Double32_t   *fITSr; //! [0.,0.,8] "detector response probabilities" (for the PID)
488   Double32_t   *fTPCr; //! [0.,0.,8] "detector response probabilities" (for the PID)
489   Double32_t   *fTRDr; //! [0.,0.,8] "detector response probabilities" (for the PID)  
490   Double32_t   *fTOFr; //! [0.,0.,8] "detector response probabilities" (for the PID)
491   Double32_t   *fHMPIDr; //! [0.,0.,8] "detector response probabilities" (for the PID)
492
493   Double32_t fHMPIDtrkTheta;//[-2*pi,2*pi,16] theta of the track extrapolated to the HMPID, LORS
494   // how much of this is needed?
495   Double32_t fHMPIDtrkPhi;     //[-2*pi,2*pi,16] phi of the track extrapolated to the HMPID, LORS
496   Double32_t fHMPIDsignal;  // HMPID PID signal (Theta ckov, rad)
497
498   Double32_t   *fTrackTime; //! TOFs estimated by the tracking
499   Double32_t   fTrackLength;   //! Track length
500
501   Double32_t   fdTPC;          // TPC-only impact parameter in XY plane
502   Double32_t   fzTPC;          // TPC-only impact parameter in Z
503   Double32_t   fCddTPC,fCdzTPC,fCzzTPC; // Covariance matrix of the TPC-only impact parameters 
504   Double32_t   fCchi2TPC;      // [0.,0.,8] TPC-only chi2 at the primary vertex
505
506   Double32_t   fD;             // Impact parameter in XY plane
507   Double32_t   fZ;             // Impact parameter in Z
508   Double32_t   fCdd,fCdz,fCzz; // Covariance matrix of the impact parameters 
509   Double32_t   fCchi2;          // [0.,0.,8] chi2 at the primary vertex
510
511   Double32_t   fITSchi2Std[kNITSchi2Std];  // [0.,0.,8] standard chi2 in the ITS (with standard errors)
512   Double32_t   fITSchi2;        // [0.,0.,8] chi2 in the ITS
513   Double32_t   fTPCchi2;        // [0.,0.,8] chi2 in the TPC
514   Double32_t   fTPCchi2Iter1;  // [0.,0.,8] chi2 in the TPC
515   Double32_t   fTRDchi2;        // [0.,0.,8] chi2 in the TRD
516   Double32_t   fTOFchi2;        // [0.,0.,8] chi2 in the TOF
517   Double32_t fHMPIDchi2;        // [0.,0.,8] chi2 in the HMPID
518
519   Double32_t fGlobalChi2;       // [0.,0.,8] chi2 of the global track
520
521   Double32_t  fITSsignal;     // [0.,0.,10] detector's PID signal
522   Double32_t  fITSdEdxSamples[4]; // [0.,0.,10] ITS dE/dx samples
523
524   Double32_t  fTPCsignal;        // [0.,0.,10] detector's PID signal
525   Double32_t  fTPCsignalTuned;   //! [0.,0.,10] detector's PID signal tuned on data when using MC
526   Double32_t  fTPCsignalS;       // [0.,0.,10] RMS of dEdx measurement
527   AliTPCdEdxInfo * fTPCdEdxInfo; // object containing dE/dx information for different pad regions
528   Double32_t  fTPCPoints[4];     // [0.,0.,10] TPC points -first, max. dens, last and max density
529
530   Double32_t fTRDsignal;      // detector's PID signal
531   Double32_t fTRDQuality;     // trd quality factor for TOF
532   Double32_t fTRDBudget;      // trd material budget
533
534   Double32_t fTOFsignal;      //! detector's PID signal [ps]
535   Double32_t fTOFsignalTuned; //! detector's PID signal tuned on data when using MC
536   Double32_t fTOFsignalToT;   //! detector's ToT signal [ns]
537   Double32_t fTOFsignalRaw;   //! detector's uncorrected time signal [ps]
538   Double32_t fTOFsignalDz;    //! local z  of track's impact on the TOF pad [cm]
539   Double32_t fTOFsignalDx;    //! local x  of track's impact on the TOF pad [cm]
540   Double32_t fTOFInfo[10];    //! TOF informations
541   Short_t    fTOFdeltaBC;     //! detector's Delta Bunch Crossing correction
542   Short_t    fTOFl0l1;        //! detector's L0L1 latency correction
543
544   Double32_t fCaloDx ;        // [0.,0.,8] distance to calorimeter cluster in calo plain (phi direction)
545   Double32_t fCaloDz ;        // [0.,0.,8] distance to calorimeter cluster in calo plain (z direction)
546
547   Double32_t fHMPIDtrkX;       // x of the track impact, LORS 
548   Double32_t fHMPIDtrkY;       // y of the track impact, LORS 
549   Double32_t fHMPIDmipX;       // x of the MIP in LORS
550   Double32_t fHMPIDmipY;       // y of the MIP in LORS
551
552
553   UShort_t fTPCncls;       // number of clusters assigned in the TPC
554   UShort_t fTPCnclsF;      // number of findable clusters in the TPC
555   UShort_t fTPCsignalN;    // number of points used for dEdx
556   UShort_t fTPCnclsIter1;  // number of clusters assigned in the TPC - iteration 1
557   UShort_t fTPCnclsFIter1; // number of findable clusters in the TPC - iteration 1
558
559   Char_t  fITSncls;        // number of clusters assigned in the ITS
560   UChar_t fITSClusterMap;  // map of clusters, one bit per a layer
561   UChar_t fITSSharedMap;   // map of shared clusters, one bit per a layer
562   UChar_t fTRDncls;        // number of clusters assigned in the TRD
563   UChar_t fTRDncls0;       // number of clusters assigned in the TRD before first material cross
564   UChar_t fTRDntracklets;  // number of TRD tracklets used for tracking/PID
565   UChar_t fTRDNchamberdEdx;   // number of chambers used to calculated the TRD truncated mean
566   UChar_t fTRDNclusterdEdx;   // number of clusters used to calculated the TRD truncated mean
567
568   Int_t fTRDnSlices;     // number of slices used for PID in the TRD
569   Double32_t *fTRDslices;  //[fTRDnSlices] 
570
571   Char_t  fTRDTimBin[kTRDnPlanes];   // Time bin of Max cluster from all six planes
572   Char_t  fVertexID; // ID of the primary vertex this track belongs to
573   Char_t  fPIDForTracking;           // mass used for tracking
574
575   mutable const AliESDEvent*   fESDEvent; //!Pointer back to event to which the track belongs
576   
577   mutable Float_t fCacheNCrossedRows; //! Cache for the number of crossed rows
578   mutable Float_t fCacheChi2TPCConstrainedVsGlobal; //! Cache for the chi2 of constrained TPC vs global track
579   mutable const AliESDVertex* fCacheChi2TPCConstrainedVsGlobalVertex; //! Vertex for which the cache is valid
580
581   mutable const AliDetectorPID* fDetectorPID; //! transient object to cache PID information
582
583   Double_t      fTrackPhiOnEMCal;   // phi of track after being propagated to the EMCal surface (default r = 440 cm)
584   Double_t      fTrackEtaOnEMCal;   // eta of track after being propagated to the EMCal surface (default r = 440 cm)
585   Double_t      fTrackPtOnEMCal;    // pt of track after being propagated to the EMCal surface (default r = 440 cm)
586   
587
588   // new TOF data structure
589   Int_t fNtofClusters;              // number of matchable TOF clusters 
590   Int_t *fTOFcluster;               //[fNtofClusters]
591                                     // TOF clusters matchable with the track
592
593  private:
594   static bool fgkOnlineMode; //! indicate the online mode to skip some of the functionality
595
596   AliESDtrack & operator=(const AliESDtrack & );
597   ClassDef(AliESDtrack,71)  //ESDtrack 
598 };
599
600
601
602 #endif 
603