1 /**************************************************************************
2 * Copyright(c) 1998-2007, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
18 //-------------------------------------------------------------------------
19 // AOD track implementation of AliVTrack
20 // Author: Markus Oldenburg, CERN
21 // Markus.Oldenburg@cern.ch
22 //-------------------------------------------------------------------------
26 #include "AliExternalTrackParam.h"
27 #include "AliVVertex.h"
28 #include "AliDetectorPID.h"
29 #include "AliAODEvent.h"
30 #include "AliAODHMPIDrings.h"
32 #include "AliAODTrack.h"
36 //______________________________________________________________________________
37 AliAODTrack::AliAODTrack() :
41 fChi2MatchTrigger(0.),
46 fITSMuonClusterMap(0),
47 fMUONtrigHitsMapTrg(0),
48 fMUONtrigHitsMapTrk(0),
58 fCaloIndex(kEMCALNoMatch),
63 fTrackPhiOnEMCal(-999),
64 fTrackEtaOnEMCal(-999),
65 fTrackPtOnEMCal(-999),
67 fTOFsignalTuned(99999),
70 // default constructor
73 SetPosition((Float_t*)NULL);
74 SetXYAtDCA(-999., -999.);
75 SetPxPyPzAtDCA(-999., -999., -999.);
76 SetPID((Float_t*)NULL);
77 for (Int_t i = 0; i < 3; i++) {fTOFLabel[i] = -1;}
80 //______________________________________________________________________________
81 AliAODTrack::AliAODTrack(Short_t id,
87 Double_t covMatrix[21],
91 AliAODVertex *prodVertex,
93 Bool_t usedForPrimVtxFit,
99 fChi2perNDF(chi2perNDF),
100 fChi2MatchTrigger(0.),
105 fITSMuonClusterMap(0),
106 fMUONtrigHitsMapTrg(0),
107 fMUONtrigHitsMapTrk(0),
108 fFilterMap(selectInfo),
117 fCaloIndex(kEMCALNoMatch),
121 fProdVertex(prodVertex),
122 fTrackPhiOnEMCal(-999),
123 fTrackEtaOnEMCal(-999),
124 fTrackPtOnEMCal(-999),
126 fTOFsignalTuned(99999),
132 SetPosition(x, isDCA);
133 SetXYAtDCA(-999., -999.);
134 SetPxPyPzAtDCA(-999., -999., -999.);
135 SetUsedForVtxFit(usedForVtxFit);
136 SetUsedForPrimVtxFit(usedForPrimVtxFit);
137 if(covMatrix) SetCovMatrix(covMatrix);
139 SetITSClusterMap(itsClusMap);
140 for (Int_t i=0;i<3;i++) {fTOFLabel[i]=-1;}
143 //______________________________________________________________________________
144 AliAODTrack::AliAODTrack(Short_t id,
150 Float_t covMatrix[21],
154 AliAODVertex *prodVertex,
155 Bool_t usedForVtxFit,
156 Bool_t usedForPrimVtxFit,
159 Float_t chi2perNDF) :
162 fChi2perNDF(chi2perNDF),
163 fChi2MatchTrigger(0.),
168 fITSMuonClusterMap(0),
169 fMUONtrigHitsMapTrg(0),
170 fMUONtrigHitsMapTrk(0),
171 fFilterMap(selectInfo),
180 fCaloIndex(kEMCALNoMatch),
184 fProdVertex(prodVertex),
185 fTrackPhiOnEMCal(-999),
186 fTrackEtaOnEMCal(-999),
187 fTrackPtOnEMCal(-999),
189 fTOFsignalTuned(99999),
195 SetPosition(x, isDCA);
196 SetXYAtDCA(-999., -999.);
197 SetPxPyPzAtDCA(-999., -999., -999.);
198 SetUsedForVtxFit(usedForVtxFit);
199 SetUsedForPrimVtxFit(usedForPrimVtxFit);
200 if(covMatrix) SetCovMatrix(covMatrix);
202 SetITSClusterMap(itsClusMap);
203 for (Int_t i=0;i<3;i++) {fTOFLabel[i]=-1;}
206 //______________________________________________________________________________
207 AliAODTrack::~AliAODTrack()
216 //______________________________________________________________________________
217 AliAODTrack::AliAODTrack(const AliAODTrack& trk) :
219 fRAtAbsorberEnd(trk.fRAtAbsorberEnd),
220 fChi2perNDF(trk.fChi2perNDF),
221 fChi2MatchTrigger(trk.fChi2MatchTrigger),
225 fTrackLength(trk.fTrackLength),
226 fITSMuonClusterMap(trk.fITSMuonClusterMap),
227 fMUONtrigHitsMapTrg(trk.fMUONtrigHitsMapTrg),
228 fMUONtrigHitsMapTrk(trk.fMUONtrigHitsMapTrk),
229 fFilterMap(trk.fFilterMap),
230 fTPCFitMap(trk.fTPCFitMap),
231 fTPCClusterMap(trk.fTPCClusterMap),
232 fTPCSharedMap(trk.fTPCSharedMap),
233 fTPCnclsF(trk.fTPCnclsF),
234 fTPCNCrossedRows(trk.fTPCNCrossedRows),
236 fCharge(trk.fCharge),
238 fCaloIndex(trk.fCaloIndex),
242 fProdVertex(trk.fProdVertex),
243 fTrackPhiOnEMCal(trk.fTrackPhiOnEMCal),
244 fTrackEtaOnEMCal(trk.fTrackEtaOnEMCal),
245 fTrackPtOnEMCal(trk.fTrackPtOnEMCal),
246 fTPCsignalTuned(trk.fTPCsignalTuned),
247 fTOFsignalTuned(trk.fTOFsignalTuned),
248 fAODEvent(trk.fAODEvent)
253 trk.GetPosition(fPosition);
254 SetXYAtDCA(trk.XAtDCA(), trk.YAtDCA());
255 SetPxPyPzAtDCA(trk.PxAtDCA(), trk.PyAtDCA(), trk.PzAtDCA());
256 SetUsedForVtxFit(trk.GetUsedForVtxFit());
257 SetUsedForPrimVtxFit(trk.GetUsedForPrimVtxFit());
258 if(trk.fCovMatrix) fCovMatrix=new AliAODRedCov<6>(*trk.fCovMatrix);
259 if(trk.fDetPid) fDetPid=new AliAODPid(*trk.fDetPid);
261 if (trk.fDetectorPID) fDetectorPID = new AliDetectorPID(*trk.fDetectorPID);
262 for (Int_t i = 0; i < 3; i++) {fTOFLabel[i] = trk.fTOFLabel[i];}
265 //______________________________________________________________________________
266 AliAODTrack& AliAODTrack::operator=(const AliAODTrack& trk)
268 // Assignment operator
271 AliVTrack::operator=(trk);
274 trk.GetPosition(fPosition);
275 SetXYAtDCA(trk.XAtDCA(), trk.YAtDCA());
276 SetPxPyPzAtDCA(trk.PxAtDCA(), trk.PyAtDCA(), trk.PzAtDCA());
277 fRAtAbsorberEnd = trk.fRAtAbsorberEnd;
278 fChi2perNDF = trk.fChi2perNDF;
279 fChi2MatchTrigger = trk.fChi2MatchTrigger;
283 fTrackLength = trk.fTrackLength;
284 fITSMuonClusterMap = trk.fITSMuonClusterMap;
285 fMUONtrigHitsMapTrg = trk.fMUONtrigHitsMapTrg;
286 fMUONtrigHitsMapTrk = trk.fMUONtrigHitsMapTrk;
287 fFilterMap = trk.fFilterMap;
288 fTPCFitMap = trk.fTPCFitMap;
289 fTPCClusterMap = trk.fTPCClusterMap;
290 fTPCSharedMap = trk.fTPCSharedMap;
291 fTPCnclsF = trk.fTPCnclsF;
292 fTPCNCrossedRows = trk.fTPCNCrossedRows;
294 fCharge = trk.fCharge;
296 fCaloIndex = trk.fCaloIndex;
297 fTrackPhiOnEMCal = trk.fTrackPhiOnEMCal;
298 fTrackEtaOnEMCal = trk.fTrackEtaOnEMCal;
299 fTrackPtOnEMCal = trk.fTrackPtOnEMCal;
300 fTPCsignalTuned = trk.fTPCsignalTuned;
301 fTOFsignalTuned = trk.fTOFsignalTuned;
304 if(trk.fCovMatrix) fCovMatrix=new AliAODRedCov<6>(*trk.fCovMatrix);
305 else fCovMatrix=NULL;
308 fProdVertex = trk.fProdVertex;
309 SetUsedForVtxFit(trk.GetUsedForVtxFit());
310 SetUsedForPrimVtxFit(trk.GetUsedForPrimVtxFit());
312 //detector raw signals
314 if(trk.fDetPid) fDetPid=new AliAODPid(*trk.fDetPid);
317 //calibrated PID cache
320 if (trk.fDetectorPID) fDetectorPID = new AliDetectorPID(*trk.fDetectorPID);
321 for (Int_t i = 0; i < 3; i++) {fTOFLabel[i] = trk.fTOFLabel[i];}
327 //______________________________________________________________________________
328 Double_t AliAODTrack::M(AODTrkPID_t pid) const
331 // Masses for nuclei don't exist in the PDG tables, therefore they were put by hand.
336 return 0.000510999; //TDatabasePDG::Instance()->GetParticle(11/*::kElectron*/)->Mass();
340 return 0.1056584; //TDatabasePDG::Instance()->GetParticle(13/*::kMuonMinus*/)->Mass();
344 return 0.13957; //TDatabasePDG::Instance()->GetParticle(211/*::kPiPlus*/)->Mass();
348 return 0.4937; //TDatabasePDG::Instance()->GetParticle(321/*::kKPlus*/)->Mass();
352 return 0.9382720; //TDatabasePDG::Instance()->GetParticle(2212/*::kProton*/)->Mass();
356 return 1.8756; //TDatabasePDG::Instance()->GetParticle(1000010020)->Mass();
360 return 2.8089; //TDatabasePDG::Instance()->GetParticle(1000010030)->Mass();
364 return 2.8084; //TDatabasePDG::Instance()->GetParticle(1000020030)->Mass();
368 return 3.7274; //TDatabasePDG::Instance()->GetParticle(1000020040)->Mass();
380 //______________________________________________________________________________
381 Double_t AliAODTrack::E(AODTrkPID_t pid) const
383 // Returns the energy of the particle of a given pid.
385 if (pid != kUnknown) { // particle was identified
387 return TMath::Sqrt(P()*P() + m*m);
388 } else { // pid unknown
393 //______________________________________________________________________________
394 Double_t AliAODTrack::Y(AODTrkPID_t pid) const
396 // Returns the rapidity of a particle of a given pid.
398 if (pid != kUnknown) { // particle was identified
401 if (e>=0 && e!=pz) { // energy was positive (e.g. not -999.) and not equal to pz
402 return 0.5*TMath::Log((e+pz)/(e-pz));
403 } else { // energy not known or equal to pz
406 } else { // pid unknown
411 //______________________________________________________________________________
412 Double_t AliAODTrack::Y(Double_t m) const
414 // Returns the rapidity of a particle of a given mass.
416 if (m >= 0.) { // mass makes sense
419 if (e>=0 && e!=pz) { // energy was positive (e.g. not -999.) and not equal to pz
420 return 0.5*TMath::Log((e+pz)/(e-pz));
421 } else { // energy not known or equal to pz
424 } else { // pid unknown
429 void AliAODTrack::SetTOFLabel(const Int_t *p) {
431 for (Int_t i = 0; i < 3; i++) fTOFLabel[i]=p[i];
434 //_______________________________________________________________________
435 void AliAODTrack::GetTOFLabel(Int_t *p) const {
437 for (Int_t i=0; i<3; i++) p[i]=fTOFLabel[i];
440 //______________________________________________________________________________
441 AliAODTrack::AODTrkPID_t AliAODTrack::GetMostProbablePID() const
443 // Returns the most probable PID array element.
446 AODTrkPID_t loc = kUnknown;
448 Bool_t allTheSame = kTRUE;
450 for (Int_t iPID = 0; iPID < nPID; iPID++) {
451 if (fPID[iPID] >= max) {
452 if (fPID[iPID] > max) {
455 loc = (AODTrkPID_t)iPID;
461 return allTheSame ? kUnknown : loc;
464 //______________________________________________________________________________
465 void AliAODTrack::ConvertAliPIDtoAODPID()
467 // Converts AliPID array.
468 // The numbering scheme is the same for electrons, muons, pions, kaons, and protons.
469 // Everything else has to be set to zero.
471 fPID[kDeuteron] = 0.;
481 //______________________________________________________________________________
482 template <typename T> void AliAODTrack::SetP(const T *p, const Bool_t cartesian)
488 Double_t pt2 = p[0]*p[0] + p[1]*p[1];
489 Double_t pp = TMath::Sqrt(pt2 + p[2]*p[2]);
491 fMomentum[0] = TMath::Sqrt(pt2); // pt
492 fMomentum[1] = (pt2 != 0.) ? TMath::Pi()+TMath::ATan2(-p[1], -p[0]) : -999; // phi
493 fMomentum[2] = (pp != 0.) ? TMath::ACos(p[2] / pp) : -999.; // theta
495 fMomentum[0] = p[0]; // pt
496 fMomentum[1] = p[1]; // phi
497 fMomentum[2] = p[2]; // theta
500 fMomentum[0] = -999.;
501 fMomentum[1] = -999.;
502 fMomentum[2] = -999.;
507 //______________________________________________________________________________
508 template <typename T> void AliAODTrack::SetPosition(const T *x, const Bool_t dca)
521 // don't know any better yet
522 fPosition[0] = -999.;
523 fPosition[1] = -999.;
524 fPosition[2] = -999.;
529 fPosition[0] = -999.;
530 fPosition[1] = -999.;
531 fPosition[2] = -999.;
535 //______________________________________________________________________________
536 void AliAODTrack::SetDCA(Double_t d, Double_t z)
545 //______________________________________________________________________________
546 void AliAODTrack::Print(Option_t* /* option */) const
548 // prints information about AliAODTrack
550 printf("Object name: %s Track type: %s\n", GetName(), GetTitle());
551 printf(" px = %f\n", Px());
552 printf(" py = %f\n", Py());
553 printf(" pz = %f\n", Pz());
554 printf(" pt = %f\n", Pt());
555 printf(" 1/pt = %f\n", OneOverPt());
556 printf(" theta = %f\n", Theta());
557 printf(" phi = %f\n", Phi());
558 printf(" chi2/NDF = %f\n", Chi2perNDF());
559 printf(" charge = %d\n", Charge());
562 //______________________________________________________________________________
563 void AliAODTrack::SetMatchTrigger(Int_t matchTrig)
565 // Set the MUON trigger information
567 case 0: // 0 track does not match trigger
568 fITSMuonClusterMap=fITSMuonClusterMap&0x3fffffff;
570 case 1: // 1 track match but does not pass pt cut
571 fITSMuonClusterMap=(fITSMuonClusterMap&0x3fffffff)|0x40000000;
573 case 2: // 2 track match Low pt cut
574 fITSMuonClusterMap=(fITSMuonClusterMap&0x3fffffff)|0x80000000;
576 case 3: // 3 track match High pt cut
577 fITSMuonClusterMap=fITSMuonClusterMap|0xc0000000;
580 fITSMuonClusterMap=fITSMuonClusterMap&0x3fffffff;
581 AliWarning(Form("unknown case for matchTrig: %d\n",matchTrig));
585 //______________________________________________________________________________
586 Bool_t AliAODTrack::HitsMuonChamber(Int_t MuonChamber, Int_t cathode) const
588 // return kTRUE if the track fires the given tracking or trigger chamber.
589 // If the chamber is a trigger one:
590 // - if cathode = 0 or 1, the track matches the corresponding cathode
591 // - if cathode = -1, the track matches both cathodes
593 if (MuonChamber < 0) return kFALSE;
595 if (MuonChamber < 10) return TESTBIT(GetMUONClusterMap(), MuonChamber);
597 if (MuonChamber < 14) {
599 if (cathode < 0) return TESTBIT(GetHitsPatternInTrigCh(), 13-MuonChamber) &&
600 TESTBIT(GetHitsPatternInTrigCh(), 13-MuonChamber+4);
602 if (cathode < 2) return TESTBIT(GetHitsPatternInTrigCh(), 13-MuonChamber+(1-cathode)*4);
609 //______________________________________________________________________________
610 Bool_t AliAODTrack::MatchTriggerDigits() const
612 // return kTRUE if the track matches a digit on both planes of at least 2 trigger chambers
614 Int_t nMatchedChambers = 0;
615 for (Int_t ich=10; ich<14; ich++) if (HitsMuonChamber(ich)) nMatchedChambers++;
617 return (nMatchedChambers >= 2);
620 //______________________________________________________________________________
621 Bool_t AliAODTrack::PropagateToDCA(const AliVVertex *vtx,
622 Double_t b, Double_t maxd, Double_t dz[2], Double_t covar[3])
624 // compute impact parameters to the vertex vtx and their covariance matrix
625 // b is the Bz, needed to propagate correctly the track to vertex
626 // only the track parameters are update after the propagation (pos and mom),
627 // not the covariance matrix. This is OK for propagation over short distance
628 // inside the beam pipe.
629 // return kFALSE is something went wrong
631 // allowed only for tracks inside the beam pipe
632 Float_t xstart2 = fPosition[0]*fPosition[0]+fPosition[1]*fPosition[1];
633 if(xstart2 > 3.*3.) { // outside beampipe radius
634 AliError("This method can be used only for propagation inside the beam pipe");
638 // convert to AliExternalTrackParam
639 AliExternalTrackParam etp; etp.CopyFromVTrack(this);
642 if(!etp.PropagateToDCA(vtx,b,maxd,dz,covar)) return kFALSE;
644 // update track position and momentum
649 SetPosition(mom,kFALSE);
655 //______________________________________________________________________________
656 Bool_t AliAODTrack::GetPxPyPz(Double_t p[3]) const
658 //---------------------------------------------------------------------
659 // This function returns the global track momentum components
660 //---------------------------------------------------------------------
661 p[0]=Px(); p[1]=Py(); p[2]=Pz();
666 //_______________________________________________________________________
667 Float_t AliAODTrack::GetTPCClusterInfo(Int_t nNeighbours/*=3*/, Int_t type/*=0*/, Int_t row0, Int_t row1, Int_t bitType ) const
670 // TPC cluster information
671 // type 0: get fraction of found/findable clusters with neighbourhood definition
672 // 1: findable clusters with neighbourhood definition
675 // 0 - all cluster used
676 // 1 - clusters used for the kalman update
677 // definition of findable clusters:
678 // a cluster is defined as findable if there is another cluster
679 // within +- nNeighbours pad rows. The idea is to overcome threshold
680 // effects with a very simple algorithm.
686 Int_t last=-nNeighbours;
687 const TBits & clusterMap = (bitType%2==0) ? fTPCClusterMap : fTPCFitMap;
689 Int_t upperBound=clusterMap.GetNbits();
690 if (upperBound>row1) upperBound=row1;
691 for (Int_t i=row0; i<upperBound; ++i){
692 //look to current row
699 //look to nNeighbours before
700 if ((i-last)<=nNeighbours) {
704 //look to nNeighbours after
705 for (Int_t j=i+1; j<i+1+nNeighbours; ++j){
712 if (type==2) return found;
713 if (type==1) return findable;
718 fraction=(Float_t)found/(Float_t)findable;
723 return 0; // undefined type - default value
727 //______________________________________________________________________________
728 Double_t AliAODTrack::GetTRDslice(Int_t plane, Int_t slice) const {
730 // return TRD Pid information
732 if (!fDetPid) return -1;
733 Double32_t *trdSlices=fDetPid->GetTRDslices();
734 if (!trdSlices) return -1;
735 if ((plane<0) || (plane>=kTRDnPlanes)) {
739 Int_t ns=fDetPid->GetTRDnSlices();
740 if ((slice<-1) || (slice>=ns)) {
744 if(slice>=0) return trdSlices[plane*ns + slice];
746 // return average of the dEdx measurements
747 Double_t q=0.; Double32_t *s = &trdSlices[plane*ns];
748 for (Int_t i=0; i<ns; i++, s++) if((*s)>0.) q+=(*s);
752 //______________________________________________________________________________
753 UChar_t AliAODTrack::GetTRDntrackletsPID() const{
755 // return number of tracklets calculated from the slices
757 if(!fDetPid) return -1;
758 return fDetPid->GetTRDntrackletsPID();
761 //______________________________________________________________________________
762 UChar_t AliAODTrack::GetTRDncls(Int_t layer) const {
764 // return number of TRD clusters
766 if(!fDetPid || layer > 5) return -1;
767 if(layer < 0) return fDetPid->GetTRDncls();
768 else return fDetPid->GetTRDncls(layer);
771 //______________________________________________________________________________
772 Double_t AliAODTrack::GetTRDmomentum(Int_t plane, Double_t */*sp*/) const
774 //Returns momentum estimation
775 // in TRD layer "plane".
777 if (!fDetPid) return -1;
778 const Double_t *trdMomentum=fDetPid->GetTRDmomentum();
783 if ((plane<0) || (plane>=kTRDnPlanes)) {
787 return trdMomentum[plane];
790 //_______________________________________________________________________
791 Int_t AliAODTrack::GetTOFBunchCrossing(Double_t b, Bool_t) const
793 // Returns the number of bunch crossings after trigger (assuming 25ns spacing)
794 const double kSpacing = 25e3; // min interbanch spacing
795 const double kShift = 0;
796 Int_t bcid = kTOFBCNA; // defualt one
797 if (!IsOn(kTOFout) || !IsOn(kESDpid)) return bcid; // no info
799 double tdif = GetTOFsignal();
800 if (IsOn(kTIME)) { // integrated time info is there
801 int pid = (int)GetMostProbablePID();
803 GetIntegratedTimes(ttimes);
806 else { // assume integrated time info from TOF radius and momentum
807 const double kRTOF = 385.;
808 const double kCSpeed = 3.e-2; // cm/ps
810 if (p<0.001) p = 1.0;
812 double path = kRTOF; // mean TOF radius
813 if (TMath::Abs(b)>kAlmost0) { // account for curvature
814 double curv = Pt()/(b*kB2C);
816 double tgl = Pz()/Pt();
817 path = 2./curv*TMath::ASin(kRTOF*curv/2.)*TMath::Sqrt(1.+tgl*tgl);
820 tdif -= path/kCSpeed*TMath::Sqrt(1.+m*m/(p*p));
822 bcid = TMath::Nint((tdif - kShift)/kSpacing);
826 void AliAODTrack::SetDetectorPID(const AliDetectorPID *pid)
829 // Set the detector PID
831 if (fDetectorPID) delete fDetectorPID;
836 //_____________________________________________________________________________
837 Double_t AliAODTrack::GetHMPIDsignal() const
839 if(fAODEvent->GetHMPIDringForTrackID(fID)) return fAODEvent->GetHMPIDringForTrackID(fID)->GetHmpSignal();
843 //_____________________________________________________________________________
844 Double_t AliAODTrack::GetHMPIDoccupancy() const
846 if(fAODEvent->GetHMPIDringForTrackID(fID)) return fAODEvent->GetHMPIDringForTrackID(fID)->GetHmpOccupancy();
850 //_____________________________________________________________________________
851 Int_t AliAODTrack::GetHMPIDcluIdx() const
853 if(fAODEvent->GetHMPIDringForTrackID(fID)) return fAODEvent->GetHMPIDringForTrackID(fID)->GetHmpCluIdx();
857 //_____________________________________________________________________________
858 void AliAODTrack::GetHMPIDtrk(Float_t &x, Float_t &y, Float_t &th, Float_t &ph) const
860 x = -999; y = -999.; th = -999.; ph = -999.;
862 const AliAODHMPIDrings *ring=fAODEvent->GetHMPIDringForTrackID(fID);
864 x = ring->GetHmpTrackX();
865 y = ring->GetHmpTrackY();
866 th = ring->GetHmpTrackTheta();
867 ph = ring->GetHmpTrackPhi();
871 //_____________________________________________________________________________
872 void AliAODTrack::GetHMPIDmip(Float_t &x,Float_t &y,Int_t &q, Int_t &nph) const
874 x = -999; y = -999.; q = -999; nph = -999;
876 const AliAODHMPIDrings *ring=fAODEvent->GetHMPIDringForTrackID(fID);
878 x = ring->GetHmpMipX();
879 y = ring->GetHmpMipY();
880 q = (Int_t)ring->GetHmpMipCharge();
881 nph = (Int_t)ring->GetHmpNumOfPhotonClusters();
885 //_____________________________________________________________________________
886 Bool_t AliAODTrack::GetOuterHmpPxPyPz(Double_t *p) const
888 if(fAODEvent->GetHMPIDringForTrackID(fID)) {fAODEvent->GetHMPIDringForTrackID(fID)->GetHmpMom(p); return kTRUE;}
892 //_____________________________________________________________________________
893 Bool_t AliAODTrack::GetXYZAt(Double_t x, Double_t b, Double_t *r) const
895 //---------------------------------------------------------------------
896 // This function returns the global track position extrapolated to
897 // the radial position "x" (cm) in the magnetic field "b" (kG)
898 //---------------------------------------------------------------------
900 //conversion of track parameter representation is
901 //based on the implementation of AliExternalTrackParam::Set(...)
902 //maybe some of this code can be moved to AliVTrack to avoid code duplication
904 Double_t radPos2 = fPosition[0]*fPosition[0]+fPosition[1]*fPosition[1];
905 Double_t radMax = 45.; // approximately ITS outer radius
906 if (radPos2 < radMax*radMax) { // inside the ITS
907 alpha = fMomentum[1]; //TMath::ATan2(fMomentum[1],fMomentum[0]); // fMom is pt,phi,theta!
908 } else { // outside the ITS
909 Float_t phiPos = TMath::Pi()+TMath::ATan2(-fPosition[1], -fPosition[0]);
911 TMath::DegToRad()*(20*((((Int_t)(phiPos*TMath::RadToDeg()))/20))+10);
914 // Get the vertex of origin and the momentum
915 TVector3 ver(fPosition[0],fPosition[1],fPosition[2]);
916 TVector3 mom(Px(),Py(),Pz());
918 // Rotate to the local coordinate system
922 Double_t param0 = ver.Y();
923 Double_t param1 = ver.Z();
924 Double_t param2 = TMath::Sin(mom.Phi());
925 Double_t param3 = mom.Pz()/mom.Pt();
926 Double_t param4 = TMath::Sign(1/mom.Pt(),(Double_t)fCharge);
928 //calculate the propagated coordinates
929 //this is based on AliExternalTrackParam::GetXYZAt(Double_t x, Double_t b, Double_t *r)
930 Double_t dx=x-ver.X();
931 if(TMath::Abs(dx)<=kAlmost0) return GetXYZ(r);
934 Double_t f2=f1 + dx*param4*b*kB2C;
936 if (TMath::Abs(f1) >= kAlmost1) return kFALSE;
937 if (TMath::Abs(f2) >= kAlmost1) return kFALSE;
939 Double_t r1=TMath::Sqrt((1.-f1)*(1.+f1)), r2=TMath::Sqrt((1.-f2)*(1.+f2));
941 r[1] = param0 + dx*(f1+f2)/(r1+r2);
942 r[2] = param1 + dx*(r2 + f2*(f1+f2)/(r1+r2))*param3;//Thanks to Andrea & Peter
943 return Local2GlobalPosition(r,alpha);
947 //_______________________________________________________
948 void AliAODTrack::GetITSdEdxSamples(Double_t s[4]) const
950 // get ITS dedx samples
951 if (!fDetPid) for (int i=4;i--;) s[i]=0;
952 else for (int i=4;i--;) s[i] = fDetPid->GetITSdEdxSample(i);