1 /**************************************************************************
2 * Copyright(c) 1998-1999, 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 **************************************************************************/
15 //-----------------------------------------------------------------
16 // Implementation of the ESD track class
17 // ESD = Event Summary Data
18 // This is the class to deal with during the phisics analysis of data
19 // Origin: Iouri Belikov, CERN
20 // e-mail: Jouri.Belikov@cern.ch
24 // What do you need to know before starting analysis
25 // (by Marian Ivanov: marian.ivanov@cern.ch)
29 // 1. What is the AliESDtrack
30 // 2. What informations do we store
31 // 3. How to use the information for analysis
34 // 1.AliESDtrack is the container of the information about the track/particle
35 // reconstructed during Barrel Tracking.
36 // The track information is propagated from one tracking detector to
37 // other using the functionality of AliESDtrack - Current parameters.
39 // No global fit model is used.
40 // Barrel tracking use Kalman filtering technique, it gives optimal local
41 // track parameters at given point under certian assumptions.
43 // Kalman filter take into account additional effect which are
44 // difficult to handle using global fit.
46 // a.) Multiple scattering
48 // c.) Non homogenous magnetic field
50 // In general case, following barrel detectors are contributing to
51 // the Kalman track information:
56 // In general 3 reconstruction itteration are performed:
57 // 1. Find tracks - sequence TPC->ITS
58 // 2. PropagateBack - sequence ITS->TPC->TRD -> Outer PID detectors
59 // 3. Refit invward - sequence TRD->TPC->ITS
60 // The current tracks are updated after each detector (see bellow).
61 // In specical cases a track sanpshots are stored.
64 // For some type of analysis (+visualization) track local parameters at
65 // different position are neccesary. A snapshots during the track
66 // propagation are created.
67 // (See AliExternalTrackParam class for desctiption of variables and
70 // a. Current parameters - class itself (AliExternalTrackParam)
71 // Contributors: general case TRD->TPC->ITS
72 // Preferable usage: Decission - primary or secondary track
73 // NOTICE - By default the track parameters are stored at the DCA point
74 // to the primary vertex. optimal for primary tracks,
75 // far from optimal for secondary tracks.
76 // b. Constrained parameters - Kalman information updated with
77 // the Primary vertex information
78 // Contributors: general case TRD->TPC->ITS
79 // Preferable usage: Use only for tracks selected as primary
80 // NOTICE - not real constrain - taken as additional measurement
81 // with corresponding error
83 // const AliExternalTrackParam *GetConstrainedParam() const {return fCp;}
84 // c. Inner parameters - Track parameters at inner wall of the TPC
85 // Contributors: general case TRD->TPC
87 // const AliExternalTrackParam *GetInnerParam() const { return fIp;}
89 // d. TPCinnerparam - contributors - TPC only
91 // Preferable usage: Requested for HBT study
92 // (smaller correlations as using also ITS information)
93 // NOTICE - the track parameters are propagated to the DCA to
95 // Optimal for primary, far from optimal for secondary tracks
97 // const AliExternalTrackParam *GetTPCInnerParam() const {return fTPCInner;}
99 // e. Outer parameters -
100 // Contributors- general case - ITS-> TPC -> TRD
101 // The last point - Outer parameters radius is determined
102 // e.a) Local inclination angle bigger than threshold -
103 // Low momenta tracks
104 // e.a) Catastrofic energy losss in material
105 // e.b) Not further improvement (no space points)
107 // a.) Tracking: Starting parameter for Refit inward
110 // NOTICE: Should be not used for the physic analysis
112 // const AliExternalTrackParam *GetOuterParam() const { return fOp;}
114 //-----------------------------------------------------------------
117 #include <TParticle.h>
118 #include <TDatabasePDG.h>
120 #include "AliESDVertex.h"
121 #include "AliESDtrack.h"
122 #include "AliKalmanTrack.h"
123 #include "AliVTrack.h"
125 #include "AliTrackPointArray.h"
126 #include "TPolyMarker3D.h"
128 ClassImp(AliESDtrack)
130 void SetPIDValues(Double_t * dest, const Double_t * src, Int_t n) {
131 // This function copies "n" PID weights from "scr" to "dest"
132 // and normalizes their sum to 1 thus producing conditional probabilities.
133 // The negative weights are set to 0.
134 // In case all the weights are non-positive they are replaced by
135 // uniform probabilities
139 Float_t uniform = 1./(Float_t)n;
142 for (Int_t i=0; i<n; i++)
152 for (Int_t i=0; i<n; i++) dest[i] /= sum;
154 for (Int_t i=0; i<n; i++) dest[i] = uniform;
157 //_______________________________________________________________________
158 AliESDtrack::AliESDtrack() :
159 AliExternalTrackParam(),
164 fFriendTrack(new AliESDfriendTrack()),
165 fTPCClusterMap(159),//number of padrows
166 fTPCSharedMap(159),//number of padrows
177 fEMCALindex(kEMCALNoMatch),
183 fCddTPC(0),fCdzTPC(0),fCzzTPC(0),
186 fCdd(0),fCdz(0),fCzz(0),
218 fVertexID(-2) // -2 means an orphan track
221 // The default ESD constructor
224 for (i=0; i<AliPID::kSPECIES; i++) {
234 for (i=0; i<3; i++) { fKinkIndexes[i]=0;}
235 for (i=0; i<3; i++) { fV0Indexes[i]=0;}
236 for (i=0;i<kTRDnPlanes;i++) {
239 for (i=0;i<4;i++) {fITSdEdxSamples[i]=0.;}
240 for (i=0;i<4;i++) {fTPCPoints[i]=0;}
241 for (i=0;i<3;i++) {fTOFLabel[i]=0;}
242 for (i=0;i<10;i++) {fTOFInfo[i]=0;}
243 for (i=0;i<12;i++) {fITSModule[i]=-1;}
246 //_______________________________________________________________________
247 AliESDtrack::AliESDtrack(const AliESDtrack& track):
248 AliExternalTrackParam(track),
254 fTPCClusterMap(track.fTPCClusterMap),
255 fTPCSharedMap(track.fTPCSharedMap),
256 fFlags(track.fFlags),
258 fLabel(track.fLabel),
259 fITSLabel(track.fITSLabel),
260 fTPCLabel(track.fTPCLabel),
261 fTRDLabel(track.fTRDLabel),
262 fTOFCalChannel(track.fTOFCalChannel),
263 fTOFindex(track.fTOFindex),
264 fHMPIDqn(track.fHMPIDqn),
265 fHMPIDcluIdx(track.fHMPIDcluIdx),
266 fEMCALindex(track.fEMCALindex),
267 fHMPIDtrkTheta(track.fHMPIDtrkTheta),
268 fHMPIDtrkPhi(track.fHMPIDtrkPhi),
269 fHMPIDsignal(track.fHMPIDsignal),
270 fTrackLength(track.fTrackLength),
271 fdTPC(track.fdTPC),fzTPC(track.fzTPC),
272 fCddTPC(track.fCddTPC),fCdzTPC(track.fCdzTPC),fCzzTPC(track.fCzzTPC),
273 fCchi2TPC(track.fCchi2TPC),
274 fD(track.fD),fZ(track.fZ),
275 fCdd(track.fCdd),fCdz(track.fCdz),fCzz(track.fCzz),
276 fCchi2(track.fCchi2),
277 fITSchi2(track.fITSchi2),
278 fTPCchi2(track.fTPCchi2),
279 fTRDchi2(track.fTRDchi2),
280 fTOFchi2(track.fTOFchi2),
281 fHMPIDchi2(track.fHMPIDchi2),
282 fGlobalChi2(track.fGlobalChi2),
283 fITSsignal(track.fITSsignal),
284 fTPCsignal(track.fTPCsignal),
285 fTPCsignalS(track.fTPCsignalS),
286 fTRDsignal(track.fTRDsignal),
287 fTRDQuality(track.fTRDQuality),
288 fTRDBudget(track.fTRDBudget),
289 fTOFsignal(track.fTOFsignal),
290 fTOFsignalToT(track.fTOFsignalToT),
291 fTOFsignalRaw(track.fTOFsignalRaw),
292 fTOFsignalDz(track.fTOFsignalDz),
293 fHMPIDtrkX(track.fHMPIDtrkX),
294 fHMPIDtrkY(track.fHMPIDtrkY),
295 fHMPIDmipX(track.fHMPIDmipX),
296 fHMPIDmipY(track.fHMPIDmipY),
297 fTPCncls(track.fTPCncls),
298 fTPCnclsF(track.fTPCnclsF),
299 fTPCsignalN(track.fTPCsignalN),
300 fITSncls(track.fITSncls),
301 fITSClusterMap(track.fITSClusterMap),
302 fTRDncls(track.fTRDncls),
303 fTRDncls0(track.fTRDncls0),
304 fTRDntracklets(track.fTRDntracklets),
305 fTRDnSlices(track.fTRDnSlices),
307 fVertexID(track.fVertexID)
312 for (Int_t i=0;i<AliPID::kSPECIES;i++) fTrackTime[i]=track.fTrackTime[i];
313 for (Int_t i=0;i<AliPID::kSPECIES;i++) fR[i]=track.fR[i];
315 for (Int_t i=0;i<AliPID::kSPECIES;i++) fITSr[i]=track.fITSr[i];
317 for (Int_t i=0;i<AliPID::kSPECIES;i++) fTPCr[i]=track.fTPCr[i];
318 for (Int_t i=0;i<4;i++) {fITSdEdxSamples[i]=track.fITSdEdxSamples[i];}
319 for (Int_t i=0;i<4;i++) {fTPCPoints[i]=track.fTPCPoints[i];}
320 for (Int_t i=0; i<3;i++) { fKinkIndexes[i]=track.fKinkIndexes[i];}
321 for (Int_t i=0; i<3;i++) { fV0Indexes[i]=track.fV0Indexes[i];}
323 for (Int_t i=0;i<kTRDnPlanes;i++) {
324 fTRDTimBin[i]=track.fTRDTimBin[i];
328 fTRDslices=new Double32_t[fTRDnSlices];
329 for (Int_t i=0; i<fTRDnSlices; i++) fTRDslices[i]=track.fTRDslices[i];
332 for (Int_t i=0;i<AliPID::kSPECIES;i++) fTRDr[i]=track.fTRDr[i];
333 for (Int_t i=0;i<AliPID::kSPECIES;i++) fTOFr[i]=track.fTOFr[i];
334 for (Int_t i=0;i<3;i++) fTOFLabel[i]=track.fTOFLabel[i];
335 for (Int_t i=0;i<10;i++) fTOFInfo[i]=track.fTOFInfo[i];
336 for (Int_t i=0;i<12;i++) fITSModule[i]=track.fITSModule[i];
337 for (Int_t i=0;i<AliPID::kSPECIES;i++) fHMPIDr[i]=track.fHMPIDr[i];
339 if (track.fCp) fCp=new AliExternalTrackParam(*track.fCp);
340 if (track.fIp) fIp=new AliExternalTrackParam(*track.fIp);
341 if (track.fTPCInner) fTPCInner=new AliExternalTrackParam(*track.fTPCInner);
342 if (track.fOp) fOp=new AliExternalTrackParam(*track.fOp);
344 if (track.fFriendTrack) fFriendTrack=new AliESDfriendTrack(*(track.fFriendTrack));
347 //_______________________________________________________________________
348 AliESDtrack::AliESDtrack(const AliVTrack *track) :
349 AliExternalTrackParam(track),
355 fTPCClusterMap(159),//number of padrows
356 fTPCSharedMap(159),//number of padrows
367 fEMCALindex(kEMCALNoMatch),
373 fCddTPC(0),fCdzTPC(0),fCzzTPC(0),
376 fCdd(0),fCdz(0),fCzz(0),
408 fVertexID(-2) // -2 means an orphan track
411 // ESD track from AliVTrack.
412 // This is not a copy constructor !
415 if (track->InheritsFrom("AliExternalTrackParam")) {
416 AliError("This is not a copy constructor. Use AliESDtrack(const AliESDtrack &) !");
417 AliWarning("Calling the default constructor...");
422 // Reset all the arrays
424 for (i=0; i<AliPID::kSPECIES; i++) {
434 for (i=0; i<3; i++) { fKinkIndexes[i]=0;}
435 for (i=0; i<3; i++) { fV0Indexes[i]=-1;}
436 for (i=0;i<kTRDnPlanes;i++) {
439 for (i=0;i<4;i++) {fITSdEdxSamples[i]=0.;}
440 for (i=0;i<4;i++) {fTPCPoints[i]=0;}
441 for (i=0;i<3;i++) {fTOFLabel[i]=0;}
442 for (i=0;i<10;i++) {fTOFInfo[i]=0;}
443 for (i=0;i<12;i++) {fITSModule[i]=-1;}
446 SetID(track->GetID());
448 // Set ITS cluster map
449 fITSClusterMap=track->GetITSClusterMap();
453 if(HasPointOnITSLayer(i)) fITSncls++;
456 // Set the combined PID
457 const Double_t *pid = track->PID();
459 for (i=0; i<AliPID::kSPECIES; i++) fR[i]=pid[i];
461 // AliESD track label
462 SetLabel(track->GetLabel());
464 SetStatus(track->GetStatus());
467 //_______________________________________________________________________
468 AliESDtrack::AliESDtrack(TParticle * part) :
469 AliExternalTrackParam(),
475 fTPCClusterMap(159),//number of padrows
476 fTPCSharedMap(159),//number of padrows
487 fEMCALindex(kEMCALNoMatch),
493 fCddTPC(0),fCdzTPC(0),fCzzTPC(0),
496 fCdd(0),fCdz(0),fCzz(0),
528 fVertexID(-2) // -2 means an orphan track
531 // ESD track from TParticle
534 // Reset all the arrays
536 for (i=0; i<AliPID::kSPECIES; i++) {
546 for (i=0; i<3; i++) { fKinkIndexes[i]=0;}
547 for (i=0; i<3; i++) { fV0Indexes[i]=-1;}
548 for (i=0;i<kTRDnPlanes;i++) {
551 for (i=0;i<4;i++) {fITSdEdxSamples[i]=0.;}
552 for (i=0;i<4;i++) {fTPCPoints[i]=0;}
553 for (i=0;i<3;i++) {fTOFLabel[i]=0;}
554 for (i=0;i<10;i++) {fTOFInfo[i]=0;}
555 for (i=0;i<12;i++) {fITSModule[i]=-1;}
557 // Calculate the AliExternalTrackParam content
564 // Calculate alpha: the rotation angle of the corresponding local system (TPC sector)
565 alpha = part->Phi()*180./TMath::Pi();
566 if (alpha<0) alpha+= 360.;
567 if (alpha>360) alpha -= 360.;
569 Int_t sector = (Int_t)(alpha/20.);
570 alpha = 10. + 20.*sector;
572 alpha *= TMath::Pi();
574 // Covariance matrix: no errors, the parameters are exact
575 for (i=0; i<15; i++) covar[i]=0.;
577 // Get the vertex of origin and the momentum
578 TVector3 ver(part->Vx(),part->Vy(),part->Vz());
579 TVector3 mom(part->Px(),part->Py(),part->Pz());
581 // Rotate to the local coordinate system (TPC sector)
585 // X of the referense plane
588 Int_t pdgCode = part->GetPdgCode();
591 TDatabasePDG::Instance()->GetParticle(pdgCode)->Charge();
595 param[2] = TMath::Sin(mom.Phi());
596 param[3] = mom.Pz()/mom.Pt();
597 param[4] = TMath::Sign(1/mom.Pt(),charge);
599 // Set AliExternalTrackParam
600 Set(xref, alpha, param, covar);
605 switch (TMath::Abs(pdgCode)) {
631 // If the particle is not e,mu,pi,K or p the PID probabilities are set to 0
632 if (indexPID < AliPID::kSPECIES) {
638 fHMPIDr[indexPID]=1.;
641 // AliESD track label
642 SetLabel(part->GetUniqueID());
646 //_______________________________________________________________________
647 AliESDtrack::~AliESDtrack(){
649 // This is destructor according Coding Conventrions
651 //printf("Delete track\n");
661 AliESDtrack &AliESDtrack::operator=(const AliESDtrack &source){
664 if(&source == this) return *this;
665 AliExternalTrackParam::operator=(source);
669 // we have the trackparam: assign or copy construct
670 if(fCp)*fCp = *source.fCp;
671 else fCp = new AliExternalTrackParam(*source.fCp);
674 // no track param delete the old one
680 // we have the trackparam: assign or copy construct
681 if(fIp)*fIp = *source.fIp;
682 else fIp = new AliExternalTrackParam(*source.fIp);
685 // no track param delete the old one
691 if(source.fTPCInner){
692 // we have the trackparam: assign or copy construct
693 if(fTPCInner) *fTPCInner = *source.fTPCInner;
694 else fTPCInner = new AliExternalTrackParam(*source.fTPCInner);
697 // no track param delete the old one
698 if(fTPCInner)delete fTPCInner;
704 // we have the trackparam: assign or copy construct
705 if(fOp) *fOp = *source.fOp;
706 else fOp = new AliExternalTrackParam(*source.fOp);
709 // no track param delete the old one
714 // copy also the friend track
715 // use copy constructor
716 if(source.fFriendTrack){
717 // we have the trackparam: assign or copy construct
718 delete fFriendTrack; fFriendTrack=new AliESDfriendTrack(*source.fFriendTrack);
721 // no track param delete the old one
722 delete fFriendTrack; fFriendTrack= 0;
725 fTPCClusterMap = source.fTPCClusterMap;
726 fTPCSharedMap = source.fTPCSharedMap;
728 fFlags = source.fFlags;
730 fLabel = source.fLabel;
731 fITSLabel = source.fITSLabel;
732 for(int i = 0; i< 12;++i){
733 fITSModule[i] = source.fITSModule[i];
735 fTPCLabel = source.fTPCLabel;
736 fTRDLabel = source.fTRDLabel;
737 for(int i = 0; i< 3;++i){
738 fTOFLabel[i] = source.fTOFLabel[i];
740 fTOFCalChannel = source.fTOFCalChannel;
741 fTOFindex = source.fTOFindex;
742 fHMPIDqn = source.fHMPIDqn;
743 fHMPIDcluIdx = source.fHMPIDcluIdx;
744 fEMCALindex = source.fEMCALindex;
746 for(int i = 0; i< 3;++i){
747 fKinkIndexes[i] = source.fKinkIndexes[i];
748 fV0Indexes[i] = source.fV0Indexes[i];
751 for(int i = 0; i< AliPID::kSPECIES;++i){
752 fR[i] = source.fR[i];
753 fITSr[i] = source.fITSr[i];
754 fTPCr[i] = source.fTPCr[i];
755 fTRDr[i] = source.fTRDr[i];
756 fTOFr[i] = source.fTOFr[i];
757 fHMPIDr[i] = source.fHMPIDr[i];
758 fTrackTime[i] = source.fTrackTime[i];
761 fHMPIDtrkTheta = source.fHMPIDtrkTheta;
762 fHMPIDtrkPhi = source.fHMPIDtrkPhi;
763 fHMPIDsignal = source.fHMPIDsignal;
766 fTrackLength = source. fTrackLength;
767 fdTPC = source.fdTPC;
768 fzTPC = source.fzTPC;
769 fCddTPC = source.fCddTPC;
770 fCdzTPC = source.fCdzTPC;
771 fCzzTPC = source.fCzzTPC;
772 fCchi2TPC = source.fCchi2TPC;
779 fCchi2 = source.fCchi2;
781 fITSchi2 = source.fITSchi2;
782 fTPCchi2 = source.fTPCchi2;
783 fTRDchi2 = source.fTRDchi2;
784 fTOFchi2 = source.fTOFchi2;
785 fHMPIDchi2 = source.fHMPIDchi2;
787 fGlobalChi2 = source.fGlobalChi2;
789 fITSsignal = source.fITSsignal;
790 for (Int_t i=0;i<4;i++) {fITSdEdxSamples[i]=source.fITSdEdxSamples[i];}
791 fTPCsignal = source.fTPCsignal;
792 fTPCsignalS = source.fTPCsignalS;
793 for(int i = 0; i< 4;++i){
794 fTPCPoints[i] = source.fTPCPoints[i];
796 fTRDsignal = source.fTRDsignal;
798 for(int i = 0;i < kTRDnPlanes;++i){
799 fTRDTimBin[i] = source.fTRDTimBin[i];
805 fTRDnSlices=source.fTRDnSlices;
807 fTRDslices=new Double32_t[fTRDnSlices];
808 for(int j = 0;j < fTRDnSlices;++j) fTRDslices[j] = source.fTRDslices[j];
811 fTRDQuality = source.fTRDQuality;
812 fTRDBudget = source.fTRDBudget;
813 fTOFsignal = source.fTOFsignal;
814 fTOFsignalToT = source.fTOFsignalToT;
815 fTOFsignalRaw = source.fTOFsignalRaw;
816 fTOFsignalDz = source.fTOFsignalDz;
818 for(int i = 0;i<10;++i){
819 fTOFInfo[i] = source.fTOFInfo[i];
822 fHMPIDtrkX = source.fHMPIDtrkX;
823 fHMPIDtrkY = source.fHMPIDtrkY;
824 fHMPIDmipX = source.fHMPIDmipX;
825 fHMPIDmipY = source.fHMPIDmipY;
827 fTPCncls = source.fTPCncls;
828 fTPCnclsF = source.fTPCnclsF;
829 fTPCsignalN = source.fTPCsignalN;
831 fITSncls = source.fITSncls;
832 fITSClusterMap = source.fITSClusterMap;
833 fTRDncls = source.fTRDncls;
834 fTRDncls0 = source.fTRDncls0;
835 fTRDntracklets = source.fTRDntracklets;
836 fVertexID = source.fVertexID;
842 void AliESDtrack::Copy(TObject &obj) const {
844 // this overwrites the virtual TOBject::Copy()
845 // to allow run time copying without casting
848 if(this==&obj)return;
849 AliESDtrack *robj = dynamic_cast<AliESDtrack*>(&obj);
850 if(!robj)return; // not an AliESDtrack
857 void AliESDtrack::AddCalibObject(TObject * object){
859 // add calib object to the list
861 if (!fFriendTrack) fFriendTrack = new AliESDfriendTrack;
862 fFriendTrack->AddCalibObject(object);
865 TObject * AliESDtrack::GetCalibObject(Int_t index){
867 // return calib objct at given position
869 if (!fFriendTrack) return 0;
870 return fFriendTrack->GetCalibObject(index);
874 Bool_t AliESDtrack::FillTPCOnlyTrack(AliESDtrack &track){
876 // Fills the information of the TPC-only first reconstruction pass
877 // into the passed ESDtrack object. For consistency fTPCInner is also filled
882 // For data produced before r26675
883 // RelateToVertexTPC was not properly called during reco
884 // so you'll have to call it again, before FillTPCOnlyTrack
885 // Float_t p[2],cov[3];
886 // track->GetImpactParametersTPC(p,cov);
887 // if(p[0]==0&&p[1]==0) // <- Default values
888 // track->RelateToVertexTPC(esd->GetPrimaryVertexTPC(),esd->GetMagneticField(),kVeryBig);
891 if(!fTPCInner)return kFALSE;
893 // fill the TPC track params to the global track parameters
894 track.Set(fTPCInner->GetX(),fTPCInner->GetAlpha(),fTPCInner->GetParameter(),fTPCInner->GetCovariance());
897 track.fCdd = fCddTPC;
898 track.fCdz = fCdzTPC;
899 track.fCzz = fCzzTPC;
901 // copy the TPCinner parameters
902 if(track.fTPCInner) *track.fTPCInner = *fTPCInner;
903 else track.fTPCInner = new AliExternalTrackParam(*fTPCInner);
906 track.fCddTPC = fCddTPC;
907 track.fCdzTPC = fCdzTPC;
908 track.fCzzTPC = fCzzTPC;
909 track.fCchi2TPC = fCchi2TPC;
912 // copy all other TPC specific parameters
914 // replace label by TPC label
915 track.fLabel = fTPCLabel;
916 track.fTPCLabel = fTPCLabel;
918 track.fTPCchi2 = fTPCchi2;
919 track.fTPCsignal = fTPCsignal;
920 track.fTPCsignalS = fTPCsignalS;
921 for(int i = 0;i<4;++i)track.fTPCPoints[i] = fTPCPoints[i];
923 track.fTPCncls = fTPCncls;
924 track.fTPCnclsF = fTPCnclsF;
925 track.fTPCsignalN = fTPCsignalN;
928 for(int i=0;i<AliPID::kSPECIES;++i){
929 track.fTPCr[i] = fTPCr[i];
930 // combined PID is TPC only!
931 track.fR[i] = fTPCr[i];
933 track.fTPCClusterMap = fTPCClusterMap;
934 track.fTPCSharedMap = fTPCSharedMap;
938 track.fFlags = kTPCin;
941 track.fFlags |= fFlags & kTPCpid; //copy the TPCpid status flag
943 for (Int_t i=0;i<3;i++) track.fKinkIndexes[i] = fKinkIndexes[i];
949 //_______________________________________________________________________
950 void AliESDtrack::MakeMiniESDtrack(){
951 // Resets everything except
952 // fFlags: Reconstruction status flags
953 // fLabel: Track label
954 // fID: Unique ID of the track
955 // Impact parameter information
956 // fR[AliPID::kSPECIES]: combined "detector response probability"
957 // Running track parameters in the base class (AliExternalTrackParam)
961 for (Int_t i=0;i<AliPID::kSPECIES;i++) fTrackTime[i] = 0;
963 // Reset track parameters constrained to the primary vertex
966 // Reset track parameters at the inner wall of TPC
968 delete fTPCInner;fTPCInner=0;
969 // Reset track parameters at the inner wall of the TRD
973 // Reset ITS track related information
978 for (Int_t i=0;i<4;i++) fITSdEdxSamples[i] = 0.;
979 for (Int_t i=0;i<AliPID::kSPECIES;i++) fITSr[i]=0;
982 // Reset TPC related track information
991 for (Int_t i=0;i<AliPID::kSPECIES;i++) fTPCr[i]=0;
993 for (Int_t i=0;i<4;i++) fTPCPoints[i] = 0;
994 for (Int_t i=0; i<3;i++) fKinkIndexes[i] = 0;
995 for (Int_t i=0; i<3;i++) fV0Indexes[i] = 0;
997 // Reset TRD related track information
1002 for (Int_t i=0;i<kTRDnPlanes;i++) {
1005 for (Int_t i=0;i<AliPID::kSPECIES;i++) fTRDr[i] = 0;
1010 delete[] fTRDslices;
1015 // Reset TOF related track information
1023 for (Int_t i=0;i<AliPID::kSPECIES;i++) fTOFr[i] = 0;
1024 for (Int_t i=0;i<3;i++) fTOFLabel[i] = 0;
1025 for (Int_t i=0;i<10;i++) fTOFInfo[i] = 0;
1027 // Reset HMPID related track information
1032 for (Int_t i=0;i<AliPID::kSPECIES;i++) fHMPIDr[i] = 0;
1039 fEMCALindex = kEMCALNoMatch;
1041 // reset global track chi2
1044 fVertexID = -2; // an orphan track
1046 delete fFriendTrack; fFriendTrack = 0;
1048 //_______________________________________________________________________
1049 Double_t AliESDtrack::GetMass() const {
1050 // Returns the mass of the most probable particle type
1053 for (Int_t i=0; i<AliPID::kSPECIES; i++) {
1054 if (fR[i]>max) {k=i; max=fR[i];}
1056 if (k==0) { // dE/dx "crossing points" in the TPC
1058 if ((p>0.38)&&(p<0.48))
1059 if (fR[0]<fR[3]*10.) return AliPID::ParticleMass(AliPID::kKaon);
1060 if ((p>0.75)&&(p<0.85))
1061 if (fR[0]<fR[4]*10.) return AliPID::ParticleMass(AliPID::kProton);
1064 if (k==1) return AliPID::ParticleMass(AliPID::kMuon);
1065 if (k==2||k==-1) return AliPID::ParticleMass(AliPID::kPion);
1066 if (k==3) return AliPID::ParticleMass(AliPID::kKaon);
1067 if (k==4) return AliPID::ParticleMass(AliPID::kProton);
1068 AliWarning("Undefined mass !");
1069 return AliPID::ParticleMass(AliPID::kPion);
1072 //______________________________________________________________________________
1073 Double_t AliESDtrack::E() const
1075 // Returns the energy of the particle given its assumed mass.
1076 // Assumes the pion mass if the particle can't be identified properly.
1080 return TMath::Sqrt(p*p + m*m);
1083 //______________________________________________________________________________
1084 Double_t AliESDtrack::Y() const
1086 // Returns the rapidity of a particle given its assumed mass.
1087 // Assumes the pion mass if the particle can't be identified properly.
1091 if (e != TMath::Abs(pz)) { // energy was not equal to pz
1092 return 0.5*TMath::Log((e+pz)/(e-pz));
1093 } else { // energy was equal to pz
1098 //_______________________________________________________________________
1099 Bool_t AliESDtrack::UpdateTrackParams(const AliKalmanTrack *t, ULong_t flags){
1101 // This function updates track's running parameters
1107 fLabel=t->GetLabel();
1109 if (t->IsStartedTimeIntegral()) {
1111 Double_t times[10];t->GetIntegratedTimes(times); SetIntegratedTimes(times);
1112 SetIntegratedLength(t->GetIntegratedLength());
1115 Set(t->GetX(),t->GetAlpha(),t->GetParameter(),t->GetCovariance());
1116 if (flags==kITSout) fFriendTrack->SetITSOut(*t);
1117 if (flags==kTPCout) fFriendTrack->SetTPCOut(*t);
1118 if (flags==kTRDrefit) fFriendTrack->SetTRDIn(*t);
1122 case kITSin: case kITSout: case kITSrefit:
1124 fITSncls=t->GetNumberOfClusters();
1125 index=fFriendTrack->GetITSindices();
1126 for (Int_t i=0;i<AliESDfriendTrack::kMaxITScluster;i++) {
1127 index[i]=t->GetClusterIndex(i);
1129 Int_t l=(index[i] & 0xf0000000) >> 28;
1130 SETBIT(fITSClusterMap,l);
1133 fITSchi2=t->GetChi2();
1134 fITSsignal=t->GetPIDsignal();
1135 fITSLabel = t->GetLabel();
1136 // keep in fOp the parameters outside ITS for ITS stand-alone tracks
1137 if (flags==kITSout) {
1138 if (!fOp) fOp=new AliExternalTrackParam(*t);
1140 fOp->Set(t->GetX(),t->GetAlpha(),t->GetParameter(),t->GetCovariance());
1144 case kTPCin: case kTPCrefit:
1145 fTPCLabel = t->GetLabel();
1146 if (flags==kTPCin) fTPCInner=new AliExternalTrackParam(*t);
1147 if (!fIp) fIp=new AliExternalTrackParam(*t);
1149 fIp->Set(t->GetX(),t->GetAlpha(),t->GetParameter(),t->GetCovariance());
1151 index=fFriendTrack->GetTPCindices();
1152 if (flags & kTPCout){
1153 if (!fOp) fOp=new AliExternalTrackParam(*t);
1155 fOp->Set(t->GetX(),t->GetAlpha(),t->GetParameter(),t->GetCovariance());
1157 fTPCncls=t->GetNumberOfClusters();
1158 fTPCchi2=t->GetChi2();
1160 {//prevrow must be declared in separate namespace, otherwise compiler cries:
1161 //"jump to case label crosses initialization of `Int_t prevrow'"
1163 // for (Int_t i=0;i<fTPCncls;i++)
1164 for (Int_t i=0;i<AliESDfriendTrack::kMaxTPCcluster;i++)
1166 index[i]=t->GetClusterIndex(i);
1167 Int_t idx = index[i];
1169 if (idx<0) continue;
1171 // Piotr's Cluster Map for HBT
1172 // ### please change accordingly if cluster array is changing
1173 // to "New TPC Tracking" style (with gaps in array)
1174 Int_t sect = (idx&0xff000000)>>24;
1175 Int_t row = (idx&0x00ff0000)>>16;
1176 if (sect > 18) row +=63; //if it is outer sector, add number of inner sectors
1178 fTPCClusterMap.SetBitNumber(row,kTRUE);
1180 //Fill the gap between previous row and this row with 0 bits
1181 //In case ### pleas change it as well - just set bit 0 in case there
1182 //is no associated clusters for current "i"
1185 prevrow = row;//if previous bit was not assigned yet == this is the first one
1188 { //we don't know the order (inner to outer or reverse)
1189 //just to be save in case it is going to change
1202 for (Int_t j = n+1; j < m; j++)
1204 fTPCClusterMap.SetBitNumber(j,kFALSE);
1208 // End Of Piotr's Cluster Map for HBT
1211 fTPCsignal=t->GetPIDsignal();
1214 case kTRDin: case kTRDrefit:
1217 index = fFriendTrack->GetTRDindices();
1218 fTRDLabel = t->GetLabel();
1219 fTRDchi2 = t->GetChi2();
1220 fTRDncls = t->GetNumberOfClusters();
1221 for (Int_t i=0;i<6;i++) index[i]=t->GetTrackletIndex(i);
1223 fTRDsignal=t->GetPIDsignal();
1226 if (!fOp) fOp=new AliExternalTrackParam(*t);
1228 fOp->Set(t->GetX(),t->GetAlpha(),t->GetParameter(),t->GetCovariance());
1229 fTRDncls0 = t->GetNumberOfClusters();
1238 AliError("Wrong flag !");
1245 //_______________________________________________________________________
1246 void AliESDtrack::GetExternalParameters(Double_t &x, Double_t p[5]) const {
1247 //---------------------------------------------------------------------
1248 // This function returns external representation of the track parameters
1249 //---------------------------------------------------------------------
1251 for (Int_t i=0; i<5; i++) p[i]=GetParameter()[i];
1254 //_______________________________________________________________________
1255 void AliESDtrack::GetExternalCovariance(Double_t cov[15]) const {
1256 //---------------------------------------------------------------------
1257 // This function returns external representation of the cov. matrix
1258 //---------------------------------------------------------------------
1259 for (Int_t i=0; i<15; i++) cov[i]=AliExternalTrackParam::GetCovariance()[i];
1262 //_______________________________________________________________________
1263 Bool_t AliESDtrack::GetConstrainedExternalParameters
1264 (Double_t &alpha, Double_t &x, Double_t p[5]) const {
1265 //---------------------------------------------------------------------
1266 // This function returns the constrained external track parameters
1267 //---------------------------------------------------------------------
1268 if (!fCp) return kFALSE;
1269 alpha=fCp->GetAlpha();
1271 for (Int_t i=0; i<5; i++) p[i]=fCp->GetParameter()[i];
1275 //_______________________________________________________________________
1277 AliESDtrack::GetConstrainedExternalCovariance(Double_t c[15]) const {
1278 //---------------------------------------------------------------------
1279 // This function returns the constrained external cov. matrix
1280 //---------------------------------------------------------------------
1281 if (!fCp) return kFALSE;
1282 for (Int_t i=0; i<15; i++) c[i]=fCp->GetCovariance()[i];
1287 AliESDtrack::GetInnerExternalParameters
1288 (Double_t &alpha, Double_t &x, Double_t p[5]) const {
1289 //---------------------------------------------------------------------
1290 // This function returns external representation of the track parameters
1291 // at the inner layer of TPC
1292 //---------------------------------------------------------------------
1293 if (!fIp) return kFALSE;
1294 alpha=fIp->GetAlpha();
1296 for (Int_t i=0; i<5; i++) p[i]=fIp->GetParameter()[i];
1301 AliESDtrack::GetInnerExternalCovariance(Double_t cov[15]) const {
1302 //---------------------------------------------------------------------
1303 // This function returns external representation of the cov. matrix
1304 // at the inner layer of TPC
1305 //---------------------------------------------------------------------
1306 if (!fIp) return kFALSE;
1307 for (Int_t i=0; i<15; i++) cov[i]=fIp->GetCovariance()[i];
1312 AliESDtrack::SetOuterParam(const AliExternalTrackParam *p, ULong_t flags) {
1314 // This is a direct setter for the outer track parameters
1317 if (fOp) delete fOp;
1318 fOp=new AliExternalTrackParam(*p);
1322 AliESDtrack::GetOuterExternalParameters
1323 (Double_t &alpha, Double_t &x, Double_t p[5]) const {
1324 //---------------------------------------------------------------------
1325 // This function returns external representation of the track parameters
1326 // at the inner layer of TRD
1327 //---------------------------------------------------------------------
1328 if (!fOp) return kFALSE;
1329 alpha=fOp->GetAlpha();
1331 for (Int_t i=0; i<5; i++) p[i]=fOp->GetParameter()[i];
1336 AliESDtrack::GetOuterExternalCovariance(Double_t cov[15]) const {
1337 //---------------------------------------------------------------------
1338 // This function returns external representation of the cov. matrix
1339 // at the inner layer of TRD
1340 //---------------------------------------------------------------------
1341 if (!fOp) return kFALSE;
1342 for (Int_t i=0; i<15; i++) cov[i]=fOp->GetCovariance()[i];
1346 Int_t AliESDtrack::GetNcls(Int_t idet) const
1348 // Get number of clusters by subdetector index
1362 if (fTOFindex != -1)
1368 if ((fHMPIDcluIdx >= 0) && (fHMPIDcluIdx < 7000000)) {
1369 if ((fHMPIDcluIdx%1000000 != 9999) && (fHMPIDcluIdx%1000000 != 99999)) {
1380 Int_t AliESDtrack::GetClusters(Int_t idet, Int_t *idx) const
1382 // Get cluster index array by subdetector index
1387 ncls = GetITSclusters(idx);
1390 ncls = GetTPCclusters(idx);
1393 ncls = GetTRDclusters(idx);
1396 if (fTOFindex != -1) {
1404 if ((fHMPIDcluIdx >= 0) && (fHMPIDcluIdx < 7000000)) {
1405 if ((fHMPIDcluIdx%1000000 != 9999) && (fHMPIDcluIdx%1000000 != 99999)) {
1406 idx[0] = GetHMPIDcluIdx();
1419 //_______________________________________________________________________
1420 void AliESDtrack::GetIntegratedTimes(Double_t *times) const {
1421 // Returns the array with integrated times for each particle hypothesis
1422 for (Int_t i=0; i<AliPID::kSPECIES; i++) times[i]=fTrackTime[i];
1425 //_______________________________________________________________________
1426 void AliESDtrack::SetIntegratedTimes(const Double_t *times) {
1427 // Sets the array with integrated times for each particle hypotesis
1428 for (Int_t i=0; i<AliPID::kSPECIES; i++) fTrackTime[i]=times[i];
1431 //_______________________________________________________________________
1432 void AliESDtrack::SetITSpid(const Double_t *p) {
1433 // Sets values for the probability of each particle type (in ITS)
1434 SetPIDValues(fITSr,p,AliPID::kSPECIES);
1435 SetStatus(AliESDtrack::kITSpid);
1438 //_______________________________________________________________________
1439 void AliESDtrack::GetITSpid(Double_t *p) const {
1440 // Gets the probability of each particle type (in ITS)
1441 for (Int_t i=0; i<AliPID::kSPECIES; i++) p[i]=fITSr[i];
1444 //_______________________________________________________________________
1445 Char_t AliESDtrack::GetITSclusters(Int_t *idx) const {
1446 //---------------------------------------------------------------------
1447 // This function returns indices of the assgined ITS clusters
1448 //---------------------------------------------------------------------
1450 Int_t *index=fFriendTrack->GetITSindices();
1451 for (Int_t i=0; i<AliESDfriendTrack::kMaxITScluster; i++) {
1452 if ( (i>=fITSncls) && (i<6) ) idx[i]=-1;
1453 else idx[i]=index[i];
1459 //_______________________________________________________________________
1460 Bool_t AliESDtrack::GetITSModuleIndexInfo(Int_t ilayer,Int_t &idet,Int_t &status,
1461 Float_t &xloc,Float_t &zloc) const {
1462 //----------------------------------------------------------------------
1463 // This function encodes in the module number also the status of cluster association
1464 // "status" can have the following values:
1465 // 1 "found" (cluster is associated),
1466 // 2 "dead" (module is dead from OCDB),
1467 // 3 "skipped" (module or layer forced to be skipped),
1468 // 4 "outinz" (track out of z acceptance),
1469 // 5 "nocls" (no clusters in the road),
1470 // 6 "norefit" (cluster rejected during refit),
1471 // 7 "deadzspd" (holes in z in SPD)
1472 // Also given are the coordinates of the crossing point of track and module
1473 // (in the local module ref. system)
1474 // WARNING: THIS METHOD HAS TO BE SYNCHRONIZED WITH AliITStrackV2::GetModuleIndexInfo()!
1475 //----------------------------------------------------------------------
1477 if(fITSModule[ilayer]==-1) {
1480 xloc=-99.; zloc=-99.;
1484 Int_t module = fITSModule[ilayer];
1486 idet = Int_t(module/1000000);
1488 module -= idet*1000000;
1490 status = Int_t(module/100000);
1492 module -= status*100000;
1494 Int_t signs = Int_t(module/10000);
1496 module-=signs*10000;
1498 Int_t xInt = Int_t(module/100);
1501 Int_t zInt = module;
1503 if(signs==1) { xInt*=1; zInt*=1; }
1504 if(signs==2) { xInt*=1; zInt*=-1; }
1505 if(signs==3) { xInt*=-1; zInt*=1; }
1506 if(signs==4) { xInt*=-1; zInt*=-1; }
1508 xloc = 0.1*(Float_t)xInt;
1509 zloc = 0.1*(Float_t)zInt;
1511 if(status==4) idet = -1;
1516 //_______________________________________________________________________
1517 UShort_t AliESDtrack::GetTPCclusters(Int_t *idx) const {
1518 //---------------------------------------------------------------------
1519 // This function returns indices of the assgined ITS clusters
1520 //---------------------------------------------------------------------
1522 Int_t *index=fFriendTrack->GetTPCindices();
1523 for (Int_t i=0; i<AliESDfriendTrack::kMaxTPCcluster; i++) idx[i]=index[i];
1528 Double_t AliESDtrack::GetTPCdensity(Int_t row0, Int_t row1) const{
1530 // GetDensity of the clusters on given region between row0 and row1
1531 // Dead zone effect takin into acoount
1536 Int_t *index=fFriendTrack->GetTPCindices();
1537 for (Int_t i=row0;i<=row1;i++){
1538 Int_t idx = index[i];
1539 if (idx!=-1) good++; // track outside of dead zone
1542 Float_t density=0.5;
1543 if (good>(row1-row0)*0.5) density = Float_t(found)/Float_t(good);
1547 //_______________________________________________________________________
1548 void AliESDtrack::SetTPCpid(const Double_t *p) {
1549 // Sets values for the probability of each particle type (in TPC)
1550 SetPIDValues(fTPCr,p,AliPID::kSPECIES);
1551 SetStatus(AliESDtrack::kTPCpid);
1554 //_______________________________________________________________________
1555 void AliESDtrack::GetTPCpid(Double_t *p) const {
1556 // Gets the probability of each particle type (in TPC)
1557 for (Int_t i=0; i<AliPID::kSPECIES; i++) p[i]=fTPCr[i];
1560 //_______________________________________________________________________
1561 UChar_t AliESDtrack::GetTRDclusters(Int_t *idx) const {
1562 //---------------------------------------------------------------------
1563 // This function returns indices of the assgined TRD clusters
1564 //---------------------------------------------------------------------
1566 Int_t *index=fFriendTrack->GetTRDindices();
1567 for (Int_t i=0; i<AliESDfriendTrack::kMaxTRDcluster; i++) idx[i]=index[i];
1572 //_______________________________________________________________________
1573 UChar_t AliESDtrack::GetTRDtracklets(Int_t *idx) const {
1574 //---------------------------------------------------------------------
1575 // This function returns indices of the assigned TRD tracklets
1576 //---------------------------------------------------------------------
1578 Int_t *index=fFriendTrack->GetTRDindices();
1579 for (Int_t i=0; i<6/*AliESDfriendTrack::kMaxTRDcluster*/; i++) idx[i]=index[i];
1584 //_______________________________________________________________________
1585 void AliESDtrack::SetTRDpid(const Double_t *p) {
1586 // Sets values for the probability of each particle type (in TRD)
1587 SetPIDValues(fTRDr,p,AliPID::kSPECIES);
1588 SetStatus(AliESDtrack::kTRDpid);
1591 //_______________________________________________________________________
1592 void AliESDtrack::GetTRDpid(Double_t *p) const {
1593 // Gets the probability of each particle type (in TRD)
1594 for (Int_t i=0; i<AliPID::kSPECIES; i++) p[i]=fTRDr[i];
1597 //_______________________________________________________________________
1598 void AliESDtrack::SetTRDpid(Int_t iSpecies, Float_t p)
1600 // Sets the probability of particle type iSpecies to p (in TRD)
1601 fTRDr[iSpecies] = p;
1604 Double_t AliESDtrack::GetTRDpid(Int_t iSpecies) const
1606 // Returns the probability of particle type iSpecies (in TRD)
1607 return fTRDr[iSpecies];
1610 //____________________________________________________
1611 Int_t AliESDtrack::GetNumberOfTRDslices() const
1613 // built in backward compatibility
1614 Int_t idx = fTRDnSlices - (kTRDnPlanes<<1);
1615 return idx<18 ? fTRDnSlices/kTRDnPlanes : idx/kTRDnPlanes;
1618 //____________________________________________________
1619 Double_t AliESDtrack::GetTRDmomentum(Int_t plane, Double_t *sp) const
1621 //Returns momentum estimation and optional its error (sp)
1622 // in TRD layer "plane".
1625 AliError("No TRD info allocated for this track !");
1628 if ((plane<0) || (plane>=kTRDnPlanes)) {
1629 AliError("Info for TRD plane not available!");
1633 Int_t idx = fTRDnSlices-(kTRDnPlanes<<1)+plane;
1634 // Protection for backward compatibility
1635 if(idx<(GetNumberOfTRDslices()*kTRDnPlanes)) return -1.;
1637 if(sp) (*sp) = fTRDslices[idx+kTRDnPlanes];
1638 return fTRDslices[idx];
1641 //____________________________________________________
1642 Double_t AliESDtrack::GetTRDslice(Int_t plane, Int_t slice) const {
1643 //Gets the charge from the slice of the plane
1646 //AliError("No TRD slices allocated for this track !");
1649 if ((plane<0) || (plane>=kTRDnPlanes)) {
1650 AliError("Info for TRD plane not available !");
1653 Int_t ns=GetNumberOfTRDslices();
1654 if ((slice<-1) || (slice>=ns)) {
1655 //AliError("Wrong TRD slice !");
1659 if(slice>=0) return fTRDslices[plane*ns + slice];
1661 // return average of the dEdx measurements
1662 Double_t q=0.; Double32_t *s = &fTRDslices[plane*ns];
1663 for (Int_t i=0; i<ns; i++, s++) if((*s)>0.) q+=(*s);
1667 //____________________________________________________
1668 void AliESDtrack::SetNumberOfTRDslices(Int_t n) {
1669 //Sets the number of slices used for PID
1670 if (fTRDnSlices) return;
1673 fTRDslices=new Double32_t[fTRDnSlices];
1675 // set-up correctly the allocated memory
1676 memset(fTRDslices, 0, n*sizeof(Double32_t));
1677 for (Int_t i=GetNumberOfTRDslices(); i--;) fTRDslices[i]=-1.;
1680 //____________________________________________________
1681 void AliESDtrack::SetTRDslice(Double_t q, Int_t plane, Int_t slice) {
1682 //Sets the charge q in the slice of the plane
1684 AliError("No TRD slices allocated for this track !");
1687 if ((plane<0) || (plane>=kTRDnPlanes)) {
1688 AliError("Info for TRD plane not allocated !");
1691 Int_t ns=GetNumberOfTRDslices();
1692 if ((slice<0) || (slice>=ns)) {
1693 AliError("Wrong TRD slice !");
1696 Int_t n=plane*ns + slice;
1701 //____________________________________________________
1702 void AliESDtrack::SetTRDmomentum(Double_t p, Int_t plane, Double_t *sp)
1705 AliError("No TRD slices allocated for this track !");
1708 if ((plane<0) || (plane>=kTRDnPlanes)) {
1709 AliError("Info for TRD plane not allocated !");
1713 Int_t idx = fTRDnSlices-(kTRDnPlanes<<1)+plane;
1714 // Protection for backward compatibility
1715 if(idx<GetNumberOfTRDslices()*kTRDnPlanes) return;
1717 if(sp) fTRDslices[idx+kTRDnPlanes] = (*sp);
1718 fTRDslices[idx] = p;
1722 //_______________________________________________________________________
1723 void AliESDtrack::SetTOFpid(const Double_t *p) {
1724 // Sets the probability of each particle type (in TOF)
1725 SetPIDValues(fTOFr,p,AliPID::kSPECIES);
1726 SetStatus(AliESDtrack::kTOFpid);
1729 //_______________________________________________________________________
1730 void AliESDtrack::SetTOFLabel(const Int_t *p) {
1732 for (Int_t i=0; i<3; i++) fTOFLabel[i]=p[i];
1735 //_______________________________________________________________________
1736 void AliESDtrack::GetTOFpid(Double_t *p) const {
1737 // Gets probabilities of each particle type (in TOF)
1738 for (Int_t i=0; i<AliPID::kSPECIES; i++) p[i]=fTOFr[i];
1741 //_______________________________________________________________________
1742 void AliESDtrack::GetTOFLabel(Int_t *p) const {
1744 for (Int_t i=0; i<3; i++) p[i]=fTOFLabel[i];
1747 //_______________________________________________________________________
1748 void AliESDtrack::GetTOFInfo(Float_t *info) const {
1750 for (Int_t i=0; i<10; i++) info[i]=fTOFInfo[i];
1753 //_______________________________________________________________________
1754 void AliESDtrack::SetTOFInfo(Float_t*info) {
1756 for (Int_t i=0; i<10; i++) fTOFInfo[i]=info[i];
1761 //_______________________________________________________________________
1762 void AliESDtrack::SetHMPIDpid(const Double_t *p) {
1763 // Sets the probability of each particle type (in HMPID)
1764 SetPIDValues(fHMPIDr,p,AliPID::kSPECIES);
1765 SetStatus(AliESDtrack::kHMPIDpid);
1768 //_______________________________________________________________________
1769 void AliESDtrack::GetHMPIDpid(Double_t *p) const {
1770 // Gets probabilities of each particle type (in HMPID)
1771 for (Int_t i=0; i<AliPID::kSPECIES; i++) p[i]=fHMPIDr[i];
1776 //_______________________________________________________________________
1777 void AliESDtrack::SetESDpid(const Double_t *p) {
1778 // Sets the probability of each particle type for the ESD track
1779 SetPIDValues(fR,p,AliPID::kSPECIES);
1780 SetStatus(AliESDtrack::kESDpid);
1783 //_______________________________________________________________________
1784 void AliESDtrack::GetESDpid(Double_t *p) const {
1785 // Gets probability of each particle type for the ESD track
1786 for (Int_t i=0; i<AliPID::kSPECIES; i++) p[i]=fR[i];
1789 //_______________________________________________________________________
1790 Bool_t AliESDtrack::RelateToVertexTPC(const AliESDVertex *vtx,
1791 Double_t b, Double_t maxd, AliExternalTrackParam *cParam) {
1793 // Try to relate the TPC-only track parameters to the vertex "vtx",
1794 // if the (rough) transverse impact parameter is not bigger then "maxd".
1795 // Magnetic field is "b" (kG).
1797 // a) The TPC-only paramters are extapolated to the DCA to the vertex.
1798 // b) The impact parameters and their covariance matrix are calculated.
1799 // c) An attempt to constrain the TPC-only params to the vertex is done.
1800 // The constrained params are returned via "cParam".
1802 // In the case of success, the returned value is kTRUE
1803 // otherwise, it's kFALSE)
1806 if (!fTPCInner) return kFALSE;
1807 if (!vtx) return kFALSE;
1809 Double_t dz[2],cov[3];
1810 if (!fTPCInner->PropagateToDCA(vtx, b, maxd, dz, cov)) return kFALSE;
1818 Double_t covar[6]; vtx->GetCovMatrix(covar);
1819 Double_t p[2]={GetParameter()[0]-dz[0],GetParameter()[1]-dz[1]};
1820 Double_t c[3]={covar[2],0.,covar[5]};
1822 Double_t chi2=GetPredictedChi2(p,c);
1823 if (chi2>kVeryBig) return kFALSE;
1827 if (!cParam) return kTRUE;
1829 *cParam = *fTPCInner;
1830 if (!cParam->Update(p,c)) return kFALSE;
1835 //_______________________________________________________________________
1836 Bool_t AliESDtrack::RelateToVertex(const AliESDVertex *vtx,
1837 Double_t b, Double_t maxd, AliExternalTrackParam *cParam) {
1839 // Try to relate this track to the vertex "vtx",
1840 // if the (rough) transverse impact parameter is not bigger then "maxd".
1841 // Magnetic field is "b" (kG).
1843 // a) The track gets extapolated to the DCA to the vertex.
1844 // b) The impact parameters and their covariance matrix are calculated.
1845 // c) An attempt to constrain this track to the vertex is done.
1846 // The constrained params are returned via "cParam".
1848 // In the case of success, the returned value is kTRUE
1849 // (otherwise, it's kFALSE)
1852 if (!vtx) return kFALSE;
1854 Double_t dz[2],cov[3];
1855 if (!PropagateToDCA(vtx, b, maxd, dz, cov)) return kFALSE;
1863 Double_t covar[6]; vtx->GetCovMatrix(covar);
1864 Double_t p[2]={GetParameter()[0]-dz[0],GetParameter()[1]-dz[1]};
1865 Double_t c[3]={covar[2],0.,covar[5]};
1867 Double_t chi2=GetPredictedChi2(p,c);
1868 if (chi2>kVeryBig) return kFALSE;
1873 //--- Could now these lines be removed ? ---
1875 fCp=new AliExternalTrackParam(*this);
1877 if (!fCp->Update(p,c)) {delete fCp; fCp=0; return kFALSE;}
1878 //----------------------------------------
1880 fVertexID = vtx->GetID();
1882 if (!cParam) return kTRUE;
1885 if (!cParam->Update(p,c)) return kFALSE;
1890 //_______________________________________________________________________
1891 void AliESDtrack::Print(Option_t *) const {
1892 // Prints info on the track
1893 AliExternalTrackParam::Print();
1894 printf("ESD track info\n") ;
1895 Double_t p[AliPID::kSPECIESN] ;
1897 if( IsOn(kITSpid) ){
1898 printf("From ITS: ") ;
1900 for(index = 0 ; index < AliPID::kSPECIES; index++)
1901 printf("%f, ", p[index]) ;
1902 printf("\n signal = %f\n", GetITSsignal()) ;
1904 if( IsOn(kTPCpid) ){
1905 printf("From TPC: ") ;
1907 for(index = 0 ; index < AliPID::kSPECIES; index++)
1908 printf("%f, ", p[index]) ;
1909 printf("\n signal = %f\n", GetTPCsignal()) ;
1911 if( IsOn(kTRDpid) ){
1912 printf("From TRD: ") ;
1914 for(index = 0 ; index < AliPID::kSPECIES; index++)
1915 printf("%f, ", p[index]) ;
1916 printf("\n signal = %f\n", GetTRDsignal()) ;
1918 if( IsOn(kTOFpid) ){
1919 printf("From TOF: ") ;
1921 for(index = 0 ; index < AliPID::kSPECIES; index++)
1922 printf("%f, ", p[index]) ;
1923 printf("\n signal = %f\n", GetTOFsignal()) ;
1925 if( IsOn(kHMPIDpid) ){
1926 printf("From HMPID: ") ;
1928 for(index = 0 ; index < AliPID::kSPECIES; index++)
1929 printf("%f, ", p[index]) ;
1930 printf("\n signal = %f\n", GetHMPIDsignal()) ;
1936 // Draw functionality
1937 // Origin: Marian Ivanov, Marian.Ivanov@cern.ch
1939 void AliESDtrack::FillPolymarker(TPolyMarker3D *pol, Float_t magF, Float_t minR, Float_t maxR, Float_t stepR){
1941 // Fill points in the polymarker
1944 arrayRef.AddLast(new AliExternalTrackParam(*this));
1945 if (fIp) arrayRef.AddLast(new AliExternalTrackParam(*fIp));
1946 if (fOp) arrayRef.AddLast(new AliExternalTrackParam(*fOp));
1948 Double_t mpos[3]={0,0,0};
1949 Int_t entries=arrayRef.GetEntries();
1950 for (Int_t i=0;i<entries;i++){
1952 ((AliExternalTrackParam*)arrayRef.At(i))->GetXYZ(pos);
1953 mpos[0]+=pos[0]/entries;
1954 mpos[1]+=pos[1]/entries;
1955 mpos[2]+=pos[2]/entries;
1957 // Rotate to the mean position
1959 Float_t fi= TMath::ATan2(mpos[1],mpos[0]);
1960 for (Int_t i=0;i<entries;i++){
1961 Bool_t res = ((AliExternalTrackParam*)arrayRef.At(i))->Rotate(fi);
1962 if (!res) delete arrayRef.RemoveAt(i);
1965 for (Double_t r=minR; r<maxR; r+=stepR){
1967 Double_t mlpos[3]={0,0,0};
1968 for (Int_t i=0;i<entries;i++){
1969 Double_t point[3]={0,0,0};
1970 AliExternalTrackParam *param = ((AliExternalTrackParam*)arrayRef.At(i));
1971 if (!param) continue;
1972 if (param->GetXYZAt(r,magF,point)){
1973 Double_t weight = 1./(10.+(r-param->GetX())*(r-param->GetX()));
1975 mlpos[0]+=point[0]*weight;
1976 mlpos[1]+=point[1]*weight;
1977 mlpos[2]+=point[2]*weight;
1984 pol->SetPoint(counter,mlpos[0],mlpos[1], mlpos[2]);
1985 printf("xyz\t%f\t%f\t%f\n",mlpos[0], mlpos[1],mlpos[2]);
1991 //_______________________________________________________________________
1992 void AliESDtrack::SetITSdEdxSamples(const Double_t s[4]) {
1994 // Store the dE/dx samples measured by the two SSD and two SDD layers.
1995 // These samples are corrected for the track segment length.
1997 for (Int_t i=0; i<4; i++) fITSdEdxSamples[i]=s[i];
2000 //_______________________________________________________________________
2001 void AliESDtrack::GetITSdEdxSamples(Double_t *s) const {
2003 // Get the dE/dx samples measured by the two SSD and two SDD layers.
2004 // These samples are corrected for the track segment length.
2006 for (Int_t i=0; i<4; i++) s[i]=fITSdEdxSamples[i];