]>
Commit | Line | Data |
---|---|---|
df9db588 | 1 | /************************************************************************** |
2 | * Copyright(c) 1998-2007, ALICE Experiment at CERN, All rights reserved. * | |
3 | * * | |
4 | * Author: The ALICE Off-line Project. * | |
5 | * Contributors are mentioned in the code where appropriate. * | |
6 | * * | |
7 | * Permission to use, copy, modify and distribute this software and its * | |
8 | * documentation strictly for non-commercial purposes is hereby granted * | |
9 | * without fee, provided that the above copyright notice appears in all * | |
10 | * copies and that both the copyright notice and this permission notice * | |
11 | * appear in the supporting documentation. The authors make no claims * | |
12 | * about the suitability of this software for any purpose. It is * | |
13 | * provided "as is" without express or implied warranty. * | |
14 | **************************************************************************/ | |
15 | ||
16 | /* $Id$ */ | |
17 | ||
18 | //------------------------------------------------------------------------- | |
4f6e22bd | 19 | // AOD track implementation of AliVTrack |
df9db588 | 20 | // Author: Markus Oldenburg, CERN |
0c5f89fb | 21 | // Markus.Oldenburg@cern.ch |
df9db588 | 22 | //------------------------------------------------------------------------- |
23 | ||
086400fc | 24 | #include <TVector3.h> |
8ac4fa64 | 25 | #include "AliLog.h" |
6dc40b1c | 26 | #include "AliExternalTrackParam.h" |
27 | #include "AliVVertex.h" | |
df9db588 | 28 | #include "AliAODTrack.h" |
aab77ed0 | 29 | #include "AliAODEvent.h" |
df9db588 | 30 | |
31 | ClassImp(AliAODTrack) | |
32 | ||
33 | //______________________________________________________________________________ | |
34 | AliAODTrack::AliAODTrack() : | |
4f6e22bd | 35 | AliVTrack(), |
f43586f0 | 36 | fRAtAbsorberEnd(0.), |
1912763f | 37 | fChi2perNDF(-999.), |
9333290e | 38 | fChi2MatchTrigger(0.), |
6efb741f | 39 | fFlags(0), |
df9db588 | 40 | fLabel(-999), |
1912763f | 41 | fITSMuonClusterMap(0), |
0a2dcc83 | 42 | fMUONtrigHitsMapTrg(0), |
43 | fMUONtrigHitsMapTrk(0), | |
9333290e | 44 | fFilterMap(0), |
bcabd0e4 | 45 | fTPCFitMap(), |
d999f2e6 | 46 | fTPCClusterMap(), |
47 | fTPCSharedMap(), | |
3c01c166 | 48 | fTPCnclsF(0), |
02153d58 | 49 | fID(-999), |
9333290e | 50 | fCharge(-99), |
e1c744ca | 51 | fType(kUndef), |
a7d9ab9e | 52 | fCaloIndex(kEMCALNoMatch), |
9333290e | 53 | fCovMatrix(NULL), |
7be1db84 | 54 | fDetPid(NULL), |
ed15417e | 55 | fProdVertex(NULL), |
56 | fTrackPhiOnEMCal(-999), | |
aab77ed0 | 57 | fTrackEtaOnEMCal(-999), |
58 | fAODEvent(NULL) | |
df9db588 | 59 | { |
60 | // default constructor | |
61 | ||
62 | SetP(); | |
63 | SetPosition((Float_t*)NULL); | |
6c954176 | 64 | SetXYAtDCA(-999., -999.); |
65 | SetPxPyPzAtDCA(-999., -999., -999.); | |
df9db588 | 66 | SetPID((Float_t*)NULL); |
67 | } | |
68 | ||
69 | //______________________________________________________________________________ | |
02153d58 | 70 | AliAODTrack::AliAODTrack(Short_t id, |
df9db588 | 71 | Int_t label, |
72 | Double_t p[3], | |
73 | Bool_t cartesian, | |
74 | Double_t x[3], | |
75 | Bool_t isDCA, | |
76 | Double_t covMatrix[21], | |
77 | Short_t charge, | |
78 | UChar_t itsClusMap, | |
79 | Double_t pid[10], | |
80 | AliAODVertex *prodVertex, | |
1912763f | 81 | Bool_t usedForVtxFit, |
dc825b15 | 82 | Bool_t usedForPrimVtxFit, |
ec40c484 | 83 | AODTrk_t ttype, |
862ce351 | 84 | UInt_t selectInfo, |
85 | Float_t chi2perNDF) : | |
4f6e22bd | 86 | AliVTrack(), |
f43586f0 | 87 | fRAtAbsorberEnd(0.), |
862ce351 | 88 | fChi2perNDF(chi2perNDF), |
9333290e | 89 | fChi2MatchTrigger(0.), |
6efb741f | 90 | fFlags(0), |
df9db588 | 91 | fLabel(label), |
6c954176 | 92 | fITSMuonClusterMap(0), |
0a2dcc83 | 93 | fMUONtrigHitsMapTrg(0), |
94 | fMUONtrigHitsMapTrk(0), | |
9333290e | 95 | fFilterMap(selectInfo), |
bcabd0e4 | 96 | fTPCFitMap(), |
d999f2e6 | 97 | fTPCClusterMap(), |
98 | fTPCSharedMap(), | |
3c01c166 | 99 | fTPCnclsF(0), |
02153d58 | 100 | fID(id), |
9333290e | 101 | fCharge(charge), |
e1c744ca | 102 | fType(ttype), |
a7d9ab9e | 103 | fCaloIndex(kEMCALNoMatch), |
9333290e | 104 | fCovMatrix(NULL), |
7be1db84 | 105 | fDetPid(NULL), |
ed15417e | 106 | fProdVertex(prodVertex), |
107 | fTrackPhiOnEMCal(-999), | |
aab77ed0 | 108 | fTrackEtaOnEMCal(-999), |
109 | fAODEvent(NULL) | |
df9db588 | 110 | { |
111 | // constructor | |
112 | ||
113 | SetP(p, cartesian); | |
114 | SetPosition(x, isDCA); | |
6c954176 | 115 | SetXYAtDCA(-999., -999.); |
116 | SetPxPyPzAtDCA(-999., -999., -999.); | |
1912763f | 117 | SetUsedForVtxFit(usedForVtxFit); |
dc825b15 | 118 | SetUsedForPrimVtxFit(usedForPrimVtxFit); |
df9db588 | 119 | if(covMatrix) SetCovMatrix(covMatrix); |
120 | SetPID(pid); | |
6c954176 | 121 | SetITSClusterMap(itsClusMap); |
df9db588 | 122 | } |
123 | ||
124 | //______________________________________________________________________________ | |
02153d58 | 125 | AliAODTrack::AliAODTrack(Short_t id, |
df9db588 | 126 | Int_t label, |
127 | Float_t p[3], | |
128 | Bool_t cartesian, | |
129 | Float_t x[3], | |
130 | Bool_t isDCA, | |
131 | Float_t covMatrix[21], | |
132 | Short_t charge, | |
133 | UChar_t itsClusMap, | |
134 | Float_t pid[10], | |
135 | AliAODVertex *prodVertex, | |
1912763f | 136 | Bool_t usedForVtxFit, |
dc825b15 | 137 | Bool_t usedForPrimVtxFit, |
ec40c484 | 138 | AODTrk_t ttype, |
862ce351 | 139 | UInt_t selectInfo, |
140 | Float_t chi2perNDF) : | |
4f6e22bd | 141 | AliVTrack(), |
f43586f0 | 142 | fRAtAbsorberEnd(0.), |
862ce351 | 143 | fChi2perNDF(chi2perNDF), |
9333290e | 144 | fChi2MatchTrigger(0.), |
6efb741f | 145 | fFlags(0), |
df9db588 | 146 | fLabel(label), |
6c954176 | 147 | fITSMuonClusterMap(0), |
0a2dcc83 | 148 | fMUONtrigHitsMapTrg(0), |
149 | fMUONtrigHitsMapTrk(0), | |
9333290e | 150 | fFilterMap(selectInfo), |
bcabd0e4 | 151 | fTPCFitMap(), |
d999f2e6 | 152 | fTPCClusterMap(), |
153 | fTPCSharedMap(), | |
3c01c166 | 154 | fTPCnclsF(0), |
02153d58 | 155 | fID(id), |
9333290e | 156 | fCharge(charge), |
e1c744ca | 157 | fType(ttype), |
a7d9ab9e | 158 | fCaloIndex(kEMCALNoMatch), |
9333290e | 159 | fCovMatrix(NULL), |
7be1db84 | 160 | fDetPid(NULL), |
ed15417e | 161 | fProdVertex(prodVertex), |
162 | fTrackPhiOnEMCal(-999), | |
aab77ed0 | 163 | fTrackEtaOnEMCal(-999), |
164 | fAODEvent(NULL) | |
df9db588 | 165 | { |
166 | // constructor | |
167 | ||
168 | SetP(p, cartesian); | |
169 | SetPosition(x, isDCA); | |
6c954176 | 170 | SetXYAtDCA(-999., -999.); |
171 | SetPxPyPzAtDCA(-999., -999., -999.); | |
1912763f | 172 | SetUsedForVtxFit(usedForVtxFit); |
dc825b15 | 173 | SetUsedForPrimVtxFit(usedForPrimVtxFit); |
df9db588 | 174 | if(covMatrix) SetCovMatrix(covMatrix); |
175 | SetPID(pid); | |
6c954176 | 176 | SetITSClusterMap(itsClusMap); |
df9db588 | 177 | } |
178 | ||
df9db588 | 179 | //______________________________________________________________________________ |
180 | AliAODTrack::~AliAODTrack() | |
181 | { | |
182 | // destructor | |
183 | delete fCovMatrix; | |
7450f8ab | 184 | delete fDetPid; |
df9db588 | 185 | } |
186 | ||
187 | ||
188 | //______________________________________________________________________________ | |
189 | AliAODTrack::AliAODTrack(const AliAODTrack& trk) : | |
4f6e22bd | 190 | AliVTrack(trk), |
f43586f0 | 191 | fRAtAbsorberEnd(trk.fRAtAbsorberEnd), |
1912763f | 192 | fChi2perNDF(trk.fChi2perNDF), |
9333290e | 193 | fChi2MatchTrigger(trk.fChi2MatchTrigger), |
6efb741f | 194 | fFlags(trk.fFlags), |
df9db588 | 195 | fLabel(trk.fLabel), |
1912763f | 196 | fITSMuonClusterMap(trk.fITSMuonClusterMap), |
0a2dcc83 | 197 | fMUONtrigHitsMapTrg(trk.fMUONtrigHitsMapTrg), |
198 | fMUONtrigHitsMapTrk(trk.fMUONtrigHitsMapTrk), | |
9333290e | 199 | fFilterMap(trk.fFilterMap), |
bcabd0e4 | 200 | fTPCFitMap(trk.fTPCFitMap), |
d999f2e6 | 201 | fTPCClusterMap(trk.fTPCClusterMap), |
202 | fTPCSharedMap(trk.fTPCSharedMap), | |
3c01c166 | 203 | fTPCnclsF(trk.fTPCnclsF), |
02153d58 | 204 | fID(trk.fID), |
9333290e | 205 | fCharge(trk.fCharge), |
e1c744ca | 206 | fType(trk.fType), |
a7d9ab9e | 207 | fCaloIndex(trk.fCaloIndex), |
9333290e | 208 | fCovMatrix(NULL), |
7be1db84 | 209 | fDetPid(NULL), |
ed15417e | 210 | fProdVertex(trk.fProdVertex), |
211 | fTrackPhiOnEMCal(trk.fTrackPhiOnEMCal), | |
aab77ed0 | 212 | fTrackEtaOnEMCal(trk.fTrackEtaOnEMCal), |
213 | fAODEvent(trk.fAODEvent) | |
df9db588 | 214 | { |
215 | // Copy constructor | |
216 | ||
217 | trk.GetP(fMomentum); | |
218 | trk.GetPosition(fPosition); | |
6c954176 | 219 | SetXYAtDCA(trk.XAtDCA(), trk.YAtDCA()); |
220 | SetPxPyPzAtDCA(trk.PxAtDCA(), trk.PyAtDCA(), trk.PzAtDCA()); | |
1912763f | 221 | SetUsedForVtxFit(trk.GetUsedForVtxFit()); |
dc825b15 | 222 | SetUsedForPrimVtxFit(trk.GetUsedForPrimVtxFit()); |
5d62ce04 | 223 | if(trk.fCovMatrix) fCovMatrix=new AliAODRedCov<6>(*trk.fCovMatrix); |
7be1db84 | 224 | if(trk.fDetPid) fDetPid=new AliAODPid(*trk.fDetPid); |
df9db588 | 225 | SetPID(trk.fPID); |
df9db588 | 226 | } |
227 | ||
228 | //______________________________________________________________________________ | |
229 | AliAODTrack& AliAODTrack::operator=(const AliAODTrack& trk) | |
230 | { | |
231 | // Assignment operator | |
232 | if(this!=&trk) { | |
233 | ||
4f6e22bd | 234 | AliVTrack::operator=(trk); |
df9db588 | 235 | |
236 | trk.GetP(fMomentum); | |
237 | trk.GetPosition(fPosition); | |
6c954176 | 238 | SetXYAtDCA(trk.XAtDCA(), trk.YAtDCA()); |
239 | SetPxPyPzAtDCA(trk.PxAtDCA(), trk.PyAtDCA(), trk.PzAtDCA()); | |
05f9607e | 240 | fRAtAbsorberEnd = trk.fRAtAbsorberEnd; |
241 | fChi2perNDF = trk.fChi2perNDF; | |
242 | fChi2MatchTrigger = trk.fChi2MatchTrigger; | |
243 | trk.GetPID(fPID); | |
244 | fFlags = trk.fFlags; | |
245 | fLabel = trk.fLabel; | |
9333290e | 246 | fITSMuonClusterMap = trk.fITSMuonClusterMap; |
0a2dcc83 | 247 | fMUONtrigHitsMapTrg = trk.fMUONtrigHitsMapTrg; |
248 | fMUONtrigHitsMapTrk = trk.fMUONtrigHitsMapTrk; | |
05f9607e | 249 | fFilterMap = trk.fFilterMap; |
bcabd0e4 | 250 | fTPCFitMap = trk.fTPCFitMap; |
05f9607e | 251 | fTPCClusterMap = trk.fTPCClusterMap; |
252 | fTPCSharedMap = trk.fTPCSharedMap; | |
253 | fTPCnclsF = trk.fTPCnclsF; | |
254 | fID = trk.fID; | |
255 | fCharge = trk.fCharge; | |
256 | fType = trk.fType; | |
257 | fCaloIndex = trk.fCaloIndex; | |
ed15417e | 258 | fTrackPhiOnEMCal = trk.fTrackPhiOnEMCal; |
259 | fTrackEtaOnEMCal = trk.fTrackEtaOnEMCal; | |
a7d9ab9e | 260 | |
df9db588 | 261 | delete fCovMatrix; |
5d62ce04 | 262 | if(trk.fCovMatrix) fCovMatrix=new AliAODRedCov<6>(*trk.fCovMatrix); |
df9db588 | 263 | else fCovMatrix=NULL; |
df9db588 | 264 | |
05f9607e | 265 | |
266 | fProdVertex = trk.fProdVertex; | |
1912763f | 267 | SetUsedForVtxFit(trk.GetUsedForVtxFit()); |
dc825b15 | 268 | SetUsedForPrimVtxFit(trk.GetUsedForPrimVtxFit()); |
7be1db84 | 269 | |
270 | delete fDetPid; | |
271 | if(trk.fDetPid) fDetPid=new AliAODPid(*trk.fDetPid); | |
272 | else fDetPid=NULL; | |
05f9607e | 273 | |
274 | ||
df9db588 | 275 | } |
276 | ||
277 | return *this; | |
278 | } | |
279 | ||
4697e4fb | 280 | //______________________________________________________________________________ |
281 | Double_t AliAODTrack::M(AODTrkPID_t pid) const | |
282 | { | |
283 | // Returns the mass. | |
9861edc0 | 284 | // Masses for nuclei don't exist in the PDG tables, therefore they were put by hand. |
4697e4fb | 285 | |
286 | switch (pid) { | |
287 | ||
288 | case kElectron : | |
9861edc0 | 289 | return 0.000510999; //TDatabasePDG::Instance()->GetParticle(11/*::kElectron*/)->Mass(); |
4697e4fb | 290 | break; |
291 | ||
292 | case kMuon : | |
9861edc0 | 293 | return 0.1056584; //TDatabasePDG::Instance()->GetParticle(13/*::kMuonMinus*/)->Mass(); |
4697e4fb | 294 | break; |
295 | ||
296 | case kPion : | |
9861edc0 | 297 | return 0.13957; //TDatabasePDG::Instance()->GetParticle(211/*::kPiPlus*/)->Mass(); |
4697e4fb | 298 | break; |
299 | ||
300 | case kKaon : | |
9861edc0 | 301 | return 0.4937; //TDatabasePDG::Instance()->GetParticle(321/*::kKPlus*/)->Mass(); |
4697e4fb | 302 | break; |
303 | ||
304 | case kProton : | |
9861edc0 | 305 | return 0.9382720; //TDatabasePDG::Instance()->GetParticle(2212/*::kProton*/)->Mass(); |
4697e4fb | 306 | break; |
307 | ||
308 | case kDeuteron : | |
9861edc0 | 309 | return 1.8756; //TDatabasePDG::Instance()->GetParticle(1000010020)->Mass(); |
4697e4fb | 310 | break; |
311 | ||
312 | case kTriton : | |
9861edc0 | 313 | return 2.8089; //TDatabasePDG::Instance()->GetParticle(1000010030)->Mass(); |
4697e4fb | 314 | break; |
315 | ||
316 | case kHelium3 : | |
9861edc0 | 317 | return 2.8084; //TDatabasePDG::Instance()->GetParticle(1000020030)->Mass(); |
4697e4fb | 318 | break; |
319 | ||
320 | case kAlpha : | |
9861edc0 | 321 | return 3.7274; //TDatabasePDG::Instance()->GetParticle(1000020040)->Mass(); |
4697e4fb | 322 | break; |
323 | ||
324 | case kUnknown : | |
325 | return -999.; | |
326 | break; | |
327 | ||
328 | default : | |
329 | return -999.; | |
330 | } | |
331 | } | |
332 | ||
333 | //______________________________________________________________________________ | |
334 | Double_t AliAODTrack::E(AODTrkPID_t pid) const | |
335 | { | |
336 | // Returns the energy of the particle of a given pid. | |
337 | ||
338 | if (pid != kUnknown) { // particle was identified | |
339 | Double_t m = M(pid); | |
340 | return TMath::Sqrt(P()*P() + m*m); | |
341 | } else { // pid unknown | |
342 | return -999.; | |
343 | } | |
344 | } | |
345 | ||
346 | //______________________________________________________________________________ | |
347 | Double_t AliAODTrack::Y(AODTrkPID_t pid) const | |
348 | { | |
9861edc0 | 349 | // Returns the rapidity of a particle of a given pid. |
4697e4fb | 350 | |
351 | if (pid != kUnknown) { // particle was identified | |
352 | Double_t e = E(pid); | |
353 | Double_t pz = Pz(); | |
354 | if (e>=0 && e!=pz) { // energy was positive (e.g. not -999.) and not equal to pz | |
355 | return 0.5*TMath::Log((e+pz)/(e-pz)); | |
356 | } else { // energy not known or equal to pz | |
357 | return -999.; | |
358 | } | |
359 | } else { // pid unknown | |
360 | return -999.; | |
361 | } | |
362 | } | |
363 | ||
364 | //______________________________________________________________________________ | |
365 | Double_t AliAODTrack::Y(Double_t m) const | |
366 | { | |
9861edc0 | 367 | // Returns the rapidity of a particle of a given mass. |
4697e4fb | 368 | |
369 | if (m >= 0.) { // mass makes sense | |
370 | Double_t e = E(m); | |
371 | Double_t pz = Pz(); | |
372 | if (e>=0 && e!=pz) { // energy was positive (e.g. not -999.) and not equal to pz | |
373 | return 0.5*TMath::Log((e+pz)/(e-pz)); | |
374 | } else { // energy not known or equal to pz | |
375 | return -999.; | |
376 | } | |
377 | } else { // pid unknown | |
378 | return -999.; | |
379 | } | |
380 | } | |
381 | ||
382 | //______________________________________________________________________________ | |
383 | AliAODTrack::AODTrkPID_t AliAODTrack::GetMostProbablePID() const | |
384 | { | |
385 | // Returns the most probable PID array element. | |
386 | ||
387 | Int_t nPID = 10; | |
7ba6f91a | 388 | AODTrkPID_t loc = kUnknown; |
389 | Double_t max = 0.; | |
390 | Bool_t allTheSame = kTRUE; | |
391 | ||
392 | for (Int_t iPID = 0; iPID < nPID; iPID++) { | |
393 | if (fPID[iPID] >= max) { | |
394 | if (fPID[iPID] > max) { | |
395 | allTheSame = kFALSE; | |
396 | max = fPID[iPID]; | |
397 | loc = (AODTrkPID_t)iPID; | |
398 | } else { | |
399 | allTheSame = kTRUE; | |
4697e4fb | 400 | } |
401 | } | |
4697e4fb | 402 | } |
7ba6f91a | 403 | return allTheSame ? kUnknown : loc; |
4697e4fb | 404 | } |
405 | ||
406 | //______________________________________________________________________________ | |
407 | void AliAODTrack::ConvertAliPIDtoAODPID() | |
408 | { | |
409 | // Converts AliPID array. | |
410 | // The numbering scheme is the same for electrons, muons, pions, kaons, and protons. | |
411 | // Everything else has to be set to zero. | |
412 | ||
413 | fPID[kDeuteron] = 0.; | |
8a1418dc | 414 | fPID[kTriton] = 0.; |
415 | fPID[kHelium3] = 0.; | |
416 | fPID[kAlpha] = 0.; | |
417 | fPID[kUnknown] = 0.; | |
4697e4fb | 418 | |
419 | return; | |
420 | } | |
421 | ||
422 | ||
df9db588 | 423 | //______________________________________________________________________________ |
424 | template <class T> void AliAODTrack::SetP(const T *p, const Bool_t cartesian) | |
425 | { | |
8a1418dc | 426 | // Set the momentum |
df9db588 | 427 | |
428 | if (p) { | |
429 | if (cartesian) { | |
16b65f2a | 430 | Double_t pt2 = p[0]*p[0] + p[1]*p[1]; |
0c5f89fb | 431 | Double_t pp = TMath::Sqrt(pt2 + p[2]*p[2]); |
df9db588 | 432 | |
16b65f2a | 433 | fMomentum[0] = TMath::Sqrt(pt2); // pt |
b1a9edc8 | 434 | fMomentum[1] = (pt2 != 0.) ? TMath::Pi()+TMath::ATan2(-p[1], -p[0]) : -999; // phi |
0c5f89fb | 435 | fMomentum[2] = (pp != 0.) ? TMath::ACos(p[2] / pp) : -999.; // theta |
df9db588 | 436 | } else { |
16b65f2a | 437 | fMomentum[0] = p[0]; // pt |
df9db588 | 438 | fMomentum[1] = p[1]; // phi |
439 | fMomentum[2] = p[2]; // theta | |
440 | } | |
441 | } else { | |
442 | fMomentum[0] = -999.; | |
443 | fMomentum[1] = -999.; | |
444 | fMomentum[2] = -999.; | |
445 | } | |
446 | } | |
447 | ||
448 | //______________________________________________________________________________ | |
449 | template <class T> void AliAODTrack::SetPosition(const T *x, const Bool_t dca) | |
450 | { | |
451 | // set the position | |
452 | ||
453 | if (x) { | |
454 | if (!dca) { | |
455 | ResetBit(kIsDCA); | |
456 | ||
457 | fPosition[0] = x[0]; | |
458 | fPosition[1] = x[1]; | |
459 | fPosition[2] = x[2]; | |
460 | } else { | |
461 | SetBit(kIsDCA); | |
462 | // don't know any better yet | |
463 | fPosition[0] = -999.; | |
464 | fPosition[1] = -999.; | |
465 | fPosition[2] = -999.; | |
466 | } | |
467 | } else { | |
468 | ResetBit(kIsDCA); | |
469 | ||
470 | fPosition[0] = -999.; | |
471 | fPosition[1] = -999.; | |
472 | fPosition[2] = -999.; | |
473 | } | |
474 | } | |
475 | ||
476 | //______________________________________________________________________________ | |
477 | void AliAODTrack::SetDCA(Double_t d, Double_t z) | |
478 | { | |
479 | // set the dca | |
480 | fPosition[0] = d; | |
481 | fPosition[1] = z; | |
482 | fPosition[2] = 0.; | |
483 | SetBit(kIsDCA); | |
484 | } | |
485 | ||
486 | //______________________________________________________________________________ | |
487 | void AliAODTrack::Print(Option_t* /* option */) const | |
488 | { | |
489 | // prints information about AliAODTrack | |
490 | ||
491 | printf("Object name: %s Track type: %s\n", GetName(), GetTitle()); | |
492 | printf(" px = %f\n", Px()); | |
493 | printf(" py = %f\n", Py()); | |
494 | printf(" pz = %f\n", Pz()); | |
495 | printf(" pt = %f\n", Pt()); | |
496 | printf(" 1/pt = %f\n", OneOverPt()); | |
497 | printf(" theta = %f\n", Theta()); | |
498 | printf(" phi = %f\n", Phi()); | |
1912763f | 499 | printf(" chi2/NDF = %f\n", Chi2perNDF()); |
df9db588 | 500 | printf(" charge = %d\n", Charge()); |
df9db588 | 501 | } |
502 | ||
2200238e | 503 | //______________________________________________________________________________ |
504 | void AliAODTrack::SetMatchTrigger(Int_t matchTrig) | |
505 | { | |
506 | // Set the MUON trigger information | |
8ac4fa64 | 507 | switch(matchTrig){ |
e1c744ca | 508 | case 0: // 0 track does not match trigger |
509 | fITSMuonClusterMap=fITSMuonClusterMap&0x3fffffff; | |
510 | break; | |
511 | case 1: // 1 track match but does not pass pt cut | |
512 | fITSMuonClusterMap=(fITSMuonClusterMap&0x3fffffff)|0x40000000; | |
513 | break; | |
514 | case 2: // 2 track match Low pt cut | |
515 | fITSMuonClusterMap=(fITSMuonClusterMap&0x3fffffff)|0x80000000; | |
516 | break; | |
517 | case 3: // 3 track match High pt cut | |
518 | fITSMuonClusterMap=fITSMuonClusterMap|0xc0000000; | |
519 | break; | |
520 | default: | |
521 | fITSMuonClusterMap=fITSMuonClusterMap&0x3fffffff; | |
8ac4fa64 | 522 | AliWarning(Form("unknown case for matchTrig: %d\n",matchTrig)); |
e1c744ca | 523 | } |
524 | } | |
525 | ||
2200238e | 526 | //______________________________________________________________________________ |
527 | Bool_t AliAODTrack::HitsMuonChamber(Int_t MuonChamber, Int_t cathode) const | |
528 | { | |
529 | // return kTRUE if the track fires the given tracking or trigger chamber. | |
530 | // If the chamber is a trigger one: | |
531 | // - if cathode = 0 or 1, the track matches the corresponding cathode | |
532 | // - if cathode = -1, the track matches both cathodes | |
533 | ||
534 | if (MuonChamber < 0) return kFALSE; | |
535 | ||
536 | if (MuonChamber < 10) return TESTBIT(GetMUONClusterMap(), MuonChamber); | |
537 | ||
538 | if (MuonChamber < 14) { | |
539 | ||
540 | if (cathode < 0) return TESTBIT(GetHitsPatternInTrigCh(), 13-MuonChamber) && | |
541 | TESTBIT(GetHitsPatternInTrigCh(), 13-MuonChamber+4); | |
542 | ||
543 | if (cathode < 2) return TESTBIT(GetHitsPatternInTrigCh(), 13-MuonChamber+(1-cathode)*4); | |
544 | ||
e1c744ca | 545 | } |
2200238e | 546 | |
547 | return kFALSE; | |
e1c744ca | 548 | } |
549 | ||
2200238e | 550 | //______________________________________________________________________________ |
551 | Bool_t AliAODTrack::MatchTriggerDigits() const | |
552 | { | |
553 | // return kTRUE if the track matches a digit on both planes of at least 2 trigger chambers | |
6c954176 | 554 | |
2200238e | 555 | Int_t nMatchedChambers = 0; |
556 | for (Int_t ich=10; ich<14; ich++) if (HitsMuonChamber(ich)) nMatchedChambers++; | |
557 | ||
558 | return (nMatchedChambers >= 2); | |
e1c744ca | 559 | } |
c683ddc2 | 560 | |
6dc40b1c | 561 | //______________________________________________________________________________ |
562 | Bool_t AliAODTrack::PropagateToDCA(const AliVVertex *vtx, | |
563 | Double_t b, Double_t maxd, Double_t dz[2], Double_t covar[3]) | |
564 | { | |
565 | // compute impact parameters to the vertex vtx and their covariance matrix | |
566 | // b is the Bz, needed to propagate correctly the track to vertex | |
567 | // only the track parameters are update after the propagation (pos and mom), | |
568 | // not the covariance matrix. This is OK for propagation over short distance | |
569 | // inside the beam pipe. | |
570 | // return kFALSE is something went wrong | |
571 | ||
572 | // convert to AliExternalTrackParam | |
4ec1ca0f | 573 | AliExternalTrackParam etp; etp.CopyFromVTrack(this); |
6dc40b1c | 574 | |
575 | Float_t xstart = etp.GetX(); | |
576 | if(xstart>3.) { | |
577 | AliError("This method can be used only for propagation inside the beam pipe"); | |
578 | return kFALSE; | |
579 | } | |
580 | ||
581 | if(!etp.PropagateToDCA(vtx,b,maxd,dz,covar)) return kFALSE; | |
582 | ||
583 | // update track position and momentum | |
584 | Double_t mom[3]; | |
585 | etp.GetPxPyPz(mom); | |
586 | SetP(mom,kTRUE); | |
587 | etp.GetXYZ(mom); | |
588 | SetPosition(mom,kFALSE); | |
589 | ||
590 | ||
591 | return kTRUE; | |
592 | } | |
593 | ||
c8fe2783 | 594 | //______________________________________________________________________________ |
595 | Bool_t AliAODTrack::GetPxPyPz(Double_t p[3]) const | |
596 | { | |
597 | //--------------------------------------------------------------------- | |
598 | // This function returns the global track momentum components | |
599 | //--------------------------------------------------------------------- | |
600 | p[0]=Px(); p[1]=Py(); p[2]=Pz(); | |
601 | return kTRUE; | |
602 | } | |
9006fe9c | 603 | |
25f906db | 604 | |
605 | //_______________________________________________________________________ | |
606 | Float_t AliAODTrack::GetTPCClusterInfo(Int_t nNeighbours/*=3*/, Int_t type/*=0*/, Int_t row0, Int_t row1, Int_t bitType ) const | |
9006fe9c | 607 | { |
608 | // | |
25f906db | 609 | // TPC cluster information |
9006fe9c | 610 | // type 0: get fraction of found/findable clusters with neighbourhood definition |
611 | // 1: findable clusters with neighbourhood definition | |
612 | // 2: found clusters | |
25f906db | 613 | // bitType: |
614 | // 0 - all cluster used | |
615 | // 1 - clusters used for the kalman update | |
9006fe9c | 616 | // definition of findable clusters: |
617 | // a cluster is defined as findable if there is another cluster | |
618 | // within +- nNeighbours pad rows. The idea is to overcome threshold | |
619 | // effects with a very simple algorithm. | |
620 | // | |
25f906db | 621 | |
9006fe9c | 622 | |
623 | Int_t found=0; | |
624 | Int_t findable=0; | |
625 | Int_t last=-nNeighbours; | |
25f906db | 626 | const TBits & clusterMap = (bitType%2==0) ? fTPCClusterMap : fTPCFitMap; |
9006fe9c | 627 | |
25f906db | 628 | Int_t upperBound=clusterMap.GetNbits(); |
629 | if (upperBound>row1) upperBound=row1; | |
630 | for (Int_t i=row0; i<upperBound; ++i){ | |
9006fe9c | 631 | //look to current row |
25f906db | 632 | if (clusterMap[i]) { |
9006fe9c | 633 | last=i; |
634 | ++found; | |
635 | ++findable; | |
636 | continue; | |
637 | } | |
638 | //look to nNeighbours before | |
639 | if ((i-last)<=nNeighbours) { | |
640 | ++findable; | |
641 | continue; | |
642 | } | |
643 | //look to nNeighbours after | |
644 | for (Int_t j=i+1; j<i+1+nNeighbours; ++j){ | |
25f906db | 645 | if (clusterMap[j]){ |
9006fe9c | 646 | ++findable; |
647 | break; | |
648 | } | |
649 | } | |
650 | } | |
25f906db | 651 | if (type==2) return found; |
9006fe9c | 652 | if (type==1) return findable; |
653 | ||
654 | if (type==0){ | |
655 | Float_t fraction=0; | |
25f906db | 656 | if (findable>0) |
9006fe9c | 657 | fraction=(Float_t)found/(Float_t)findable; |
25f906db | 658 | else |
9006fe9c | 659 | fraction=0; |
660 | return fraction; | |
25f906db | 661 | } |
9006fe9c | 662 | return 0; // undefined type - default value |
663 | } | |
fd21ec8d | 664 | |
25f906db | 665 | |
fd21ec8d | 666 | //______________________________________________________________________________ |
667 | Double_t AliAODTrack::GetTRDslice(Int_t plane, Int_t slice) const { | |
668 | // | |
669 | // return TRD Pid information | |
670 | // | |
671 | if (!fDetPid) return -1; | |
672 | Double32_t *trdSlices=fDetPid->GetTRDsignal(); | |
673 | if (!trdSlices) return -1; | |
674 | if ((plane<0) || (plane>=kTRDnPlanes)) { | |
675 | return -1.; | |
676 | } | |
677 | ||
99e9d5ec | 678 | Int_t ns=fDetPid->GetTRDnSlices()/kTRDnPlanes; |
fd21ec8d | 679 | if ((slice<-1) || (slice>=ns)) { |
680 | return -1.; | |
681 | } | |
682 | ||
683 | if(slice>=0) return trdSlices[plane*ns + slice]; | |
684 | ||
685 | // return average of the dEdx measurements | |
686 | Double_t q=0.; Double32_t *s = &trdSlices[plane*ns]; | |
687 | for (Int_t i=0; i<ns; i++, s++) if((*s)>0.) q+=(*s); | |
688 | return q/ns; | |
689 | } | |
690 | ||
99e9d5ec | 691 | //______________________________________________________________________________ |
692 | UChar_t AliAODTrack::GetTRDntrackletsPID() const{ | |
693 | // | |
694 | // return number of tracklets calculated from the slices | |
695 | // | |
696 | if(!fDetPid) return -1; | |
59a8e853 | 697 | return fDetPid->GetTRDntrackletsPID(); |
698 | } | |
99e9d5ec | 699 | |
59a8e853 | 700 | //______________________________________________________________________________ |
701 | UChar_t AliAODTrack::GetTRDncls(Int_t layer) const { | |
702 | // | |
703 | // return number of TRD clusters | |
704 | // | |
705 | if(!fDetPid || layer > 5) return -1; | |
706 | if(layer < 0) return fDetPid->GetTRDncls(); | |
707 | else return fDetPid->GetTRDncls(layer); | |
99e9d5ec | 708 | } |
709 | ||
fd21ec8d | 710 | //______________________________________________________________________________ |
711 | Double_t AliAODTrack::GetTRDmomentum(Int_t plane, Double_t */*sp*/) const | |
712 | { | |
713 | //Returns momentum estimation | |
714 | // in TRD layer "plane". | |
715 | ||
716 | if (!fDetPid) return -1; | |
59a8e853 | 717 | const Float_t *trdMomentum=fDetPid->GetTRDmomentum(); |
fd21ec8d | 718 | |
719 | if (!trdMomentum) { | |
720 | return -1.; | |
721 | } | |
722 | if ((plane<0) || (plane>=kTRDnPlanes)) { | |
723 | return -1.; | |
724 | } | |
725 | ||
726 | return trdMomentum[plane]; | |
727 | } | |
76e6ee6a | 728 | |
729 | //_______________________________________________________________________ | |
1cecd6e3 | 730 | Int_t AliAODTrack::GetTOFBunchCrossing(Double_t b, Bool_t) const |
76e6ee6a | 731 | { |
732 | // Returns the number of bunch crossings after trigger (assuming 25ns spacing) | |
76e6ee6a | 733 | const double kSpacing = 25e3; // min interbanch spacing |
734 | const double kShift = 0; | |
3f2db92f | 735 | Int_t bcid = kTOFBCNA; // defualt one |
a512bf97 | 736 | if (!IsOn(kTOFout) || !IsOn(kESDpid)) return bcid; // no info |
737 | // | |
738 | double tdif = GetTOFsignal(); | |
739 | if (IsOn(kTIME)) { // integrated time info is there | |
740 | int pid = (int)GetMostProbablePID(); | |
741 | double ttimes[10]; | |
742 | GetIntegratedTimes(ttimes); | |
743 | tdif -= ttimes[pid]; | |
744 | } | |
745 | else { // assume integrated time info from TOF radius and momentum | |
746 | const double kRTOF = 385.; | |
747 | const double kCSpeed = 3.e-2; // cm/ps | |
748 | double p = P(); | |
749 | if (p<0.001) p = 1.0; | |
750 | double m = M(); | |
751 | double path = kRTOF; // mean TOF radius | |
752 | if (TMath::Abs(b)>kAlmost0) { // account for curvature | |
753 | double curv = Pt()/(b*kB2C); | |
754 | if (curv>kAlmost0) { | |
755 | double tgl = Pz()/Pt(); | |
756 | path = 2./curv*TMath::ASin(kRTOF*curv/2.)*TMath::Sqrt(1.+tgl*tgl); | |
757 | } | |
758 | } | |
759 | tdif -= path/kCSpeed*TMath::Sqrt(1.+m*m/(p*p)); | |
760 | } | |
76e6ee6a | 761 | bcid = TMath::Nint((tdif - kShift)/kSpacing); |
762 | return bcid; | |
763 | } | |
086400fc | 764 | |
765 | //_____________________________________________________________________________ | |
766 | Bool_t AliAODTrack::GetXYZAt(Double_t x, Double_t b, Double_t *r) const | |
767 | { | |
768 | //--------------------------------------------------------------------- | |
769 | // This function returns the global track position extrapolated to | |
770 | // the radial position "x" (cm) in the magnetic field "b" (kG) | |
771 | //--------------------------------------------------------------------- | |
772 | ||
773 | //conversion of track parameter representation is | |
774 | //based on the implementation of AliExternalTrackParam::Set(...) | |
775 | //maybe some of this code can be moved to AliVTrack to avoid code duplication | |
776 | const double kSafe = 1e-5; | |
777 | Double_t alpha=0.0; | |
778 | Double_t radPos2 = fPosition[0]*fPosition[0]+fPosition[1]*fPosition[1]; | |
779 | Double_t radMax = 45.; // approximately ITS outer radius | |
780 | if (radPos2 < radMax*radMax) { // inside the ITS | |
781 | alpha = TMath::ATan2(fMomentum[1],fMomentum[0]); | |
782 | } else { // outside the ITS | |
783 | Float_t phiPos = TMath::Pi()+TMath::ATan2(-fPosition[1], -fPosition[0]); | |
784 | alpha = | |
785 | TMath::DegToRad()*(20*((((Int_t)(phiPos*TMath::RadToDeg()))/20))+10); | |
786 | } | |
787 | // | |
788 | Double_t cs=TMath::Cos(alpha), sn=TMath::Sin(alpha); | |
789 | // protection: avoid alpha being too close to 0 or +-pi/2 | |
790 | if (TMath::Abs(sn)<kSafe) { | |
791 | alpha = kSafe; | |
792 | cs=TMath::Cos(alpha); | |
793 | sn=TMath::Sin(alpha); | |
794 | } | |
795 | else if (cs<kSafe) { | |
796 | alpha -= TMath::Sign(kSafe, alpha); | |
797 | cs=TMath::Cos(alpha); | |
798 | sn=TMath::Sin(alpha); | |
799 | } | |
800 | ||
801 | // Get the vertex of origin and the momentum | |
802 | TVector3 ver(fPosition[0],fPosition[1],fPosition[2]); | |
803 | TVector3 mom(fMomentum[0],fMomentum[1],fMomentum[2]); | |
804 | // | |
805 | // avoid momenta along axis | |
806 | if (TMath::Abs(mom[0])<kSafe) mom[0] = TMath::Sign(kSafe*TMath::Abs(mom[1]), mom[0]); | |
807 | if (TMath::Abs(mom[1])<kSafe) mom[1] = TMath::Sign(kSafe*TMath::Abs(mom[0]), mom[1]); | |
808 | ||
809 | // Rotate to the local coordinate system | |
810 | ver.RotateZ(-alpha); | |
811 | mom.RotateZ(-alpha); | |
812 | ||
813 | Double_t param0 = ver.Y(); | |
814 | Double_t param1 = ver.Z(); | |
815 | Double_t param2 = TMath::Sin(mom.Phi()); | |
816 | Double_t param3 = mom.Pz()/mom.Pt(); | |
817 | Double_t param4 = TMath::Sign(1/mom.Pt(),(Double_t)fCharge); | |
818 | ||
819 | //calculate the propagated coordinates | |
820 | //this is based on AliExternalTrackParam::GetXYZAt(Double_t x, Double_t b, Double_t *r) | |
821 | Double_t dx=x-ver.X(); | |
822 | if(TMath::Abs(dx)<=kAlmost0) return GetXYZ(r); | |
823 | ||
824 | Double_t f1=param2; | |
825 | Double_t f2=f1 + dx*param4*b*kB2C; | |
826 | ||
827 | if (TMath::Abs(f1) >= kAlmost1) return kFALSE; | |
828 | if (TMath::Abs(f2) >= kAlmost1) return kFALSE; | |
829 | ||
830 | Double_t r1=TMath::Sqrt((1.-f1)*(1.+f1)), r2=TMath::Sqrt((1.-f2)*(1.+f2)); | |
831 | r[0] = x; | |
832 | r[1] = param0 + dx*(f1+f2)/(r1+r2); | |
833 | r[2] = param1 + dx*(r2 + f2*(f1+f2)/(r1+r2))*param3;//Thanks to Andrea & Peter | |
834 | ||
835 | return Local2GlobalPosition(r,alpha); | |
836 | } | |
837 | ||
838 | ||
839 |