]>
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" | |
00a38d07 | 28 | #include "AliDetectorPID.h" |
aab77ed0 | 29 | #include "AliAODEvent.h" |
567624b5 | 30 | #include "AliAODHMPIDrings.h" |
31 | ||
32 | #include "AliAODTrack.h" | |
df9db588 | 33 | |
34 | ClassImp(AliAODTrack) | |
35 | ||
36 | //______________________________________________________________________________ | |
37 | AliAODTrack::AliAODTrack() : | |
4f6e22bd | 38 | AliVTrack(), |
f43586f0 | 39 | fRAtAbsorberEnd(0.), |
1912763f | 40 | fChi2perNDF(-999.), |
9333290e | 41 | fChi2MatchTrigger(0.), |
76b98553 | 42 | fPID(0), |
6efb741f | 43 | fFlags(0), |
df9db588 | 44 | fLabel(-999), |
a2c30af1 | 45 | fTOFLabel(), |
9b5c8b95 | 46 | fTrackLength(0), |
1912763f | 47 | fITSMuonClusterMap(0), |
0a2dcc83 | 48 | fMUONtrigHitsMapTrg(0), |
49 | fMUONtrigHitsMapTrk(0), | |
9333290e | 50 | fFilterMap(0), |
bcabd0e4 | 51 | fTPCFitMap(), |
d999f2e6 | 52 | fTPCClusterMap(), |
53 | fTPCSharedMap(), | |
3c01c166 | 54 | fTPCnclsF(0), |
820214a7 | 55 | fTPCNCrossedRows(0), |
02153d58 | 56 | fID(-999), |
9333290e | 57 | fCharge(-99), |
e1c744ca | 58 | fType(kUndef), |
76b98553 | 59 | fPIDForTracking(AliPID::kPion), |
a7d9ab9e | 60 | fCaloIndex(kEMCALNoMatch), |
9333290e | 61 | fCovMatrix(NULL), |
7be1db84 | 62 | fDetPid(NULL), |
00a38d07 | 63 | fDetectorPID(NULL), |
ed15417e | 64 | fProdVertex(NULL), |
65 | fTrackPhiOnEMCal(-999), | |
aab77ed0 | 66 | fTrackEtaOnEMCal(-999), |
a29b2a8a | 67 | fTrackPtOnEMCal(-999), |
539a5a59 | 68 | fTPCsignalTuned(0), |
a2c30af1 | 69 | fTOFsignalTuned(99999), |
aab77ed0 | 70 | fAODEvent(NULL) |
df9db588 | 71 | { |
72 | // default constructor | |
73 | ||
74 | SetP(); | |
75 | SetPosition((Float_t*)NULL); | |
6c954176 | 76 | SetXYAtDCA(-999., -999.); |
77 | SetPxPyPzAtDCA(-999., -999., -999.); | |
a2c30af1 | 78 | for (Int_t i = 0; i < 3; i++) {fTOFLabel[i] = -1;} |
df9db588 | 79 | } |
80 | ||
81 | //______________________________________________________________________________ | |
02153d58 | 82 | AliAODTrack::AliAODTrack(Short_t id, |
df9db588 | 83 | Int_t label, |
84 | Double_t p[3], | |
85 | Bool_t cartesian, | |
86 | Double_t x[3], | |
87 | Bool_t isDCA, | |
88 | Double_t covMatrix[21], | |
89 | Short_t charge, | |
90 | UChar_t itsClusMap, | |
df9db588 | 91 | AliAODVertex *prodVertex, |
1912763f | 92 | Bool_t usedForVtxFit, |
dc825b15 | 93 | Bool_t usedForPrimVtxFit, |
ec40c484 | 94 | AODTrk_t ttype, |
862ce351 | 95 | UInt_t selectInfo, |
96 | Float_t chi2perNDF) : | |
4f6e22bd | 97 | AliVTrack(), |
f43586f0 | 98 | fRAtAbsorberEnd(0.), |
862ce351 | 99 | fChi2perNDF(chi2perNDF), |
9333290e | 100 | fChi2MatchTrigger(0.), |
76b98553 | 101 | fPID(0), |
6efb741f | 102 | fFlags(0), |
df9db588 | 103 | fLabel(label), |
a2c30af1 | 104 | fTOFLabel(), |
9b5c8b95 | 105 | fTrackLength(0), |
6c954176 | 106 | fITSMuonClusterMap(0), |
0a2dcc83 | 107 | fMUONtrigHitsMapTrg(0), |
108 | fMUONtrigHitsMapTrk(0), | |
9333290e | 109 | fFilterMap(selectInfo), |
bcabd0e4 | 110 | fTPCFitMap(), |
d999f2e6 | 111 | fTPCClusterMap(), |
112 | fTPCSharedMap(), | |
3c01c166 | 113 | fTPCnclsF(0), |
820214a7 | 114 | fTPCNCrossedRows(0), |
02153d58 | 115 | fID(id), |
9333290e | 116 | fCharge(charge), |
e1c744ca | 117 | fType(ttype), |
76b98553 | 118 | fPIDForTracking(AliPID::kPion), |
a7d9ab9e | 119 | fCaloIndex(kEMCALNoMatch), |
9333290e | 120 | fCovMatrix(NULL), |
7be1db84 | 121 | fDetPid(NULL), |
00a38d07 | 122 | fDetectorPID(NULL), |
ed15417e | 123 | fProdVertex(prodVertex), |
124 | fTrackPhiOnEMCal(-999), | |
aab77ed0 | 125 | fTrackEtaOnEMCal(-999), |
a29b2a8a | 126 | fTrackPtOnEMCal(-999), |
539a5a59 | 127 | fTPCsignalTuned(0), |
a2c30af1 | 128 | fTOFsignalTuned(99999), |
aab77ed0 | 129 | fAODEvent(NULL) |
df9db588 | 130 | { |
131 | // constructor | |
132 | ||
133 | SetP(p, cartesian); | |
134 | SetPosition(x, isDCA); | |
6c954176 | 135 | SetXYAtDCA(-999., -999.); |
136 | SetPxPyPzAtDCA(-999., -999., -999.); | |
1912763f | 137 | SetUsedForVtxFit(usedForVtxFit); |
dc825b15 | 138 | SetUsedForPrimVtxFit(usedForPrimVtxFit); |
df9db588 | 139 | if(covMatrix) SetCovMatrix(covMatrix); |
6c954176 | 140 | SetITSClusterMap(itsClusMap); |
a2c30af1 | 141 | for (Int_t i=0;i<3;i++) {fTOFLabel[i]=-1;} |
df9db588 | 142 | } |
143 | ||
144 | //______________________________________________________________________________ | |
02153d58 | 145 | AliAODTrack::AliAODTrack(Short_t id, |
df9db588 | 146 | Int_t label, |
147 | Float_t p[3], | |
148 | Bool_t cartesian, | |
149 | Float_t x[3], | |
150 | Bool_t isDCA, | |
151 | Float_t covMatrix[21], | |
152 | Short_t charge, | |
153 | UChar_t itsClusMap, | |
df9db588 | 154 | AliAODVertex *prodVertex, |
1912763f | 155 | Bool_t usedForVtxFit, |
dc825b15 | 156 | Bool_t usedForPrimVtxFit, |
ec40c484 | 157 | AODTrk_t ttype, |
862ce351 | 158 | UInt_t selectInfo, |
76b98553 | 159 | Float_t chi2perNDF ) : |
4f6e22bd | 160 | AliVTrack(), |
f43586f0 | 161 | fRAtAbsorberEnd(0.), |
862ce351 | 162 | fChi2perNDF(chi2perNDF), |
9333290e | 163 | fChi2MatchTrigger(0.), |
76b98553 | 164 | fPID(0), |
6efb741f | 165 | fFlags(0), |
df9db588 | 166 | fLabel(label), |
a2c30af1 | 167 | fTOFLabel(), |
9b5c8b95 | 168 | fTrackLength(0), |
6c954176 | 169 | fITSMuonClusterMap(0), |
0a2dcc83 | 170 | fMUONtrigHitsMapTrg(0), |
171 | fMUONtrigHitsMapTrk(0), | |
9333290e | 172 | fFilterMap(selectInfo), |
bcabd0e4 | 173 | fTPCFitMap(), |
d999f2e6 | 174 | fTPCClusterMap(), |
175 | fTPCSharedMap(), | |
3c01c166 | 176 | fTPCnclsF(0), |
820214a7 | 177 | fTPCNCrossedRows(0), |
02153d58 | 178 | fID(id), |
9333290e | 179 | fCharge(charge), |
e1c744ca | 180 | fType(ttype), |
76b98553 | 181 | fPIDForTracking(AliPID::kPion), |
a7d9ab9e | 182 | fCaloIndex(kEMCALNoMatch), |
9333290e | 183 | fCovMatrix(NULL), |
7be1db84 | 184 | fDetPid(NULL), |
00a38d07 | 185 | fDetectorPID(NULL), |
ed15417e | 186 | fProdVertex(prodVertex), |
187 | fTrackPhiOnEMCal(-999), | |
aab77ed0 | 188 | fTrackEtaOnEMCal(-999), |
a29b2a8a | 189 | fTrackPtOnEMCal(-999), |
539a5a59 | 190 | fTPCsignalTuned(0), |
a2c30af1 | 191 | fTOFsignalTuned(99999), |
aab77ed0 | 192 | fAODEvent(NULL) |
df9db588 | 193 | { |
194 | // constructor | |
195 | ||
196 | SetP(p, cartesian); | |
197 | SetPosition(x, isDCA); | |
6c954176 | 198 | SetXYAtDCA(-999., -999.); |
199 | SetPxPyPzAtDCA(-999., -999., -999.); | |
1912763f | 200 | SetUsedForVtxFit(usedForVtxFit); |
dc825b15 | 201 | SetUsedForPrimVtxFit(usedForPrimVtxFit); |
df9db588 | 202 | if(covMatrix) SetCovMatrix(covMatrix); |
6c954176 | 203 | SetITSClusterMap(itsClusMap); |
a2c30af1 | 204 | for (Int_t i=0;i<3;i++) {fTOFLabel[i]=-1;} |
df9db588 | 205 | } |
206 | ||
df9db588 | 207 | //______________________________________________________________________________ |
208 | AliAODTrack::~AliAODTrack() | |
209 | { | |
210 | // destructor | |
211 | delete fCovMatrix; | |
7450f8ab | 212 | delete fDetPid; |
00a38d07 | 213 | delete fDetectorPID; |
76b98553 | 214 | delete[] fPID; |
df9db588 | 215 | } |
216 | ||
217 | ||
218 | //______________________________________________________________________________ | |
219 | AliAODTrack::AliAODTrack(const AliAODTrack& trk) : | |
4f6e22bd | 220 | AliVTrack(trk), |
f43586f0 | 221 | fRAtAbsorberEnd(trk.fRAtAbsorberEnd), |
1912763f | 222 | fChi2perNDF(trk.fChi2perNDF), |
9333290e | 223 | fChi2MatchTrigger(trk.fChi2MatchTrigger), |
76b98553 | 224 | fPID(0), |
6efb741f | 225 | fFlags(trk.fFlags), |
df9db588 | 226 | fLabel(trk.fLabel), |
a2c30af1 | 227 | fTOFLabel(), |
9b5c8b95 | 228 | fTrackLength(trk.fTrackLength), |
1912763f | 229 | fITSMuonClusterMap(trk.fITSMuonClusterMap), |
0a2dcc83 | 230 | fMUONtrigHitsMapTrg(trk.fMUONtrigHitsMapTrg), |
231 | fMUONtrigHitsMapTrk(trk.fMUONtrigHitsMapTrk), | |
9333290e | 232 | fFilterMap(trk.fFilterMap), |
bcabd0e4 | 233 | fTPCFitMap(trk.fTPCFitMap), |
d999f2e6 | 234 | fTPCClusterMap(trk.fTPCClusterMap), |
235 | fTPCSharedMap(trk.fTPCSharedMap), | |
3c01c166 | 236 | fTPCnclsF(trk.fTPCnclsF), |
820214a7 | 237 | fTPCNCrossedRows(trk.fTPCNCrossedRows), |
02153d58 | 238 | fID(trk.fID), |
9333290e | 239 | fCharge(trk.fCharge), |
e1c744ca | 240 | fType(trk.fType), |
76b98553 | 241 | fPIDForTracking(trk.fPIDForTracking), |
a7d9ab9e | 242 | fCaloIndex(trk.fCaloIndex), |
9333290e | 243 | fCovMatrix(NULL), |
7be1db84 | 244 | fDetPid(NULL), |
00a38d07 | 245 | fDetectorPID(NULL), |
ed15417e | 246 | fProdVertex(trk.fProdVertex), |
247 | fTrackPhiOnEMCal(trk.fTrackPhiOnEMCal), | |
aab77ed0 | 248 | fTrackEtaOnEMCal(trk.fTrackEtaOnEMCal), |
a29b2a8a | 249 | fTrackPtOnEMCal(trk.fTrackPtOnEMCal), |
539a5a59 | 250 | fTPCsignalTuned(trk.fTPCsignalTuned), |
a2c30af1 | 251 | fTOFsignalTuned(trk.fTOFsignalTuned), |
aab77ed0 | 252 | fAODEvent(trk.fAODEvent) |
df9db588 | 253 | { |
254 | // Copy constructor | |
255 | ||
256 | trk.GetP(fMomentum); | |
257 | trk.GetPosition(fPosition); | |
6c954176 | 258 | SetXYAtDCA(trk.XAtDCA(), trk.YAtDCA()); |
259 | SetPxPyPzAtDCA(trk.PxAtDCA(), trk.PyAtDCA(), trk.PzAtDCA()); | |
1912763f | 260 | SetUsedForVtxFit(trk.GetUsedForVtxFit()); |
dc825b15 | 261 | SetUsedForPrimVtxFit(trk.GetUsedForPrimVtxFit()); |
5d62ce04 | 262 | if(trk.fCovMatrix) fCovMatrix=new AliAODRedCov<6>(*trk.fCovMatrix); |
7be1db84 | 263 | if(trk.fDetPid) fDetPid=new AliAODPid(*trk.fDetPid); |
df9db588 | 264 | SetPID(trk.fPID); |
00a38d07 | 265 | if (trk.fDetectorPID) fDetectorPID = new AliDetectorPID(*trk.fDetectorPID); |
a2c30af1 | 266 | for (Int_t i = 0; i < 3; i++) {fTOFLabel[i] = trk.fTOFLabel[i];} |
df9db588 | 267 | } |
268 | ||
269 | //______________________________________________________________________________ | |
270 | AliAODTrack& AliAODTrack::operator=(const AliAODTrack& trk) | |
271 | { | |
272 | // Assignment operator | |
273 | if(this!=&trk) { | |
274 | ||
4f6e22bd | 275 | AliVTrack::operator=(trk); |
df9db588 | 276 | |
277 | trk.GetP(fMomentum); | |
278 | trk.GetPosition(fPosition); | |
6c954176 | 279 | SetXYAtDCA(trk.XAtDCA(), trk.YAtDCA()); |
280 | SetPxPyPzAtDCA(trk.PxAtDCA(), trk.PyAtDCA(), trk.PzAtDCA()); | |
05f9607e | 281 | fRAtAbsorberEnd = trk.fRAtAbsorberEnd; |
282 | fChi2perNDF = trk.fChi2perNDF; | |
283 | fChi2MatchTrigger = trk.fChi2MatchTrigger; | |
76b98553 | 284 | SetPID( trk.fPID ); |
05f9607e | 285 | fFlags = trk.fFlags; |
286 | fLabel = trk.fLabel; | |
9b5c8b95 | 287 | fTrackLength = trk.fTrackLength; |
9333290e | 288 | fITSMuonClusterMap = trk.fITSMuonClusterMap; |
0a2dcc83 | 289 | fMUONtrigHitsMapTrg = trk.fMUONtrigHitsMapTrg; |
290 | fMUONtrigHitsMapTrk = trk.fMUONtrigHitsMapTrk; | |
05f9607e | 291 | fFilterMap = trk.fFilterMap; |
bcabd0e4 | 292 | fTPCFitMap = trk.fTPCFitMap; |
05f9607e | 293 | fTPCClusterMap = trk.fTPCClusterMap; |
294 | fTPCSharedMap = trk.fTPCSharedMap; | |
295 | fTPCnclsF = trk.fTPCnclsF; | |
820214a7 | 296 | fTPCNCrossedRows = trk.fTPCNCrossedRows; |
05f9607e | 297 | fID = trk.fID; |
298 | fCharge = trk.fCharge; | |
299 | fType = trk.fType; | |
76b98553 | 300 | fPIDForTracking = trk.fPIDForTracking; |
05f9607e | 301 | fCaloIndex = trk.fCaloIndex; |
ed15417e | 302 | fTrackPhiOnEMCal = trk.fTrackPhiOnEMCal; |
303 | fTrackEtaOnEMCal = trk.fTrackEtaOnEMCal; | |
a29b2a8a | 304 | fTrackPtOnEMCal = trk.fTrackPtOnEMCal; |
539a5a59 | 305 | fTPCsignalTuned = trk.fTPCsignalTuned; |
a2c30af1 | 306 | fTOFsignalTuned = trk.fTOFsignalTuned; |
a7d9ab9e | 307 | |
df9db588 | 308 | delete fCovMatrix; |
5d62ce04 | 309 | if(trk.fCovMatrix) fCovMatrix=new AliAODRedCov<6>(*trk.fCovMatrix); |
df9db588 | 310 | else fCovMatrix=NULL; |
df9db588 | 311 | |
05f9607e | 312 | |
313 | fProdVertex = trk.fProdVertex; | |
1912763f | 314 | SetUsedForVtxFit(trk.GetUsedForVtxFit()); |
dc825b15 | 315 | SetUsedForPrimVtxFit(trk.GetUsedForPrimVtxFit()); |
7be1db84 | 316 | |
00a38d07 | 317 | //detector raw signals |
7be1db84 | 318 | delete fDetPid; |
319 | if(trk.fDetPid) fDetPid=new AliAODPid(*trk.fDetPid); | |
320 | else fDetPid=NULL; | |
05f9607e | 321 | |
00a38d07 | 322 | //calibrated PID cache |
323 | delete fDetectorPID; | |
324 | fDetectorPID=0x0; | |
325 | if (trk.fDetectorPID) fDetectorPID = new AliDetectorPID(*trk.fDetectorPID); | |
a2c30af1 | 326 | for (Int_t i = 0; i < 3; i++) {fTOFLabel[i] = trk.fTOFLabel[i];} |
df9db588 | 327 | } |
328 | ||
329 | return *this; | |
330 | } | |
331 | ||
4697e4fb | 332 | //______________________________________________________________________________ |
333 | Double_t AliAODTrack::M(AODTrkPID_t pid) const | |
334 | { | |
335 | // Returns the mass. | |
9861edc0 | 336 | // Masses for nuclei don't exist in the PDG tables, therefore they were put by hand. |
4697e4fb | 337 | |
338 | switch (pid) { | |
339 | ||
340 | case kElectron : | |
9861edc0 | 341 | return 0.000510999; //TDatabasePDG::Instance()->GetParticle(11/*::kElectron*/)->Mass(); |
4697e4fb | 342 | break; |
343 | ||
344 | case kMuon : | |
9861edc0 | 345 | return 0.1056584; //TDatabasePDG::Instance()->GetParticle(13/*::kMuonMinus*/)->Mass(); |
4697e4fb | 346 | break; |
347 | ||
348 | case kPion : | |
9861edc0 | 349 | return 0.13957; //TDatabasePDG::Instance()->GetParticle(211/*::kPiPlus*/)->Mass(); |
4697e4fb | 350 | break; |
351 | ||
352 | case kKaon : | |
9861edc0 | 353 | return 0.4937; //TDatabasePDG::Instance()->GetParticle(321/*::kKPlus*/)->Mass(); |
4697e4fb | 354 | break; |
355 | ||
356 | case kProton : | |
9861edc0 | 357 | return 0.9382720; //TDatabasePDG::Instance()->GetParticle(2212/*::kProton*/)->Mass(); |
4697e4fb | 358 | break; |
359 | ||
360 | case kDeuteron : | |
9861edc0 | 361 | return 1.8756; //TDatabasePDG::Instance()->GetParticle(1000010020)->Mass(); |
4697e4fb | 362 | break; |
363 | ||
364 | case kTriton : | |
9861edc0 | 365 | return 2.8089; //TDatabasePDG::Instance()->GetParticle(1000010030)->Mass(); |
4697e4fb | 366 | break; |
367 | ||
368 | case kHelium3 : | |
9861edc0 | 369 | return 2.8084; //TDatabasePDG::Instance()->GetParticle(1000020030)->Mass(); |
4697e4fb | 370 | break; |
371 | ||
372 | case kAlpha : | |
9861edc0 | 373 | return 3.7274; //TDatabasePDG::Instance()->GetParticle(1000020040)->Mass(); |
4697e4fb | 374 | break; |
375 | ||
376 | case kUnknown : | |
377 | return -999.; | |
378 | break; | |
379 | ||
380 | default : | |
381 | return -999.; | |
382 | } | |
383 | } | |
384 | ||
385 | //______________________________________________________________________________ | |
386 | Double_t AliAODTrack::E(AODTrkPID_t pid) const | |
387 | { | |
388 | // Returns the energy of the particle of a given pid. | |
389 | ||
390 | if (pid != kUnknown) { // particle was identified | |
391 | Double_t m = M(pid); | |
392 | return TMath::Sqrt(P()*P() + m*m); | |
393 | } else { // pid unknown | |
394 | return -999.; | |
395 | } | |
396 | } | |
397 | ||
398 | //______________________________________________________________________________ | |
399 | Double_t AliAODTrack::Y(AODTrkPID_t pid) const | |
400 | { | |
9861edc0 | 401 | // Returns the rapidity of a particle of a given pid. |
4697e4fb | 402 | |
403 | if (pid != kUnknown) { // particle was identified | |
404 | Double_t e = E(pid); | |
405 | Double_t pz = Pz(); | |
406 | if (e>=0 && e!=pz) { // energy was positive (e.g. not -999.) and not equal to pz | |
407 | return 0.5*TMath::Log((e+pz)/(e-pz)); | |
408 | } else { // energy not known or equal to pz | |
409 | return -999.; | |
410 | } | |
411 | } else { // pid unknown | |
412 | return -999.; | |
413 | } | |
414 | } | |
415 | ||
416 | //______________________________________________________________________________ | |
417 | Double_t AliAODTrack::Y(Double_t m) const | |
418 | { | |
9861edc0 | 419 | // Returns the rapidity of a particle of a given mass. |
4697e4fb | 420 | |
421 | if (m >= 0.) { // mass makes sense | |
422 | Double_t e = E(m); | |
423 | Double_t pz = Pz(); | |
424 | if (e>=0 && e!=pz) { // energy was positive (e.g. not -999.) and not equal to pz | |
425 | return 0.5*TMath::Log((e+pz)/(e-pz)); | |
426 | } else { // energy not known or equal to pz | |
427 | return -999.; | |
428 | } | |
429 | } else { // pid unknown | |
430 | return -999.; | |
431 | } | |
432 | } | |
433 | ||
a2c30af1 | 434 | void AliAODTrack::SetTOFLabel(const Int_t *p) { |
435 | // Sets (in TOF) | |
436 | for (Int_t i = 0; i < 3; i++) fTOFLabel[i]=p[i]; | |
437 | } | |
438 | ||
439 | //_______________________________________________________________________ | |
440 | void AliAODTrack::GetTOFLabel(Int_t *p) const { | |
441 | // Gets (in TOF) | |
442 | for (Int_t i=0; i<3; i++) p[i]=fTOFLabel[i]; | |
443 | } | |
444 | ||
4697e4fb | 445 | //______________________________________________________________________________ |
446 | AliAODTrack::AODTrkPID_t AliAODTrack::GetMostProbablePID() const | |
447 | { | |
448 | // Returns the most probable PID array element. | |
449 | ||
450 | Int_t nPID = 10; | |
7ba6f91a | 451 | AODTrkPID_t loc = kUnknown; |
7ba6f91a | 452 | Bool_t allTheSame = kTRUE; |
76b98553 | 453 | if (fPID) { |
454 | Double_t max = 0.; | |
455 | for (Int_t iPID = 0; iPID < nPID; iPID++) { | |
456 | if (fPID[iPID] >= max) { | |
457 | if (fPID[iPID] > max) { | |
458 | allTheSame = kFALSE; | |
459 | max = fPID[iPID]; | |
460 | loc = (AODTrkPID_t)iPID; | |
461 | } else { | |
462 | allTheSame = kTRUE; | |
463 | } | |
4697e4fb | 464 | } |
465 | } | |
4697e4fb | 466 | } |
76b98553 | 467 | return allTheSame ? AODTrkPID_t(GetPIDForTracking()) : loc; |
4697e4fb | 468 | } |
469 | ||
470 | //______________________________________________________________________________ | |
471 | void AliAODTrack::ConvertAliPIDtoAODPID() | |
472 | { | |
473 | // Converts AliPID array. | |
474 | // The numbering scheme is the same for electrons, muons, pions, kaons, and protons. | |
475 | // Everything else has to be set to zero. | |
76b98553 | 476 | if (fPID) { |
477 | fPID[kDeuteron] = 0.; | |
478 | fPID[kTriton] = 0.; | |
479 | fPID[kHelium3] = 0.; | |
480 | fPID[kAlpha] = 0.; | |
481 | fPID[kUnknown] = 0.; | |
482 | } | |
4697e4fb | 483 | return; |
484 | } | |
485 | ||
486 | ||
df9db588 | 487 | //______________________________________________________________________________ |
cdd730d0 | 488 | template <typename T> void AliAODTrack::SetP(const T *p, const Bool_t cartesian) |
df9db588 | 489 | { |
8a1418dc | 490 | // Set the momentum |
df9db588 | 491 | |
492 | if (p) { | |
493 | if (cartesian) { | |
16b65f2a | 494 | Double_t pt2 = p[0]*p[0] + p[1]*p[1]; |
0c5f89fb | 495 | Double_t pp = TMath::Sqrt(pt2 + p[2]*p[2]); |
df9db588 | 496 | |
16b65f2a | 497 | fMomentum[0] = TMath::Sqrt(pt2); // pt |
b1a9edc8 | 498 | fMomentum[1] = (pt2 != 0.) ? TMath::Pi()+TMath::ATan2(-p[1], -p[0]) : -999; // phi |
0c5f89fb | 499 | fMomentum[2] = (pp != 0.) ? TMath::ACos(p[2] / pp) : -999.; // theta |
df9db588 | 500 | } else { |
16b65f2a | 501 | fMomentum[0] = p[0]; // pt |
df9db588 | 502 | fMomentum[1] = p[1]; // phi |
503 | fMomentum[2] = p[2]; // theta | |
504 | } | |
505 | } else { | |
506 | fMomentum[0] = -999.; | |
507 | fMomentum[1] = -999.; | |
508 | fMomentum[2] = -999.; | |
509 | } | |
510 | } | |
511 | ||
6e78367a | 512 | /* |
df9db588 | 513 | //______________________________________________________________________________ |
cdd730d0 | 514 | template <typename T> void AliAODTrack::SetPosition(const T *x, const Bool_t dca) |
df9db588 | 515 | { |
516 | // set the position | |
517 | ||
518 | if (x) { | |
519 | if (!dca) { | |
520 | ResetBit(kIsDCA); | |
521 | ||
522 | fPosition[0] = x[0]; | |
523 | fPosition[1] = x[1]; | |
524 | fPosition[2] = x[2]; | |
525 | } else { | |
526 | SetBit(kIsDCA); | |
527 | // don't know any better yet | |
528 | fPosition[0] = -999.; | |
529 | fPosition[1] = -999.; | |
530 | fPosition[2] = -999.; | |
531 | } | |
532 | } else { | |
533 | ResetBit(kIsDCA); | |
534 | ||
535 | fPosition[0] = -999.; | |
536 | fPosition[1] = -999.; | |
537 | fPosition[2] = -999.; | |
538 | } | |
539 | } | |
6e78367a | 540 | */ |
df9db588 | 541 | //______________________________________________________________________________ |
542 | void AliAODTrack::SetDCA(Double_t d, Double_t z) | |
543 | { | |
544 | // set the dca | |
545 | fPosition[0] = d; | |
546 | fPosition[1] = z; | |
547 | fPosition[2] = 0.; | |
548 | SetBit(kIsDCA); | |
549 | } | |
550 | ||
551 | //______________________________________________________________________________ | |
552 | void AliAODTrack::Print(Option_t* /* option */) const | |
553 | { | |
554 | // prints information about AliAODTrack | |
555 | ||
556 | printf("Object name: %s Track type: %s\n", GetName(), GetTitle()); | |
557 | printf(" px = %f\n", Px()); | |
558 | printf(" py = %f\n", Py()); | |
559 | printf(" pz = %f\n", Pz()); | |
560 | printf(" pt = %f\n", Pt()); | |
561 | printf(" 1/pt = %f\n", OneOverPt()); | |
562 | printf(" theta = %f\n", Theta()); | |
563 | printf(" phi = %f\n", Phi()); | |
1912763f | 564 | printf(" chi2/NDF = %f\n", Chi2perNDF()); |
df9db588 | 565 | printf(" charge = %d\n", Charge()); |
df9db588 | 566 | } |
567 | ||
2200238e | 568 | //______________________________________________________________________________ |
569 | void AliAODTrack::SetMatchTrigger(Int_t matchTrig) | |
570 | { | |
571 | // Set the MUON trigger information | |
8ac4fa64 | 572 | switch(matchTrig){ |
e1c744ca | 573 | case 0: // 0 track does not match trigger |
574 | fITSMuonClusterMap=fITSMuonClusterMap&0x3fffffff; | |
575 | break; | |
576 | case 1: // 1 track match but does not pass pt cut | |
577 | fITSMuonClusterMap=(fITSMuonClusterMap&0x3fffffff)|0x40000000; | |
578 | break; | |
579 | case 2: // 2 track match Low pt cut | |
580 | fITSMuonClusterMap=(fITSMuonClusterMap&0x3fffffff)|0x80000000; | |
581 | break; | |
582 | case 3: // 3 track match High pt cut | |
583 | fITSMuonClusterMap=fITSMuonClusterMap|0xc0000000; | |
584 | break; | |
585 | default: | |
586 | fITSMuonClusterMap=fITSMuonClusterMap&0x3fffffff; | |
8ac4fa64 | 587 | AliWarning(Form("unknown case for matchTrig: %d\n",matchTrig)); |
e1c744ca | 588 | } |
589 | } | |
590 | ||
2200238e | 591 | //______________________________________________________________________________ |
592 | Bool_t AliAODTrack::HitsMuonChamber(Int_t MuonChamber, Int_t cathode) const | |
593 | { | |
594 | // return kTRUE if the track fires the given tracking or trigger chamber. | |
595 | // If the chamber is a trigger one: | |
596 | // - if cathode = 0 or 1, the track matches the corresponding cathode | |
597 | // - if cathode = -1, the track matches both cathodes | |
598 | ||
599 | if (MuonChamber < 0) return kFALSE; | |
600 | ||
601 | if (MuonChamber < 10) return TESTBIT(GetMUONClusterMap(), MuonChamber); | |
602 | ||
603 | if (MuonChamber < 14) { | |
604 | ||
605 | if (cathode < 0) return TESTBIT(GetHitsPatternInTrigCh(), 13-MuonChamber) && | |
606 | TESTBIT(GetHitsPatternInTrigCh(), 13-MuonChamber+4); | |
607 | ||
608 | if (cathode < 2) return TESTBIT(GetHitsPatternInTrigCh(), 13-MuonChamber+(1-cathode)*4); | |
609 | ||
e1c744ca | 610 | } |
2200238e | 611 | |
612 | return kFALSE; | |
e1c744ca | 613 | } |
614 | ||
2200238e | 615 | //______________________________________________________________________________ |
616 | Bool_t AliAODTrack::MatchTriggerDigits() const | |
617 | { | |
618 | // return kTRUE if the track matches a digit on both planes of at least 2 trigger chambers | |
6c954176 | 619 | |
2200238e | 620 | Int_t nMatchedChambers = 0; |
621 | for (Int_t ich=10; ich<14; ich++) if (HitsMuonChamber(ich)) nMatchedChambers++; | |
622 | ||
623 | return (nMatchedChambers >= 2); | |
e1c744ca | 624 | } |
c683ddc2 | 625 | |
6dc40b1c | 626 | //______________________________________________________________________________ |
627 | Bool_t AliAODTrack::PropagateToDCA(const AliVVertex *vtx, | |
628 | Double_t b, Double_t maxd, Double_t dz[2], Double_t covar[3]) | |
629 | { | |
630 | // compute impact parameters to the vertex vtx and their covariance matrix | |
631 | // b is the Bz, needed to propagate correctly the track to vertex | |
632 | // only the track parameters are update after the propagation (pos and mom), | |
633 | // not the covariance matrix. This is OK for propagation over short distance | |
634 | // inside the beam pipe. | |
635 | // return kFALSE is something went wrong | |
636 | ||
95764f96 | 637 | // allowed only for tracks inside the beam pipe |
638 | Float_t xstart2 = fPosition[0]*fPosition[0]+fPosition[1]*fPosition[1]; | |
639 | if(xstart2 > 3.*3.) { // outside beampipe radius | |
6dc40b1c | 640 | AliError("This method can be used only for propagation inside the beam pipe"); |
641 | return kFALSE; | |
642 | } | |
643 | ||
95764f96 | 644 | // convert to AliExternalTrackParam |
645 | AliExternalTrackParam etp; etp.CopyFromVTrack(this); | |
646 | ||
647 | // propagate | |
6dc40b1c | 648 | if(!etp.PropagateToDCA(vtx,b,maxd,dz,covar)) return kFALSE; |
649 | ||
650 | // update track position and momentum | |
651 | Double_t mom[3]; | |
652 | etp.GetPxPyPz(mom); | |
653 | SetP(mom,kTRUE); | |
654 | etp.GetXYZ(mom); | |
655 | SetPosition(mom,kFALSE); | |
656 | ||
657 | ||
658 | return kTRUE; | |
659 | } | |
660 | ||
c8fe2783 | 661 | //______________________________________________________________________________ |
662 | Bool_t AliAODTrack::GetPxPyPz(Double_t p[3]) const | |
663 | { | |
664 | //--------------------------------------------------------------------- | |
665 | // This function returns the global track momentum components | |
666 | //--------------------------------------------------------------------- | |
667 | p[0]=Px(); p[1]=Py(); p[2]=Pz(); | |
668 | return kTRUE; | |
669 | } | |
9006fe9c | 670 | |
25f906db | 671 | |
672 | //_______________________________________________________________________ | |
673 | Float_t AliAODTrack::GetTPCClusterInfo(Int_t nNeighbours/*=3*/, Int_t type/*=0*/, Int_t row0, Int_t row1, Int_t bitType ) const | |
9006fe9c | 674 | { |
675 | // | |
25f906db | 676 | // TPC cluster information |
9006fe9c | 677 | // type 0: get fraction of found/findable clusters with neighbourhood definition |
678 | // 1: findable clusters with neighbourhood definition | |
679 | // 2: found clusters | |
25f906db | 680 | // bitType: |
681 | // 0 - all cluster used | |
682 | // 1 - clusters used for the kalman update | |
9006fe9c | 683 | // definition of findable clusters: |
684 | // a cluster is defined as findable if there is another cluster | |
685 | // within +- nNeighbours pad rows. The idea is to overcome threshold | |
686 | // effects with a very simple algorithm. | |
687 | // | |
25f906db | 688 | |
9006fe9c | 689 | |
690 | Int_t found=0; | |
691 | Int_t findable=0; | |
692 | Int_t last=-nNeighbours; | |
25f906db | 693 | const TBits & clusterMap = (bitType%2==0) ? fTPCClusterMap : fTPCFitMap; |
9006fe9c | 694 | |
25f906db | 695 | Int_t upperBound=clusterMap.GetNbits(); |
696 | if (upperBound>row1) upperBound=row1; | |
697 | for (Int_t i=row0; i<upperBound; ++i){ | |
9006fe9c | 698 | //look to current row |
25f906db | 699 | if (clusterMap[i]) { |
9006fe9c | 700 | last=i; |
701 | ++found; | |
702 | ++findable; | |
703 | continue; | |
704 | } | |
705 | //look to nNeighbours before | |
706 | if ((i-last)<=nNeighbours) { | |
707 | ++findable; | |
708 | continue; | |
709 | } | |
710 | //look to nNeighbours after | |
711 | for (Int_t j=i+1; j<i+1+nNeighbours; ++j){ | |
25f906db | 712 | if (clusterMap[j]){ |
9006fe9c | 713 | ++findable; |
714 | break; | |
715 | } | |
716 | } | |
717 | } | |
25f906db | 718 | if (type==2) return found; |
9006fe9c | 719 | if (type==1) return findable; |
720 | ||
721 | if (type==0){ | |
722 | Float_t fraction=0; | |
25f906db | 723 | if (findable>0) |
9006fe9c | 724 | fraction=(Float_t)found/(Float_t)findable; |
25f906db | 725 | else |
9006fe9c | 726 | fraction=0; |
727 | return fraction; | |
25f906db | 728 | } |
9006fe9c | 729 | return 0; // undefined type - default value |
730 | } | |
fd21ec8d | 731 | |
25f906db | 732 | |
fd21ec8d | 733 | //______________________________________________________________________________ |
734 | Double_t AliAODTrack::GetTRDslice(Int_t plane, Int_t slice) const { | |
735 | // | |
736 | // return TRD Pid information | |
737 | // | |
738 | if (!fDetPid) return -1; | |
6736efd5 | 739 | Double32_t *trdSlices=fDetPid->GetTRDslices(); |
fd21ec8d | 740 | if (!trdSlices) return -1; |
741 | if ((plane<0) || (plane>=kTRDnPlanes)) { | |
742 | return -1.; | |
743 | } | |
744 | ||
eb550f5c | 745 | Int_t ns=fDetPid->GetTRDnSlices(); |
fd21ec8d | 746 | if ((slice<-1) || (slice>=ns)) { |
747 | return -1.; | |
748 | } | |
749 | ||
750 | if(slice>=0) return trdSlices[plane*ns + slice]; | |
751 | ||
752 | // return average of the dEdx measurements | |
753 | Double_t q=0.; Double32_t *s = &trdSlices[plane*ns]; | |
754 | for (Int_t i=0; i<ns; i++, s++) if((*s)>0.) q+=(*s); | |
755 | return q/ns; | |
756 | } | |
757 | ||
99e9d5ec | 758 | //______________________________________________________________________________ |
759 | UChar_t AliAODTrack::GetTRDntrackletsPID() const{ | |
760 | // | |
761 | // return number of tracklets calculated from the slices | |
762 | // | |
763 | if(!fDetPid) return -1; | |
59a8e853 | 764 | return fDetPid->GetTRDntrackletsPID(); |
765 | } | |
99e9d5ec | 766 | |
59a8e853 | 767 | //______________________________________________________________________________ |
768 | UChar_t AliAODTrack::GetTRDncls(Int_t layer) const { | |
769 | // | |
770 | // return number of TRD clusters | |
771 | // | |
772 | if(!fDetPid || layer > 5) return -1; | |
773 | if(layer < 0) return fDetPid->GetTRDncls(); | |
774 | else return fDetPid->GetTRDncls(layer); | |
99e9d5ec | 775 | } |
776 | ||
fd21ec8d | 777 | //______________________________________________________________________________ |
778 | Double_t AliAODTrack::GetTRDmomentum(Int_t plane, Double_t */*sp*/) const | |
779 | { | |
780 | //Returns momentum estimation | |
781 | // in TRD layer "plane". | |
782 | ||
783 | if (!fDetPid) return -1; | |
c997f0f9 | 784 | const Double_t *trdMomentum=fDetPid->GetTRDmomentum(); |
fd21ec8d | 785 | |
786 | if (!trdMomentum) { | |
787 | return -1.; | |
788 | } | |
789 | if ((plane<0) || (plane>=kTRDnPlanes)) { | |
790 | return -1.; | |
791 | } | |
792 | ||
793 | return trdMomentum[plane]; | |
794 | } | |
76e6ee6a | 795 | |
796 | //_______________________________________________________________________ | |
1cecd6e3 | 797 | Int_t AliAODTrack::GetTOFBunchCrossing(Double_t b, Bool_t) const |
76e6ee6a | 798 | { |
799 | // Returns the number of bunch crossings after trigger (assuming 25ns spacing) | |
76e6ee6a | 800 | const double kSpacing = 25e3; // min interbanch spacing |
801 | const double kShift = 0; | |
3f2db92f | 802 | Int_t bcid = kTOFBCNA; // defualt one |
a512bf97 | 803 | if (!IsOn(kTOFout) || !IsOn(kESDpid)) return bcid; // no info |
804 | // | |
805 | double tdif = GetTOFsignal(); | |
806 | if (IsOn(kTIME)) { // integrated time info is there | |
807 | int pid = (int)GetMostProbablePID(); | |
808 | double ttimes[10]; | |
809 | GetIntegratedTimes(ttimes); | |
810 | tdif -= ttimes[pid]; | |
811 | } | |
812 | else { // assume integrated time info from TOF radius and momentum | |
813 | const double kRTOF = 385.; | |
814 | const double kCSpeed = 3.e-2; // cm/ps | |
815 | double p = P(); | |
816 | if (p<0.001) p = 1.0; | |
817 | double m = M(); | |
818 | double path = kRTOF; // mean TOF radius | |
819 | if (TMath::Abs(b)>kAlmost0) { // account for curvature | |
820 | double curv = Pt()/(b*kB2C); | |
821 | if (curv>kAlmost0) { | |
822 | double tgl = Pz()/Pt(); | |
823 | path = 2./curv*TMath::ASin(kRTOF*curv/2.)*TMath::Sqrt(1.+tgl*tgl); | |
824 | } | |
825 | } | |
826 | tdif -= path/kCSpeed*TMath::Sqrt(1.+m*m/(p*p)); | |
827 | } | |
76e6ee6a | 828 | bcid = TMath::Nint((tdif - kShift)/kSpacing); |
829 | return bcid; | |
830 | } | |
086400fc | 831 | |
00a38d07 | 832 | void AliAODTrack::SetDetectorPID(const AliDetectorPID *pid) |
833 | { | |
834 | // | |
835 | // Set the detector PID | |
836 | // | |
837 | if (fDetectorPID) delete fDetectorPID; | |
838 | fDetectorPID=pid; | |
839 | ||
840 | } | |
841 | ||
567624b5 | 842 | //_____________________________________________________________________________ |
843 | Double_t AliAODTrack::GetHMPIDsignal() const | |
844 | { | |
845 | if(fAODEvent->GetHMPIDringForTrackID(fID)) return fAODEvent->GetHMPIDringForTrackID(fID)->GetHmpSignal(); | |
846 | else return -999.; | |
847 | } | |
848 | ||
849 | //_____________________________________________________________________________ | |
850 | Double_t AliAODTrack::GetHMPIDoccupancy() const | |
851 | { | |
852 | if(fAODEvent->GetHMPIDringForTrackID(fID)) return fAODEvent->GetHMPIDringForTrackID(fID)->GetHmpOccupancy(); | |
853 | else return -999.; | |
854 | } | |
855 | ||
856 | //_____________________________________________________________________________ | |
857 | Int_t AliAODTrack::GetHMPIDcluIdx() const | |
858 | { | |
859 | if(fAODEvent->GetHMPIDringForTrackID(fID)) return fAODEvent->GetHMPIDringForTrackID(fID)->GetHmpCluIdx(); | |
860 | else return -999; | |
861 | } | |
862 | ||
863 | //_____________________________________________________________________________ | |
864 | void AliAODTrack::GetHMPIDtrk(Float_t &x, Float_t &y, Float_t &th, Float_t &ph) const | |
865 | { | |
866 | x = -999; y = -999.; th = -999.; ph = -999.; | |
867 | ||
868 | const AliAODHMPIDrings *ring=fAODEvent->GetHMPIDringForTrackID(fID); | |
869 | if(ring){ | |
870 | x = ring->GetHmpTrackX(); | |
871 | y = ring->GetHmpTrackY(); | |
872 | th = ring->GetHmpTrackTheta(); | |
873 | ph = ring->GetHmpTrackPhi(); | |
874 | } | |
875 | } | |
876 | ||
877 | //_____________________________________________________________________________ | |
878 | void AliAODTrack::GetHMPIDmip(Float_t &x,Float_t &y,Int_t &q, Int_t &nph) const | |
879 | { | |
880 | x = -999; y = -999.; q = -999; nph = -999; | |
881 | ||
882 | const AliAODHMPIDrings *ring=fAODEvent->GetHMPIDringForTrackID(fID); | |
883 | if(ring){ | |
884 | x = ring->GetHmpMipX(); | |
885 | y = ring->GetHmpMipY(); | |
886 | q = (Int_t)ring->GetHmpMipCharge(); | |
887 | nph = (Int_t)ring->GetHmpNumOfPhotonClusters(); | |
888 | } | |
889 | } | |
890 | ||
891 | //_____________________________________________________________________________ | |
892 | Bool_t AliAODTrack::GetOuterHmpPxPyPz(Double_t *p) const | |
893 | { | |
894 | if(fAODEvent->GetHMPIDringForTrackID(fID)) {fAODEvent->GetHMPIDringForTrackID(fID)->GetHmpMom(p); return kTRUE;} | |
895 | ||
896 | else return kFALSE; | |
897 | } | |
086400fc | 898 | //_____________________________________________________________________________ |
899 | Bool_t AliAODTrack::GetXYZAt(Double_t x, Double_t b, Double_t *r) const | |
900 | { | |
901 | //--------------------------------------------------------------------- | |
902 | // This function returns the global track position extrapolated to | |
903 | // the radial position "x" (cm) in the magnetic field "b" (kG) | |
904 | //--------------------------------------------------------------------- | |
905 | ||
906 | //conversion of track parameter representation is | |
907 | //based on the implementation of AliExternalTrackParam::Set(...) | |
908 | //maybe some of this code can be moved to AliVTrack to avoid code duplication | |
086400fc | 909 | Double_t alpha=0.0; |
910 | Double_t radPos2 = fPosition[0]*fPosition[0]+fPosition[1]*fPosition[1]; | |
911 | Double_t radMax = 45.; // approximately ITS outer radius | |
912 | if (radPos2 < radMax*radMax) { // inside the ITS | |
37f42322 | 913 | alpha = fMomentum[1]; //TMath::ATan2(fMomentum[1],fMomentum[0]); // fMom is pt,phi,theta! |
086400fc | 914 | } else { // outside the ITS |
915 | Float_t phiPos = TMath::Pi()+TMath::ATan2(-fPosition[1], -fPosition[0]); | |
916 | alpha = | |
917 | TMath::DegToRad()*(20*((((Int_t)(phiPos*TMath::RadToDeg()))/20))+10); | |
918 | } | |
919 | // | |
086400fc | 920 | // Get the vertex of origin and the momentum |
921 | TVector3 ver(fPosition[0],fPosition[1],fPosition[2]); | |
37f42322 | 922 | TVector3 mom(Px(),Py(),Pz()); |
086400fc | 923 | // |
086400fc | 924 | // Rotate to the local coordinate system |
925 | ver.RotateZ(-alpha); | |
926 | mom.RotateZ(-alpha); | |
927 | ||
928 | Double_t param0 = ver.Y(); | |
929 | Double_t param1 = ver.Z(); | |
930 | Double_t param2 = TMath::Sin(mom.Phi()); | |
931 | Double_t param3 = mom.Pz()/mom.Pt(); | |
932 | Double_t param4 = TMath::Sign(1/mom.Pt(),(Double_t)fCharge); | |
933 | ||
934 | //calculate the propagated coordinates | |
935 | //this is based on AliExternalTrackParam::GetXYZAt(Double_t x, Double_t b, Double_t *r) | |
936 | Double_t dx=x-ver.X(); | |
937 | if(TMath::Abs(dx)<=kAlmost0) return GetXYZ(r); | |
938 | ||
939 | Double_t f1=param2; | |
940 | Double_t f2=f1 + dx*param4*b*kB2C; | |
941 | ||
942 | if (TMath::Abs(f1) >= kAlmost1) return kFALSE; | |
943 | if (TMath::Abs(f2) >= kAlmost1) return kFALSE; | |
944 | ||
945 | Double_t r1=TMath::Sqrt((1.-f1)*(1.+f1)), r2=TMath::Sqrt((1.-f2)*(1.+f2)); | |
946 | r[0] = x; | |
947 | r[1] = param0 + dx*(f1+f2)/(r1+r2); | |
948 | r[2] = param1 + dx*(r2 + f2*(f1+f2)/(r1+r2))*param3;//Thanks to Andrea & Peter | |
086400fc | 949 | return Local2GlobalPosition(r,alpha); |
950 | } | |
951 | ||
c8253dd9 | 952 | //_____________________________________________________________________________ |
953 | Bool_t AliAODTrack::GetXYZatR(Double_t xr,Double_t bz, Double_t *xyz, Double_t* alpSect) const | |
954 | { | |
955 | // This method has 3 modes of behaviour | |
956 | // 1) xyz[3] array is provided but alpSect pointer is 0: calculate the position of track intersection | |
957 | // with circle of radius xr and fill it in xyz array | |
958 | // 2) alpSect pointer is provided: find alpha of the sector where the track reaches local coordinate xr | |
959 | // Note that in this case xr is NOT the radius but the local coordinate. | |
960 | // If the xyz array is provided, it will be filled by track lab coordinates at local X in this sector | |
961 | // 3) Neither alpSect nor xyz pointers are provided: just check if the track reaches radius xr | |
962 | // | |
963 | // | |
964 | Double_t alpha=0.0; | |
965 | Double_t radPos2 = fPosition[0]*fPosition[0]+fPosition[1]*fPosition[1]; | |
966 | Double_t radMax = 45.; // approximately ITS outer radius | |
967 | if (radPos2 < radMax*radMax) { // inside the ITS | |
968 | alpha = fMomentum[1]; //TMath::ATan2(fMomentum[1],fMomentum[0]); // fMom is pt,phi,theta! | |
969 | } else { // outside the ITS | |
970 | Float_t phiPos = TMath::Pi()+TMath::ATan2(-fPosition[1], -fPosition[0]); | |
971 | alpha = | |
972 | TMath::DegToRad()*(20*((((Int_t)(phiPos*TMath::RadToDeg()))/20))+10); | |
973 | } | |
974 | // | |
975 | // Get the vertex of origin and the momentum | |
976 | TVector3 ver(fPosition[0],fPosition[1],fPosition[2]); | |
977 | TVector3 mom(Px(),Py(),Pz()); | |
978 | // | |
979 | // Rotate to the local coordinate system | |
980 | ver.RotateZ(-alpha); | |
981 | mom.RotateZ(-alpha); | |
982 | // | |
983 | Double_t fx = ver.X(); | |
984 | Double_t fy = ver.Y(); | |
985 | Double_t fz = ver.Z(); | |
986 | Double_t sn = TMath::Sin(mom.Phi()); | |
987 | Double_t tgl = mom.Pz()/mom.Pt(); | |
988 | Double_t crv = TMath::Sign(1/mom.Pt(),(Double_t)fCharge)*bz*kB2C; | |
989 | // | |
990 | if ( (TMath::Abs(bz))<kAlmost0Field ) crv=0.; | |
991 | // | |
992 | // general circle parameterization: | |
993 | // x = (r0+tR)cos(phi0) - tR cos(t+phi0) | |
994 | // y = (r0+tR)sin(phi0) - tR sin(t+phi0) | |
995 | // where qb is the sign of the curvature, tR is the track's signed radius and r0 | |
996 | // is the DCA of helix to origin | |
997 | // | |
998 | double tR = 1./crv; // track radius signed | |
999 | double cs = TMath::Sqrt((1-sn)*(1+sn)); | |
1000 | double x0 = fx - sn*tR; // helix center coordinates | |
1001 | double y0 = fy + cs*tR; | |
1002 | double phi0 = TMath::ATan2(y0,x0); // angle of PCA wrt to the origin | |
1003 | if (tR<0) phi0 += TMath::Pi(); | |
1004 | if (phi0 > TMath::Pi()) phi0 -= 2.*TMath::Pi(); | |
1005 | else if (phi0 <-TMath::Pi()) phi0 += 2.*TMath::Pi(); | |
1006 | double cs0 = TMath::Cos(phi0); | |
1007 | double sn0 = TMath::Sin(phi0); | |
1008 | double r0 = x0*cs0 + y0*sn0 - tR; // DCA to origin | |
1009 | double r2R = 1.+r0/tR; | |
1010 | // | |
1011 | // | |
1012 | if (r2R<kAlmost0) return kFALSE; // helix is centered at the origin, no specific intersection with other concetric circle | |
1013 | if (!xyz && !alpSect) return kTRUE; | |
1014 | double xr2R = xr/tR; | |
1015 | double r2Ri = 1./r2R; | |
1016 | // the intersection cos(t) = [1 + (r0/tR+1)^2 - (r0/tR)^2]/[2(1+r0/tR)] | |
1017 | double cosT = 0.5*(r2R + (1-xr2R*xr2R)*r2Ri); | |
1018 | if ( TMath::Abs(cosT)>kAlmost1 ) { | |
1019 | // printf("Does not reach : %f %f\n",r0,tR); | |
1020 | return kFALSE; // track does not reach the radius xr | |
1021 | } | |
1022 | // | |
1023 | double t = TMath::ACos(cosT); | |
1024 | if (tR<0) t = -t; | |
1025 | // intersection point | |
1026 | double xyzi[3]; | |
1027 | xyzi[0] = x0 - tR*TMath::Cos(t+phi0); | |
1028 | xyzi[1] = y0 - tR*TMath::Sin(t+phi0); | |
1029 | if (xyz) { // if postition is requested, then z is needed: | |
1030 | double t0 = TMath::ATan2(cs,-sn) - phi0; | |
1031 | double z0 = fz - t0*tR*tgl; | |
1032 | xyzi[2] = z0 + tR*t*tgl; | |
1033 | } | |
1034 | else xyzi[2] = 0; | |
1035 | // | |
1036 | Local2GlobalPosition(xyzi,alpha); | |
1037 | // | |
1038 | if (xyz) { | |
1039 | xyz[0] = xyzi[0]; | |
1040 | xyz[1] = xyzi[1]; | |
1041 | xyz[2] = xyzi[2]; | |
1042 | } | |
1043 | // | |
1044 | if (alpSect) { | |
1045 | double &alp = *alpSect; | |
1046 | // determine the sector of crossing | |
1047 | double phiPos = TMath::Pi()+TMath::ATan2(-xyzi[1],-xyzi[0]); | |
1048 | int sect = ((Int_t)(phiPos*TMath::RadToDeg()))/20; | |
1049 | alp = TMath::DegToRad()*(20*sect+10); | |
1050 | double x2r,f1,f2,r1,r2,dx,dy2dx,yloc=0, ylocMax = xr*TMath::Tan(TMath::Pi()/18); // min max Y within sector at given X | |
1051 | // | |
1052 | while(1) { | |
1053 | Double_t ca=TMath::Cos(alp-alpha), sa=TMath::Sin(alp-alpha); | |
1054 | if ((cs*ca+sn*sa)<0) { | |
1055 | AliDebug(1,Form("Rotation to target sector impossible: local cos(phi) would become %.2f",cs*ca+sn*sa)); | |
1056 | return kFALSE; | |
1057 | } | |
1058 | // | |
1059 | f1 = sn*ca - cs*sa; | |
1060 | if (TMath::Abs(f1) >= kAlmost1) { | |
1061 | AliDebug(1,Form("Rotation to target sector impossible: local sin(phi) would become %.2f",f1)); | |
1062 | return kFALSE; | |
1063 | } | |
1064 | // | |
1065 | double tmpX = fx*ca + fy*sa; | |
1066 | double tmpY = -fx*sa + fy*ca; | |
1067 | // | |
1068 | // estimate Y at X=xr | |
1069 | dx=xr-tmpX; | |
1070 | x2r = crv*dx; | |
1071 | f2=f1 + x2r; | |
1072 | if (TMath::Abs(f2) >= kAlmost1) { | |
1073 | AliDebug(1,Form("Propagation in target sector failed ! %.10e",f2)); | |
1074 | return kFALSE; | |
1075 | } | |
1076 | r1 = TMath::Sqrt((1.-f1)*(1.+f1)); | |
1077 | r2 = TMath::Sqrt((1.-f2)*(1.+f2)); | |
1078 | dy2dx = (f1+f2)/(r1+r2); | |
1079 | yloc = tmpY + dx*dy2dx; | |
1080 | if (yloc>ylocMax) {alp += 2*TMath::Pi()/18; sect++;} | |
1081 | else if (yloc<-ylocMax) {alp -= 2*TMath::Pi()/18; sect--;} | |
1082 | else break; | |
1083 | if (alp >= TMath::Pi()) alp -= 2*TMath::Pi(); | |
1084 | else if (alp < -TMath::Pi()) alp += 2*TMath::Pi(); | |
1085 | // if (sect>=18) sect = 0; | |
1086 | // if (sect<=0) sect = 17; | |
1087 | } | |
1088 | // | |
1089 | // if alpha was requested, then recalculate the position at intersection in sector | |
1090 | if (xyz) { | |
1091 | xyz[0] = xr; | |
1092 | xyz[1] = yloc; | |
1093 | if (TMath::Abs(x2r)<0.05) xyz[2] = fz + dx*(r2 + f2*dy2dx)*tgl; | |
1094 | else { | |
1095 | // for small dx/R the linear apporximation of the arc by the segment is OK, | |
1096 | // but at large dx/R the error is very large and leads to incorrect Z propagation | |
1097 | // angle traversed delta = 2*asin(dist_start_end / R / 2), hence the arc is: R*deltaPhi | |
1098 | // The dist_start_end is obtained from sqrt(dx^2+dy^2) = x/(r1+r2)*sqrt(2+f1*f2+r1*r2) | |
1099 | // Similarly, the rotation angle in linear in dx only for dx<<R | |
1100 | double chord = dx*TMath::Sqrt(1+dy2dx*dy2dx); // distance from old position to new one | |
1101 | double rot = 2*TMath::ASin(0.5*chord*crv); // angular difference seen from the circle center | |
1102 | xyz[2] = fz + rot/crv*tgl; | |
1103 | } | |
1104 | Local2GlobalPosition(xyz,alp); | |
1105 | } | |
1106 | } | |
1107 | return kTRUE; | |
1108 | // | |
1109 | } | |
086400fc | 1110 | |
74ca66e3 | 1111 | //_______________________________________________________ |
1112 | void AliAODTrack::GetITSdEdxSamples(Double_t s[4]) const | |
1113 | { | |
1114 | // get ITS dedx samples | |
1115 | if (!fDetPid) for (int i=4;i--;) s[i]=0; | |
1116 | else for (int i=4;i--;) s[i] = fDetPid->GetITSdEdxSample(i); | |
1117 | } | |
76b98553 | 1118 | |
1119 | //_____________________________________________ | |
1120 | Double_t AliAODTrack::GetMassForTracking() const | |
1121 | { | |
1122 | double m = AliPID::ParticleMass(fPIDForTracking); | |
1123 | return (fPIDForTracking==AliPID::kHe3 || fPIDForTracking==AliPID::kAlpha) ? -m : m; | |
1124 | } |