3 /* Copyright(c) 1998-2007, ALICE Experiment at CERN, All rights reserved. *
4 * See cxx source for full Copyright notice */
8 //-------------------------------------------------------------------------
9 // AOD track base class
10 // Author: Markus Oldenburg, CERN
11 //-------------------------------------------------------------------------
15 #include "AliVirtualParticle.h"
16 #include "AliAODVertex.h"
17 #include "AliAODRedCov.h"
19 class AliAODTrack : public AliVirtualParticle {
23 enum AODTrk_t {kUndef=-1, kPrimary, kSecondary, kOrphan};
26 kIsDCA=BIT(14), // set if fPosition is the DCA and not the position of the first point
27 kUsedForPrimVtxFit=BIT(15) // set if this track was used to fit the primary vertex
31 kUnknown=0, kElectron, kMuon, kPion, kProton, kDeuton, kTriton, kAlpha, kOther};
40 Double_t covMatrix[21],
44 AliAODVertex *prodVertex,
45 Bool_t usedForPrimVtxFit,
46 AODTrk_t ttype=kUndef);
54 Float_t covMatrix[21],
58 AliAODVertex *prodVertex,
59 Bool_t usedForPrimVtxFit,
60 AODTrk_t ttype=kUndef);
62 virtual ~AliAODTrack();
63 AliAODTrack(const AliAODTrack& trk);
64 AliAODTrack& operator=(const AliAODTrack& trk);
67 virtual Double_t OneOverPt() const { return fMomentum[0]; }
68 virtual Double_t Phi() const { return fMomentum[1]; }
69 virtual Double_t Theta() const { return fMomentum[2]; }
71 virtual Double_t Px() const { return TMath::Cos(fMomentum[1])/fMomentum[0]; }
72 virtual Double_t Py() const { return TMath::Sin(fMomentum[1])/fMomentum[0]; }
73 virtual Double_t Pz() const { return 1./(fMomentum[0] * TMath::Tan(fMomentum[2])); }
74 virtual Double_t Pt() const { return 1./fMomentum[0]; }
75 virtual Double_t P() const { return TMath::Sqrt(Pt()*Pt()+Pz()*Pz()); }
77 Double_t Chi2() const { return fChi2; }
79 virtual Double_t E() const { return -999.; }
80 // make a connection to the PID object, here!!!
81 virtual Double_t M() const { return -999.; }
83 virtual Double_t Eta() const { return -TMath::Log(TMath::Tan(0.5 * fMomentum[2])); }
84 // make a connection to the PID object, here!!!
85 virtual Double_t Y() const { return -999.; }
87 virtual Short_t Charge() const {return fCharge; }
90 virtual const Double_t *PID() const { return fPID; }
92 template <class T> void GetPID(T *pid) const {
93 for(Int_t i=0; i<10; ++i) pid[i]=fPID[i];}
95 template <class T> void SetPID(const T *pid) {
96 if(pid) for(Int_t i=0; i<10; ++i) fPID[i]=pid[i];
97 else {for(Int_t i=1; i<10; fPID[i++]=0); fPID[0]=1.;}}
99 Int_t GetID() const { return fID; }
100 Int_t GetLabel() const { return fLabel; }
101 Char_t GetType() const { return fType;}
102 Bool_t GetUsedForPrimVtxFit() const { return TestBit(kUsedForPrimVtxFit); }
104 template <class T> void GetP(T *p) const {
105 p[0]=fMomentum[0]; p[1]=fMomentum[1]; p[2]=fMomentum[2];}
107 template <class T> void GetPxPyPz(T *p) const {
108 p[0] = Px(); p[1] = Py(); p[2] = Pz();}
110 template <class T> Bool_t GetPosition(T *x) const {
111 x[0]=fPosition[0]; x[1]=fPosition[1]; x[2]=fPosition[2];
112 return TestBit(kIsDCA);}
114 template <class T> void SetCovMatrix(const T *covMatrix) {
115 if(!fCovMatrix) fCovMatrix=new AliAODRedCov<6>();
116 fCovMatrix->SetCovMatrix(covMatrix);}
118 template <class T> Bool_t GetCovMatrix(T *covMatrix) const {
119 if(!fCovMatrix) return kFALSE;
120 fCovMatrix->GetCovMatrix(covMatrix); return kTRUE;}
122 void RemoveCovMatrix() {delete fCovMatrix; fCovMatrix=NULL;}
124 UChar_t GetITSClusterMap() const { return fITSClusterMap; }
126 AliAODVertex *GetProdVertex() const { return (AliAODVertex*)fProdVertex.GetObject(); }
129 void Print(const Option_t *opt = "") const;
132 void SetID(Int_t id) { fID = id; }
133 void SetLabel(Int_t label) {fLabel = label; }
135 template <class T> void SetPosition(const T *x, Bool_t isDCA = kFALSE);
136 void SetDCA(Double_t d, Double_t z);
137 void SetUsedForPrimVtxFit(Bool_t used = kTRUE) { used ? SetBit(kUsedForPrimVtxFit) : ResetBit(kUsedForPrimVtxFit); }
139 void SetOneOverPt(Double_t oneOverPt) { fMomentum[0] = oneOverPt; }
140 void SetPt(Double_t pt) { fMomentum[0] = 1./pt; };
141 void SetPhi(Double_t phi) { fMomentum[1] = phi; }
142 void SetTheta(Double_t theta) { fMomentum[2] = theta; }
143 template <class T> void SetP(const T *p, Bool_t cartesian = kTRUE);
144 void SetP() {fMomentum[0]=fMomentum[1]=fMomentum[2]=-999.;}
146 void SetCharge(Short_t q) { fCharge = q; }
147 void SetChi2(Double_t chi2) { fChi2 = chi2; }
149 void SetITSClusterMap(UChar_t itsClusMap) { fITSClusterMap = itsClusMap; }
151 void SetProdVertex(TObject *vertex) { fProdVertex = vertex; }
154 void SetType(AODTrk_t ttype) { fType=ttype; }
158 // Momentum & position
159 Double32_t fMomentum[3]; // momemtum stored in 1/pt, phi, theta
160 Double32_t fPosition[3]; // position of first point on track or dca
162 Double32_t fPID[10]; // [0.,1.,8] pointer to PID object
163 Double32_t fChi2; // chi2 of mometum fit
165 Int_t fID; // unique track ID, points back to the ESD track
166 Int_t fLabel; // track label, points back to MC track
168 AliAODRedCov<6> *fCovMatrix; // covariance matrix (x, y, z, px, py, pz)
169 TRef fProdVertex; // vertex of origin
171 Char_t fCharge; // particle charge
172 UChar_t fITSClusterMap; // map of ITS cluster, one bit per layer
173 Char_t fType; // Track Type
176 ClassDef(AliAODTrack,1);