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