]>
Commit | Line | Data |
---|---|---|
1 | #ifndef AliAODTrack_H | |
2 | #define AliAODTrack_H | |
3 | /* Copyright(c) 1998-2007, ALICE Experiment at CERN, All rights reserved. * | |
4 | * See cxx source for full Copyright notice */ | |
5 | ||
6 | /* $Id$ */ | |
7 | ||
8 | //------------------------------------------------------------------------- | |
9 | // AOD track implementation of AliVParticle | |
10 | // Author: Markus Oldenburg, CERN | |
11 | //------------------------------------------------------------------------- | |
12 | ||
13 | #include <TRef.h> | |
14 | ||
15 | #include "AliVParticle.h" | |
16 | #include "AliAODVertex.h" | |
17 | #include "AliAODRedCov.h" | |
18 | #include "AliAODPid.h" | |
19 | ||
20 | class AliAODTrack : public AliVParticle { | |
21 | ||
22 | public: | |
23 | ||
24 | enum AODTrk_t {kUndef = -1, | |
25 | kPrimary, | |
26 | kSecondary, | |
27 | kOrphan}; | |
28 | ||
29 | enum AODTrkBits_t { | |
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 | |
33 | }; | |
34 | ||
35 | enum AODTrkPID_t { | |
36 | kElectron = 0, | |
37 | kMuon = 1, | |
38 | kPion = 2, | |
39 | kKaon = 3, | |
40 | kProton = 4, | |
41 | kDeuteron = 5, | |
42 | kTriton = 6, | |
43 | kHelium3 = 7, | |
44 | kAlpha = 8, | |
45 | kUnknown = 9, | |
46 | kMostProbable = -1 | |
47 | }; | |
48 | ||
49 | AliAODTrack(); | |
50 | AliAODTrack(Short_t id, | |
51 | Int_t label, | |
52 | Double_t p[3], | |
53 | Bool_t cartesian, | |
54 | Double_t x[3], | |
55 | Bool_t dca, | |
56 | Double_t covMatrix[21], | |
57 | Short_t q, | |
58 | UChar_t itsClusMap, | |
59 | Double_t pid[10], | |
60 | AliAODVertex *prodVertex, | |
61 | Bool_t usedForVtxFit, | |
62 | Bool_t usedForPrimVtxFit, | |
63 | AODTrk_t ttype=kUndef, | |
64 | UInt_t selectInfo=0); | |
65 | ||
66 | AliAODTrack(Short_t id, | |
67 | Int_t label, | |
68 | Float_t p[3], | |
69 | Bool_t cartesian, | |
70 | Float_t x[3], | |
71 | Bool_t dca, | |
72 | Float_t covMatrix[21], | |
73 | Short_t q, | |
74 | UChar_t itsClusMap, | |
75 | Float_t pid[10], | |
76 | AliAODVertex *prodVertex, | |
77 | Bool_t usedForVtxFit, | |
78 | Bool_t usedForPrimVtxFit, | |
79 | AODTrk_t ttype=kUndef, | |
80 | UInt_t selectInfo=0); | |
81 | ||
82 | virtual ~AliAODTrack(); | |
83 | AliAODTrack(const AliAODTrack& trk); | |
84 | AliAODTrack& operator=(const AliAODTrack& trk); | |
85 | ||
86 | // kinematics | |
87 | virtual Double_t OneOverPt() const { return (fMomentum[0] != 0.) ? 1./fMomentum[0] : -999.; } | |
88 | virtual Double_t Phi() const { return fMomentum[1]; } | |
89 | virtual Double_t Theta() const { return fMomentum[2]; } | |
90 | ||
91 | virtual Double_t Px() const { return fMomentum[0] * TMath::Cos(fMomentum[1]); } | |
92 | virtual Double_t Py() const { return fMomentum[0] * TMath::Sin(fMomentum[1]); } | |
93 | virtual Double_t Pz() const { return fMomentum[0] / TMath::Tan(fMomentum[2]); } | |
94 | virtual Double_t Pt() const { return fMomentum[0]; } | |
95 | virtual Double_t P() const { return TMath::Sqrt(Pt()*Pt()+Pz()*Pz()); } | |
96 | virtual Bool_t PxPyPz(Double_t p[3]) const { p[0] = Px(); p[1] = Py(); p[2] = Pz(); return kTRUE; } | |
97 | ||
98 | virtual Double_t Xv() const { return GetProdVertex() ? GetProdVertex()->GetX() : -999.; } | |
99 | virtual Double_t Yv() const { return GetProdVertex() ? GetProdVertex()->GetY() : -999.; } | |
100 | virtual Double_t Zv() const { return GetProdVertex() ? GetProdVertex()->GetZ() : -999.; } | |
101 | virtual Bool_t XvYvZv(Double_t x[3]) const { x[0] = Xv(); x[1] = Yv(); x[2] = Zv(); return kTRUE; } | |
102 | ||
103 | Double_t Chi2perNDF() const { return fChi2perNDF; } | |
104 | ||
105 | virtual Double_t M() const { return M(GetMostProbablePID()); } | |
106 | Double_t M(AODTrkPID_t pid) const; | |
107 | virtual Double_t E() const { return E(GetMostProbablePID()); } | |
108 | Double_t E(AODTrkPID_t pid) const; | |
109 | Double_t E(Double_t m) const { return TMath::Sqrt(P()*P() + m*m); } | |
110 | virtual Double_t Y() const { return Y(GetMostProbablePID()); } | |
111 | Double_t Y(AODTrkPID_t pid) const; | |
112 | Double_t Y(Double_t m) const; | |
113 | ||
114 | virtual Double_t Eta() const { return -TMath::Log(TMath::Tan(0.5 * fMomentum[2])); } | |
115 | ||
116 | virtual Short_t Charge() const {return fCharge; } | |
117 | ||
118 | // PID | |
119 | virtual const Double_t *PID() const { return fPID; } | |
120 | AODTrkPID_t GetMostProbablePID() const; | |
121 | void ConvertAliPIDtoAODPID(); | |
122 | ||
123 | template <class T> void GetPID(T *pid) const { | |
124 | for(Int_t i=0; i<10; ++i) pid[i]=fPID[i];} | |
125 | ||
126 | template <class T> void SetPID(const T *pid) { | |
127 | if(pid) for(Int_t i=0; i<10; ++i) fPID[i]=pid[i]; | |
128 | else {for(Int_t i=0; i<10; fPID[i++]=0.); fPID[AliAODTrack::kUnknown]=1.;}} | |
129 | ||
130 | Bool_t IsOn(Int_t mask) const {return (fFlags&mask)>0;} | |
131 | ULong_t GetStatus() const { return GetFlags(); } | |
132 | ULong_t GetFlags() const { return fFlags; } | |
133 | ||
134 | Short_t GetID() const { return fID; } | |
135 | Int_t GetLabel() const { return fLabel; } | |
136 | Char_t GetType() const { return fType;} | |
137 | Bool_t GetUsedForVtxFit() const { return TestBit(kUsedForVtxFit); } | |
138 | Bool_t GetUsedForPrimVtxFit() const { return TestBit(kUsedForPrimVtxFit); } | |
139 | ||
140 | template <class T> void GetP(T *p) const { | |
141 | p[0]=fMomentum[0]; p[1]=fMomentum[1]; p[2]=fMomentum[2];} | |
142 | ||
143 | template <class T> void GetPxPyPz(T *p) const { | |
144 | p[0] = Px(); p[1] = Py(); p[2] = Pz();} | |
145 | ||
146 | template <class T> Bool_t GetPosition(T *x) const { | |
147 | x[0]=fPosition[0]; x[1]=fPosition[1]; x[2]=fPosition[2]; | |
148 | return TestBit(kIsDCA);} | |
149 | ||
150 | template <class T> void SetCovMatrix(const T *covMatrix) { | |
151 | if(!fCovMatrix) fCovMatrix=new AliAODRedCov<6>(); | |
152 | fCovMatrix->SetCovMatrix(covMatrix);} | |
153 | ||
154 | template <class T> Bool_t GetCovMatrix(T *covMatrix) const { | |
155 | if(!fCovMatrix) return kFALSE; | |
156 | fCovMatrix->GetCovMatrix(covMatrix); return kTRUE;} | |
157 | ||
158 | void RemoveCovMatrix() {delete fCovMatrix; fCovMatrix=NULL;} | |
159 | ||
160 | UChar_t GetITSClusterMap() const { return (UChar_t)fITSMuonClusterMap; } | |
161 | UInt_t GetMUONClusterMap() const { return fITSMuonClusterMap/65536; } | |
162 | UInt_t GetITSMUONClusterMap() const { return fITSMuonClusterMap; } | |
163 | Bool_t TestFilterBit(UInt_t filterBit) const {return (Bool_t) ((filterBit & fFilterMap) != 0);} | |
164 | ||
165 | AliAODPid *GetDetPid() const { return fDetPid; } | |
166 | AliAODVertex *GetProdVertex() const { return (AliAODVertex*)fProdVertex.GetObject(); } | |
167 | ||
168 | ||
169 | void Print(const Option_t *opt = "") const; | |
170 | ||
171 | // setters | |
172 | void SetFlags(ULong_t flags) { fFlags = flags; } | |
173 | void SetStatus(ULong_t flags) { fFlags|=flags; } | |
174 | void ResetStatus(ULong_t flags) { fFlags&=~flags; } | |
175 | ||
176 | void SetID(Short_t id) { fID = id; } | |
177 | void SetLabel(Int_t label) { fLabel = label; } | |
178 | ||
179 | template <class T> void SetPosition(const T *x, Bool_t isDCA = kFALSE); | |
180 | void SetDCA(Double_t d, Double_t z); | |
181 | void SetUsedForVtxFit(Bool_t used = kTRUE) { used ? SetBit(kUsedForVtxFit) : ResetBit(kUsedForVtxFit); } | |
182 | void SetUsedForPrimVtxFit(Bool_t used = kTRUE) { used ? SetBit(kUsedForPrimVtxFit) : ResetBit(kUsedForPrimVtxFit); } | |
183 | ||
184 | void SetOneOverPt(Double_t oneOverPt) { fMomentum[0] = oneOverPt; } | |
185 | void SetPt(Double_t pt) { fMomentum[0] = pt; }; | |
186 | void SetPhi(Double_t phi) { fMomentum[1] = phi; } | |
187 | void SetTheta(Double_t theta) { fMomentum[2] = theta; } | |
188 | template <class T> void SetP(const T *p, Bool_t cartesian = kTRUE); | |
189 | void SetP() {fMomentum[0]=fMomentum[1]=fMomentum[2]=-999.;} | |
190 | ||
191 | void SetCharge(Short_t q) { fCharge = q; } | |
192 | void SetChi2perNDF(Double_t chi2perNDF) { fChi2perNDF = chi2perNDF; } | |
193 | ||
194 | void SetITSClusterMap(UChar_t itsClusMap) { fITSMuonClusterMap = (UInt_t)itsClusMap; } | |
195 | void SetMuonClusterMap(UInt_t muonClusMap) { fITSMuonClusterMap = muonClusMap*65536; } | |
196 | void SetITSMuonClusterMap(UInt_t itsMuonClusMap) { fITSMuonClusterMap = itsMuonClusMap; } | |
197 | ||
198 | Int_t GetMatchTrigger() const {return fITSMuonClusterMap>>30;} | |
199 | // 0 Muon track does not match trigger | |
200 | // 1 Muon track match but does not pass pt cut | |
201 | // 2 Muon track match Low pt cut | |
202 | // 3 Muon track match High pt cut | |
203 | void SetMatchTrigger(Int_t MatchTrigger); | |
204 | Int_t MatchTrigger() const { return (GetMatchTrigger()>0)?1:0; } // Muon track matches trigger track | |
205 | Int_t MatchTriggerAnyPt() const { return (GetMatchTrigger()>0)?1:0; } // Muon track matches trigger track | |
206 | Int_t MatchTriggerLowPt() const { return (GetMatchTrigger()>1)?1:0; } // Muon track matches trigger track and passes Low pt cut | |
207 | Int_t MatchTriggerHighPt() const { return (GetMatchTrigger()>2)?1:0; } // Muon track matches trigger track and passes High pt cut | |
208 | Double_t GetChi2MatchTrigger() const { return fChi2MatchTrigger;} | |
209 | void SetChi2MatchTrigger(Double_t Chi2MatchTrigger) {fChi2MatchTrigger = Chi2MatchTrigger;} | |
210 | UShort_t GetHitsPatternInTrigCh() const { return (fITSMuonClusterMap&0xff00)>>8; } | |
211 | void SetHitsPatternInTrigCh(UShort_t hitsPatternInTrigCh); | |
212 | Int_t HitsMT(Int_t istation, Int_t iplane, Char_t *cathode=0); // Check if track hits Muon chambers | |
213 | Int_t HitsMuonChamber(Int_t MuonChamber); // Check if track hits Muon chambers | |
214 | Bool_t IsMuonTrack() const { return fITSMuonClusterMap>>16;} // This scheme has to be checked, still! | |
215 | ||
216 | void SetProdVertex(TObject *vertex) { fProdVertex = vertex; } | |
217 | void SetType(AODTrk_t ttype) { fType=ttype; } | |
218 | ||
219 | // track operations | |
220 | Bool_t PropagateTo(Double_t xk, Double_t b); | |
221 | ||
222 | ||
223 | private : | |
224 | ||
225 | // Momentum & position | |
226 | Double32_t fMomentum[3]; // momemtum stored in pt, phi, theta | |
227 | Double32_t fPosition[3]; // position of first point on track or dca | |
228 | ||
229 | Double32_t fChi2perNDF; // chi2/NDF of mometum fit | |
230 | Double32_t fChi2MatchTrigger; // chi2 of trigger/track matching | |
231 | Double32_t fPID[10]; // [0.,1.,8] pointer to PID object | |
232 | ||
233 | ULong_t fFlags; // reconstruction status flags | |
234 | Int_t fLabel; // track label, points back to MC track | |
235 | ||
236 | UInt_t fITSMuonClusterMap; // map of ITS and muon clusters, one bit per layer (ITS: bit 1-8, muon: bit 17-32) | |
237 | UInt_t fFilterMap; // filter information, one bit per set of cuts | |
238 | ||
239 | Short_t fID; // unique track ID, points back to the ESD track | |
240 | ||
241 | Char_t fCharge; // particle charge | |
242 | Char_t fType; // Track Type | |
243 | ||
244 | AliAODRedCov<6> *fCovMatrix; // covariance matrix (x, y, z, px, py, pz) | |
245 | AliAODPid *fDetPid; // more detailed or detector specific pid information | |
246 | TRef fProdVertex; // vertex of origin | |
247 | ||
248 | ClassDef(AliAODTrack,7); | |
249 | }; | |
250 | ||
251 | #endif |