]>
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 AliVTrack | |
10 | // Author: Markus Oldenburg, CERN | |
11 | //------------------------------------------------------------------------- | |
12 | ||
13 | #include <TRef.h> | |
14 | ||
15 | #include "AliVTrack.h" | |
16 | #include "AliAODVertex.h" | |
17 | #include "AliAODRedCov.h" | |
18 | #include "AliAODPid.h" | |
19 | ||
20 | class AliAODTrack : public AliVTrack { | |
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 | Float_t chi2perNDF = -999.); | |
66 | ||
67 | AliAODTrack(Short_t id, | |
68 | Int_t label, | |
69 | Float_t p[3], | |
70 | Bool_t cartesian, | |
71 | Float_t x[3], | |
72 | Bool_t dca, | |
73 | Float_t covMatrix[21], | |
74 | Short_t q, | |
75 | UChar_t itsClusMap, | |
76 | Float_t pid[10], | |
77 | AliAODVertex *prodVertex, | |
78 | Bool_t usedForVtxFit, | |
79 | Bool_t usedForPrimVtxFit, | |
80 | AODTrk_t ttype=kUndef, | |
81 | UInt_t selectInfo=0, | |
82 | Float_t chi2perNDF = -999.); | |
83 | ||
84 | virtual ~AliAODTrack(); | |
85 | AliAODTrack(const AliAODTrack& trk); | |
86 | AliAODTrack& operator=(const AliAODTrack& trk); | |
87 | ||
88 | // kinematics | |
89 | virtual Double_t OneOverPt() const { return (fMomentum[0] != 0.) ? 1./fMomentum[0] : -999.; } | |
90 | virtual Double_t Phi() const { return fMomentum[1]; } | |
91 | virtual Double_t Theta() const { return fMomentum[2]; } | |
92 | ||
93 | virtual Double_t Px() const { return fMomentum[0] * TMath::Cos(fMomentum[1]); } | |
94 | virtual Double_t Py() const { return fMomentum[0] * TMath::Sin(fMomentum[1]); } | |
95 | virtual Double_t Pz() const { return fMomentum[0] / TMath::Tan(fMomentum[2]); } | |
96 | virtual Double_t Pt() const { return fMomentum[0]; } | |
97 | virtual Double_t P() const { return TMath::Sqrt(Pt()*Pt()+Pz()*Pz()); } | |
98 | virtual Bool_t PxPyPz(Double_t p[3]) const { p[0] = Px(); p[1] = Py(); p[2] = Pz(); return kTRUE; } | |
99 | ||
100 | virtual Double_t Xv() const { return GetProdVertex() ? GetProdVertex()->GetX() : -999.; } | |
101 | virtual Double_t Yv() const { return GetProdVertex() ? GetProdVertex()->GetY() : -999.; } | |
102 | virtual Double_t Zv() const { return GetProdVertex() ? GetProdVertex()->GetZ() : -999.; } | |
103 | virtual Bool_t XvYvZv(Double_t x[3]) const { x[0] = Xv(); x[1] = Yv(); x[2] = Zv(); return kTRUE; } | |
104 | ||
105 | Double_t Chi2perNDF() const { return fChi2perNDF; } | |
106 | ||
107 | virtual Double_t M() const { return M(GetMostProbablePID()); } | |
108 | Double_t M(AODTrkPID_t pid) const; | |
109 | virtual Double_t E() const { return E(GetMostProbablePID()); } | |
110 | Double_t E(AODTrkPID_t pid) const; | |
111 | Double_t E(Double_t m) const { return TMath::Sqrt(P()*P() + m*m); } | |
112 | virtual Double_t Y() const { return Y(GetMostProbablePID()); } | |
113 | Double_t Y(AODTrkPID_t pid) const; | |
114 | Double_t Y(Double_t m) const; | |
115 | ||
116 | virtual Double_t Eta() const { return -TMath::Log(TMath::Tan(0.5 * fMomentum[2])); } | |
117 | ||
118 | virtual Short_t Charge() const {return fCharge; } | |
119 | ||
120 | // PID | |
121 | virtual const Double_t *PID() const { return fPID; } | |
122 | AODTrkPID_t GetMostProbablePID() const; | |
123 | void ConvertAliPIDtoAODPID(); | |
124 | void SetDetPID(AliAODPid *aodpid) {fDetPid = aodpid;} | |
125 | ||
126 | template <class T> void GetPID(T *pid) const { | |
127 | for(Int_t i=0; i<10; ++i) pid[i]=fPID[i];} | |
128 | ||
129 | template <class T> void SetPID(const T *pid) { | |
130 | if(pid) for(Int_t i=0; i<10; ++i) fPID[i]=pid[i]; | |
131 | else {for(Int_t i=0; i<10; fPID[i++]=0.) ; fPID[AliAODTrack::kUnknown]=1.;}} | |
132 | ||
133 | Bool_t IsOn(Int_t mask) const {return (fFlags&mask)>0;} | |
134 | ULong_t GetStatus() const { return GetFlags(); } | |
135 | ULong_t GetFlags() const { return fFlags; } | |
136 | ||
137 | Int_t GetID() const { return (Int_t)fID; } | |
138 | Int_t GetLabel() const { return fLabel; } | |
139 | Char_t GetType() const { return fType;} | |
140 | Bool_t IsPrimaryCandidate() const; | |
141 | Bool_t GetUsedForVtxFit() const { return TestBit(kUsedForVtxFit); } | |
142 | Bool_t GetUsedForPrimVtxFit() const { return TestBit(kUsedForPrimVtxFit); } | |
143 | ||
144 | template <class T> void GetP(T *p) const { | |
145 | p[0]=fMomentum[0]; p[1]=fMomentum[1]; p[2]=fMomentum[2];} | |
146 | ||
147 | template <class T> void GetPxPyPz(T *p) const { | |
148 | p[0] = Px(); p[1] = Py(); p[2] = Pz();} | |
149 | ||
150 | template <class T> Bool_t GetPosition(T *x) const { | |
151 | x[0]=fPosition[0]; x[1]=fPosition[1]; x[2]=fPosition[2]; | |
152 | return TestBit(kIsDCA);} | |
153 | ||
154 | template <class T> void SetCovMatrix(const T *covMatrix) { | |
155 | if(!fCovMatrix) fCovMatrix=new AliAODRedCov<6>(); | |
156 | fCovMatrix->SetCovMatrix(covMatrix);} | |
157 | ||
158 | template <class T> Bool_t GetCovMatrix(T *covMatrix) const { | |
159 | if(!fCovMatrix) return kFALSE; | |
160 | fCovMatrix->GetCovMatrix(covMatrix); return kTRUE;} | |
161 | ||
162 | Bool_t GetXYZ(Double_t *p) const { | |
163 | return GetPosition(p); } | |
164 | ||
165 | Bool_t GetCovarianceXYZPxPyPz(Double_t cv[21]) const { | |
166 | return GetCovMatrix(cv);} | |
167 | ||
168 | void RemoveCovMatrix() {delete fCovMatrix; fCovMatrix=NULL;} | |
169 | ||
170 | Double_t XAtDCA() const { return fPositionAtDCA[0]; } | |
171 | Double_t YAtDCA() const { return fPositionAtDCA[1]; } | |
172 | Double_t ZAtDCA() const { | |
173 | if (IsMuonTrack()) return fPosition[2]; | |
174 | else if (TestBit(kIsDCA)) return fPosition[1]; | |
175 | else return -999.; } | |
176 | Bool_t XYZAtDCA(Double_t x[3]) const { x[0] = XAtDCA(); x[1] = YAtDCA(); x[2] = ZAtDCA(); return kTRUE; } | |
177 | ||
178 | Double_t DCA() const { | |
179 | if (IsMuonTrack()) return TMath::Sqrt(XAtDCA()*XAtDCA() + YAtDCA()*YAtDCA()); | |
180 | else if (TestBit(kIsDCA)) return fPosition[0]; | |
181 | else return -999.; } | |
182 | ||
183 | Double_t PxAtDCA() const { return fMomentumAtDCA[0]; } | |
184 | Double_t PyAtDCA() const { return fMomentumAtDCA[1]; } | |
185 | Double_t PzAtDCA() const { return fMomentumAtDCA[2]; } | |
186 | Double_t PAtDCA() const { return TMath::Sqrt(PxAtDCA()*PxAtDCA() + PyAtDCA()*PyAtDCA() + PzAtDCA()*PzAtDCA()); } | |
187 | Bool_t PxPyPzAtDCA(Double_t p[3]) const { p[0] = PxAtDCA(); p[1] = PyAtDCA(); p[2] = PzAtDCA(); return kTRUE; } | |
188 | ||
189 | UChar_t GetITSClusterMap() const { return (UChar_t)(fITSMuonClusterMap&0xff); } | |
190 | UShort_t GetHitsPatternInTrigCh() const { return (UShort_t)((fITSMuonClusterMap&0xff00)>>8); } | |
191 | UInt_t GetMUONClusterMap() const { return (fITSMuonClusterMap&0x3ff0000)>>16; } | |
192 | UInt_t GetITSMUONClusterMap() const { return fITSMuonClusterMap; } | |
193 | ||
194 | Bool_t TestFilterBit(UInt_t filterBit) const {return (Bool_t) ((filterBit & fFilterMap) != 0);} | |
195 | ||
196 | AliAODPid *GetDetPid() const { return fDetPid; } | |
197 | AliAODVertex *GetProdVertex() const { return (AliAODVertex*)fProdVertex.GetObject(); } | |
198 | ||
199 | ||
200 | void Print(const Option_t *opt = "") const; | |
201 | ||
202 | // setters | |
203 | void SetFlags(ULong_t flags) { fFlags = flags; } | |
204 | void SetStatus(ULong_t flags) { fFlags|=flags; } | |
205 | void ResetStatus(ULong_t flags) { fFlags&=~flags; } | |
206 | ||
207 | void SetID(Short_t id) { fID = id; } | |
208 | void SetLabel(Int_t label) { fLabel = label; } | |
209 | ||
210 | template <class T> void SetPosition(const T *x, Bool_t isDCA = kFALSE); | |
211 | void SetDCA(Double_t d, Double_t z); | |
212 | void SetUsedForVtxFit(Bool_t used = kTRUE) { used ? SetBit(kUsedForVtxFit) : ResetBit(kUsedForVtxFit); } | |
213 | void SetUsedForPrimVtxFit(Bool_t used = kTRUE) { used ? SetBit(kUsedForPrimVtxFit) : ResetBit(kUsedForPrimVtxFit); } | |
214 | ||
215 | void SetOneOverPt(Double_t oneOverPt) { fMomentum[0] = oneOverPt; } | |
216 | void SetPt(Double_t pt) { fMomentum[0] = pt; }; | |
217 | void SetPhi(Double_t phi) { fMomentum[1] = phi; } | |
218 | void SetTheta(Double_t theta) { fMomentum[2] = theta; } | |
219 | template <class T> void SetP(const T *p, Bool_t cartesian = kTRUE); | |
220 | void SetP() {fMomentum[0]=fMomentum[1]=fMomentum[2]=-999.;} | |
221 | ||
222 | void SetXYAtDCA(Double_t x, Double_t y) {fPositionAtDCA[0] = x; fPositionAtDCA[1] = y;} | |
223 | void SetPxPyPzAtDCA(Double_t pX, Double_t pY, Double_t pZ) {fMomentumAtDCA[0] = pX; fMomentumAtDCA[1] = pY; fMomentumAtDCA[2] = pZ;} | |
224 | ||
225 | void SetCharge(Short_t q) { fCharge = q; } | |
226 | void SetChi2perNDF(Double_t chi2perNDF) { fChi2perNDF = chi2perNDF; } | |
227 | ||
228 | void SetITSClusterMap(UChar_t itsClusMap) { fITSMuonClusterMap = (fITSMuonClusterMap&0xffffff00)|(((UInt_t)itsClusMap)&0xff); } | |
229 | void SetHitsPatternInTrigCh(UShort_t hitsPatternInTrigCh) { fITSMuonClusterMap = (fITSMuonClusterMap&0xffff00ff)|((((UInt_t)hitsPatternInTrigCh)&0xff)<<8); } | |
230 | void SetMuonClusterMap(UInt_t muonClusMap) { fITSMuonClusterMap = (fITSMuonClusterMap&0xfc00ffff)|((muonClusMap&0x3ff)<<16); } | |
231 | void SetITSMuonClusterMap(UInt_t itsMuonClusMap) { fITSMuonClusterMap = itsMuonClusMap; } | |
232 | ||
233 | Int_t GetMatchTrigger() const {return fITSMuonClusterMap>>30;} | |
234 | // 0 Muon track does not match trigger | |
235 | // 1 Muon track match but does not pass pt cut | |
236 | // 2 Muon track match Low pt cut | |
237 | // 3 Muon track match High pt cut | |
238 | void SetMatchTrigger(Int_t MatchTrigger); | |
239 | Int_t MatchTrigger() const { return (GetMatchTrigger()>0)?1:0; } // Muon track matches trigger track | |
240 | Int_t MatchTriggerAnyPt() const { return (GetMatchTrigger()>0)?1:0; } // Muon track matches trigger track | |
241 | Int_t MatchTriggerLowPt() const { return (GetMatchTrigger()>1)?1:0; } // Muon track matches trigger track and passes Low pt cut | |
242 | Int_t MatchTriggerHighPt() const { return (GetMatchTrigger()>2)?1:0; } // Muon track matches trigger track and passes High pt cut | |
243 | Double_t GetChi2MatchTrigger() const { return fChi2MatchTrigger;} | |
244 | void SetChi2MatchTrigger(Double_t Chi2MatchTrigger) {fChi2MatchTrigger = Chi2MatchTrigger; } | |
245 | Int_t HitsMT(Int_t istation, Int_t iplane, Option_t *cathode=0); // Check if track hits Muon chambers | |
246 | Int_t HitsMuonChamber(Int_t MuonChamber); // Check if track hits Muon chambers | |
247 | Bool_t IsMuonTrack() const { return (GetMUONClusterMap()>0) ? kTRUE : kFALSE; } | |
248 | ||
249 | void SetProdVertex(TObject *vertex) { fProdVertex = vertex; } | |
250 | void SetType(AODTrk_t ttype) { fType=ttype; } | |
251 | ||
252 | ||
253 | private : | |
254 | ||
255 | // Momentum & position | |
256 | Double32_t fMomentum[3]; // momemtum stored in pt, phi, theta | |
257 | Double32_t fPosition[3]; // position of first point on track or dca | |
258 | ||
259 | Double32_t fMomentumAtDCA[3]; // momentum (px,py,pz) at DCA | |
260 | Double32_t fPositionAtDCA[2]; // trasverse position (x,y) at DCA | |
261 | ||
262 | Double32_t fChi2perNDF; // chi2/NDF of momentum fit | |
263 | Double32_t fChi2MatchTrigger; // chi2 of trigger/track matching | |
264 | Double32_t fPID[10]; // [0.,1.,8] pointer to PID object | |
265 | ||
266 | ULong_t fFlags; // reconstruction status flags | |
267 | Int_t fLabel; // track label, points back to MC track | |
268 | ||
269 | UInt_t fITSMuonClusterMap; // map of ITS and muon clusters, one bit per layer | |
270 | // (ITS: bit 1-8, muon trigger: bit 9-16, muon tracker: bit 17-26, muon match trigger: bit 31-32) | |
271 | UInt_t fFilterMap; // filter information, one bit per set of cuts | |
272 | ||
273 | Short_t fID; // unique track ID, points back to the ESD track | |
274 | ||
275 | Char_t fCharge; // particle charge | |
276 | Char_t fType; // Track Type | |
277 | ||
278 | AliAODRedCov<6> *fCovMatrix; // covariance matrix (x, y, z, px, py, pz) | |
279 | AliAODPid *fDetPid; // more detailed or detector specific pid information | |
280 | TRef fProdVertex; // vertex of origin | |
281 | ||
282 | ClassDef(AliAODTrack,8); | |
283 | }; | |
284 | ||
285 | inline Bool_t AliAODTrack::IsPrimaryCandidate() const | |
286 | { | |
287 | // True of track passes primary particle selection (independent of type) | |
288 | // | |
289 | if (fFilterMap) { | |
290 | return kTRUE; | |
291 | } else { | |
292 | return kFALSE; | |
293 | } | |
294 | } | |
295 | ||
296 | #endif |