]>
Commit | Line | Data |
---|---|---|
df9db588 | 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 | //------------------------------------------------------------------------- | |
4f6e22bd | 9 | // AOD track implementation of AliVTrack |
df9db588 | 10 | // Author: Markus Oldenburg, CERN |
11 | //------------------------------------------------------------------------- | |
12 | ||
13 | #include <TRef.h> | |
507ed024 | 14 | #include <TBits.h> |
df9db588 | 15 | |
4f6e22bd | 16 | #include "AliVTrack.h" |
df9db588 | 17 | #include "AliAODVertex.h" |
5d62ce04 | 18 | #include "AliAODRedCov.h" |
7be1db84 | 19 | #include "AliAODPid.h" |
c8fe2783 | 20 | |
df9db588 | 21 | |
6dc40b1c | 22 | class AliVVertex; |
23 | ||
4f6e22bd | 24 | class AliAODTrack : public AliVTrack { |
df9db588 | 25 | |
26 | public: | |
27 | ||
1912763f | 28 | enum AODTrk_t {kUndef = -1, |
29 | kPrimary, | |
30 | kSecondary, | |
31 | kOrphan}; | |
df9db588 | 32 | |
33 | enum AODTrkBits_t { | |
dc825b15 | 34 | kIsDCA=BIT(14), // set if fPosition is the DCA and not the position of the first point |
1912763f | 35 | kUsedForVtxFit=BIT(15), // set if this track was used to fit the vertex it is attached to |
36 | kUsedForPrimVtxFit=BIT(16) // set if this track was used to fit the primary vertex | |
df9db588 | 37 | }; |
38 | ||
4697e4fb | 39 | enum AODTrkPID_t { |
1912763f | 40 | kElectron = 0, |
41 | kMuon = 1, | |
42 | kPion = 2, | |
43 | kKaon = 3, | |
44 | kProton = 4, | |
4697e4fb | 45 | kDeuteron = 5, |
46 | kTriton = 6, | |
47 | kHelium3 = 7, | |
48 | kAlpha = 8, | |
49 | kUnknown = 9, | |
50 | kMostProbable = -1 | |
51 | }; | |
df9db588 | 52 | |
53 | AliAODTrack(); | |
02153d58 | 54 | AliAODTrack(Short_t id, |
df9db588 | 55 | Int_t label, |
56 | Double_t p[3], | |
57 | Bool_t cartesian, | |
58 | Double_t x[3], | |
59 | Bool_t dca, | |
60 | Double_t covMatrix[21], | |
61 | Short_t q, | |
62 | UChar_t itsClusMap, | |
63 | Double_t pid[10], | |
64 | AliAODVertex *prodVertex, | |
1912763f | 65 | Bool_t usedForVtxFit, |
dc825b15 | 66 | Bool_t usedForPrimVtxFit, |
ec40c484 | 67 | AODTrk_t ttype=kUndef, |
862ce351 | 68 | UInt_t selectInfo=0, |
69 | Float_t chi2perNDF = -999.); | |
df9db588 | 70 | |
02153d58 | 71 | AliAODTrack(Short_t id, |
df9db588 | 72 | Int_t label, |
73 | Float_t p[3], | |
74 | Bool_t cartesian, | |
75 | Float_t x[3], | |
76 | Bool_t dca, | |
77 | Float_t covMatrix[21], | |
78 | Short_t q, | |
79 | UChar_t itsClusMap, | |
80 | Float_t pid[10], | |
81 | AliAODVertex *prodVertex, | |
1912763f | 82 | Bool_t usedForVtxFit, |
dc825b15 | 83 | Bool_t usedForPrimVtxFit, |
ec40c484 | 84 | AODTrk_t ttype=kUndef, |
862ce351 | 85 | UInt_t selectInfo=0, |
86 | Float_t chi2perNDF = -999.); | |
df9db588 | 87 | |
88 | virtual ~AliAODTrack(); | |
89 | AliAODTrack(const AliAODTrack& trk); | |
90 | AliAODTrack& operator=(const AliAODTrack& trk); | |
91 | ||
92 | // kinematics | |
16b65f2a | 93 | virtual Double_t OneOverPt() const { return (fMomentum[0] != 0.) ? 1./fMomentum[0] : -999.; } |
df9db588 | 94 | virtual Double_t Phi() const { return fMomentum[1]; } |
95 | virtual Double_t Theta() const { return fMomentum[2]; } | |
96 | ||
16b65f2a | 97 | virtual Double_t Px() const { return fMomentum[0] * TMath::Cos(fMomentum[1]); } |
98 | virtual Double_t Py() const { return fMomentum[0] * TMath::Sin(fMomentum[1]); } | |
99 | virtual Double_t Pz() const { return fMomentum[0] / TMath::Tan(fMomentum[2]); } | |
100 | virtual Double_t Pt() const { return fMomentum[0]; } | |
df9db588 | 101 | virtual Double_t P() const { return TMath::Sqrt(Pt()*Pt()+Pz()*Pz()); } |
c683ddc2 | 102 | virtual Bool_t PxPyPz(Double_t p[3]) const { p[0] = Px(); p[1] = Py(); p[2] = Pz(); return kTRUE; } |
103 | ||
104 | virtual Double_t Xv() const { return GetProdVertex() ? GetProdVertex()->GetX() : -999.; } | |
105 | virtual Double_t Yv() const { return GetProdVertex() ? GetProdVertex()->GetY() : -999.; } | |
106 | virtual Double_t Zv() const { return GetProdVertex() ? GetProdVertex()->GetZ() : -999.; } | |
107 | virtual Bool_t XvYvZv(Double_t x[3]) const { x[0] = Xv(); x[1] = Yv(); x[2] = Zv(); return kTRUE; } | |
108 | ||
c4460410 | 109 | Double_t Chi2perNDF() const { return fChi2perNDF; } |
110 | UShort_t GetTPCNcls() const { return fTPCClusterMap.CountBits();} | |
4697e4fb | 111 | |
112 | virtual Double_t M() const { return M(GetMostProbablePID()); } | |
113 | Double_t M(AODTrkPID_t pid) const; | |
114 | virtual Double_t E() const { return E(GetMostProbablePID()); } | |
115 | Double_t E(AODTrkPID_t pid) const; | |
116 | Double_t E(Double_t m) const { return TMath::Sqrt(P()*P() + m*m); } | |
117 | virtual Double_t Y() const { return Y(GetMostProbablePID()); } | |
118 | Double_t Y(AODTrkPID_t pid) const; | |
119 | Double_t Y(Double_t m) const; | |
df9db588 | 120 | |
121 | virtual Double_t Eta() const { return -TMath::Log(TMath::Tan(0.5 * fMomentum[2])); } | |
df9db588 | 122 | |
123 | virtual Short_t Charge() const {return fCharge; } | |
124 | ||
6dc40b1c | 125 | virtual Bool_t PropagateToDCA(const AliVVertex *vtx, |
126 | Double_t b, Double_t maxd, Double_t dz[2], Double_t covar[3]); | |
127 | ||
df9db588 | 128 | // PID |
129 | virtual const Double_t *PID() const { return fPID; } | |
4697e4fb | 130 | AODTrkPID_t GetMostProbablePID() const; |
131 | void ConvertAliPIDtoAODPID(); | |
e68fa179 | 132 | void SetDetPID(AliAODPid *aodpid) {fDetPid = aodpid;} |
df9db588 | 133 | |
134 | template <class T> void GetPID(T *pid) const { | |
135 | for(Int_t i=0; i<10; ++i) pid[i]=fPID[i];} | |
136 | ||
137 | template <class T> void SetPID(const T *pid) { | |
138 | if(pid) for(Int_t i=0; i<10; ++i) fPID[i]=pid[i]; | |
f12d42ce | 139 | else {for(Int_t i=0; i<10; fPID[i++]=0.) ; fPID[AliAODTrack::kUnknown]=1.;}} |
df9db588 | 140 | |
6efb741f | 141 | Bool_t IsOn(Int_t mask) const {return (fFlags&mask)>0;} |
142 | ULong_t GetStatus() const { return GetFlags(); } | |
143 | ULong_t GetFlags() const { return fFlags; } | |
144 | ||
4f6e22bd | 145 | Int_t GetID() const { return (Int_t)fID; } |
02153d58 | 146 | Int_t GetLabel() const { return fLabel; } |
147 | Char_t GetType() const { return fType;} | |
862ce351 | 148 | Bool_t IsPrimaryCandidate() const; |
02153d58 | 149 | Bool_t GetUsedForVtxFit() const { return TestBit(kUsedForVtxFit); } |
150 | Bool_t GetUsedForPrimVtxFit() const { return TestBit(kUsedForPrimVtxFit); } | |
df9db588 | 151 | |
152 | template <class T> void GetP(T *p) const { | |
153 | p[0]=fMomentum[0]; p[1]=fMomentum[1]; p[2]=fMomentum[2];} | |
154 | ||
c8fe2783 | 155 | // template <class T> void GetPxPyPz(T *p) const { |
156 | // p[0] = Px(); p[1] = Py(); p[2] = Pz();} | |
157 | Bool_t GetPxPyPz(Double_t *p) const; | |
df9db588 | 158 | |
159 | template <class T> Bool_t GetPosition(T *x) const { | |
160 | x[0]=fPosition[0]; x[1]=fPosition[1]; x[2]=fPosition[2]; | |
161 | return TestBit(kIsDCA);} | |
162 | ||
163 | template <class T> void SetCovMatrix(const T *covMatrix) { | |
5d62ce04 | 164 | if(!fCovMatrix) fCovMatrix=new AliAODRedCov<6>(); |
df9db588 | 165 | fCovMatrix->SetCovMatrix(covMatrix);} |
166 | ||
167 | template <class T> Bool_t GetCovMatrix(T *covMatrix) const { | |
168 | if(!fCovMatrix) return kFALSE; | |
169 | fCovMatrix->GetCovMatrix(covMatrix); return kTRUE;} | |
170 | ||
892be05f | 171 | Bool_t GetXYZ(Double_t *p) const { |
172 | return GetPosition(p); } | |
173 | ||
4f6e22bd | 174 | Bool_t GetCovarianceXYZPxPyPz(Double_t cv[21]) const { |
175 | return GetCovMatrix(cv);} | |
176 | ||
df9db588 | 177 | void RemoveCovMatrix() {delete fCovMatrix; fCovMatrix=NULL;} |
178 | ||
6c954176 | 179 | Double_t XAtDCA() const { return fPositionAtDCA[0]; } |
180 | Double_t YAtDCA() const { return fPositionAtDCA[1]; } | |
181 | Double_t ZAtDCA() const { | |
182 | if (IsMuonTrack()) return fPosition[2]; | |
183 | else if (TestBit(kIsDCA)) return fPosition[1]; | |
184 | else return -999.; } | |
185 | Bool_t XYZAtDCA(Double_t x[3]) const { x[0] = XAtDCA(); x[1] = YAtDCA(); x[2] = ZAtDCA(); return kTRUE; } | |
186 | ||
187 | Double_t DCA() const { | |
188 | if (IsMuonTrack()) return TMath::Sqrt(XAtDCA()*XAtDCA() + YAtDCA()*YAtDCA()); | |
189 | else if (TestBit(kIsDCA)) return fPosition[0]; | |
190 | else return -999.; } | |
191 | ||
192 | Double_t PxAtDCA() const { return fMomentumAtDCA[0]; } | |
193 | Double_t PyAtDCA() const { return fMomentumAtDCA[1]; } | |
194 | Double_t PzAtDCA() const { return fMomentumAtDCA[2]; } | |
195 | Double_t PAtDCA() const { return TMath::Sqrt(PxAtDCA()*PxAtDCA() + PyAtDCA()*PyAtDCA() + PzAtDCA()*PzAtDCA()); } | |
196 | Bool_t PxPyPzAtDCA(Double_t p[3]) const { p[0] = PxAtDCA(); p[1] = PyAtDCA(); p[2] = PzAtDCA(); return kTRUE; } | |
197 | ||
f43586f0 | 198 | Double_t GetRAtAbsorberEnd() const { return fRAtAbsorberEnd; } |
199 | ||
6c954176 | 200 | UChar_t GetITSClusterMap() const { return (UChar_t)(fITSMuonClusterMap&0xff); } |
6dc40b1c | 201 | Int_t GetITSNcls() const; |
202 | Bool_t HasPointOnITSLayer(Int_t i) const { return TESTBIT(GetITSClusterMap(),i); } | |
6c954176 | 203 | UShort_t GetHitsPatternInTrigCh() const { return (UShort_t)((fITSMuonClusterMap&0xff00)>>8); } |
204 | UInt_t GetMUONClusterMap() const { return (fITSMuonClusterMap&0x3ff0000)>>16; } | |
205 | UInt_t GetITSMUONClusterMap() const { return fITSMuonClusterMap; } | |
206 | ||
8a1418dc | 207 | Bool_t TestFilterBit(UInt_t filterBit) const {return (Bool_t) ((filterBit & fFilterMap) != 0);} |
6db112a4 | 208 | Bool_t TestFilterMask(UInt_t filterMask) const {return (Bool_t) ((filterMask & fFilterMap) == filterMask);} |
df9db588 | 209 | |
507ed024 | 210 | const TBits& GetTPCClusterMap() const {return fTPCClusterMap;} |
211 | const TBits& GetTPCSharedMap() const {return fTPCSharedMap;} | |
212 | void SetTPCClusterMap(const TBits amap) {fTPCClusterMap = amap;} | |
213 | void SetTPCSharedMap(const TBits amap) {fTPCSharedMap = amap;} | |
214 | ||
7be1db84 | 215 | AliAODPid *GetDetPid() const { return fDetPid; } |
df9db588 | 216 | AliAODVertex *GetProdVertex() const { return (AliAODVertex*)fProdVertex.GetObject(); } |
217 | ||
218 | ||
219 | void Print(const Option_t *opt = "") const; | |
220 | ||
221 | // setters | |
6efb741f | 222 | void SetFlags(ULong_t flags) { fFlags = flags; } |
223 | void SetStatus(ULong_t flags) { fFlags|=flags; } | |
224 | void ResetStatus(ULong_t flags) { fFlags&=~flags; } | |
225 | ||
02153d58 | 226 | void SetID(Short_t id) { fID = id; } |
6efb741f | 227 | void SetLabel(Int_t label) { fLabel = label; } |
df9db588 | 228 | |
14b34be5 | 229 | template <class T> void SetPosition(const T *x, Bool_t isDCA = kFALSE); |
df9db588 | 230 | void SetDCA(Double_t d, Double_t z); |
1912763f | 231 | void SetUsedForVtxFit(Bool_t used = kTRUE) { used ? SetBit(kUsedForVtxFit) : ResetBit(kUsedForVtxFit); } |
dc825b15 | 232 | void SetUsedForPrimVtxFit(Bool_t used = kTRUE) { used ? SetBit(kUsedForPrimVtxFit) : ResetBit(kUsedForPrimVtxFit); } |
df9db588 | 233 | |
f4ad422f | 234 | void SetOneOverPt(Double_t oneOverPt) { fMomentum[0] = 1. / oneOverPt; } |
16b65f2a | 235 | void SetPt(Double_t pt) { fMomentum[0] = pt; }; |
14b34be5 | 236 | void SetPhi(Double_t phi) { fMomentum[1] = phi; } |
237 | void SetTheta(Double_t theta) { fMomentum[2] = theta; } | |
238 | template <class T> void SetP(const T *p, Bool_t cartesian = kTRUE); | |
df9db588 | 239 | void SetP() {fMomentum[0]=fMomentum[1]=fMomentum[2]=-999.;} |
240 | ||
6c954176 | 241 | void SetXYAtDCA(Double_t x, Double_t y) {fPositionAtDCA[0] = x; fPositionAtDCA[1] = y;} |
242 | void SetPxPyPzAtDCA(Double_t pX, Double_t pY, Double_t pZ) {fMomentumAtDCA[0] = pX; fMomentumAtDCA[1] = pY; fMomentumAtDCA[2] = pZ;} | |
243 | ||
f43586f0 | 244 | void SetRAtAbsorberEnd(Double_t r) { fRAtAbsorberEnd = r; } |
245 | ||
14b34be5 | 246 | void SetCharge(Short_t q) { fCharge = q; } |
1912763f | 247 | void SetChi2perNDF(Double_t chi2perNDF) { fChi2perNDF = chi2perNDF; } |
df9db588 | 248 | |
6c954176 | 249 | void SetITSClusterMap(UChar_t itsClusMap) { fITSMuonClusterMap = (fITSMuonClusterMap&0xffffff00)|(((UInt_t)itsClusMap)&0xff); } |
250 | void SetHitsPatternInTrigCh(UShort_t hitsPatternInTrigCh) { fITSMuonClusterMap = (fITSMuonClusterMap&0xffff00ff)|((((UInt_t)hitsPatternInTrigCh)&0xff)<<8); } | |
251 | void SetMuonClusterMap(UInt_t muonClusMap) { fITSMuonClusterMap = (fITSMuonClusterMap&0xfc00ffff)|((muonClusMap&0x3ff)<<16); } | |
252 | void SetITSMuonClusterMap(UInt_t itsMuonClusMap) { fITSMuonClusterMap = itsMuonClusMap; } | |
df9db588 | 253 | |
8a1418dc | 254 | Int_t GetMatchTrigger() const {return fITSMuonClusterMap>>30;} |
e1c744ca | 255 | // 0 Muon track does not match trigger |
256 | // 1 Muon track match but does not pass pt cut | |
257 | // 2 Muon track match Low pt cut | |
258 | // 3 Muon track match High pt cut | |
259 | void SetMatchTrigger(Int_t MatchTrigger); | |
2200238e | 260 | Bool_t MatchTrigger() const { return (GetMatchTrigger()>0); } // Muon track matches trigger track |
261 | Bool_t MatchTriggerLowPt() const { return (GetMatchTrigger()>1); } // Muon track matches trigger track and passes Low pt cut | |
262 | Bool_t MatchTriggerHighPt() const { return (GetMatchTrigger()>2); } // Muon track matches trigger track and passes High pt cut | |
263 | Bool_t MatchTriggerDigits() const; // Muon track matches trigger digits | |
8a1418dc | 264 | Double_t GetChi2MatchTrigger() const { return fChi2MatchTrigger;} |
6c954176 | 265 | void SetChi2MatchTrigger(Double_t Chi2MatchTrigger) {fChi2MatchTrigger = Chi2MatchTrigger; } |
2200238e | 266 | Bool_t HitsMuonChamber(Int_t MuonChamber, Int_t cathode = -1) const; // Check if track hits Muon chambers |
6c954176 | 267 | Bool_t IsMuonTrack() const { return (GetMUONClusterMap()>0) ? kTRUE : kFALSE; } |
5c15a68b | 268 | |
269 | void Connected(Bool_t flag) {flag ? SETBIT(fITSMuonClusterMap,26) : CLRBIT(fITSMuonClusterMap,26);} | |
270 | Bool_t IsConnected() const {return TESTBIT(fITSMuonClusterMap,26);} | |
e1c744ca | 271 | |
c683ddc2 | 272 | void SetProdVertex(TObject *vertex) { fProdVertex = vertex; } |
273 | void SetType(AODTrk_t ttype) { fType=ttype; } | |
274 | ||
6dc40b1c | 275 | |
276 | ||
6a8e543a | 277 | // Dummy |
278 | Int_t PdgCode() const {return 0;} | |
279 | ||
df9db588 | 280 | private : |
281 | ||
282 | // Momentum & position | |
1912763f | 283 | Double32_t fMomentum[3]; // momemtum stored in pt, phi, theta |
284 | Double32_t fPosition[3]; // position of first point on track or dca | |
6c954176 | 285 | |
286 | Double32_t fMomentumAtDCA[3]; // momentum (px,py,pz) at DCA | |
287 | Double32_t fPositionAtDCA[2]; // trasverse position (x,y) at DCA | |
288 | ||
f43586f0 | 289 | Double32_t fRAtAbsorberEnd; // transverse position r at the end of the muon absorber |
290 | ||
862ce351 | 291 | Double32_t fChi2perNDF; // chi2/NDF of momentum fit |
9333290e | 292 | Double32_t fChi2MatchTrigger; // chi2 of trigger/track matching |
293 | Double32_t fPID[10]; // [0.,1.,8] pointer to PID object | |
df9db588 | 294 | |
6efb741f | 295 | ULong_t fFlags; // reconstruction status flags |
1912763f | 296 | Int_t fLabel; // track label, points back to MC track |
df9db588 | 297 | |
6c954176 | 298 | UInt_t fITSMuonClusterMap; // map of ITS and muon clusters, one bit per layer |
299 | // (ITS: bit 1-8, muon trigger: bit 9-16, muon tracker: bit 17-26, muon match trigger: bit 31-32) | |
9333290e | 300 | UInt_t fFilterMap; // filter information, one bit per set of cuts |
df9db588 | 301 | |
507ed024 | 302 | TBits fTPCClusterMap; // Map of clusters, one bit per padrow; 1 if has a cluster on given padrow |
303 | TBits fTPCSharedMap; // Map of clusters, one bit per padrow; 1 if has a shared cluster on given padrow | |
304 | ||
02153d58 | 305 | Short_t fID; // unique track ID, points back to the ESD track |
306 | ||
1912763f | 307 | Char_t fCharge; // particle charge |
1912763f | 308 | Char_t fType; // Track Type |
507ed024 | 309 | |
9333290e | 310 | AliAODRedCov<6> *fCovMatrix; // covariance matrix (x, y, z, px, py, pz) |
7be1db84 | 311 | AliAODPid *fDetPid; // more detailed or detector specific pid information |
9333290e | 312 | TRef fProdVertex; // vertex of origin |
df9db588 | 313 | |
f43586f0 | 314 | ClassDef(AliAODTrack, 10); |
df9db588 | 315 | }; |
316 | ||
862ce351 | 317 | inline Bool_t AliAODTrack::IsPrimaryCandidate() const |
318 | { | |
319 | // True of track passes primary particle selection (independent of type) | |
320 | // | |
321 | if (fFilterMap) { | |
322 | return kTRUE; | |
323 | } else { | |
324 | return kFALSE; | |
325 | } | |
326 | } | |
327 | ||
6dc40b1c | 328 | inline Int_t AliAODTrack::GetITSNcls() const |
329 | { | |
330 | // Number of points in ITS | |
331 | Int_t n=0; | |
332 | for(Int_t i=0;i<6;i++) if(HasPointOnITSLayer(i)) n++; | |
333 | return n; | |
334 | } | |
335 | ||
df9db588 | 336 | #endif |