]>
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 | //______________________________________________________________________________ |
cdd730d0 | 424 | template <typename T> void AliAODTrack::SetP(const T *p, const Bool_t cartesian) |
df9db588 | 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 | ||
6e78367a | 448 | /* |
df9db588 | 449 | //______________________________________________________________________________ |
cdd730d0 | 450 | template <typename T> void AliAODTrack::SetPosition(const T *x, const Bool_t dca) |
df9db588 | 451 | { |
452 | // set the position | |
453 | ||
454 | if (x) { | |
455 | if (!dca) { | |
456 | ResetBit(kIsDCA); | |
457 | ||
458 | fPosition[0] = x[0]; | |
459 | fPosition[1] = x[1]; | |
460 | fPosition[2] = x[2]; | |
461 | } else { | |
462 | SetBit(kIsDCA); | |
463 | // don't know any better yet | |
464 | fPosition[0] = -999.; | |
465 | fPosition[1] = -999.; | |
466 | fPosition[2] = -999.; | |
467 | } | |
468 | } else { | |
469 | ResetBit(kIsDCA); | |
470 | ||
471 | fPosition[0] = -999.; | |
472 | fPosition[1] = -999.; | |
473 | fPosition[2] = -999.; | |
474 | } | |
475 | } | |
6e78367a | 476 | */ |
df9db588 | 477 | //______________________________________________________________________________ |
478 | void AliAODTrack::SetDCA(Double_t d, Double_t z) | |
479 | { | |
480 | // set the dca | |
481 | fPosition[0] = d; | |
482 | fPosition[1] = z; | |
483 | fPosition[2] = 0.; | |
484 | SetBit(kIsDCA); | |
485 | } | |
486 | ||
487 | //______________________________________________________________________________ | |
488 | void AliAODTrack::Print(Option_t* /* option */) const | |
489 | { | |
490 | // prints information about AliAODTrack | |
491 | ||
492 | printf("Object name: %s Track type: %s\n", GetName(), GetTitle()); | |
493 | printf(" px = %f\n", Px()); | |
494 | printf(" py = %f\n", Py()); | |
495 | printf(" pz = %f\n", Pz()); | |
496 | printf(" pt = %f\n", Pt()); | |
497 | printf(" 1/pt = %f\n", OneOverPt()); | |
498 | printf(" theta = %f\n", Theta()); | |
499 | printf(" phi = %f\n", Phi()); | |
1912763f | 500 | printf(" chi2/NDF = %f\n", Chi2perNDF()); |
df9db588 | 501 | printf(" charge = %d\n", Charge()); |
df9db588 | 502 | } |
503 | ||
2200238e | 504 | //______________________________________________________________________________ |
505 | void AliAODTrack::SetMatchTrigger(Int_t matchTrig) | |
506 | { | |
507 | // Set the MUON trigger information | |
8ac4fa64 | 508 | switch(matchTrig){ |
e1c744ca | 509 | case 0: // 0 track does not match trigger |
510 | fITSMuonClusterMap=fITSMuonClusterMap&0x3fffffff; | |
511 | break; | |
512 | case 1: // 1 track match but does not pass pt cut | |
513 | fITSMuonClusterMap=(fITSMuonClusterMap&0x3fffffff)|0x40000000; | |
514 | break; | |
515 | case 2: // 2 track match Low pt cut | |
516 | fITSMuonClusterMap=(fITSMuonClusterMap&0x3fffffff)|0x80000000; | |
517 | break; | |
518 | case 3: // 3 track match High pt cut | |
519 | fITSMuonClusterMap=fITSMuonClusterMap|0xc0000000; | |
520 | break; | |
521 | default: | |
522 | fITSMuonClusterMap=fITSMuonClusterMap&0x3fffffff; | |
8ac4fa64 | 523 | AliWarning(Form("unknown case for matchTrig: %d\n",matchTrig)); |
e1c744ca | 524 | } |
525 | } | |
526 | ||
2200238e | 527 | //______________________________________________________________________________ |
528 | Bool_t AliAODTrack::HitsMuonChamber(Int_t MuonChamber, Int_t cathode) const | |
529 | { | |
530 | // return kTRUE if the track fires the given tracking or trigger chamber. | |
531 | // If the chamber is a trigger one: | |
532 | // - if cathode = 0 or 1, the track matches the corresponding cathode | |
533 | // - if cathode = -1, the track matches both cathodes | |
534 | ||
535 | if (MuonChamber < 0) return kFALSE; | |
536 | ||
537 | if (MuonChamber < 10) return TESTBIT(GetMUONClusterMap(), MuonChamber); | |
538 | ||
539 | if (MuonChamber < 14) { | |
540 | ||
541 | if (cathode < 0) return TESTBIT(GetHitsPatternInTrigCh(), 13-MuonChamber) && | |
542 | TESTBIT(GetHitsPatternInTrigCh(), 13-MuonChamber+4); | |
543 | ||
544 | if (cathode < 2) return TESTBIT(GetHitsPatternInTrigCh(), 13-MuonChamber+(1-cathode)*4); | |
545 | ||
e1c744ca | 546 | } |
2200238e | 547 | |
548 | return kFALSE; | |
e1c744ca | 549 | } |
550 | ||
2200238e | 551 | //______________________________________________________________________________ |
552 | Bool_t AliAODTrack::MatchTriggerDigits() const | |
553 | { | |
554 | // return kTRUE if the track matches a digit on both planes of at least 2 trigger chambers | |
6c954176 | 555 | |
2200238e | 556 | Int_t nMatchedChambers = 0; |
557 | for (Int_t ich=10; ich<14; ich++) if (HitsMuonChamber(ich)) nMatchedChambers++; | |
558 | ||
559 | return (nMatchedChambers >= 2); | |
e1c744ca | 560 | } |
c683ddc2 | 561 | |
6dc40b1c | 562 | //______________________________________________________________________________ |
563 | Bool_t AliAODTrack::PropagateToDCA(const AliVVertex *vtx, | |
564 | Double_t b, Double_t maxd, Double_t dz[2], Double_t covar[3]) | |
565 | { | |
566 | // compute impact parameters to the vertex vtx and their covariance matrix | |
567 | // b is the Bz, needed to propagate correctly the track to vertex | |
568 | // only the track parameters are update after the propagation (pos and mom), | |
569 | // not the covariance matrix. This is OK for propagation over short distance | |
570 | // inside the beam pipe. | |
571 | // return kFALSE is something went wrong | |
572 | ||
573 | // convert to AliExternalTrackParam | |
4ec1ca0f | 574 | AliExternalTrackParam etp; etp.CopyFromVTrack(this); |
6dc40b1c | 575 | |
576 | Float_t xstart = etp.GetX(); | |
577 | if(xstart>3.) { | |
578 | AliError("This method can be used only for propagation inside the beam pipe"); | |
579 | return kFALSE; | |
580 | } | |
581 | ||
582 | if(!etp.PropagateToDCA(vtx,b,maxd,dz,covar)) return kFALSE; | |
583 | ||
584 | // update track position and momentum | |
585 | Double_t mom[3]; | |
586 | etp.GetPxPyPz(mom); | |
587 | SetP(mom,kTRUE); | |
588 | etp.GetXYZ(mom); | |
589 | SetPosition(mom,kFALSE); | |
590 | ||
591 | ||
592 | return kTRUE; | |
593 | } | |
594 | ||
c8fe2783 | 595 | //______________________________________________________________________________ |
596 | Bool_t AliAODTrack::GetPxPyPz(Double_t p[3]) const | |
597 | { | |
598 | //--------------------------------------------------------------------- | |
599 | // This function returns the global track momentum components | |
600 | //--------------------------------------------------------------------- | |
601 | p[0]=Px(); p[1]=Py(); p[2]=Pz(); | |
602 | return kTRUE; | |
603 | } | |
9006fe9c | 604 | |
25f906db | 605 | |
606 | //_______________________________________________________________________ | |
607 | Float_t AliAODTrack::GetTPCClusterInfo(Int_t nNeighbours/*=3*/, Int_t type/*=0*/, Int_t row0, Int_t row1, Int_t bitType ) const | |
9006fe9c | 608 | { |
609 | // | |
25f906db | 610 | // TPC cluster information |
9006fe9c | 611 | // type 0: get fraction of found/findable clusters with neighbourhood definition |
612 | // 1: findable clusters with neighbourhood definition | |
613 | // 2: found clusters | |
25f906db | 614 | // bitType: |
615 | // 0 - all cluster used | |
616 | // 1 - clusters used for the kalman update | |
9006fe9c | 617 | // definition of findable clusters: |
618 | // a cluster is defined as findable if there is another cluster | |
619 | // within +- nNeighbours pad rows. The idea is to overcome threshold | |
620 | // effects with a very simple algorithm. | |
621 | // | |
25f906db | 622 | |
9006fe9c | 623 | |
624 | Int_t found=0; | |
625 | Int_t findable=0; | |
626 | Int_t last=-nNeighbours; | |
25f906db | 627 | const TBits & clusterMap = (bitType%2==0) ? fTPCClusterMap : fTPCFitMap; |
9006fe9c | 628 | |
25f906db | 629 | Int_t upperBound=clusterMap.GetNbits(); |
630 | if (upperBound>row1) upperBound=row1; | |
631 | for (Int_t i=row0; i<upperBound; ++i){ | |
9006fe9c | 632 | //look to current row |
25f906db | 633 | if (clusterMap[i]) { |
9006fe9c | 634 | last=i; |
635 | ++found; | |
636 | ++findable; | |
637 | continue; | |
638 | } | |
639 | //look to nNeighbours before | |
640 | if ((i-last)<=nNeighbours) { | |
641 | ++findable; | |
642 | continue; | |
643 | } | |
644 | //look to nNeighbours after | |
645 | for (Int_t j=i+1; j<i+1+nNeighbours; ++j){ | |
25f906db | 646 | if (clusterMap[j]){ |
9006fe9c | 647 | ++findable; |
648 | break; | |
649 | } | |
650 | } | |
651 | } | |
25f906db | 652 | if (type==2) return found; |
9006fe9c | 653 | if (type==1) return findable; |
654 | ||
655 | if (type==0){ | |
656 | Float_t fraction=0; | |
25f906db | 657 | if (findable>0) |
9006fe9c | 658 | fraction=(Float_t)found/(Float_t)findable; |
25f906db | 659 | else |
9006fe9c | 660 | fraction=0; |
661 | return fraction; | |
25f906db | 662 | } |
9006fe9c | 663 | return 0; // undefined type - default value |
664 | } | |
fd21ec8d | 665 | |
25f906db | 666 | |
fd21ec8d | 667 | //______________________________________________________________________________ |
668 | Double_t AliAODTrack::GetTRDslice(Int_t plane, Int_t slice) const { | |
669 | // | |
670 | // return TRD Pid information | |
671 | // | |
672 | if (!fDetPid) return -1; | |
673 | Double32_t *trdSlices=fDetPid->GetTRDsignal(); | |
674 | if (!trdSlices) return -1; | |
675 | if ((plane<0) || (plane>=kTRDnPlanes)) { | |
676 | return -1.; | |
677 | } | |
678 | ||
99e9d5ec | 679 | Int_t ns=fDetPid->GetTRDnSlices()/kTRDnPlanes; |
fd21ec8d | 680 | if ((slice<-1) || (slice>=ns)) { |
681 | return -1.; | |
682 | } | |
683 | ||
684 | if(slice>=0) return trdSlices[plane*ns + slice]; | |
685 | ||
686 | // return average of the dEdx measurements | |
687 | Double_t q=0.; Double32_t *s = &trdSlices[plane*ns]; | |
688 | for (Int_t i=0; i<ns; i++, s++) if((*s)>0.) q+=(*s); | |
689 | return q/ns; | |
690 | } | |
691 | ||
99e9d5ec | 692 | //______________________________________________________________________________ |
693 | UChar_t AliAODTrack::GetTRDntrackletsPID() const{ | |
694 | // | |
695 | // return number of tracklets calculated from the slices | |
696 | // | |
697 | if(!fDetPid) return -1; | |
59a8e853 | 698 | return fDetPid->GetTRDntrackletsPID(); |
699 | } | |
99e9d5ec | 700 | |
59a8e853 | 701 | //______________________________________________________________________________ |
702 | UChar_t AliAODTrack::GetTRDncls(Int_t layer) const { | |
703 | // | |
704 | // return number of TRD clusters | |
705 | // | |
706 | if(!fDetPid || layer > 5) return -1; | |
707 | if(layer < 0) return fDetPid->GetTRDncls(); | |
708 | else return fDetPid->GetTRDncls(layer); | |
99e9d5ec | 709 | } |
710 | ||
fd21ec8d | 711 | //______________________________________________________________________________ |
712 | Double_t AliAODTrack::GetTRDmomentum(Int_t plane, Double_t */*sp*/) const | |
713 | { | |
714 | //Returns momentum estimation | |
715 | // in TRD layer "plane". | |
716 | ||
717 | if (!fDetPid) return -1; | |
c997f0f9 | 718 | const Double_t *trdMomentum=fDetPid->GetTRDmomentum(); |
fd21ec8d | 719 | |
720 | if (!trdMomentum) { | |
721 | return -1.; | |
722 | } | |
723 | if ((plane<0) || (plane>=kTRDnPlanes)) { | |
724 | return -1.; | |
725 | } | |
726 | ||
727 | return trdMomentum[plane]; | |
728 | } | |
76e6ee6a | 729 | |
730 | //_______________________________________________________________________ | |
1cecd6e3 | 731 | Int_t AliAODTrack::GetTOFBunchCrossing(Double_t b, Bool_t) const |
76e6ee6a | 732 | { |
733 | // Returns the number of bunch crossings after trigger (assuming 25ns spacing) | |
76e6ee6a | 734 | const double kSpacing = 25e3; // min interbanch spacing |
735 | const double kShift = 0; | |
3f2db92f | 736 | Int_t bcid = kTOFBCNA; // defualt one |
a512bf97 | 737 | if (!IsOn(kTOFout) || !IsOn(kESDpid)) return bcid; // no info |
738 | // | |
739 | double tdif = GetTOFsignal(); | |
740 | if (IsOn(kTIME)) { // integrated time info is there | |
741 | int pid = (int)GetMostProbablePID(); | |
742 | double ttimes[10]; | |
743 | GetIntegratedTimes(ttimes); | |
744 | tdif -= ttimes[pid]; | |
745 | } | |
746 | else { // assume integrated time info from TOF radius and momentum | |
747 | const double kRTOF = 385.; | |
748 | const double kCSpeed = 3.e-2; // cm/ps | |
749 | double p = P(); | |
750 | if (p<0.001) p = 1.0; | |
751 | double m = M(); | |
752 | double path = kRTOF; // mean TOF radius | |
753 | if (TMath::Abs(b)>kAlmost0) { // account for curvature | |
754 | double curv = Pt()/(b*kB2C); | |
755 | if (curv>kAlmost0) { | |
756 | double tgl = Pz()/Pt(); | |
757 | path = 2./curv*TMath::ASin(kRTOF*curv/2.)*TMath::Sqrt(1.+tgl*tgl); | |
758 | } | |
759 | } | |
760 | tdif -= path/kCSpeed*TMath::Sqrt(1.+m*m/(p*p)); | |
761 | } | |
76e6ee6a | 762 | bcid = TMath::Nint((tdif - kShift)/kSpacing); |
763 | return bcid; | |
764 | } | |
086400fc | 765 | |
766 | //_____________________________________________________________________________ | |
767 | Bool_t AliAODTrack::GetXYZAt(Double_t x, Double_t b, Double_t *r) const | |
768 | { | |
769 | //--------------------------------------------------------------------- | |
770 | // This function returns the global track position extrapolated to | |
771 | // the radial position "x" (cm) in the magnetic field "b" (kG) | |
772 | //--------------------------------------------------------------------- | |
773 | ||
774 | //conversion of track parameter representation is | |
775 | //based on the implementation of AliExternalTrackParam::Set(...) | |
776 | //maybe some of this code can be moved to AliVTrack to avoid code duplication | |
777 | const double kSafe = 1e-5; | |
778 | Double_t alpha=0.0; | |
779 | Double_t radPos2 = fPosition[0]*fPosition[0]+fPosition[1]*fPosition[1]; | |
780 | Double_t radMax = 45.; // approximately ITS outer radius | |
781 | if (radPos2 < radMax*radMax) { // inside the ITS | |
782 | alpha = TMath::ATan2(fMomentum[1],fMomentum[0]); | |
783 | } else { // outside the ITS | |
784 | Float_t phiPos = TMath::Pi()+TMath::ATan2(-fPosition[1], -fPosition[0]); | |
785 | alpha = | |
786 | TMath::DegToRad()*(20*((((Int_t)(phiPos*TMath::RadToDeg()))/20))+10); | |
787 | } | |
788 | // | |
789 | Double_t cs=TMath::Cos(alpha), sn=TMath::Sin(alpha); | |
790 | // protection: avoid alpha being too close to 0 or +-pi/2 | |
791 | if (TMath::Abs(sn)<kSafe) { | |
792 | alpha = kSafe; | |
793 | cs=TMath::Cos(alpha); | |
794 | sn=TMath::Sin(alpha); | |
795 | } | |
796 | else if (cs<kSafe) { | |
797 | alpha -= TMath::Sign(kSafe, alpha); | |
798 | cs=TMath::Cos(alpha); | |
799 | sn=TMath::Sin(alpha); | |
800 | } | |
801 | ||
802 | // Get the vertex of origin and the momentum | |
803 | TVector3 ver(fPosition[0],fPosition[1],fPosition[2]); | |
804 | TVector3 mom(fMomentum[0],fMomentum[1],fMomentum[2]); | |
805 | // | |
806 | // avoid momenta along axis | |
807 | if (TMath::Abs(mom[0])<kSafe) mom[0] = TMath::Sign(kSafe*TMath::Abs(mom[1]), mom[0]); | |
808 | if (TMath::Abs(mom[1])<kSafe) mom[1] = TMath::Sign(kSafe*TMath::Abs(mom[0]), mom[1]); | |
809 | ||
810 | // Rotate to the local coordinate system | |
811 | ver.RotateZ(-alpha); | |
812 | mom.RotateZ(-alpha); | |
813 | ||
814 | Double_t param0 = ver.Y(); | |
815 | Double_t param1 = ver.Z(); | |
816 | Double_t param2 = TMath::Sin(mom.Phi()); | |
817 | Double_t param3 = mom.Pz()/mom.Pt(); | |
818 | Double_t param4 = TMath::Sign(1/mom.Pt(),(Double_t)fCharge); | |
819 | ||
820 | //calculate the propagated coordinates | |
821 | //this is based on AliExternalTrackParam::GetXYZAt(Double_t x, Double_t b, Double_t *r) | |
822 | Double_t dx=x-ver.X(); | |
823 | if(TMath::Abs(dx)<=kAlmost0) return GetXYZ(r); | |
824 | ||
825 | Double_t f1=param2; | |
826 | Double_t f2=f1 + dx*param4*b*kB2C; | |
827 | ||
828 | if (TMath::Abs(f1) >= kAlmost1) return kFALSE; | |
829 | if (TMath::Abs(f2) >= kAlmost1) return kFALSE; | |
830 | ||
831 | Double_t r1=TMath::Sqrt((1.-f1)*(1.+f1)), r2=TMath::Sqrt((1.-f2)*(1.+f2)); | |
832 | r[0] = x; | |
833 | r[1] = param0 + dx*(f1+f2)/(r1+r2); | |
834 | r[2] = param1 + dx*(r2 + f2*(f1+f2)/(r1+r2))*param3;//Thanks to Andrea & Peter | |
835 | ||
836 | return Local2GlobalPosition(r,alpha); | |
837 | } | |
838 | ||
839 | ||
840 |