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,
30 kIsDCA=BIT(14), // set if fPosition is the DCA and not the position of the first point
31 kUsedForVtxFit=BIT(15), // set if this track was used to fit the vertex it is attached to
32 kUsedForPrimVtxFit=BIT(16) // set if this track was used to fit the primary vertex
56 Double_t covMatrix[21],
60 AliAODVertex *prodVertex,
62 Bool_t usedForPrimVtxFit,
63 AODTrk_t ttype=kUndef);
71 Float_t covMatrix[21],
75 AliAODVertex *prodVertex,
77 Bool_t usedForPrimVtxFit,
78 AODTrk_t ttype=kUndef);
80 virtual ~AliAODTrack();
81 AliAODTrack(const AliAODTrack& trk);
82 AliAODTrack& operator=(const AliAODTrack& trk);
85 virtual Double_t OneOverPt() const { return (fMomentum[0] != 0.) ? 1./fMomentum[0] : -999.; }
86 virtual Double_t Phi() const { return fMomentum[1]; }
87 virtual Double_t Theta() const { return fMomentum[2]; }
89 virtual Double_t Px() const { return fMomentum[0] * TMath::Cos(fMomentum[1]); }
90 virtual Double_t Py() const { return fMomentum[0] * TMath::Sin(fMomentum[1]); }
91 virtual Double_t Pz() const { return fMomentum[0] / TMath::Tan(fMomentum[2]); }
92 virtual Double_t Pt() const { return fMomentum[0]; }
93 virtual Double_t P() const { return TMath::Sqrt(Pt()*Pt()+Pz()*Pz()); }
95 Double_t Chi2perNDF() const { return fChi2perNDF; }
97 virtual Double_t M() const { return M(GetMostProbablePID()); }
98 Double_t M(AODTrkPID_t pid) const;
99 virtual Double_t E() const { return E(GetMostProbablePID()); }
100 Double_t E(AODTrkPID_t pid) const;
101 Double_t E(Double_t m) const { return TMath::Sqrt(P()*P() + m*m); }
102 virtual Double_t Y() const { return Y(GetMostProbablePID()); }
103 Double_t Y(AODTrkPID_t pid) const;
104 Double_t Y(Double_t m) const;
106 virtual Double_t Eta() const { return -TMath::Log(TMath::Tan(0.5 * fMomentum[2])); }
108 virtual Short_t Charge() const {return fCharge; }
111 virtual const Double_t *PID() const { return fPID; }
112 AODTrkPID_t GetMostProbablePID() const;
113 void ConvertAliPIDtoAODPID();
115 template <class T> void GetPID(T *pid) const {
116 for(Int_t i=0; i<10; ++i) pid[i]=fPID[i];}
118 template <class T> void SetPID(const T *pid) {
119 if(pid) for(Int_t i=0; i<10; ++i) fPID[i]=pid[i];
120 else {for(Int_t i=0; i<10; fPID[i++]=0.); fPID[AliAODTrack::kUnknown]=1.;}}
122 Int_t GetID() const { return fID; }
123 Int_t GetLabel() const { return fLabel; }
124 Char_t GetType() const { return fType;}
125 Bool_t GetUsedForVtxFit() const { return TestBit(kUsedForVtxFit); }
126 Bool_t GetUsedForPrimVtxFit() const { return TestBit(kUsedForPrimVtxFit); }
128 template <class T> void GetP(T *p) const {
129 p[0]=fMomentum[0]; p[1]=fMomentum[1]; p[2]=fMomentum[2];}
131 template <class T> void GetPxPyPz(T *p) const {
132 p[0] = Px(); p[1] = Py(); p[2] = Pz();}
134 template <class T> Bool_t GetPosition(T *x) const {
135 x[0]=fPosition[0]; x[1]=fPosition[1]; x[2]=fPosition[2];
136 return TestBit(kIsDCA);}
138 template <class T> void SetCovMatrix(const T *covMatrix) {
139 if(!fCovMatrix) fCovMatrix=new AliAODRedCov<6>();
140 fCovMatrix->SetCovMatrix(covMatrix);}
142 template <class T> Bool_t GetCovMatrix(T *covMatrix) const {
143 if(!fCovMatrix) return kFALSE;
144 fCovMatrix->GetCovMatrix(covMatrix); return kTRUE;}
146 void RemoveCovMatrix() {delete fCovMatrix; fCovMatrix=NULL;}
148 UChar_t GetITSClusterMap() const { return (UChar_t)fITSMuonClusterMap; }
149 UInt_t GetMUONClusterMap() const { return fITSMuonClusterMap/65536; }
150 UInt_t GetITSMUONClusterMap() const { return fITSMuonClusterMap; }
152 AliAODVertex *GetProdVertex() const { return (AliAODVertex*)fProdVertex.GetObject(); }
155 void Print(const Option_t *opt = "") const;
158 void SetID(Int_t id) { fID = id; }
159 void SetLabel(Int_t label) {fLabel = label; }
161 template <class T> void SetPosition(const T *x, Bool_t isDCA = kFALSE);
162 void SetDCA(Double_t d, Double_t z);
163 void SetUsedForVtxFit(Bool_t used = kTRUE) { used ? SetBit(kUsedForVtxFit) : ResetBit(kUsedForVtxFit); }
164 void SetUsedForPrimVtxFit(Bool_t used = kTRUE) { used ? SetBit(kUsedForPrimVtxFit) : ResetBit(kUsedForPrimVtxFit); }
166 void SetOneOverPt(Double_t oneOverPt) { fMomentum[0] = oneOverPt; }
167 void SetPt(Double_t pt) { fMomentum[0] = pt; };
168 void SetPhi(Double_t phi) { fMomentum[1] = phi; }
169 void SetTheta(Double_t theta) { fMomentum[2] = theta; }
170 template <class T> void SetP(const T *p, Bool_t cartesian = kTRUE);
171 void SetP() {fMomentum[0]=fMomentum[1]=fMomentum[2]=-999.;}
173 void SetCharge(Short_t q) { fCharge = q; }
174 void SetChi2perNDF(Double_t chi2perNDF) { fChi2perNDF = chi2perNDF; }
176 void SetITSClusterMap(UChar_t itsClusMap) { fITSMuonClusterMap = (UInt_t)itsClusMap; }
177 void SetMuonClusterMap(UInt_t muonClusMap) { fITSMuonClusterMap = muonClusMap*65536; }
178 void SetITSMuonClusterMap(UInt_t itsMuonClusMap) { fITSMuonClusterMap = itsMuonClusMap; }
180 Int_t GetMatchTrigger() const {return fITSMuonClusterMap>>30;}
181 // 0 Muon track does not match trigger
182 // 1 Muon track match but does not pass pt cut
183 // 2 Muon track match Low pt cut
184 // 3 Muon track match High pt cut
185 void SetMatchTrigger(Int_t MatchTrigger);
186 Int_t MatchTrigger(){ return (GetMatchTrigger()>0)?1:0; } // Muon track matches trigger track
187 Int_t MatchTriggerAnyPt(){ return (GetMatchTrigger()>0)?1:0; } // Muon track matches trigger track
188 Int_t MatchTriggerLowPt(){ return (GetMatchTrigger()>1)?1:0; } // Muon track matches trigger track and passes Low pt cut
189 Int_t MatchTriggerHighPt(){ return (GetMatchTrigger()>2)?1:0; } // Muon track matches trigger track and passes High pt cut
190 Double_t GetChi2MatchTrigger() const {return fChi2MatchTrigger;}
191 void SetChi2MatchTrigger(Double_t Chi2MatchTrigger) {fChi2MatchTrigger = Chi2MatchTrigger;}
192 UShort_t GetHitsPatternInTrigCh() const { return (fITSMuonClusterMap&0xff00)>>8; }
193 void SetHitsPatternInTrigCh(UShort_t hitsPatternInTrigCh);
194 Int_t HitsMT(Int_t istation, Int_t iplane, Char_t *cathode=0); // Check if track hits Muon chambers
195 Int_t HitsMuonChamber(Int_t MuonChamber); // Check if track hits Muon chambers
197 void SetProdVertex(TObject *vertex) { fProdVertex = vertex; }
200 void SetType(AODTrk_t ttype) { fType=ttype; }
204 // Momentum & position
205 Double32_t fMomentum[3]; // momemtum stored in pt, phi, theta
206 Double32_t fPosition[3]; // position of first point on track or dca
208 Double32_t fPID[10]; // [0.,1.,8] pointer to PID object
209 Double32_t fChi2perNDF; // chi2/NDF of mometum fit
211 Int_t fID; // unique track ID, points back to the ESD track
212 Int_t fLabel; // track label, points back to MC track
214 AliAODRedCov<6> *fCovMatrix; // covariance matrix (x, y, z, px, py, pz)
215 TRef fProdVertex; // vertex of origin
217 Char_t fCharge; // particle charge
218 UInt_t fITSMuonClusterMap; // map of ITS and muon clusters, one bit per layer (ITS: bit 1-8, muon: bit 17-32)
219 Char_t fType; // Track Type
221 Double_t fChi2MatchTrigger; // chi2 of trigger/track matching
223 ClassDef(AliAODTrack,2);