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),
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++) {fTPCPoints[i]=0;}
239 for (i=0;i<3;i++) {fTOFLabel[i]=0;}
240 for (i=0;i<10;i++) {fTOFInfo[i]=0;}
241 for (i=0;i<12;i++) {fITSModule[i]=-1;}
244 //_______________________________________________________________________
245 AliESDtrack::AliESDtrack(const AliESDtrack& track):
246 AliExternalTrackParam(track),
252 fTPCClusterMap(track.fTPCClusterMap),
253 fTPCSharedMap(track.fTPCSharedMap),
254 fFlags(track.fFlags),
256 fLabel(track.fLabel),
257 fITSLabel(track.fITSLabel),
258 fTPCLabel(track.fTPCLabel),
259 fTRDLabel(track.fTRDLabel),
260 fTOFCalChannel(track.fTOFCalChannel),
261 fTOFindex(track.fTOFindex),
262 fHMPIDqn(track.fHMPIDqn),
263 fHMPIDcluIdx(track.fHMPIDcluIdx),
264 fEMCALindex(track.fEMCALindex),
265 fHMPIDtrkTheta(track.fHMPIDtrkTheta),
266 fHMPIDtrkPhi(track.fHMPIDtrkPhi),
267 fHMPIDsignal(track.fHMPIDsignal),
268 fTrackLength(track.fTrackLength),
269 fdTPC(track.fdTPC),fzTPC(track.fzTPC),
270 fCddTPC(track.fCddTPC),fCdzTPC(track.fCdzTPC),fCzzTPC(track.fCzzTPC),
271 fCchi2TPC(track.fCchi2TPC),
272 fD(track.fD),fZ(track.fZ),
273 fCdd(track.fCdd),fCdz(track.fCdz),fCzz(track.fCzz),
274 fCchi2(track.fCchi2),
275 fITSchi2(track.fITSchi2),
276 fTPCchi2(track.fTPCchi2),
277 fTRDchi2(track.fTRDchi2),
278 fTOFchi2(track.fTOFchi2),
279 fHMPIDchi2(track.fHMPIDchi2),
280 fGlobalChi2(track.fGlobalChi2),
281 fITSsignal(track.fITSsignal),
282 fTPCsignal(track.fTPCsignal),
283 fTPCsignalS(track.fTPCsignalS),
284 fTRDsignal(track.fTRDsignal),
285 fTRDQuality(track.fTRDQuality),
286 fTRDBudget(track.fTRDBudget),
287 fTOFsignal(track.fTOFsignal),
288 fTOFsignalToT(track.fTOFsignalToT),
289 fTOFsignalRaw(track.fTOFsignalRaw),
290 fTOFsignalDz(track.fTOFsignalDz),
291 fHMPIDtrkX(track.fHMPIDtrkX),
292 fHMPIDtrkY(track.fHMPIDtrkY),
293 fHMPIDmipX(track.fHMPIDmipX),
294 fHMPIDmipY(track.fHMPIDmipY),
295 fTPCncls(track.fTPCncls),
296 fTPCnclsF(track.fTPCnclsF),
297 fTPCsignalN(track.fTPCsignalN),
298 fITSncls(track.fITSncls),
299 fITSClusterMap(track.fITSClusterMap),
300 fTRDncls(track.fTRDncls),
301 fTRDncls0(track.fTRDncls0),
302 fTRDpidQuality(track.fTRDpidQuality),
303 fTRDnSlices(track.fTRDnSlices),
309 for (Int_t i=0;i<AliPID::kSPECIES;i++) fTrackTime[i]=track.fTrackTime[i];
310 for (Int_t i=0;i<AliPID::kSPECIES;i++) fR[i]=track.fR[i];
312 for (Int_t i=0;i<AliPID::kSPECIES;i++) fITSr[i]=track.fITSr[i];
314 for (Int_t i=0;i<AliPID::kSPECIES;i++) fTPCr[i]=track.fTPCr[i];
315 for (Int_t i=0;i<4;i++) {fTPCPoints[i]=track.fTPCPoints[i];}
316 for (Int_t i=0; i<3;i++) { fKinkIndexes[i]=track.fKinkIndexes[i];}
317 for (Int_t i=0; i<3;i++) { fV0Indexes[i]=track.fV0Indexes[i];}
319 for (Int_t i=0;i<kTRDnPlanes;i++) {
320 fTRDTimBin[i]=track.fTRDTimBin[i];
324 fTRDslices=new Double32_t[fTRDnSlices];
325 for (Int_t i=0; i<fTRDnSlices; i++) fTRDslices[i]=track.fTRDslices[i];
328 for (Int_t i=0;i<AliPID::kSPECIES;i++) fTRDr[i]=track.fTRDr[i];
329 for (Int_t i=0;i<AliPID::kSPECIES;i++) fTOFr[i]=track.fTOFr[i];
330 for (Int_t i=0;i<3;i++) fTOFLabel[i]=track.fTOFLabel[i];
331 for (Int_t i=0;i<10;i++) fTOFInfo[i]=track.fTOFInfo[i];
332 for (Int_t i=0;i<12;i++) fITSModule[i]=track.fITSModule[i];
333 for (Int_t i=0;i<AliPID::kSPECIES;i++) fHMPIDr[i]=track.fHMPIDr[i];
335 if (track.fCp) fCp=new AliExternalTrackParam(*track.fCp);
336 if (track.fIp) fIp=new AliExternalTrackParam(*track.fIp);
337 if (track.fTPCInner) fTPCInner=new AliExternalTrackParam(*track.fTPCInner);
338 if (track.fOp) fOp=new AliExternalTrackParam(*track.fOp);
340 if (track.fFriendTrack) fFriendTrack=new AliESDfriendTrack(*(track.fFriendTrack));
343 //_______________________________________________________________________
344 AliESDtrack::AliESDtrack(const AliVTrack *track) :
345 AliExternalTrackParam(track),
351 fTPCClusterMap(159),//number of padrows
352 fTPCSharedMap(159),//number of padrows
363 fEMCALindex(kEMCALNoMatch),
369 fCddTPC(0),fCdzTPC(0),fCzzTPC(0),
372 fCdd(0),fCdz(0),fCzz(0),
406 // ESD track from AliVTrack.
407 // This is not a copy constructor !
410 if (track->InheritsFrom("AliExternalTrackParam")) {
411 AliError("This is not a copy constructor. Use AliESDtrack(const AliESDtrack &) !");
412 AliWarning("Calling the default constructor...");
417 // Reset all the arrays
419 for (i=0; i<AliPID::kSPECIES; i++) {
429 for (i=0; i<3; i++) { fKinkIndexes[i]=0;}
430 for (i=0; i<3; i++) { fV0Indexes[i]=-1;}
431 for (i=0;i<kTRDnPlanes;i++) {
434 for (i=0;i<4;i++) {fTPCPoints[i]=0;}
435 for (i=0;i<3;i++) {fTOFLabel[i]=0;}
436 for (i=0;i<10;i++) {fTOFInfo[i]=0;}
437 for (i=0;i<12;i++) {fITSModule[i]=-1;}
440 SetID(track->GetID());
442 // Set ITS cluster map
443 fITSClusterMap=track->GetITSClusterMap();
447 if(HasPointOnITSLayer(i)) fITSncls++;
450 // Set the combined PID
451 const Double_t *pid = track->PID();
453 for (i=0; i<AliPID::kSPECIES; i++) fR[i]=pid[i];
455 // AliESD track label
456 SetLabel(track->GetLabel());
458 SetStatus(track->GetStatus());
461 //_______________________________________________________________________
462 AliESDtrack::AliESDtrack(TParticle * part) :
463 AliExternalTrackParam(),
469 fTPCClusterMap(159),//number of padrows
470 fTPCSharedMap(159),//number of padrows
481 fEMCALindex(kEMCALNoMatch),
487 fCddTPC(0),fCdzTPC(0),fCzzTPC(0),
490 fCdd(0),fCdz(0),fCzz(0),
524 // ESD track from TParticle
527 // Reset all the arrays
529 for (i=0; i<AliPID::kSPECIES; i++) {
539 for (i=0; i<3; i++) { fKinkIndexes[i]=0;}
540 for (i=0; i<3; i++) { fV0Indexes[i]=-1;}
541 for (i=0;i<kTRDnPlanes;i++) {
544 for (i=0;i<4;i++) {fTPCPoints[i]=0;}
545 for (i=0;i<3;i++) {fTOFLabel[i]=0;}
546 for (i=0;i<10;i++) {fTOFInfo[i]=0;}
547 for (i=0;i<12;i++) {fITSModule[i]=-1;}
549 // Calculate the AliExternalTrackParam content
556 // Calculate alpha: the rotation angle of the corresponding local system (TPC sector)
557 alpha = part->Phi()*180./TMath::Pi();
558 if (alpha<0) alpha+= 360.;
559 if (alpha>360) alpha -= 360.;
561 Int_t sector = (Int_t)(alpha/20.);
562 alpha = 10. + 20.*sector;
564 alpha *= TMath::Pi();
566 // Covariance matrix: no errors, the parameters are exact
567 for (i=0; i<15; i++) covar[i]=0.;
569 // Get the vertex of origin and the momentum
570 TVector3 ver(part->Vx(),part->Vy(),part->Vz());
571 TVector3 mom(part->Px(),part->Py(),part->Pz());
573 // Rotate to the local coordinate system (TPC sector)
577 // X of the referense plane
580 Int_t pdgCode = part->GetPdgCode();
583 TDatabasePDG::Instance()->GetParticle(pdgCode)->Charge();
587 param[2] = TMath::Sin(mom.Phi());
588 param[3] = mom.Pz()/mom.Pt();
589 param[4] = TMath::Sign(1/mom.Pt(),charge);
591 // Set AliExternalTrackParam
592 Set(xref, alpha, param, covar);
597 switch (TMath::Abs(pdgCode)) {
623 // If the particle is not e,mu,pi,K or p the PID probabilities are set to 0
624 if (indexPID < AliPID::kSPECIES) {
630 fHMPIDr[indexPID]=1.;
633 // AliESD track label
634 SetLabel(part->GetUniqueID());
638 //_______________________________________________________________________
639 AliESDtrack::~AliESDtrack(){
641 // This is destructor according Coding Conventrions
643 //printf("Delete track\n");
653 AliESDtrack &AliESDtrack::operator=(const AliESDtrack &source){
656 if(&source == this) return *this;
657 AliExternalTrackParam::operator=(source);
661 // we have the trackparam: assign or copy construct
662 if(fCp)*fCp = *source.fCp;
663 else fCp = new AliExternalTrackParam(*source.fCp);
666 // no track param delete the old one
672 // we have the trackparam: assign or copy construct
673 if(fIp)*fIp = *source.fIp;
674 else fIp = new AliExternalTrackParam(*source.fIp);
677 // no track param delete the old one
683 if(source.fTPCInner){
684 // we have the trackparam: assign or copy construct
685 if(fTPCInner) *fTPCInner = *source.fTPCInner;
686 else fTPCInner = new AliExternalTrackParam(*source.fTPCInner);
689 // no track param delete the old one
690 if(fTPCInner)delete fTPCInner;
696 // we have the trackparam: assign or copy construct
697 if(fOp) *fOp = *source.fOp;
698 else fOp = new AliExternalTrackParam(*source.fOp);
701 // no track param delete the old one
706 // copy also the friend track
707 // use copy constructor
708 if(source.fFriendTrack){
709 // we have the trackparam: assign or copy construct
710 delete fFriendTrack; fFriendTrack=new AliESDfriendTrack(*source.fFriendTrack);
713 // no track param delete the old one
714 delete fFriendTrack; fFriendTrack= 0;
717 fTPCClusterMap = source.fTPCClusterMap;
718 fTPCSharedMap = source.fTPCSharedMap;
720 fFlags = source.fFlags;
722 fLabel = source.fLabel;
723 fITSLabel = source.fITSLabel;
724 for(int i = 0; i< 12;++i){
725 fITSModule[i] = source.fITSModule[i];
727 fTPCLabel = source.fTPCLabel;
728 fTRDLabel = source.fTRDLabel;
729 for(int i = 0; i< 3;++i){
730 fTOFLabel[i] = source.fTOFLabel[i];
732 fTOFCalChannel = source.fTOFCalChannel;
733 fTOFindex = source.fTOFindex;
734 fHMPIDqn = source.fHMPIDqn;
735 fHMPIDcluIdx = source.fHMPIDcluIdx;
736 fEMCALindex = source.fEMCALindex;
738 for(int i = 0; i< 3;++i){
739 fKinkIndexes[i] = source.fKinkIndexes[i];
740 fV0Indexes[i] = source.fV0Indexes[i];
743 for(int i = 0; i< AliPID::kSPECIES;++i){
744 fR[i] = source.fR[i];
745 fITSr[i] = source.fITSr[i];
746 fTPCr[i] = source.fTPCr[i];
747 fTRDr[i] = source.fTRDr[i];
748 fTOFr[i] = source.fTOFr[i];
749 fHMPIDr[i] = source.fHMPIDr[i];
750 fTrackTime[i] = source.fTrackTime[i];
753 fHMPIDtrkTheta = source.fHMPIDtrkTheta;
754 fHMPIDtrkPhi = source.fHMPIDtrkPhi;
755 fHMPIDsignal = source.fHMPIDsignal;
758 fTrackLength = source. fTrackLength;
759 fdTPC = source.fdTPC;
760 fzTPC = source.fzTPC;
761 fCddTPC = source.fCddTPC;
762 fCdzTPC = source.fCdzTPC;
763 fCzzTPC = source.fCzzTPC;
764 fCchi2TPC = source.fCchi2TPC;
771 fCchi2 = source.fCchi2;
773 fITSchi2 = source.fITSchi2;
774 fTPCchi2 = source.fTPCchi2;
775 fTRDchi2 = source.fTRDchi2;
776 fTOFchi2 = source.fTOFchi2;
777 fHMPIDchi2 = source.fHMPIDchi2;
779 fGlobalChi2 = source.fGlobalChi2;
781 fITSsignal = source.fITSsignal;
782 fTPCsignal = source.fTPCsignal;
783 fTPCsignalS = source.fTPCsignalS;
784 for(int i = 0; i< 4;++i){
785 fTPCPoints[i] = source.fTPCPoints[i];
787 fTRDsignal = source.fTRDsignal;
789 for(int i = 0;i < kTRDnPlanes;++i){
790 fTRDTimBin[i] = source.fTRDTimBin[i];
796 fTRDnSlices=source.fTRDnSlices;
798 fTRDslices=new Double32_t[fTRDnSlices];
799 for(int j = 0;j < fTRDnSlices;++j) fTRDslices[j] = source.fTRDslices[j];
802 fTRDQuality = source.fTRDQuality;
803 fTRDBudget = source.fTRDBudget;
804 fTOFsignal = source.fTOFsignal;
805 fTOFsignalToT = source.fTOFsignalToT;
806 fTOFsignalRaw = source.fTOFsignalRaw;
807 fTOFsignalDz = source.fTOFsignalDz;
809 for(int i = 0;i<10;++i){
810 fTOFInfo[i] = source.fTOFInfo[i];
813 fHMPIDtrkX = source.fHMPIDtrkX;
814 fHMPIDtrkY = source.fHMPIDtrkY;
815 fHMPIDmipX = source.fHMPIDmipX;
816 fHMPIDmipY = source.fHMPIDmipY;
818 fTPCncls = source.fTPCncls;
819 fTPCnclsF = source.fTPCnclsF;
820 fTPCsignalN = source.fTPCsignalN;
822 fITSncls = source.fITSncls;
823 fITSClusterMap = source.fITSClusterMap;
824 fTRDncls = source.fTRDncls;
825 fTRDncls0 = source.fTRDncls0;
826 fTRDpidQuality = source.fTRDpidQuality;
832 void AliESDtrack::Copy(TObject &obj) const {
834 // this overwrites the virtual TOBject::Copy()
835 // to allow run time copying without casting
838 if(this==&obj)return;
839 AliESDtrack *robj = dynamic_cast<AliESDtrack*>(&obj);
840 if(!robj)return; // not an AliESDtrack
847 void AliESDtrack::AddCalibObject(TObject * object){
849 // add calib object to the list
851 if (!fFriendTrack) fFriendTrack = new AliESDfriendTrack;
852 fFriendTrack->AddCalibObject(object);
855 TObject * AliESDtrack::GetCalibObject(Int_t index){
857 // return calib objct at given position
859 if (!fFriendTrack) return 0;
860 return fFriendTrack->GetCalibObject(index);
864 Bool_t AliESDtrack::FillTPCOnlyTrack(AliESDtrack &track){
866 // Fills the information of the TPC-only first reconstruction pass
867 // into the passed ESDtrack object. For consistency fTPCInner is also filled
872 // For data produced before r26675
873 // RelateToVertexTPC was not properly called during reco
874 // so you'll have to call it again, before FillTPCOnlyTrack
875 // Float_t p[2],cov[3];
876 // track->GetImpactParametersTPC(p,cov);
877 // if(p[0]==0&&p[1]==0) // <- Default values
878 // track->RelateToVertexTPC(esd->GetPrimaryVertexTPC(),esd->GetMagneticField(),kVeryBig);
881 if(!fTPCInner)return kFALSE;
883 // fill the TPC track params to the global track parameters
884 track.Set(fTPCInner->GetX(),fTPCInner->GetAlpha(),fTPCInner->GetParameter(),fTPCInner->GetCovariance());
887 track.fCdd = fCddTPC;
888 track.fCdz = fCdzTPC;
889 track.fCzz = fCzzTPC;
891 // copy the TPCinner parameters
892 if(track.fTPCInner) *track.fTPCInner = *fTPCInner;
893 else track.fTPCInner = new AliExternalTrackParam(*fTPCInner);
896 track.fCddTPC = fCddTPC;
897 track.fCdzTPC = fCdzTPC;
898 track.fCzzTPC = fCzzTPC;
899 track.fCchi2TPC = fCchi2TPC;
902 // copy all other TPC specific parameters
904 // replace label by TPC label
905 track.fLabel = fTPCLabel;
906 track.fTPCLabel = fTPCLabel;
908 track.fTPCchi2 = fTPCchi2;
909 track.fTPCsignal = fTPCsignal;
910 track.fTPCsignalS = fTPCsignalS;
911 for(int i = 0;i<4;++i)track.fTPCPoints[i] = fTPCPoints[i];
913 track.fTPCncls = fTPCncls;
914 track.fTPCnclsF = fTPCnclsF;
915 track.fTPCsignalN = fTPCsignalN;
918 for(int i=0;i<AliPID::kSPECIES;++i){
919 track.fTPCr[i] = fTPCr[i];
920 // combined PID is TPC only!
921 track.fR[i] = fTPCr[i];
923 track.fTPCClusterMap = fTPCClusterMap;
924 track.fTPCSharedMap = fTPCSharedMap;
928 track.fFlags = kTPCin;
931 track.fFlags |= fFlags & kTPCpid; //copy the TPCpid status flag
933 for (Int_t i=0;i<3;i++) track.fKinkIndexes[i] = fKinkIndexes[i];
939 //_______________________________________________________________________
940 void AliESDtrack::MakeMiniESDtrack(){
941 // Resets everything except
942 // fFlags: Reconstruction status flags
943 // fLabel: Track label
944 // fID: Unique ID of the track
945 // Impact parameter information
946 // fR[AliPID::kSPECIES]: combined "detector response probability"
947 // Running track parameters in the base class (AliExternalTrackParam)
951 for (Int_t i=0;i<AliPID::kSPECIES;i++) fTrackTime[i] = 0;
953 // Reset track parameters constrained to the primary vertex
956 // Reset track parameters at the inner wall of TPC
958 delete fTPCInner;fTPCInner=0;
959 // Reset track parameters at the inner wall of the TRD
963 // Reset ITS track related information
968 for (Int_t i=0;i<AliPID::kSPECIES;i++) fITSr[i]=0;
971 // Reset TPC related track information
980 for (Int_t i=0;i<AliPID::kSPECIES;i++) fTPCr[i]=0;
982 for (Int_t i=0;i<4;i++) fTPCPoints[i] = 0;
983 for (Int_t i=0; i<3;i++) fKinkIndexes[i] = 0;
984 for (Int_t i=0; i<3;i++) fV0Indexes[i] = 0;
986 // Reset TRD related track information
991 for (Int_t i=0;i<kTRDnPlanes;i++) {
994 for (Int_t i=0;i<AliPID::kSPECIES;i++) fTRDr[i] = 0;
1004 // Reset TOF related track information
1012 for (Int_t i=0;i<AliPID::kSPECIES;i++) fTOFr[i] = 0;
1013 for (Int_t i=0;i<3;i++) fTOFLabel[i] = 0;
1014 for (Int_t i=0;i<10;i++) fTOFInfo[i] = 0;
1016 // Reset HMPID related track information
1021 for (Int_t i=0;i<AliPID::kSPECIES;i++) fHMPIDr[i] = 0;
1028 fEMCALindex = kEMCALNoMatch;
1030 // reset global track chi2
1033 delete fFriendTrack; fFriendTrack = 0;
1035 //_______________________________________________________________________
1036 Double_t AliESDtrack::GetMass() const {
1037 // Returns the mass of the most probable particle type
1040 for (Int_t i=0; i<AliPID::kSPECIES; i++) {
1041 if (fR[i]>max) {k=i; max=fR[i];}
1043 if (k==0) { // dE/dx "crossing points" in the TPC
1045 if ((p>0.38)&&(p<0.48))
1046 if (fR[0]<fR[3]*10.) return AliPID::ParticleMass(AliPID::kKaon);
1047 if ((p>0.75)&&(p<0.85))
1048 if (fR[0]<fR[4]*10.) return AliPID::ParticleMass(AliPID::kProton);
1051 if (k==1) return AliPID::ParticleMass(AliPID::kMuon);
1052 if (k==2||k==-1) return AliPID::ParticleMass(AliPID::kPion);
1053 if (k==3) return AliPID::ParticleMass(AliPID::kKaon);
1054 if (k==4) return AliPID::ParticleMass(AliPID::kProton);
1055 AliWarning("Undefined mass !");
1056 return AliPID::ParticleMass(AliPID::kPion);
1059 //______________________________________________________________________________
1060 Double_t AliESDtrack::E() const
1062 // Returns the energy of the particle given its assumed mass.
1063 // Assumes the pion mass if the particle can't be identified properly.
1067 return TMath::Sqrt(p*p + m*m);
1070 //______________________________________________________________________________
1071 Double_t AliESDtrack::Y() const
1073 // Returns the rapidity of a particle given its assumed mass.
1074 // Assumes the pion mass if the particle can't be identified properly.
1078 if (e != TMath::Abs(pz)) { // energy was not equal to pz
1079 return 0.5*TMath::Log((e+pz)/(e-pz));
1080 } else { // energy was equal to pz
1085 //_______________________________________________________________________
1086 Bool_t AliESDtrack::UpdateTrackParams(const AliKalmanTrack *t, ULong_t flags){
1088 // This function updates track's running parameters
1094 fLabel=t->GetLabel();
1096 if (t->IsStartedTimeIntegral()) {
1098 Double_t times[10];t->GetIntegratedTimes(times); SetIntegratedTimes(times);
1099 SetIntegratedLength(t->GetIntegratedLength());
1102 Set(t->GetX(),t->GetAlpha(),t->GetParameter(),t->GetCovariance());
1106 case kITSin: case kITSout: case kITSrefit:
1108 fITSncls=t->GetNumberOfClusters();
1109 index=fFriendTrack->GetITSindices();
1110 for (Int_t i=0;i<AliESDfriendTrack::kMaxITScluster;i++) {
1111 index[i]=t->GetClusterIndex(i);
1113 Int_t l=(index[i] & 0xf0000000) >> 28;
1114 SETBIT(fITSClusterMap,l);
1117 fITSchi2=t->GetChi2();
1118 fITSsignal=t->GetPIDsignal();
1119 fITSLabel = t->GetLabel();
1120 // keep in fOp the parameters outside ITS for ITS stand-alone tracks
1121 if (flags==kITSout) {
1122 if (!fOp) fOp=new AliExternalTrackParam(*t);
1124 fOp->Set(t->GetX(),t->GetAlpha(),t->GetParameter(),t->GetCovariance());
1128 case kTPCin: case kTPCrefit:
1129 fTPCLabel = t->GetLabel();
1130 if (flags==kTPCin) fTPCInner=new AliExternalTrackParam(*t);
1131 if (!fIp) fIp=new AliExternalTrackParam(*t);
1133 fIp->Set(t->GetX(),t->GetAlpha(),t->GetParameter(),t->GetCovariance());
1135 index=fFriendTrack->GetTPCindices();
1136 if (flags & kTPCout){
1137 if (!fOp) fOp=new AliExternalTrackParam(*t);
1139 fOp->Set(t->GetX(),t->GetAlpha(),t->GetParameter(),t->GetCovariance());
1141 fTPCncls=t->GetNumberOfClusters();
1142 fTPCchi2=t->GetChi2();
1144 {//prevrow must be declared in separate namespace, otherwise compiler cries:
1145 //"jump to case label crosses initialization of `Int_t prevrow'"
1147 // for (Int_t i=0;i<fTPCncls;i++)
1148 for (Int_t i=0;i<AliESDfriendTrack::kMaxTPCcluster;i++)
1150 index[i]=t->GetClusterIndex(i);
1151 Int_t idx = index[i];
1153 if (idx<0) continue;
1155 // Piotr's Cluster Map for HBT
1156 // ### please change accordingly if cluster array is changing
1157 // to "New TPC Tracking" style (with gaps in array)
1158 Int_t sect = (idx&0xff000000)>>24;
1159 Int_t row = (idx&0x00ff0000)>>16;
1160 if (sect > 18) row +=63; //if it is outer sector, add number of inner sectors
1162 fTPCClusterMap.SetBitNumber(row,kTRUE);
1164 //Fill the gap between previous row and this row with 0 bits
1165 //In case ### pleas change it as well - just set bit 0 in case there
1166 //is no associated clusters for current "i"
1169 prevrow = row;//if previous bit was not assigned yet == this is the first one
1172 { //we don't know the order (inner to outer or reverse)
1173 //just to be save in case it is going to change
1186 for (Int_t j = n+1; j < m; j++)
1188 fTPCClusterMap.SetBitNumber(j,kFALSE);
1192 // End Of Piotr's Cluster Map for HBT
1195 fTPCsignal=t->GetPIDsignal();
1198 case kTRDout: case kTRDin: case kTRDrefit:
1199 index = fFriendTrack->GetTRDindices();
1200 fTRDLabel = t->GetLabel();
1201 fTRDchi2 = t->GetChi2();
1202 fTRDncls = t->GetNumberOfClusters();
1203 for (Int_t i=0;i<6;i++) index[i]=t->GetTrackletIndex(i);
1205 fTRDsignal=t->GetPIDsignal();
1208 if (!fOp) fOp=new AliExternalTrackParam(*t);
1210 fOp->Set(t->GetX(),t->GetAlpha(),t->GetParameter(),t->GetCovariance());
1211 fTRDncls0 = t->GetNumberOfClusters();
1220 AliError("Wrong flag !");
1227 //_______________________________________________________________________
1228 void AliESDtrack::GetExternalParameters(Double_t &x, Double_t p[5]) const {
1229 //---------------------------------------------------------------------
1230 // This function returns external representation of the track parameters
1231 //---------------------------------------------------------------------
1233 for (Int_t i=0; i<5; i++) p[i]=GetParameter()[i];
1236 //_______________________________________________________________________
1237 void AliESDtrack::GetExternalCovariance(Double_t cov[15]) const {
1238 //---------------------------------------------------------------------
1239 // This function returns external representation of the cov. matrix
1240 //---------------------------------------------------------------------
1241 for (Int_t i=0; i<15; i++) cov[i]=AliExternalTrackParam::GetCovariance()[i];
1244 //_______________________________________________________________________
1245 Bool_t AliESDtrack::GetConstrainedExternalParameters
1246 (Double_t &alpha, Double_t &x, Double_t p[5]) const {
1247 //---------------------------------------------------------------------
1248 // This function returns the constrained external track parameters
1249 //---------------------------------------------------------------------
1250 if (!fCp) return kFALSE;
1251 alpha=fCp->GetAlpha();
1253 for (Int_t i=0; i<5; i++) p[i]=fCp->GetParameter()[i];
1257 //_______________________________________________________________________
1259 AliESDtrack::GetConstrainedExternalCovariance(Double_t c[15]) const {
1260 //---------------------------------------------------------------------
1261 // This function returns the constrained external cov. matrix
1262 //---------------------------------------------------------------------
1263 if (!fCp) return kFALSE;
1264 for (Int_t i=0; i<15; i++) c[i]=fCp->GetCovariance()[i];
1269 AliESDtrack::GetInnerExternalParameters
1270 (Double_t &alpha, Double_t &x, Double_t p[5]) const {
1271 //---------------------------------------------------------------------
1272 // This function returns external representation of the track parameters
1273 // at the inner layer of TPC
1274 //---------------------------------------------------------------------
1275 if (!fIp) return kFALSE;
1276 alpha=fIp->GetAlpha();
1278 for (Int_t i=0; i<5; i++) p[i]=fIp->GetParameter()[i];
1283 AliESDtrack::GetInnerExternalCovariance(Double_t cov[15]) const {
1284 //---------------------------------------------------------------------
1285 // This function returns external representation of the cov. matrix
1286 // at the inner layer of TPC
1287 //---------------------------------------------------------------------
1288 if (!fIp) return kFALSE;
1289 for (Int_t i=0; i<15; i++) cov[i]=fIp->GetCovariance()[i];
1294 AliESDtrack::SetOuterParam(const AliExternalTrackParam *p, ULong_t flags) {
1296 // This is a direct setter for the outer track parameters
1299 if (fOp) delete fOp;
1300 fOp=new AliExternalTrackParam(*p);
1304 AliESDtrack::GetOuterExternalParameters
1305 (Double_t &alpha, Double_t &x, Double_t p[5]) const {
1306 //---------------------------------------------------------------------
1307 // This function returns external representation of the track parameters
1308 // at the inner layer of TRD
1309 //---------------------------------------------------------------------
1310 if (!fOp) return kFALSE;
1311 alpha=fOp->GetAlpha();
1313 for (Int_t i=0; i<5; i++) p[i]=fOp->GetParameter()[i];
1318 AliESDtrack::GetOuterExternalCovariance(Double_t cov[15]) const {
1319 //---------------------------------------------------------------------
1320 // This function returns external representation of the cov. matrix
1321 // at the inner layer of TRD
1322 //---------------------------------------------------------------------
1323 if (!fOp) return kFALSE;
1324 for (Int_t i=0; i<15; i++) cov[i]=fOp->GetCovariance()[i];
1328 Int_t AliESDtrack::GetNcls(Int_t idet) const
1330 // Get number of clusters by subdetector index
1344 if (fTOFindex != -1)
1350 if ((fHMPIDcluIdx >= 0) && (fHMPIDcluIdx < 7000000)) {
1351 if ((fHMPIDcluIdx%1000000 != 9999) && (fHMPIDcluIdx%1000000 != 99999)) {
1362 Int_t AliESDtrack::GetClusters(Int_t idet, Int_t *idx) const
1364 // Get cluster index array by subdetector index
1369 ncls = GetITSclusters(idx);
1372 ncls = GetTPCclusters(idx);
1375 ncls = GetTRDclusters(idx);
1378 if (fTOFindex != -1) {
1386 if ((fHMPIDcluIdx >= 0) && (fHMPIDcluIdx < 7000000)) {
1387 if ((fHMPIDcluIdx%1000000 != 9999) && (fHMPIDcluIdx%1000000 != 99999)) {
1388 idx[0] = GetHMPIDcluIdx();
1401 //_______________________________________________________________________
1402 void AliESDtrack::GetIntegratedTimes(Double_t *times) const {
1403 // Returns the array with integrated times for each particle hypothesis
1404 for (Int_t i=0; i<AliPID::kSPECIES; i++) times[i]=fTrackTime[i];
1407 //_______________________________________________________________________
1408 void AliESDtrack::SetIntegratedTimes(const Double_t *times) {
1409 // Sets the array with integrated times for each particle hypotesis
1410 for (Int_t i=0; i<AliPID::kSPECIES; i++) fTrackTime[i]=times[i];
1413 //_______________________________________________________________________
1414 void AliESDtrack::SetITSpid(const Double_t *p) {
1415 // Sets values for the probability of each particle type (in ITS)
1416 SetPIDValues(fITSr,p,AliPID::kSPECIES);
1417 SetStatus(AliESDtrack::kITSpid);
1420 //_______________________________________________________________________
1421 void AliESDtrack::GetITSpid(Double_t *p) const {
1422 // Gets the probability of each particle type (in ITS)
1423 for (Int_t i=0; i<AliPID::kSPECIES; i++) p[i]=fITSr[i];
1426 //_______________________________________________________________________
1427 Char_t AliESDtrack::GetITSclusters(Int_t *idx) const {
1428 //---------------------------------------------------------------------
1429 // This function returns indices of the assgined ITS clusters
1430 //---------------------------------------------------------------------
1432 Int_t *index=fFriendTrack->GetITSindices();
1433 for (Int_t i=0; i<AliESDfriendTrack::kMaxITScluster; i++) {
1434 if ( (i>=fITSncls) && (i<6) ) idx[i]=-1;
1435 else idx[i]=index[i];
1441 //_______________________________________________________________________
1442 Bool_t AliESDtrack::GetITSModuleIndexInfo(Int_t ilayer,Int_t &idet,Int_t &status,
1443 Float_t &xloc,Float_t &zloc) const {
1444 //----------------------------------------------------------------------
1445 // This function encodes in the module number also the status of cluster association
1446 // "status" can have the following values:
1447 // 1 "found" (cluster is associated),
1448 // 2 "dead" (module is dead from OCDB),
1449 // 3 "skipped" (module or layer forced to be skipped),
1450 // 4 "outinz" (track out of z acceptance),
1451 // 5 "nocls" (no clusters in the road),
1452 // 6 "norefit" (cluster rejected during refit),
1453 // 7 "deadzspd" (holes in z in SPD)
1454 // Also given are the coordinates of the crossing point of track and module
1455 // (in the local module ref. system)
1456 // WARNING: THIS METHOD HAS TO BE SYNCHRONIZED WITH AliITStrackV2::GetModuleIndexInfo()!
1457 //----------------------------------------------------------------------
1459 if(fITSModule[ilayer]==-1) {
1462 xloc=-99.; zloc=-99.;
1466 Int_t module = fITSModule[ilayer];
1468 idet = Int_t(module/1000000);
1470 module -= idet*1000000;
1472 status = Int_t(module/100000);
1474 module -= status*100000;
1476 Int_t signs = Int_t(module/10000);
1478 module-=signs*10000;
1480 Int_t xInt = Int_t(module/100);
1483 Int_t zInt = module;
1485 if(signs==1) { xInt*=1; zInt*=1; }
1486 if(signs==2) { xInt*=1; zInt*=-1; }
1487 if(signs==3) { xInt*=-1; zInt*=1; }
1488 if(signs==4) { xInt*=-1; zInt*=-1; }
1490 xloc = 0.1*(Float_t)xInt;
1491 zloc = 0.1*(Float_t)zInt;
1493 if(status==4) idet = -1;
1498 //_______________________________________________________________________
1499 UShort_t AliESDtrack::GetTPCclusters(Int_t *idx) const {
1500 //---------------------------------------------------------------------
1501 // This function returns indices of the assgined ITS clusters
1502 //---------------------------------------------------------------------
1504 Int_t *index=fFriendTrack->GetTPCindices();
1505 for (Int_t i=0; i<AliESDfriendTrack::kMaxTPCcluster; i++) idx[i]=index[i];
1510 Double_t AliESDtrack::GetTPCdensity(Int_t row0, Int_t row1) const{
1512 // GetDensity of the clusters on given region between row0 and row1
1513 // Dead zone effect takin into acoount
1518 Int_t *index=fFriendTrack->GetTPCindices();
1519 for (Int_t i=row0;i<=row1;i++){
1520 Int_t idx = index[i];
1521 if (idx!=-1) good++; // track outside of dead zone
1524 Float_t density=0.5;
1525 if (good>(row1-row0)*0.5) density = Float_t(found)/Float_t(good);
1529 //_______________________________________________________________________
1530 void AliESDtrack::SetTPCpid(const Double_t *p) {
1531 // Sets values for the probability of each particle type (in TPC)
1532 SetPIDValues(fTPCr,p,AliPID::kSPECIES);
1533 SetStatus(AliESDtrack::kTPCpid);
1536 //_______________________________________________________________________
1537 void AliESDtrack::GetTPCpid(Double_t *p) const {
1538 // Gets the probability of each particle type (in TPC)
1539 for (Int_t i=0; i<AliPID::kSPECIES; i++) p[i]=fTPCr[i];
1542 //_______________________________________________________________________
1543 UChar_t AliESDtrack::GetTRDclusters(Int_t *idx) const {
1544 //---------------------------------------------------------------------
1545 // This function returns indices of the assgined TRD clusters
1546 //---------------------------------------------------------------------
1548 Int_t *index=fFriendTrack->GetTRDindices();
1549 for (Int_t i=0; i<AliESDfriendTrack::kMaxTRDcluster; i++) idx[i]=index[i];
1554 //_______________________________________________________________________
1555 UChar_t AliESDtrack::GetTRDtracklets(Int_t *idx) const {
1556 //---------------------------------------------------------------------
1557 // This function returns indices of the assigned TRD tracklets
1558 //---------------------------------------------------------------------
1560 Int_t *index=fFriendTrack->GetTRDindices();
1561 for (Int_t i=0; i<6/*AliESDfriendTrack::kMaxTRDcluster*/; i++) idx[i]=index[i];
1566 //_______________________________________________________________________
1567 void AliESDtrack::SetTRDpid(const Double_t *p) {
1568 // Sets values for the probability of each particle type (in TRD)
1569 SetPIDValues(fTRDr,p,AliPID::kSPECIES);
1570 SetStatus(AliESDtrack::kTRDpid);
1573 //_______________________________________________________________________
1574 void AliESDtrack::GetTRDpid(Double_t *p) const {
1575 // Gets the probability of each particle type (in TRD)
1576 for (Int_t i=0; i<AliPID::kSPECIES; i++) p[i]=fTRDr[i];
1579 //_______________________________________________________________________
1580 void AliESDtrack::SetTRDpid(Int_t iSpecies, Float_t p)
1582 // Sets the probability of particle type iSpecies to p (in TRD)
1583 fTRDr[iSpecies] = p;
1586 Double_t AliESDtrack::GetTRDpid(Int_t iSpecies) const
1588 // Returns the probability of particle type iSpecies (in TRD)
1589 return fTRDr[iSpecies];
1592 void AliESDtrack::SetNumberOfTRDslices(Int_t n) {
1593 //Sets the number of slices used for PID
1594 if (fTRDnSlices != 0) return;
1595 fTRDnSlices=kTRDnPlanes*n;
1596 fTRDslices=new Double32_t[fTRDnSlices];
1597 for (Int_t i=0; i<fTRDnSlices; i++) fTRDslices[i]=-1.;
1600 void AliESDtrack::SetTRDslice(Double_t q, Int_t plane, Int_t slice) {
1601 //Sets the charge q in the slice of the plane
1602 Int_t ns=GetNumberOfTRDslices();
1604 AliError("No TRD slices allocated for this track !");
1608 if ((plane<0) || (plane>=kTRDnPlanes)) {
1609 AliError("Wrong TRD plane !");
1612 if ((slice<0) || (slice>=ns)) {
1613 AliError("Wrong TRD slice !");
1616 Int_t n=plane*ns + slice;
1620 Double_t AliESDtrack::GetTRDslice(Int_t plane, Int_t slice) const {
1621 //Gets the charge from the slice of the plane
1622 Int_t ns=GetNumberOfTRDslices();
1624 //AliError("No TRD slices allocated for this track !");
1628 if ((plane<0) || (plane>=kTRDnPlanes)) {
1629 AliError("Wrong TRD plane !");
1632 if ((slice<-1) || (slice>=ns)) {
1633 //AliError("Wrong TRD slice !");
1639 for (Int_t i=0; i<ns; i++) q+=fTRDslices[plane*ns + i];
1643 return fTRDslices[plane*ns + slice];
1647 //_______________________________________________________________________
1648 void AliESDtrack::SetTOFpid(const Double_t *p) {
1649 // Sets the probability of each particle type (in TOF)
1650 SetPIDValues(fTOFr,p,AliPID::kSPECIES);
1651 SetStatus(AliESDtrack::kTOFpid);
1654 //_______________________________________________________________________
1655 void AliESDtrack::SetTOFLabel(const Int_t *p) {
1657 for (Int_t i=0; i<3; i++) fTOFLabel[i]=p[i];
1660 //_______________________________________________________________________
1661 void AliESDtrack::GetTOFpid(Double_t *p) const {
1662 // Gets probabilities of each particle type (in TOF)
1663 for (Int_t i=0; i<AliPID::kSPECIES; i++) p[i]=fTOFr[i];
1666 //_______________________________________________________________________
1667 void AliESDtrack::GetTOFLabel(Int_t *p) const {
1669 for (Int_t i=0; i<3; i++) p[i]=fTOFLabel[i];
1672 //_______________________________________________________________________
1673 void AliESDtrack::GetTOFInfo(Float_t *info) const {
1675 for (Int_t i=0; i<10; i++) info[i]=fTOFInfo[i];
1678 //_______________________________________________________________________
1679 void AliESDtrack::SetTOFInfo(Float_t*info) {
1681 for (Int_t i=0; i<10; i++) fTOFInfo[i]=info[i];
1686 //_______________________________________________________________________
1687 void AliESDtrack::SetHMPIDpid(const Double_t *p) {
1688 // Sets the probability of each particle type (in HMPID)
1689 SetPIDValues(fHMPIDr,p,AliPID::kSPECIES);
1690 SetStatus(AliESDtrack::kHMPIDpid);
1693 //_______________________________________________________________________
1694 void AliESDtrack::GetHMPIDpid(Double_t *p) const {
1695 // Gets probabilities of each particle type (in HMPID)
1696 for (Int_t i=0; i<AliPID::kSPECIES; i++) p[i]=fHMPIDr[i];
1701 //_______________________________________________________________________
1702 void AliESDtrack::SetESDpid(const Double_t *p) {
1703 // Sets the probability of each particle type for the ESD track
1704 SetPIDValues(fR,p,AliPID::kSPECIES);
1705 SetStatus(AliESDtrack::kESDpid);
1708 //_______________________________________________________________________
1709 void AliESDtrack::GetESDpid(Double_t *p) const {
1710 // Gets probability of each particle type for the ESD track
1711 for (Int_t i=0; i<AliPID::kSPECIES; i++) p[i]=fR[i];
1714 //_______________________________________________________________________
1715 Bool_t AliESDtrack::RelateToVertexTPC(const AliESDVertex *vtx,
1716 Double_t b, Double_t maxd, AliExternalTrackParam *cParam) {
1718 // Try to relate the TPC-only track parameters to the vertex "vtx",
1719 // if the (rough) transverse impact parameter is not bigger then "maxd".
1720 // Magnetic field is "b" (kG).
1722 // a) The TPC-only paramters are extapolated to the DCA to the vertex.
1723 // b) The impact parameters and their covariance matrix are calculated.
1724 // c) An attempt to constrain the TPC-only params to the vertex is done.
1725 // The constrained params are returned via "cParam".
1727 // In the case of success, the returned value is kTRUE
1728 // otherwise, it's kFALSE)
1731 if (!fTPCInner) return kFALSE;
1732 if (!vtx) return kFALSE;
1734 Double_t dz[2],cov[3];
1735 if (!fTPCInner->PropagateToDCA(vtx, b, maxd, dz, cov)) return kFALSE;
1743 Double_t covar[6]; vtx->GetCovMatrix(covar);
1744 Double_t p[2]={GetParameter()[0]-dz[0],GetParameter()[1]-dz[1]};
1745 Double_t c[3]={covar[2],0.,covar[5]};
1747 Double_t chi2=GetPredictedChi2(p,c);
1748 if (chi2>kVeryBig) return kFALSE;
1752 if (!cParam) return kTRUE;
1754 *cParam = *fTPCInner;
1755 if (!cParam->Update(p,c)) return kFALSE;
1760 //_______________________________________________________________________
1761 Bool_t AliESDtrack::RelateToVertex(const AliESDVertex *vtx,
1762 Double_t b, Double_t maxd, AliExternalTrackParam *cParam) {
1764 // Try to relate this track to the vertex "vtx",
1765 // if the (rough) transverse impact parameter is not bigger then "maxd".
1766 // Magnetic field is "b" (kG).
1768 // a) The track gets extapolated to the DCA to the vertex.
1769 // b) The impact parameters and their covariance matrix are calculated.
1770 // c) An attempt to constrain this track to the vertex is done.
1771 // The constrained params are returned via "cParam".
1773 // In the case of success, the returned value is kTRUE
1774 // (otherwise, it's kFALSE)
1777 if (!vtx) return kFALSE;
1779 Double_t dz[2],cov[3];
1780 if (!PropagateToDCA(vtx, b, maxd, dz, cov)) return kFALSE;
1788 Double_t covar[6]; vtx->GetCovMatrix(covar);
1789 Double_t p[2]={GetParameter()[0]-dz[0],GetParameter()[1]-dz[1]};
1790 Double_t c[3]={covar[2],0.,covar[5]};
1792 Double_t chi2=GetPredictedChi2(p,c);
1793 if (chi2>kVeryBig) return kFALSE;
1798 //--- Could now these lines be removed ? ---
1800 fCp=new AliExternalTrackParam(*this);
1802 if (!fCp->Update(p,c)) {delete fCp; fCp=0; return kFALSE;}
1803 //----------------------------------------
1806 if (!cParam) return kTRUE;
1809 if (!cParam->Update(p,c)) return kFALSE;
1814 //_______________________________________________________________________
1815 void AliESDtrack::Print(Option_t *) const {
1816 // Prints info on the track
1817 AliExternalTrackParam::Print();
1818 printf("ESD track info\n") ;
1819 Double_t p[AliPID::kSPECIESN] ;
1821 if( IsOn(kITSpid) ){
1822 printf("From ITS: ") ;
1824 for(index = 0 ; index < AliPID::kSPECIES; index++)
1825 printf("%f, ", p[index]) ;
1826 printf("\n signal = %f\n", GetITSsignal()) ;
1828 if( IsOn(kTPCpid) ){
1829 printf("From TPC: ") ;
1831 for(index = 0 ; index < AliPID::kSPECIES; index++)
1832 printf("%f, ", p[index]) ;
1833 printf("\n signal = %f\n", GetTPCsignal()) ;
1835 if( IsOn(kTRDpid) ){
1836 printf("From TRD: ") ;
1838 for(index = 0 ; index < AliPID::kSPECIES; index++)
1839 printf("%f, ", p[index]) ;
1840 printf("\n signal = %f\n", GetTRDsignal()) ;
1842 if( IsOn(kTOFpid) ){
1843 printf("From TOF: ") ;
1845 for(index = 0 ; index < AliPID::kSPECIES; index++)
1846 printf("%f, ", p[index]) ;
1847 printf("\n signal = %f\n", GetTOFsignal()) ;
1849 if( IsOn(kHMPIDpid) ){
1850 printf("From HMPID: ") ;
1852 for(index = 0 ; index < AliPID::kSPECIES; index++)
1853 printf("%f, ", p[index]) ;
1854 printf("\n signal = %f\n", GetHMPIDsignal()) ;
1860 // Draw functionality
1861 // Origin: Marian Ivanov, Marian.Ivanov@cern.ch
1863 void AliESDtrack::FillPolymarker(TPolyMarker3D *pol, Float_t magF, Float_t minR, Float_t maxR, Float_t stepR){
1865 // Fill points in the polymarker
1868 arrayRef.AddLast(new AliExternalTrackParam(*this));
1869 if (fIp) arrayRef.AddLast(new AliExternalTrackParam(*fIp));
1870 if (fOp) arrayRef.AddLast(new AliExternalTrackParam(*fOp));
1872 Double_t mpos[3]={0,0,0};
1873 Int_t entries=arrayRef.GetEntries();
1874 for (Int_t i=0;i<entries;i++){
1876 ((AliExternalTrackParam*)arrayRef.At(i))->GetXYZ(pos);
1877 mpos[0]+=pos[0]/entries;
1878 mpos[1]+=pos[1]/entries;
1879 mpos[2]+=pos[2]/entries;
1881 // Rotate to the mean position
1883 Float_t fi= TMath::ATan2(mpos[1],mpos[0]);
1884 for (Int_t i=0;i<entries;i++){
1885 Bool_t res = ((AliExternalTrackParam*)arrayRef.At(i))->Rotate(fi);
1886 if (!res) delete arrayRef.RemoveAt(i);
1889 for (Double_t r=minR; r<maxR; r+=stepR){
1891 Double_t mlpos[3]={0,0,0};
1892 for (Int_t i=0;i<entries;i++){
1893 Double_t point[3]={0,0,0};
1894 AliExternalTrackParam *param = ((AliExternalTrackParam*)arrayRef.At(i));
1895 if (!param) continue;
1896 if (param->GetXYZAt(r,magF,point)){
1897 Double_t weight = 1./(10.+(r-param->GetX())*(r-param->GetX()));
1899 mlpos[0]+=point[0]*weight;
1900 mlpos[1]+=point[1]*weight;
1901 mlpos[2]+=point[2]*weight;
1908 pol->SetPoint(counter,mlpos[0],mlpos[1], mlpos[2]);
1909 printf("xyz\t%f\t%f\t%f\n",mlpos[0], mlpos[1],mlpos[2]);