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>
119 #include "AliESDVertex.h"
120 #include "AliESDtrack.h"
121 #include "AliKalmanTrack.h"
122 #include "AliVTrack.h"
124 #include "AliTrackPointArray.h"
125 #include "TPolyMarker3D.h"
127 ClassImp(AliESDtrack)
129 void SetPIDValues(Double_t * dest, const Double_t * src, Int_t n) {
130 // This function copies "n" PID weights from "scr" to "dest"
131 // and normalizes their sum to 1 thus producing conditional probabilities.
132 // The negative weights are set to 0.
133 // In case all the weights are non-positive they are replaced by
134 // uniform probabilities
138 Float_t uniform = 1./(Float_t)n;
141 for (Int_t i=0; i<n; i++)
151 for (Int_t i=0; i<n; i++) dest[i] /= sum;
153 for (Int_t i=0; i<n; i++) dest[i] = uniform;
156 //_______________________________________________________________________
157 AliESDtrack::AliESDtrack() :
158 AliExternalTrackParam(),
163 fFriendTrack(new AliESDfriendTrack()),
164 fTPCClusterMap(159),//number of padrows
165 fTPCSharedMap(159),//number of padrows
176 fEMCALindex(kEMCALNoMatch),
182 fCddTPC(0),fCdzTPC(0),fCzzTPC(0),
185 fCdd(0),fCdz(0),fCzz(0),
217 fVertexID(-2) // -2 means an orphan track
220 // The default ESD constructor
223 for (i=0; i<AliPID::kSPECIES; i++) {
233 for (i=0; i<3; i++) { fKinkIndexes[i]=0;}
234 for (i=0; i<3; i++) { fV0Indexes[i]=0;}
235 for (i=0;i<kTRDnPlanes;i++) {
238 for (i=0;i<4;i++) {fITSdEdxSamples[i]=0.;}
239 for (i=0;i<4;i++) {fTPCPoints[i]=0;}
240 for (i=0;i<3;i++) {fTOFLabel[i]=0;}
241 for (i=0;i<10;i++) {fTOFInfo[i]=0;}
242 for (i=0;i<12;i++) {fITSModule[i]=-1;}
245 //_______________________________________________________________________
246 AliESDtrack::AliESDtrack(const AliESDtrack& track):
247 AliExternalTrackParam(track),
253 fTPCClusterMap(track.fTPCClusterMap),
254 fTPCSharedMap(track.fTPCSharedMap),
255 fFlags(track.fFlags),
257 fLabel(track.fLabel),
258 fITSLabel(track.fITSLabel),
259 fTPCLabel(track.fTPCLabel),
260 fTRDLabel(track.fTRDLabel),
261 fTOFCalChannel(track.fTOFCalChannel),
262 fTOFindex(track.fTOFindex),
263 fHMPIDqn(track.fHMPIDqn),
264 fHMPIDcluIdx(track.fHMPIDcluIdx),
265 fEMCALindex(track.fEMCALindex),
266 fHMPIDtrkTheta(track.fHMPIDtrkTheta),
267 fHMPIDtrkPhi(track.fHMPIDtrkPhi),
268 fHMPIDsignal(track.fHMPIDsignal),
269 fTrackLength(track.fTrackLength),
270 fdTPC(track.fdTPC),fzTPC(track.fzTPC),
271 fCddTPC(track.fCddTPC),fCdzTPC(track.fCdzTPC),fCzzTPC(track.fCzzTPC),
272 fCchi2TPC(track.fCchi2TPC),
273 fD(track.fD),fZ(track.fZ),
274 fCdd(track.fCdd),fCdz(track.fCdz),fCzz(track.fCzz),
275 fCchi2(track.fCchi2),
276 fITSchi2(track.fITSchi2),
277 fTPCchi2(track.fTPCchi2),
278 fTRDchi2(track.fTRDchi2),
279 fTOFchi2(track.fTOFchi2),
280 fHMPIDchi2(track.fHMPIDchi2),
281 fGlobalChi2(track.fGlobalChi2),
282 fITSsignal(track.fITSsignal),
283 fTPCsignal(track.fTPCsignal),
284 fTPCsignalS(track.fTPCsignalS),
285 fTRDsignal(track.fTRDsignal),
286 fTRDQuality(track.fTRDQuality),
287 fTRDBudget(track.fTRDBudget),
288 fTOFsignal(track.fTOFsignal),
289 fTOFsignalToT(track.fTOFsignalToT),
290 fTOFsignalRaw(track.fTOFsignalRaw),
291 fTOFsignalDz(track.fTOFsignalDz),
292 fHMPIDtrkX(track.fHMPIDtrkX),
293 fHMPIDtrkY(track.fHMPIDtrkY),
294 fHMPIDmipX(track.fHMPIDmipX),
295 fHMPIDmipY(track.fHMPIDmipY),
296 fTPCncls(track.fTPCncls),
297 fTPCnclsF(track.fTPCnclsF),
298 fTPCsignalN(track.fTPCsignalN),
299 fITSncls(track.fITSncls),
300 fITSClusterMap(track.fITSClusterMap),
301 fTRDncls(track.fTRDncls),
302 fTRDncls0(track.fTRDncls0),
303 fTRDntracklets(track.fTRDntracklets),
304 fTRDnSlices(track.fTRDnSlices),
306 fVertexID(track.fVertexID)
311 for (Int_t i=0;i<AliPID::kSPECIES;i++) fTrackTime[i]=track.fTrackTime[i];
312 for (Int_t i=0;i<AliPID::kSPECIES;i++) fR[i]=track.fR[i];
314 for (Int_t i=0;i<AliPID::kSPECIES;i++) fITSr[i]=track.fITSr[i];
316 for (Int_t i=0;i<AliPID::kSPECIES;i++) fTPCr[i]=track.fTPCr[i];
317 for (Int_t i=0;i<4;i++) {fITSdEdxSamples[i]=track.fITSdEdxSamples[i];}
318 for (Int_t i=0;i<4;i++) {fTPCPoints[i]=track.fTPCPoints[i];}
319 for (Int_t i=0; i<3;i++) { fKinkIndexes[i]=track.fKinkIndexes[i];}
320 for (Int_t i=0; i<3;i++) { fV0Indexes[i]=track.fV0Indexes[i];}
322 for (Int_t i=0;i<kTRDnPlanes;i++) {
323 fTRDTimBin[i]=track.fTRDTimBin[i];
327 fTRDslices=new Double32_t[fTRDnSlices];
328 for (Int_t i=0; i<fTRDnSlices; i++) fTRDslices[i]=track.fTRDslices[i];
331 for (Int_t i=0;i<AliPID::kSPECIES;i++) fTRDr[i]=track.fTRDr[i];
332 for (Int_t i=0;i<AliPID::kSPECIES;i++) fTOFr[i]=track.fTOFr[i];
333 for (Int_t i=0;i<3;i++) fTOFLabel[i]=track.fTOFLabel[i];
334 for (Int_t i=0;i<10;i++) fTOFInfo[i]=track.fTOFInfo[i];
335 for (Int_t i=0;i<12;i++) fITSModule[i]=track.fITSModule[i];
336 for (Int_t i=0;i<AliPID::kSPECIES;i++) fHMPIDr[i]=track.fHMPIDr[i];
338 if (track.fCp) fCp=new AliExternalTrackParam(*track.fCp);
339 if (track.fIp) fIp=new AliExternalTrackParam(*track.fIp);
340 if (track.fTPCInner) fTPCInner=new AliExternalTrackParam(*track.fTPCInner);
341 if (track.fOp) fOp=new AliExternalTrackParam(*track.fOp);
343 if (track.fFriendTrack) fFriendTrack=new AliESDfriendTrack(*(track.fFriendTrack));
346 //_______________________________________________________________________
347 AliESDtrack::AliESDtrack(const AliVTrack *track) :
348 AliExternalTrackParam(track),
354 fTPCClusterMap(159),//number of padrows
355 fTPCSharedMap(159),//number of padrows
366 fEMCALindex(kEMCALNoMatch),
372 fCddTPC(0),fCdzTPC(0),fCzzTPC(0),
375 fCdd(0),fCdz(0),fCzz(0),
407 fVertexID(-2) // -2 means an orphan track
410 // ESD track from AliVTrack.
411 // This is not a copy constructor !
414 if (track->InheritsFrom("AliExternalTrackParam")) {
415 AliError("This is not a copy constructor. Use AliESDtrack(const AliESDtrack &) !");
416 AliWarning("Calling the default constructor...");
421 // Reset all the arrays
423 for (i=0; i<AliPID::kSPECIES; i++) {
433 for (i=0; i<3; i++) { fKinkIndexes[i]=0;}
434 for (i=0; i<3; i++) { fV0Indexes[i]=-1;}
435 for (i=0;i<kTRDnPlanes;i++) {
438 for (i=0;i<4;i++) {fITSdEdxSamples[i]=0.;}
439 for (i=0;i<4;i++) {fTPCPoints[i]=0;}
440 for (i=0;i<3;i++) {fTOFLabel[i]=0;}
441 for (i=0;i<10;i++) {fTOFInfo[i]=0;}
442 for (i=0;i<12;i++) {fITSModule[i]=-1;}
445 SetID(track->GetID());
447 // Set ITS cluster map
448 fITSClusterMap=track->GetITSClusterMap();
452 if(HasPointOnITSLayer(i)) fITSncls++;
455 // Set the combined PID
456 const Double_t *pid = track->PID();
458 for (i=0; i<AliPID::kSPECIES; i++) fR[i]=pid[i];
460 // AliESD track label
461 SetLabel(track->GetLabel());
463 SetStatus(track->GetStatus());
466 //_______________________________________________________________________
467 AliESDtrack::AliESDtrack(TParticle * part) :
468 AliExternalTrackParam(),
474 fTPCClusterMap(159),//number of padrows
475 fTPCSharedMap(159),//number of padrows
486 fEMCALindex(kEMCALNoMatch),
492 fCddTPC(0),fCdzTPC(0),fCzzTPC(0),
495 fCdd(0),fCdz(0),fCzz(0),
527 fVertexID(-2) // -2 means an orphan track
530 // ESD track from TParticle
533 // Reset all the arrays
535 for (i=0; i<AliPID::kSPECIES; i++) {
545 for (i=0; i<3; i++) { fKinkIndexes[i]=0;}
546 for (i=0; i<3; i++) { fV0Indexes[i]=-1;}
547 for (i=0;i<kTRDnPlanes;i++) {
550 for (i=0;i<4;i++) {fITSdEdxSamples[i]=0.;}
551 for (i=0;i<4;i++) {fTPCPoints[i]=0;}
552 for (i=0;i<3;i++) {fTOFLabel[i]=0;}
553 for (i=0;i<10;i++) {fTOFInfo[i]=0;}
554 for (i=0;i<12;i++) {fITSModule[i]=-1;}
556 // Calculate the AliExternalTrackParam content
563 // Calculate alpha: the rotation angle of the corresponding local system (TPC sector)
564 alpha = part->Phi()*180./TMath::Pi();
565 if (alpha<0) alpha+= 360.;
566 if (alpha>360) alpha -= 360.;
568 Int_t sector = (Int_t)(alpha/20.);
569 alpha = 10. + 20.*sector;
571 alpha *= TMath::Pi();
573 // Covariance matrix: no errors, the parameters are exact
574 for (i=0; i<15; i++) covar[i]=0.;
576 // Get the vertex of origin and the momentum
577 TVector3 ver(part->Vx(),part->Vy(),part->Vz());
578 TVector3 mom(part->Px(),part->Py(),part->Pz());
580 // Rotate to the local coordinate system (TPC sector)
584 // X of the referense plane
587 Int_t pdgCode = part->GetPdgCode();
590 TDatabasePDG::Instance()->GetParticle(pdgCode)->Charge();
594 param[2] = TMath::Sin(mom.Phi());
595 param[3] = mom.Pz()/mom.Pt();
596 param[4] = TMath::Sign(1/mom.Pt(),charge);
598 // Set AliExternalTrackParam
599 Set(xref, alpha, param, covar);
604 switch (TMath::Abs(pdgCode)) {
630 // If the particle is not e,mu,pi,K or p the PID probabilities are set to 0
631 if (indexPID < AliPID::kSPECIES) {
637 fHMPIDr[indexPID]=1.;
640 // AliESD track label
641 SetLabel(part->GetUniqueID());
645 //_______________________________________________________________________
646 AliESDtrack::~AliESDtrack(){
648 // This is destructor according Coding Conventrions
650 //printf("Delete track\n");
660 AliESDtrack &AliESDtrack::operator=(const AliESDtrack &source){
663 if(&source == this) return *this;
664 AliExternalTrackParam::operator=(source);
668 // we have the trackparam: assign or copy construct
669 if(fCp)*fCp = *source.fCp;
670 else fCp = new AliExternalTrackParam(*source.fCp);
673 // no track param delete the old one
679 // we have the trackparam: assign or copy construct
680 if(fIp)*fIp = *source.fIp;
681 else fIp = new AliExternalTrackParam(*source.fIp);
684 // no track param delete the old one
690 if(source.fTPCInner){
691 // we have the trackparam: assign or copy construct
692 if(fTPCInner) *fTPCInner = *source.fTPCInner;
693 else fTPCInner = new AliExternalTrackParam(*source.fTPCInner);
696 // no track param delete the old one
697 if(fTPCInner)delete fTPCInner;
703 // we have the trackparam: assign or copy construct
704 if(fOp) *fOp = *source.fOp;
705 else fOp = new AliExternalTrackParam(*source.fOp);
708 // no track param delete the old one
713 // copy also the friend track
714 // use copy constructor
715 if(source.fFriendTrack){
716 // we have the trackparam: assign or copy construct
717 delete fFriendTrack; fFriendTrack=new AliESDfriendTrack(*source.fFriendTrack);
720 // no track param delete the old one
721 delete fFriendTrack; fFriendTrack= 0;
724 fTPCClusterMap = source.fTPCClusterMap;
725 fTPCSharedMap = source.fTPCSharedMap;
727 fFlags = source.fFlags;
729 fLabel = source.fLabel;
730 fITSLabel = source.fITSLabel;
731 for(int i = 0; i< 12;++i){
732 fITSModule[i] = source.fITSModule[i];
734 fTPCLabel = source.fTPCLabel;
735 fTRDLabel = source.fTRDLabel;
736 for(int i = 0; i< 3;++i){
737 fTOFLabel[i] = source.fTOFLabel[i];
739 fTOFCalChannel = source.fTOFCalChannel;
740 fTOFindex = source.fTOFindex;
741 fHMPIDqn = source.fHMPIDqn;
742 fHMPIDcluIdx = source.fHMPIDcluIdx;
743 fEMCALindex = source.fEMCALindex;
745 for(int i = 0; i< 3;++i){
746 fKinkIndexes[i] = source.fKinkIndexes[i];
747 fV0Indexes[i] = source.fV0Indexes[i];
750 for(int i = 0; i< AliPID::kSPECIES;++i){
751 fR[i] = source.fR[i];
752 fITSr[i] = source.fITSr[i];
753 fTPCr[i] = source.fTPCr[i];
754 fTRDr[i] = source.fTRDr[i];
755 fTOFr[i] = source.fTOFr[i];
756 fHMPIDr[i] = source.fHMPIDr[i];
757 fTrackTime[i] = source.fTrackTime[i];
760 fHMPIDtrkTheta = source.fHMPIDtrkTheta;
761 fHMPIDtrkPhi = source.fHMPIDtrkPhi;
762 fHMPIDsignal = source.fHMPIDsignal;
765 fTrackLength = source. fTrackLength;
766 fdTPC = source.fdTPC;
767 fzTPC = source.fzTPC;
768 fCddTPC = source.fCddTPC;
769 fCdzTPC = source.fCdzTPC;
770 fCzzTPC = source.fCzzTPC;
771 fCchi2TPC = source.fCchi2TPC;
778 fCchi2 = source.fCchi2;
780 fITSchi2 = source.fITSchi2;
781 fTPCchi2 = source.fTPCchi2;
782 fTRDchi2 = source.fTRDchi2;
783 fTOFchi2 = source.fTOFchi2;
784 fHMPIDchi2 = source.fHMPIDchi2;
786 fGlobalChi2 = source.fGlobalChi2;
788 fITSsignal = source.fITSsignal;
789 for (Int_t i=0;i<4;i++) {fITSdEdxSamples[i]=source.fITSdEdxSamples[i];}
790 fTPCsignal = source.fTPCsignal;
791 fTPCsignalS = source.fTPCsignalS;
792 for(int i = 0; i< 4;++i){
793 fTPCPoints[i] = source.fTPCPoints[i];
795 fTRDsignal = source.fTRDsignal;
797 for(int i = 0;i < kTRDnPlanes;++i){
798 fTRDTimBin[i] = source.fTRDTimBin[i];
804 fTRDnSlices=source.fTRDnSlices;
806 fTRDslices=new Double32_t[fTRDnSlices];
807 for(int j = 0;j < fTRDnSlices;++j) fTRDslices[j] = source.fTRDslices[j];
810 fTRDQuality = source.fTRDQuality;
811 fTRDBudget = source.fTRDBudget;
812 fTOFsignal = source.fTOFsignal;
813 fTOFsignalToT = source.fTOFsignalToT;
814 fTOFsignalRaw = source.fTOFsignalRaw;
815 fTOFsignalDz = source.fTOFsignalDz;
817 for(int i = 0;i<10;++i){
818 fTOFInfo[i] = source.fTOFInfo[i];
821 fHMPIDtrkX = source.fHMPIDtrkX;
822 fHMPIDtrkY = source.fHMPIDtrkY;
823 fHMPIDmipX = source.fHMPIDmipX;
824 fHMPIDmipY = source.fHMPIDmipY;
826 fTPCncls = source.fTPCncls;
827 fTPCnclsF = source.fTPCnclsF;
828 fTPCsignalN = source.fTPCsignalN;
830 fITSncls = source.fITSncls;
831 fITSClusterMap = source.fITSClusterMap;
832 fTRDncls = source.fTRDncls;
833 fTRDncls0 = source.fTRDncls0;
834 fTRDntracklets = source.fTRDntracklets;
835 fVertexID = source.fVertexID;
841 void AliESDtrack::Copy(TObject &obj) const {
843 // this overwrites the virtual TOBject::Copy()
844 // to allow run time copying without casting
847 if(this==&obj)return;
848 AliESDtrack *robj = dynamic_cast<AliESDtrack*>(&obj);
849 if(!robj)return; // not an AliESDtrack
856 void AliESDtrack::AddCalibObject(TObject * object){
858 // add calib object to the list
860 if (!fFriendTrack) fFriendTrack = new AliESDfriendTrack;
861 fFriendTrack->AddCalibObject(object);
864 TObject * AliESDtrack::GetCalibObject(Int_t index){
866 // return calib objct at given position
868 if (!fFriendTrack) return 0;
869 return fFriendTrack->GetCalibObject(index);
873 Bool_t AliESDtrack::FillTPCOnlyTrack(AliESDtrack &track){
875 // Fills the information of the TPC-only first reconstruction pass
876 // into the passed ESDtrack object. For consistency fTPCInner is also filled
881 // For data produced before r26675
882 // RelateToVertexTPC was not properly called during reco
883 // so you'll have to call it again, before FillTPCOnlyTrack
884 // Float_t p[2],cov[3];
885 // track->GetImpactParametersTPC(p,cov);
886 // if(p[0]==0&&p[1]==0) // <- Default values
887 // track->RelateToVertexTPC(esd->GetPrimaryVertexTPC(),esd->GetMagneticField(),kVeryBig);
890 if(!fTPCInner)return kFALSE;
892 // fill the TPC track params to the global track parameters
893 track.Set(fTPCInner->GetX(),fTPCInner->GetAlpha(),fTPCInner->GetParameter(),fTPCInner->GetCovariance());
896 track.fCdd = fCddTPC;
897 track.fCdz = fCdzTPC;
898 track.fCzz = fCzzTPC;
900 // copy the TPCinner parameters
901 if(track.fTPCInner) *track.fTPCInner = *fTPCInner;
902 else track.fTPCInner = new AliExternalTrackParam(*fTPCInner);
905 track.fCddTPC = fCddTPC;
906 track.fCdzTPC = fCdzTPC;
907 track.fCzzTPC = fCzzTPC;
908 track.fCchi2TPC = fCchi2TPC;
911 // copy all other TPC specific parameters
913 // replace label by TPC label
914 track.fLabel = fTPCLabel;
915 track.fTPCLabel = fTPCLabel;
917 track.fTPCchi2 = fTPCchi2;
918 track.fTPCsignal = fTPCsignal;
919 track.fTPCsignalS = fTPCsignalS;
920 for(int i = 0;i<4;++i)track.fTPCPoints[i] = fTPCPoints[i];
922 track.fTPCncls = fTPCncls;
923 track.fTPCnclsF = fTPCnclsF;
924 track.fTPCsignalN = fTPCsignalN;
927 for(int i=0;i<AliPID::kSPECIES;++i){
928 track.fTPCr[i] = fTPCr[i];
929 // combined PID is TPC only!
930 track.fR[i] = fTPCr[i];
932 track.fTPCClusterMap = fTPCClusterMap;
933 track.fTPCSharedMap = fTPCSharedMap;
937 track.fFlags = kTPCin;
940 track.fFlags |= fFlags & kTPCpid; //copy the TPCpid status flag
942 for (Int_t i=0;i<3;i++) track.fKinkIndexes[i] = fKinkIndexes[i];
948 //_______________________________________________________________________
949 void AliESDtrack::MakeMiniESDtrack(){
950 // Resets everything except
951 // fFlags: Reconstruction status flags
952 // fLabel: Track label
953 // fID: Unique ID of the track
954 // Impact parameter information
955 // fR[AliPID::kSPECIES]: combined "detector response probability"
956 // Running track parameters in the base class (AliExternalTrackParam)
960 for (Int_t i=0;i<AliPID::kSPECIES;i++) fTrackTime[i] = 0;
962 // Reset track parameters constrained to the primary vertex
965 // Reset track parameters at the inner wall of TPC
967 delete fTPCInner;fTPCInner=0;
968 // Reset track parameters at the inner wall of the TRD
972 // Reset ITS track related information
977 for (Int_t i=0;i<4;i++) fITSdEdxSamples[i] = 0.;
978 for (Int_t i=0;i<AliPID::kSPECIES;i++) fITSr[i]=0;
981 // Reset TPC related track information
990 for (Int_t i=0;i<AliPID::kSPECIES;i++) fTPCr[i]=0;
992 for (Int_t i=0;i<4;i++) fTPCPoints[i] = 0;
993 for (Int_t i=0; i<3;i++) fKinkIndexes[i] = 0;
994 for (Int_t i=0; i<3;i++) fV0Indexes[i] = 0;
996 // Reset TRD related track information
1001 for (Int_t i=0;i<kTRDnPlanes;i++) {
1004 for (Int_t i=0;i<AliPID::kSPECIES;i++) fTRDr[i] = 0;
1009 delete[] fTRDslices;
1014 // Reset TOF related track information
1022 for (Int_t i=0;i<AliPID::kSPECIES;i++) fTOFr[i] = 0;
1023 for (Int_t i=0;i<3;i++) fTOFLabel[i] = 0;
1024 for (Int_t i=0;i<10;i++) fTOFInfo[i] = 0;
1026 // Reset HMPID related track information
1031 for (Int_t i=0;i<AliPID::kSPECIES;i++) fHMPIDr[i] = 0;
1038 fEMCALindex = kEMCALNoMatch;
1040 // reset global track chi2
1043 fVertexID = -2; // an orphan track
1045 delete fFriendTrack; fFriendTrack = 0;
1047 //_______________________________________________________________________
1048 Double_t AliESDtrack::GetMass() const {
1049 // Returns the mass of the most probable particle type
1052 for (Int_t i=0; i<AliPID::kSPECIES; i++) {
1053 if (fR[i]>max) {k=i; max=fR[i];}
1055 if (k==0) { // dE/dx "crossing points" in the TPC
1057 if ((p>0.38)&&(p<0.48))
1058 if (fR[0]<fR[3]*10.) return AliPID::ParticleMass(AliPID::kKaon);
1059 if ((p>0.75)&&(p<0.85))
1060 if (fR[0]<fR[4]*10.) return AliPID::ParticleMass(AliPID::kProton);
1063 if (k==1) return AliPID::ParticleMass(AliPID::kMuon);
1064 if (k==2||k==-1) return AliPID::ParticleMass(AliPID::kPion);
1065 if (k==3) return AliPID::ParticleMass(AliPID::kKaon);
1066 if (k==4) return AliPID::ParticleMass(AliPID::kProton);
1067 AliWarning("Undefined mass !");
1068 return AliPID::ParticleMass(AliPID::kPion);
1071 //______________________________________________________________________________
1072 Double_t AliESDtrack::E() const
1074 // Returns the energy of the particle given its assumed mass.
1075 // Assumes the pion mass if the particle can't be identified properly.
1079 return TMath::Sqrt(p*p + m*m);
1082 //______________________________________________________________________________
1083 Double_t AliESDtrack::Y() const
1085 // Returns the rapidity of a particle given its assumed mass.
1086 // Assumes the pion mass if the particle can't be identified properly.
1090 if (e != TMath::Abs(pz)) { // energy was not equal to pz
1091 return 0.5*TMath::Log((e+pz)/(e-pz));
1092 } else { // energy was equal to pz
1097 //_______________________________________________________________________
1098 Bool_t AliESDtrack::UpdateTrackParams(const AliKalmanTrack *t, ULong_t flags){
1100 // This function updates track's running parameters
1106 fLabel=t->GetLabel();
1108 if (t->IsStartedTimeIntegral()) {
1110 Double_t times[10];t->GetIntegratedTimes(times); SetIntegratedTimes(times);
1111 SetIntegratedLength(t->GetIntegratedLength());
1114 Set(t->GetX(),t->GetAlpha(),t->GetParameter(),t->GetCovariance());
1115 if (flags==kITSout) fFriendTrack->SetITSOut(*t);
1116 if (flags==kTPCout) fFriendTrack->SetTPCOut(*t);
1117 if (flags==kTRDrefit) fFriendTrack->SetTRDIn(*t);
1121 case kITSin: case kITSout: case kITSrefit:
1123 fITSncls=t->GetNumberOfClusters();
1124 index=fFriendTrack->GetITSindices();
1125 for (Int_t i=0;i<AliESDfriendTrack::kMaxITScluster;i++) {
1126 index[i]=t->GetClusterIndex(i);
1128 Int_t l=(index[i] & 0xf0000000) >> 28;
1129 SETBIT(fITSClusterMap,l);
1132 fITSchi2=t->GetChi2();
1133 fITSsignal=t->GetPIDsignal();
1134 fITSLabel = t->GetLabel();
1135 // keep in fOp the parameters outside ITS for ITS stand-alone tracks
1136 if (flags==kITSout) {
1137 if (!fOp) fOp=new AliExternalTrackParam(*t);
1139 fOp->Set(t->GetX(),t->GetAlpha(),t->GetParameter(),t->GetCovariance());
1143 case kTPCin: case kTPCrefit:
1144 fTPCLabel = t->GetLabel();
1145 if (flags==kTPCin) fTPCInner=new AliExternalTrackParam(*t);
1146 if (!fIp) fIp=new AliExternalTrackParam(*t);
1148 fIp->Set(t->GetX(),t->GetAlpha(),t->GetParameter(),t->GetCovariance());
1150 index=fFriendTrack->GetTPCindices();
1151 if (flags & kTPCout){
1152 if (!fOp) fOp=new AliExternalTrackParam(*t);
1154 fOp->Set(t->GetX(),t->GetAlpha(),t->GetParameter(),t->GetCovariance());
1156 fTPCncls=t->GetNumberOfClusters();
1157 fTPCchi2=t->GetChi2();
1159 {//prevrow must be declared in separate namespace, otherwise compiler cries:
1160 //"jump to case label crosses initialization of `Int_t prevrow'"
1162 // for (Int_t i=0;i<fTPCncls;i++)
1163 for (Int_t i=0;i<AliESDfriendTrack::kMaxTPCcluster;i++)
1165 index[i]=t->GetClusterIndex(i);
1166 Int_t idx = index[i];
1168 if (idx<0) continue;
1170 // Piotr's Cluster Map for HBT
1171 // ### please change accordingly if cluster array is changing
1172 // to "New TPC Tracking" style (with gaps in array)
1173 Int_t sect = (idx&0xff000000)>>24;
1174 Int_t row = (idx&0x00ff0000)>>16;
1175 if (sect > 18) row +=63; //if it is outer sector, add number of inner sectors
1177 fTPCClusterMap.SetBitNumber(row,kTRUE);
1179 //Fill the gap between previous row and this row with 0 bits
1180 //In case ### pleas change it as well - just set bit 0 in case there
1181 //is no associated clusters for current "i"
1184 prevrow = row;//if previous bit was not assigned yet == this is the first one
1187 { //we don't know the order (inner to outer or reverse)
1188 //just to be save in case it is going to change
1201 for (Int_t j = n+1; j < m; j++)
1203 fTPCClusterMap.SetBitNumber(j,kFALSE);
1207 // End Of Piotr's Cluster Map for HBT
1210 fTPCsignal=t->GetPIDsignal();
1213 case kTRDin: case kTRDrefit:
1216 index = fFriendTrack->GetTRDindices();
1217 fTRDLabel = t->GetLabel();
1218 fTRDchi2 = t->GetChi2();
1219 fTRDncls = t->GetNumberOfClusters();
1220 for (Int_t i=0;i<6;i++) index[i]=t->GetTrackletIndex(i);
1222 fTRDsignal=t->GetPIDsignal();
1225 if (!fOp) fOp=new AliExternalTrackParam(*t);
1227 fOp->Set(t->GetX(),t->GetAlpha(),t->GetParameter(),t->GetCovariance());
1228 fTRDncls0 = t->GetNumberOfClusters();
1237 AliError("Wrong flag !");
1244 //_______________________________________________________________________
1245 void AliESDtrack::GetExternalParameters(Double_t &x, Double_t p[5]) const {
1246 //---------------------------------------------------------------------
1247 // This function returns external representation of the track parameters
1248 //---------------------------------------------------------------------
1250 for (Int_t i=0; i<5; i++) p[i]=GetParameter()[i];
1253 //_______________________________________________________________________
1254 void AliESDtrack::GetExternalCovariance(Double_t cov[15]) const {
1255 //---------------------------------------------------------------------
1256 // This function returns external representation of the cov. matrix
1257 //---------------------------------------------------------------------
1258 for (Int_t i=0; i<15; i++) cov[i]=AliExternalTrackParam::GetCovariance()[i];
1261 //_______________________________________________________________________
1262 Bool_t AliESDtrack::GetConstrainedExternalParameters
1263 (Double_t &alpha, Double_t &x, Double_t p[5]) const {
1264 //---------------------------------------------------------------------
1265 // This function returns the constrained external track parameters
1266 //---------------------------------------------------------------------
1267 if (!fCp) return kFALSE;
1268 alpha=fCp->GetAlpha();
1270 for (Int_t i=0; i<5; i++) p[i]=fCp->GetParameter()[i];
1274 //_______________________________________________________________________
1276 AliESDtrack::GetConstrainedExternalCovariance(Double_t c[15]) const {
1277 //---------------------------------------------------------------------
1278 // This function returns the constrained external cov. matrix
1279 //---------------------------------------------------------------------
1280 if (!fCp) return kFALSE;
1281 for (Int_t i=0; i<15; i++) c[i]=fCp->GetCovariance()[i];
1286 AliESDtrack::GetInnerExternalParameters
1287 (Double_t &alpha, Double_t &x, Double_t p[5]) const {
1288 //---------------------------------------------------------------------
1289 // This function returns external representation of the track parameters
1290 // at the inner layer of TPC
1291 //---------------------------------------------------------------------
1292 if (!fIp) return kFALSE;
1293 alpha=fIp->GetAlpha();
1295 for (Int_t i=0; i<5; i++) p[i]=fIp->GetParameter()[i];
1300 AliESDtrack::GetInnerExternalCovariance(Double_t cov[15]) const {
1301 //---------------------------------------------------------------------
1302 // This function returns external representation of the cov. matrix
1303 // at the inner layer of TPC
1304 //---------------------------------------------------------------------
1305 if (!fIp) return kFALSE;
1306 for (Int_t i=0; i<15; i++) cov[i]=fIp->GetCovariance()[i];
1311 AliESDtrack::SetOuterParam(const AliExternalTrackParam *p, ULong_t flags) {
1313 // This is a direct setter for the outer track parameters
1316 if (fOp) delete fOp;
1317 fOp=new AliExternalTrackParam(*p);
1321 AliESDtrack::GetOuterExternalParameters
1322 (Double_t &alpha, Double_t &x, Double_t p[5]) const {
1323 //---------------------------------------------------------------------
1324 // This function returns external representation of the track parameters
1325 // at the inner layer of TRD
1326 //---------------------------------------------------------------------
1327 if (!fOp) return kFALSE;
1328 alpha=fOp->GetAlpha();
1330 for (Int_t i=0; i<5; i++) p[i]=fOp->GetParameter()[i];
1335 AliESDtrack::GetOuterExternalCovariance(Double_t cov[15]) const {
1336 //---------------------------------------------------------------------
1337 // This function returns external representation of the cov. matrix
1338 // at the inner layer of TRD
1339 //---------------------------------------------------------------------
1340 if (!fOp) return kFALSE;
1341 for (Int_t i=0; i<15; i++) cov[i]=fOp->GetCovariance()[i];
1345 Int_t AliESDtrack::GetNcls(Int_t idet) const
1347 // Get number of clusters by subdetector index
1361 if (fTOFindex != -1)
1367 if ((fHMPIDcluIdx >= 0) && (fHMPIDcluIdx < 7000000)) {
1368 if ((fHMPIDcluIdx%1000000 != 9999) && (fHMPIDcluIdx%1000000 != 99999)) {
1379 Int_t AliESDtrack::GetClusters(Int_t idet, Int_t *idx) const
1381 // Get cluster index array by subdetector index
1386 ncls = GetITSclusters(idx);
1389 ncls = GetTPCclusters(idx);
1392 ncls = GetTRDclusters(idx);
1395 if (fTOFindex != -1) {
1403 if ((fHMPIDcluIdx >= 0) && (fHMPIDcluIdx < 7000000)) {
1404 if ((fHMPIDcluIdx%1000000 != 9999) && (fHMPIDcluIdx%1000000 != 99999)) {
1405 idx[0] = GetHMPIDcluIdx();
1418 //_______________________________________________________________________
1419 void AliESDtrack::GetIntegratedTimes(Double_t *times) const {
1420 // Returns the array with integrated times for each particle hypothesis
1421 for (Int_t i=0; i<AliPID::kSPECIES; i++) times[i]=fTrackTime[i];
1424 //_______________________________________________________________________
1425 void AliESDtrack::SetIntegratedTimes(const Double_t *times) {
1426 // Sets the array with integrated times for each particle hypotesis
1427 for (Int_t i=0; i<AliPID::kSPECIES; i++) fTrackTime[i]=times[i];
1430 //_______________________________________________________________________
1431 void AliESDtrack::SetITSpid(const Double_t *p) {
1432 // Sets values for the probability of each particle type (in ITS)
1433 SetPIDValues(fITSr,p,AliPID::kSPECIES);
1434 SetStatus(AliESDtrack::kITSpid);
1437 //_______________________________________________________________________
1438 void AliESDtrack::GetITSpid(Double_t *p) const {
1439 // Gets the probability of each particle type (in ITS)
1440 for (Int_t i=0; i<AliPID::kSPECIES; i++) p[i]=fITSr[i];
1443 //_______________________________________________________________________
1444 Char_t AliESDtrack::GetITSclusters(Int_t *idx) const {
1445 //---------------------------------------------------------------------
1446 // This function returns indices of the assgined ITS clusters
1447 //---------------------------------------------------------------------
1449 Int_t *index=fFriendTrack->GetITSindices();
1450 for (Int_t i=0; i<AliESDfriendTrack::kMaxITScluster; i++) {
1451 if ( (i>=fITSncls) && (i<6) ) idx[i]=-1;
1452 else idx[i]=index[i];
1458 //_______________________________________________________________________
1459 Bool_t AliESDtrack::GetITSModuleIndexInfo(Int_t ilayer,Int_t &idet,Int_t &status,
1460 Float_t &xloc,Float_t &zloc) const {
1461 //----------------------------------------------------------------------
1462 // This function encodes in the module number also the status of cluster association
1463 // "status" can have the following values:
1464 // 1 "found" (cluster is associated),
1465 // 2 "dead" (module is dead from OCDB),
1466 // 3 "skipped" (module or layer forced to be skipped),
1467 // 4 "outinz" (track out of z acceptance),
1468 // 5 "nocls" (no clusters in the road),
1469 // 6 "norefit" (cluster rejected during refit),
1470 // 7 "deadzspd" (holes in z in SPD)
1471 // Also given are the coordinates of the crossing point of track and module
1472 // (in the local module ref. system)
1473 // WARNING: THIS METHOD HAS TO BE SYNCHRONIZED WITH AliITStrackV2::GetModuleIndexInfo()!
1474 //----------------------------------------------------------------------
1476 if(fITSModule[ilayer]==-1) {
1479 xloc=-99.; zloc=-99.;
1483 Int_t module = fITSModule[ilayer];
1485 idet = Int_t(module/1000000);
1487 module -= idet*1000000;
1489 status = Int_t(module/100000);
1491 module -= status*100000;
1493 Int_t signs = Int_t(module/10000);
1495 module-=signs*10000;
1497 Int_t xInt = Int_t(module/100);
1500 Int_t zInt = module;
1502 if(signs==1) { xInt*=1; zInt*=1; }
1503 if(signs==2) { xInt*=1; zInt*=-1; }
1504 if(signs==3) { xInt*=-1; zInt*=1; }
1505 if(signs==4) { xInt*=-1; zInt*=-1; }
1507 xloc = 0.1*(Float_t)xInt;
1508 zloc = 0.1*(Float_t)zInt;
1510 if(status==4) idet = -1;
1515 //_______________________________________________________________________
1516 UShort_t AliESDtrack::GetTPCclusters(Int_t *idx) const {
1517 //---------------------------------------------------------------------
1518 // This function returns indices of the assgined ITS clusters
1519 //---------------------------------------------------------------------
1521 Int_t *index=fFriendTrack->GetTPCindices();
1522 for (Int_t i=0; i<AliESDfriendTrack::kMaxTPCcluster; i++) idx[i]=index[i];
1527 Double_t AliESDtrack::GetTPCdensity(Int_t row0, Int_t row1) const{
1529 // GetDensity of the clusters on given region between row0 and row1
1530 // Dead zone effect takin into acoount
1535 Int_t *index=fFriendTrack->GetTPCindices();
1536 for (Int_t i=row0;i<=row1;i++){
1537 Int_t idx = index[i];
1538 if (idx!=-1) good++; // track outside of dead zone
1541 Float_t density=0.5;
1542 if (good>(row1-row0)*0.5) density = Float_t(found)/Float_t(good);
1546 //_______________________________________________________________________
1547 void AliESDtrack::SetTPCpid(const Double_t *p) {
1548 // Sets values for the probability of each particle type (in TPC)
1549 SetPIDValues(fTPCr,p,AliPID::kSPECIES);
1550 SetStatus(AliESDtrack::kTPCpid);
1553 //_______________________________________________________________________
1554 void AliESDtrack::GetTPCpid(Double_t *p) const {
1555 // Gets the probability of each particle type (in TPC)
1556 for (Int_t i=0; i<AliPID::kSPECIES; i++) p[i]=fTPCr[i];
1559 //_______________________________________________________________________
1560 UChar_t AliESDtrack::GetTRDclusters(Int_t *idx) const {
1561 //---------------------------------------------------------------------
1562 // This function returns indices of the assgined TRD clusters
1563 //---------------------------------------------------------------------
1565 Int_t *index=fFriendTrack->GetTRDindices();
1566 for (Int_t i=0; i<AliESDfriendTrack::kMaxTRDcluster; i++) idx[i]=index[i];
1571 //_______________________________________________________________________
1572 UChar_t AliESDtrack::GetTRDtracklets(Int_t *idx) const {
1573 //---------------------------------------------------------------------
1574 // This function returns indices of the assigned TRD tracklets
1575 //---------------------------------------------------------------------
1577 Int_t *index=fFriendTrack->GetTRDindices();
1578 for (Int_t i=0; i<6/*AliESDfriendTrack::kMaxTRDcluster*/; i++) idx[i]=index[i];
1583 //_______________________________________________________________________
1584 void AliESDtrack::SetTRDpid(const Double_t *p) {
1585 // Sets values for the probability of each particle type (in TRD)
1586 SetPIDValues(fTRDr,p,AliPID::kSPECIES);
1587 SetStatus(AliESDtrack::kTRDpid);
1590 //_______________________________________________________________________
1591 void AliESDtrack::GetTRDpid(Double_t *p) const {
1592 // Gets the probability of each particle type (in TRD)
1593 for (Int_t i=0; i<AliPID::kSPECIES; i++) p[i]=fTRDr[i];
1596 //_______________________________________________________________________
1597 void AliESDtrack::SetTRDpid(Int_t iSpecies, Float_t p)
1599 // Sets the probability of particle type iSpecies to p (in TRD)
1600 fTRDr[iSpecies] = p;
1603 Double_t AliESDtrack::GetTRDpid(Int_t iSpecies) const
1605 // Returns the probability of particle type iSpecies (in TRD)
1606 return fTRDr[iSpecies];
1609 //____________________________________________________
1610 Int_t AliESDtrack::GetNumberOfTRDslices() const
1612 // built in backward compatibility
1613 Int_t idx = fTRDnSlices - (kTRDnPlanes<<1);
1614 return idx<18 ? fTRDnSlices/kTRDnPlanes : idx/kTRDnPlanes;
1617 //____________________________________________________
1618 Double_t AliESDtrack::GetTRDmomentum(Int_t plane, Double_t *sp) const
1620 //Returns momentum estimation and optional its error (sp)
1621 // in TRD layer "plane".
1624 AliError("No TRD info allocated for this track !");
1627 if ((plane<0) || (plane>=kTRDnPlanes)) {
1628 AliError("Info for TRD plane not available!");
1632 Int_t idx = fTRDnSlices-(kTRDnPlanes<<1)+plane;
1633 // Protection for backward compatibility
1634 if(idx<(GetNumberOfTRDslices()*kTRDnPlanes)) return -1.;
1636 if(sp) (*sp) = fTRDslices[idx+kTRDnPlanes];
1637 return fTRDslices[idx];
1640 //____________________________________________________
1641 Double_t AliESDtrack::GetTRDslice(Int_t plane, Int_t slice) const {
1642 //Gets the charge from the slice of the plane
1645 //AliError("No TRD slices allocated for this track !");
1648 if ((plane<0) || (plane>=kTRDnPlanes)) {
1649 AliError("Info for TRD plane not available !");
1652 Int_t ns=GetNumberOfTRDslices();
1653 if ((slice<-1) || (slice>=ns)) {
1654 //AliError("Wrong TRD slice !");
1658 if(slice>=0) return fTRDslices[plane*ns + slice];
1660 // return average of the dEdx measurements
1661 Double_t q=0.; Double32_t *s = &fTRDslices[plane*ns];
1662 for (Int_t i=0; i<ns; i++, s++) if((*s)>0.) q+=(*s);
1666 //____________________________________________________
1667 void AliESDtrack::SetNumberOfTRDslices(Int_t n) {
1668 //Sets the number of slices used for PID
1669 if (fTRDnSlices) return;
1672 fTRDslices=new Double32_t[fTRDnSlices];
1674 // set-up correctly the allocated memory
1675 memset(fTRDslices, 0, n*sizeof(Double32_t));
1676 for (Int_t i=GetNumberOfTRDslices(); i--;) fTRDslices[i]=-1.;
1679 //____________________________________________________
1680 void AliESDtrack::SetTRDslice(Double_t q, Int_t plane, Int_t slice) {
1681 //Sets the charge q in the slice of the plane
1683 AliError("No TRD slices allocated for this track !");
1686 if ((plane<0) || (plane>=kTRDnPlanes)) {
1687 AliError("Info for TRD plane not allocated !");
1690 Int_t ns=GetNumberOfTRDslices();
1691 if ((slice<0) || (slice>=ns)) {
1692 AliError("Wrong TRD slice !");
1695 Int_t n=plane*ns + slice;
1700 //____________________________________________________
1701 void AliESDtrack::SetTRDmomentum(Double_t p, Int_t plane, Double_t *sp)
1704 AliError("No TRD slices allocated for this track !");
1707 if ((plane<0) || (plane>=kTRDnPlanes)) {
1708 AliError("Info for TRD plane not allocated !");
1712 Int_t idx = fTRDnSlices-(kTRDnPlanes<<1)+plane;
1713 // Protection for backward compatibility
1714 if(idx<GetNumberOfTRDslices()*kTRDnPlanes) return;
1716 if(sp) fTRDslices[idx+kTRDnPlanes] = (*sp);
1717 fTRDslices[idx] = p;
1721 //_______________________________________________________________________
1722 void AliESDtrack::SetTOFpid(const Double_t *p) {
1723 // Sets the probability of each particle type (in TOF)
1724 SetPIDValues(fTOFr,p,AliPID::kSPECIES);
1725 SetStatus(AliESDtrack::kTOFpid);
1728 //_______________________________________________________________________
1729 void AliESDtrack::SetTOFLabel(const Int_t *p) {
1731 for (Int_t i=0; i<3; i++) fTOFLabel[i]=p[i];
1734 //_______________________________________________________________________
1735 void AliESDtrack::GetTOFpid(Double_t *p) const {
1736 // Gets probabilities of each particle type (in TOF)
1737 for (Int_t i=0; i<AliPID::kSPECIES; i++) p[i]=fTOFr[i];
1740 //_______________________________________________________________________
1741 void AliESDtrack::GetTOFLabel(Int_t *p) const {
1743 for (Int_t i=0; i<3; i++) p[i]=fTOFLabel[i];
1746 //_______________________________________________________________________
1747 void AliESDtrack::GetTOFInfo(Float_t *info) const {
1749 for (Int_t i=0; i<10; i++) info[i]=fTOFInfo[i];
1752 //_______________________________________________________________________
1753 void AliESDtrack::SetTOFInfo(Float_t*info) {
1755 for (Int_t i=0; i<10; i++) fTOFInfo[i]=info[i];
1760 //_______________________________________________________________________
1761 void AliESDtrack::SetHMPIDpid(const Double_t *p) {
1762 // Sets the probability of each particle type (in HMPID)
1763 SetPIDValues(fHMPIDr,p,AliPID::kSPECIES);
1764 SetStatus(AliESDtrack::kHMPIDpid);
1767 //_______________________________________________________________________
1768 void AliESDtrack::GetHMPIDpid(Double_t *p) const {
1769 // Gets probabilities of each particle type (in HMPID)
1770 for (Int_t i=0; i<AliPID::kSPECIES; i++) p[i]=fHMPIDr[i];
1775 //_______________________________________________________________________
1776 void AliESDtrack::SetESDpid(const Double_t *p) {
1777 // Sets the probability of each particle type for the ESD track
1778 SetPIDValues(fR,p,AliPID::kSPECIES);
1779 SetStatus(AliESDtrack::kESDpid);
1782 //_______________________________________________________________________
1783 void AliESDtrack::GetESDpid(Double_t *p) const {
1784 // Gets probability of each particle type for the ESD track
1785 for (Int_t i=0; i<AliPID::kSPECIES; i++) p[i]=fR[i];
1788 //_______________________________________________________________________
1789 Bool_t AliESDtrack::RelateToVertexTPC(const AliESDVertex *vtx,
1790 Double_t b, Double_t maxd, AliExternalTrackParam *cParam) {
1792 // Try to relate the TPC-only track parameters to the vertex "vtx",
1793 // if the (rough) transverse impact parameter is not bigger then "maxd".
1794 // Magnetic field is "b" (kG).
1796 // a) The TPC-only paramters are extapolated to the DCA to the vertex.
1797 // b) The impact parameters and their covariance matrix are calculated.
1798 // c) An attempt to constrain the TPC-only params to the vertex is done.
1799 // The constrained params are returned via "cParam".
1801 // In the case of success, the returned value is kTRUE
1802 // otherwise, it's kFALSE)
1805 if (!fTPCInner) return kFALSE;
1806 if (!vtx) return kFALSE;
1808 Double_t dz[2],cov[3];
1809 if (!fTPCInner->PropagateToDCA(vtx, b, maxd, dz, cov)) return kFALSE;
1817 Double_t covar[6]; vtx->GetCovMatrix(covar);
1818 Double_t p[2]={GetParameter()[0]-dz[0],GetParameter()[1]-dz[1]};
1819 Double_t c[3]={covar[2],0.,covar[5]};
1821 Double_t chi2=GetPredictedChi2(p,c);
1822 if (chi2>kVeryBig) return kFALSE;
1826 if (!cParam) return kTRUE;
1828 *cParam = *fTPCInner;
1829 if (!cParam->Update(p,c)) return kFALSE;
1834 //_______________________________________________________________________
1835 Bool_t AliESDtrack::RelateToVertex(const AliESDVertex *vtx,
1836 Double_t b, Double_t maxd, AliExternalTrackParam *cParam) {
1838 // Try to relate this track to the vertex "vtx",
1839 // if the (rough) transverse impact parameter is not bigger then "maxd".
1840 // Magnetic field is "b" (kG).
1842 // a) The track gets extapolated to the DCA to the vertex.
1843 // b) The impact parameters and their covariance matrix are calculated.
1844 // c) An attempt to constrain this track to the vertex is done.
1845 // The constrained params are returned via "cParam".
1847 // In the case of success, the returned value is kTRUE
1848 // (otherwise, it's kFALSE)
1851 if (!vtx) return kFALSE;
1853 Double_t dz[2],cov[3];
1854 if (!PropagateToDCA(vtx, b, maxd, dz, cov)) return kFALSE;
1862 Double_t covar[6]; vtx->GetCovMatrix(covar);
1863 Double_t p[2]={GetParameter()[0]-dz[0],GetParameter()[1]-dz[1]};
1864 Double_t c[3]={covar[2],0.,covar[5]};
1866 Double_t chi2=GetPredictedChi2(p,c);
1867 if (chi2>kVeryBig) return kFALSE;
1872 //--- Could now these lines be removed ? ---
1874 fCp=new AliExternalTrackParam(*this);
1876 if (!fCp->Update(p,c)) {delete fCp; fCp=0; return kFALSE;}
1877 //----------------------------------------
1879 fVertexID = vtx->GetID();
1881 if (!cParam) return kTRUE;
1884 if (!cParam->Update(p,c)) return kFALSE;
1889 //_______________________________________________________________________
1890 void AliESDtrack::Print(Option_t *) const {
1891 // Prints info on the track
1892 AliExternalTrackParam::Print();
1893 printf("ESD track info\n") ;
1894 Double_t p[AliPID::kSPECIESN] ;
1896 if( IsOn(kITSpid) ){
1897 printf("From ITS: ") ;
1899 for(index = 0 ; index < AliPID::kSPECIES; index++)
1900 printf("%f, ", p[index]) ;
1901 printf("\n signal = %f\n", GetITSsignal()) ;
1903 if( IsOn(kTPCpid) ){
1904 printf("From TPC: ") ;
1906 for(index = 0 ; index < AliPID::kSPECIES; index++)
1907 printf("%f, ", p[index]) ;
1908 printf("\n signal = %f\n", GetTPCsignal()) ;
1910 if( IsOn(kTRDpid) ){
1911 printf("From TRD: ") ;
1913 for(index = 0 ; index < AliPID::kSPECIES; index++)
1914 printf("%f, ", p[index]) ;
1915 printf("\n signal = %f\n", GetTRDsignal()) ;
1917 if( IsOn(kTOFpid) ){
1918 printf("From TOF: ") ;
1920 for(index = 0 ; index < AliPID::kSPECIES; index++)
1921 printf("%f, ", p[index]) ;
1922 printf("\n signal = %f\n", GetTOFsignal()) ;
1924 if( IsOn(kHMPIDpid) ){
1925 printf("From HMPID: ") ;
1927 for(index = 0 ; index < AliPID::kSPECIES; index++)
1928 printf("%f, ", p[index]) ;
1929 printf("\n signal = %f\n", GetHMPIDsignal()) ;
1935 // Draw functionality
1936 // Origin: Marian Ivanov, Marian.Ivanov@cern.ch
1938 void AliESDtrack::FillPolymarker(TPolyMarker3D *pol, Float_t magF, Float_t minR, Float_t maxR, Float_t stepR){
1940 // Fill points in the polymarker
1943 arrayRef.AddLast(new AliExternalTrackParam(*this));
1944 if (fIp) arrayRef.AddLast(new AliExternalTrackParam(*fIp));
1945 if (fOp) arrayRef.AddLast(new AliExternalTrackParam(*fOp));
1947 Double_t mpos[3]={0,0,0};
1948 Int_t entries=arrayRef.GetEntries();
1949 for (Int_t i=0;i<entries;i++){
1951 ((AliExternalTrackParam*)arrayRef.At(i))->GetXYZ(pos);
1952 mpos[0]+=pos[0]/entries;
1953 mpos[1]+=pos[1]/entries;
1954 mpos[2]+=pos[2]/entries;
1956 // Rotate to the mean position
1958 Float_t fi= TMath::ATan2(mpos[1],mpos[0]);
1959 for (Int_t i=0;i<entries;i++){
1960 Bool_t res = ((AliExternalTrackParam*)arrayRef.At(i))->Rotate(fi);
1961 if (!res) delete arrayRef.RemoveAt(i);
1964 for (Double_t r=minR; r<maxR; r+=stepR){
1966 Double_t mlpos[3]={0,0,0};
1967 for (Int_t i=0;i<entries;i++){
1968 Double_t point[3]={0,0,0};
1969 AliExternalTrackParam *param = ((AliExternalTrackParam*)arrayRef.At(i));
1970 if (!param) continue;
1971 if (param->GetXYZAt(r,magF,point)){
1972 Double_t weight = 1./(10.+(r-param->GetX())*(r-param->GetX()));
1974 mlpos[0]+=point[0]*weight;
1975 mlpos[1]+=point[1]*weight;
1976 mlpos[2]+=point[2]*weight;
1983 pol->SetPoint(counter,mlpos[0],mlpos[1], mlpos[2]);
1984 printf("xyz\t%f\t%f\t%f\n",mlpos[0], mlpos[1],mlpos[2]);
1990 //_______________________________________________________________________
1991 void AliESDtrack::SetITSdEdxSamples(const Double_t s[4]) {
1993 // Store the dE/dx samples measured by the two SSD and two SDD layers.
1994 // These samples are corrected for the track segment length.
1996 for (Int_t i=0; i<4; i++) fITSdEdxSamples[i]=s[i];
1999 //_______________________________________________________________________
2000 void AliESDtrack::GetITSdEdxSamples(Double_t *s) const {
2002 // Get the dE/dx samples measured by the two SSD and two SDD layers.
2003 // These samples are corrected for the track segment length.
2005 for (Int_t i=0; i<4; i++) s[i]=fITSdEdxSamples[i];