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 //-------------------------------------------------------------------------
14 #include <TParticle.h>
16 #include "AliVirtualParticle.h"
17 #include "AliAODVertex.h"
18 #include "AliAODRedCov.h"
20 class AliAODTrack : public AliVirtualParticle {
24 enum AODTrk_t {kUndef=-1, kPrimary, kSecondary, kOrphan};
27 kIsDCA=BIT(14), // set if fPosition is the DCA and not the position of the first point
28 kUsedForPrimVtxFit=BIT(15) // set if this track was used to fit the primary vertex
52 Double_t covMatrix[21],
56 AliAODVertex *prodVertex,
57 Bool_t usedForPrimVtxFit,
58 AODTrk_t ttype=kUndef);
66 Float_t covMatrix[21],
70 AliAODVertex *prodVertex,
71 Bool_t usedForPrimVtxFit,
72 AODTrk_t ttype=kUndef);
74 virtual ~AliAODTrack();
75 AliAODTrack(const AliAODTrack& trk);
76 AliAODTrack& operator=(const AliAODTrack& trk);
79 virtual Double_t OneOverPt() const { return (fMomentum[0] != 0.) ? 1./fMomentum[0] : -999.; }
80 virtual Double_t Phi() const { return fMomentum[1]; }
81 virtual Double_t Theta() const { return fMomentum[2]; }
83 virtual Double_t Px() const { return fMomentum[0] * TMath::Cos(fMomentum[1]); }
84 virtual Double_t Py() const { return fMomentum[0] * TMath::Sin(fMomentum[1]); }
85 virtual Double_t Pz() const { return fMomentum[0] / TMath::Tan(fMomentum[2]); }
86 virtual Double_t Pt() const { return fMomentum[0]; }
87 virtual Double_t P() const { return TMath::Sqrt(Pt()*Pt()+Pz()*Pz()); }
89 Double_t Chi2() const { return fChi2; }
91 virtual Double_t M() const { return M(GetMostProbablePID()); }
92 Double_t M(AODTrkPID_t pid) const;
93 virtual Double_t E() const { return E(GetMostProbablePID()); }
94 Double_t E(AODTrkPID_t pid) const;
95 Double_t E(Double_t m) const { return TMath::Sqrt(P()*P() + m*m); }
96 virtual Double_t Y() const { return Y(GetMostProbablePID()); }
97 Double_t Y(AODTrkPID_t pid) const;
98 Double_t Y(Double_t m) const;
100 virtual Double_t Eta() const { return -TMath::Log(TMath::Tan(0.5 * fMomentum[2])); }
102 virtual Short_t Charge() const {return fCharge; }
105 virtual const Double_t *PID() const { return fPID; }
106 AODTrkPID_t GetMostProbablePID() const;
107 void ConvertAliPIDtoAODPID();
109 template <class T> void GetPID(T *pid) const {
110 for(Int_t i=0; i<10; ++i) pid[i]=fPID[i];}
112 template <class T> void SetPID(const T *pid) {
113 if(pid) for(Int_t i=0; i<10; ++i) fPID[i]=pid[i];
114 else {for(Int_t i=0; i<10; fPID[i++]=0.);}}
116 Int_t GetID() const { return fID; }
117 Int_t GetLabel() const { return fLabel; }
118 Char_t GetType() const { return fType;}
119 Bool_t GetUsedForPrimVtxFit() const { return TestBit(kUsedForPrimVtxFit); }
121 template <class T> void GetP(T *p) const {
122 p[0]=fMomentum[0]; p[1]=fMomentum[1]; p[2]=fMomentum[2];}
124 template <class T> void GetPxPyPz(T *p) const {
125 p[0] = Px(); p[1] = Py(); p[2] = Pz();}
127 template <class T> Bool_t GetPosition(T *x) const {
128 x[0]=fPosition[0]; x[1]=fPosition[1]; x[2]=fPosition[2];
129 return TestBit(kIsDCA);}
131 template <class T> void SetCovMatrix(const T *covMatrix) {
132 if(!fCovMatrix) fCovMatrix=new AliAODRedCov<6>();
133 fCovMatrix->SetCovMatrix(covMatrix);}
135 template <class T> Bool_t GetCovMatrix(T *covMatrix) const {
136 if(!fCovMatrix) return kFALSE;
137 fCovMatrix->GetCovMatrix(covMatrix); return kTRUE;}
139 void RemoveCovMatrix() {delete fCovMatrix; fCovMatrix=NULL;}
141 UChar_t GetITSClusterMap() const { return fITSClusterMap; }
143 AliAODVertex *GetProdVertex() const { return (AliAODVertex*)fProdVertex.GetObject(); }
146 void Print(const Option_t *opt = "") const;
149 void SetID(Int_t id) { fID = id; }
150 void SetLabel(Int_t label) {fLabel = label; }
152 template <class T> void SetPosition(const T *x, Bool_t isDCA = kFALSE);
153 void SetDCA(Double_t d, Double_t z);
154 void SetUsedForPrimVtxFit(Bool_t used = kTRUE) { used ? SetBit(kUsedForPrimVtxFit) : ResetBit(kUsedForPrimVtxFit); }
156 void SetOneOverPt(Double_t oneOverPt) { fMomentum[0] = oneOverPt; }
157 void SetPt(Double_t pt) { fMomentum[0] = pt; };
158 void SetPhi(Double_t phi) { fMomentum[1] = phi; }
159 void SetTheta(Double_t theta) { fMomentum[2] = theta; }
160 template <class T> void SetP(const T *p, Bool_t cartesian = kTRUE);
161 void SetP() {fMomentum[0]=fMomentum[1]=fMomentum[2]=-999.;}
163 void SetCharge(Short_t q) { fCharge = q; }
164 void SetChi2(Double_t chi2) { fChi2 = chi2; }
166 void SetITSClusterMap(UChar_t itsClusMap) { fITSClusterMap = itsClusMap; }
168 void SetProdVertex(TObject *vertex) { fProdVertex = vertex; }
171 void SetType(AODTrk_t ttype) { fType=ttype; }
175 // Momentum & position
176 Double32_t fMomentum[3]; // momemtum stored in pt, phi, theta
177 Double32_t fPosition[3]; // position of first point on track or dca
179 Double32_t fPID[10]; // [0.,1.,8] pointer to PID object
180 Double32_t fChi2; // chi2 of mometum fit
182 Int_t fID; // unique track ID, points back to the ESD track
183 Int_t fLabel; // track label, points back to MC track
185 AliAODRedCov<6> *fCovMatrix; // covariance matrix (x, y, z, px, py, pz)
186 TRef fProdVertex; // vertex of origin
188 Char_t fCharge; // particle charge
189 UChar_t fITSClusterMap; // map of ITS cluster, one bit per layer
190 Char_t fType; // Track Type
193 ClassDef(AliAODTrack,1);