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),
219 // The default ESD constructor
222 for (i=0; i<AliPID::kSPECIES; i++) {
232 for (i=0; i<3; i++) { fKinkIndexes[i]=0;}
233 for (i=0; i<3; i++) { fV0Indexes[i]=0;}
234 for (i=0;i<kTRDnPlanes;i++) {
237 for (i=0;i<4;i++) {fTPCPoints[i]=0;}
238 for (i=0;i<3;i++) {fTOFLabel[i]=0;}
239 for (i=0;i<10;i++) {fTOFInfo[i]=0;}
240 for (i=0;i<12;i++) {fITSModule[i]=-1;}
243 //_______________________________________________________________________
244 AliESDtrack::AliESDtrack(const AliESDtrack& track):
245 AliExternalTrackParam(track),
251 fTPCClusterMap(track.fTPCClusterMap),
252 fTPCSharedMap(track.fTPCSharedMap),
253 fFlags(track.fFlags),
255 fLabel(track.fLabel),
256 fITSLabel(track.fITSLabel),
257 fTPCLabel(track.fTPCLabel),
258 fTRDLabel(track.fTRDLabel),
259 fTOFCalChannel(track.fTOFCalChannel),
260 fTOFindex(track.fTOFindex),
261 fHMPIDqn(track.fHMPIDqn),
262 fHMPIDcluIdx(track.fHMPIDcluIdx),
263 fEMCALindex(track.fEMCALindex),
264 fHMPIDtrkTheta(track.fHMPIDtrkTheta),
265 fHMPIDtrkPhi(track.fHMPIDtrkPhi),
266 fHMPIDsignal(track.fHMPIDsignal),
267 fTrackLength(track.fTrackLength),
268 fdTPC(track.fdTPC),fzTPC(track.fzTPC),
269 fCddTPC(track.fCddTPC),fCdzTPC(track.fCdzTPC),fCzzTPC(track.fCzzTPC),
270 fCchi2TPC(track.fCchi2TPC),
271 fD(track.fD),fZ(track.fZ),
272 fCdd(track.fCdd),fCdz(track.fCdz),fCzz(track.fCzz),
273 fCchi2(track.fCchi2),
274 fITSchi2(track.fITSchi2),
275 fTPCchi2(track.fTPCchi2),
276 fTRDchi2(track.fTRDchi2),
277 fTOFchi2(track.fTOFchi2),
278 fHMPIDchi2(track.fHMPIDchi2),
279 fITSsignal(track.fITSsignal),
280 fTPCsignal(track.fTPCsignal),
281 fTPCsignalS(track.fTPCsignalS),
282 fTRDsignal(track.fTRDsignal),
283 fTRDQuality(track.fTRDQuality),
284 fTRDBudget(track.fTRDBudget),
285 fTOFsignal(track.fTOFsignal),
286 fTOFsignalToT(track.fTOFsignalToT),
287 fTOFsignalRaw(track.fTOFsignalRaw),
288 fTOFsignalDz(track.fTOFsignalDz),
289 fHMPIDtrkX(track.fHMPIDtrkX),
290 fHMPIDtrkY(track.fHMPIDtrkY),
291 fHMPIDmipX(track.fHMPIDmipX),
292 fHMPIDmipY(track.fHMPIDmipY),
293 fTPCncls(track.fTPCncls),
294 fTPCnclsF(track.fTPCnclsF),
295 fTPCsignalN(track.fTPCsignalN),
296 fITSncls(track.fITSncls),
297 fITSClusterMap(track.fITSClusterMap),
298 fTRDncls(track.fTRDncls),
299 fTRDncls0(track.fTRDncls0),
300 fTRDpidQuality(track.fTRDpidQuality),
301 fTRDnSlices(track.fTRDnSlices),
307 for (Int_t i=0;i<AliPID::kSPECIES;i++) fTrackTime[i]=track.fTrackTime[i];
308 for (Int_t i=0;i<AliPID::kSPECIES;i++) fR[i]=track.fR[i];
310 for (Int_t i=0;i<AliPID::kSPECIES;i++) fITSr[i]=track.fITSr[i];
312 for (Int_t i=0;i<AliPID::kSPECIES;i++) fTPCr[i]=track.fTPCr[i];
313 for (Int_t i=0;i<4;i++) {fTPCPoints[i]=track.fTPCPoints[i];}
314 for (Int_t i=0; i<3;i++) { fKinkIndexes[i]=track.fKinkIndexes[i];}
315 for (Int_t i=0; i<3;i++) { fV0Indexes[i]=track.fV0Indexes[i];}
317 for (Int_t i=0;i<kTRDnPlanes;i++) {
318 fTRDTimBin[i]=track.fTRDTimBin[i];
322 fTRDslices=new Double32_t[fTRDnSlices];
323 for (Int_t i=0; i<fTRDnSlices; i++) fTRDslices[i]=track.fTRDslices[i];
326 for (Int_t i=0;i<AliPID::kSPECIES;i++) fTRDr[i]=track.fTRDr[i];
327 for (Int_t i=0;i<AliPID::kSPECIES;i++) fTOFr[i]=track.fTOFr[i];
328 for (Int_t i=0;i<3;i++) fTOFLabel[i]=track.fTOFLabel[i];
329 for (Int_t i=0;i<10;i++) fTOFInfo[i]=track.fTOFInfo[i];
330 for (Int_t i=0;i<12;i++) fITSModule[i]=track.fITSModule[i];
331 for (Int_t i=0;i<AliPID::kSPECIES;i++) fHMPIDr[i]=track.fHMPIDr[i];
333 if (track.fCp) fCp=new AliExternalTrackParam(*track.fCp);
334 if (track.fIp) fIp=new AliExternalTrackParam(*track.fIp);
335 if (track.fTPCInner) fTPCInner=new AliExternalTrackParam(*track.fTPCInner);
336 if (track.fOp) fOp=new AliExternalTrackParam(*track.fOp);
338 if (track.fFriendTrack) fFriendTrack=new AliESDfriendTrack(*(track.fFriendTrack));
341 //_______________________________________________________________________
342 AliESDtrack::AliESDtrack(const AliVTrack *track) :
343 AliExternalTrackParam(track),
349 fTPCClusterMap(159),//number of padrows
350 fTPCSharedMap(159),//number of padrows
361 fEMCALindex(kEMCALNoMatch),
367 fCddTPC(0),fCdzTPC(0),fCzzTPC(0),
370 fCdd(0),fCdz(0),fCzz(0),
403 // ESD track from AliVTrack
406 // Reset all the arrays
408 for (i=0; i<AliPID::kSPECIES; i++) {
418 for (i=0; i<3; i++) { fKinkIndexes[i]=0;}
419 for (i=0; i<3; i++) { fV0Indexes[i]=-1;}
420 for (i=0;i<kTRDnPlanes;i++) {
423 for (i=0;i<4;i++) {fTPCPoints[i]=0;}
424 for (i=0;i<3;i++) {fTOFLabel[i]=0;}
425 for (i=0;i<10;i++) {fTOFInfo[i]=0;}
426 for (i=0;i<12;i++) {fITSModule[i]=-1;}
429 SetID(track->GetID());
431 // Set ITS cluster map
432 fITSClusterMap=track->GetITSClusterMap();
436 if(HasPointOnITSLayer(i)) fITSncls++;
439 // Set the combined PID
440 const Double_t *pid = track->PID();
442 for (i=0; i<AliPID::kSPECIES; i++) fR[i]=pid[i];
444 // AliESD track label
445 SetLabel(track->GetLabel());
447 SetStatus(track->GetStatus());
450 //_______________________________________________________________________
451 AliESDtrack::AliESDtrack(TParticle * part) :
452 AliExternalTrackParam(),
458 fTPCClusterMap(159),//number of padrows
459 fTPCSharedMap(159),//number of padrows
470 fEMCALindex(kEMCALNoMatch),
476 fCddTPC(0),fCdzTPC(0),fCzzTPC(0),
479 fCdd(0),fCdz(0),fCzz(0),
512 // ESD track from TParticle
515 // Reset all the arrays
517 for (i=0; i<AliPID::kSPECIES; i++) {
527 for (i=0; i<3; i++) { fKinkIndexes[i]=0;}
528 for (i=0; i<3; i++) { fV0Indexes[i]=-1;}
529 for (i=0;i<kTRDnPlanes;i++) {
532 for (i=0;i<4;i++) {fTPCPoints[i]=0;}
533 for (i=0;i<3;i++) {fTOFLabel[i]=0;}
534 for (i=0;i<10;i++) {fTOFInfo[i]=0;}
535 for (i=0;i<12;i++) {fITSModule[i]=-1;}
537 // Calculate the AliExternalTrackParam content
544 // Calculate alpha: the rotation angle of the corresponding local system (TPC sector)
545 alpha = part->Phi()*180./TMath::Pi();
546 if (alpha<0) alpha+= 360.;
547 if (alpha>360) alpha -= 360.;
549 Int_t sector = (Int_t)(alpha/20.);
550 alpha = 10. + 20.*sector;
552 alpha *= TMath::Pi();
554 // Covariance matrix: no errors, the parameters are exact
555 for (i=0; i<15; i++) covar[i]=0.;
557 // Get the vertex of origin and the momentum
558 TVector3 ver(part->Vx(),part->Vy(),part->Vz());
559 TVector3 mom(part->Px(),part->Py(),part->Pz());
561 // Rotate to the local coordinate system (TPC sector)
565 // X of the referense plane
568 Int_t pdgCode = part->GetPdgCode();
571 TDatabasePDG::Instance()->GetParticle(pdgCode)->Charge();
575 param[2] = TMath::Sin(mom.Phi());
576 param[3] = mom.Pz()/mom.Pt();
577 param[4] = TMath::Sign(1/mom.Pt(),charge);
579 // Set AliExternalTrackParam
580 Set(xref, alpha, param, covar);
585 switch (TMath::Abs(pdgCode)) {
611 // If the particle is not e,mu,pi,K or p the PID probabilities are set to 0
612 if (indexPID < AliPID::kSPECIES) {
618 fHMPIDr[indexPID]=1.;
621 // AliESD track label
622 SetLabel(part->GetUniqueID());
626 //_______________________________________________________________________
627 AliESDtrack::~AliESDtrack(){
629 // This is destructor according Coding Conventrions
631 //printf("Delete track\n");
641 AliESDtrack &AliESDtrack::operator=(const AliESDtrack &source){
644 if(&source == this) return *this;
645 AliExternalTrackParam::operator=(source);
649 // we have the trackparam: assign or copy construct
650 if(fCp)*fCp = *source.fCp;
651 else fCp = new AliExternalTrackParam(*source.fCp);
654 // no track param delete the old one
660 // we have the trackparam: assign or copy construct
661 if(fIp)*fIp = *source.fIp;
662 else fIp = new AliExternalTrackParam(*source.fIp);
665 // no track param delete the old one
671 if(source.fTPCInner){
672 // we have the trackparam: assign or copy construct
673 if(fTPCInner) *fTPCInner = *source.fTPCInner;
674 else fTPCInner = new AliExternalTrackParam(*source.fTPCInner);
677 // no track param delete the old one
678 if(fTPCInner)delete fTPCInner;
684 // we have the trackparam: assign or copy construct
685 if(fOp) *fOp = *source.fOp;
686 else fOp = new AliExternalTrackParam(*source.fOp);
689 // no track param delete the old one
694 // copy also the friend track
695 // use copy constructor
696 if(source.fFriendTrack){
697 // we have the trackparam: assign or copy construct
698 delete fFriendTrack; fFriendTrack=new AliESDfriendTrack(*source.fFriendTrack);
701 // no track param delete the old one
702 delete fFriendTrack; fFriendTrack= 0;
705 fTPCClusterMap = source.fTPCClusterMap;
706 fTPCSharedMap = source.fTPCSharedMap;
708 fFlags = source.fFlags;
710 fLabel = source.fLabel;
711 fITSLabel = source.fITSLabel;
712 for(int i = 0; i< 12;++i){
713 fITSModule[i] = source.fITSModule[i];
715 fTPCLabel = source.fTPCLabel;
716 fTRDLabel = source.fTRDLabel;
717 for(int i = 0; i< 3;++i){
718 fTOFLabel[i] = source.fTOFLabel[i];
720 fTOFCalChannel = source.fTOFCalChannel;
721 fTOFindex = source.fTOFindex;
722 fHMPIDqn = source.fHMPIDqn;
723 fHMPIDcluIdx = source.fHMPIDcluIdx;
724 fEMCALindex = source.fEMCALindex;
726 for(int i = 0; i< 3;++i){
727 fKinkIndexes[i] = source.fKinkIndexes[i];
728 fV0Indexes[i] = source.fV0Indexes[i];
731 for(int i = 0; i< AliPID::kSPECIES;++i){
732 fR[i] = source.fR[i];
733 fITSr[i] = source.fITSr[i];
734 fTPCr[i] = source.fTPCr[i];
735 fTRDr[i] = source.fTRDr[i];
736 fTOFr[i] = source.fTOFr[i];
737 fHMPIDr[i] = source.fHMPIDr[i];
738 fTrackTime[i] = source.fTrackTime[i];
741 fHMPIDtrkTheta = source.fHMPIDtrkTheta;
742 fHMPIDtrkPhi = source.fHMPIDtrkPhi;
743 fHMPIDsignal = source.fHMPIDsignal;
746 fTrackLength = source. fTrackLength;
747 fdTPC = source.fdTPC;
748 fzTPC = source.fzTPC;
749 fCddTPC = source.fCddTPC;
750 fCdzTPC = source.fCdzTPC;
751 fCzzTPC = source.fCzzTPC;
752 fCchi2TPC = source.fCchi2TPC;
759 fCchi2 = source.fCchi2;
761 fITSchi2 = source.fITSchi2;
762 fTPCchi2 = source.fTPCchi2;
763 fTRDchi2 = source.fTRDchi2;
764 fTOFchi2 = source.fTOFchi2;
765 fHMPIDchi2 = source.fHMPIDchi2;
768 fITSsignal = source.fITSsignal;
769 fTPCsignal = source.fTPCsignal;
770 fTPCsignalS = source.fTPCsignalS;
771 for(int i = 0; i< 4;++i){
772 fTPCPoints[i] = source.fTPCPoints[i];
774 fTRDsignal = source.fTRDsignal;
776 for(int i = 0;i < kTRDnPlanes;++i){
777 fTRDTimBin[i] = source.fTRDTimBin[i];
783 fTRDnSlices=source.fTRDnSlices;
785 fTRDslices=new Double32_t[fTRDnSlices];
786 for(int j = 0;j < fTRDnSlices;++j) fTRDslices[j] = source.fTRDslices[j];
789 fTRDQuality = source.fTRDQuality;
790 fTRDBudget = source.fTRDBudget;
791 fTOFsignal = source.fTOFsignal;
792 fTOFsignalToT = source.fTOFsignalToT;
793 fTOFsignalRaw = source.fTOFsignalRaw;
794 fTOFsignalDz = source.fTOFsignalDz;
796 for(int i = 0;i<10;++i){
797 fTOFInfo[i] = source.fTOFInfo[i];
800 fHMPIDtrkX = source.fHMPIDtrkX;
801 fHMPIDtrkY = source.fHMPIDtrkY;
802 fHMPIDmipX = source.fHMPIDmipX;
803 fHMPIDmipY = source.fHMPIDmipY;
805 fTPCncls = source.fTPCncls;
806 fTPCnclsF = source.fTPCnclsF;
807 fTPCsignalN = source.fTPCsignalN;
809 fITSncls = source.fITSncls;
810 fITSClusterMap = source.fITSClusterMap;
811 fTRDncls = source.fTRDncls;
812 fTRDncls0 = source.fTRDncls0;
813 fTRDpidQuality = source.fTRDpidQuality;
819 void AliESDtrack::Copy(TObject &obj) const {
821 // this overwrites the virtual TOBject::Copy()
822 // to allow run time copying without casting
825 if(this==&obj)return;
826 AliESDtrack *robj = dynamic_cast<AliESDtrack*>(&obj);
827 if(!robj)return; // not an AliESDtrack
834 void AliESDtrack::AddCalibObject(TObject * object){
836 // add calib object to the list
838 if (!fFriendTrack) fFriendTrack = new AliESDfriendTrack;
839 fFriendTrack->AddCalibObject(object);
842 TObject * AliESDtrack::GetCalibObject(Int_t index){
844 // return calib objct at given position
846 if (!fFriendTrack) return 0;
847 return fFriendTrack->GetCalibObject(index);
851 Bool_t AliESDtrack::FillTPCOnlyTrack(AliESDtrack &track){
853 // Fills the information of the TPC-only first reconstruction pass
854 // into the passed ESDtrack object. For consistency fTPCInner is also filled
859 // For data produced before r26675
860 // RelateToVertexTPC was not properly called during reco
861 // so you'll have to call it again, before FillTPCOnlyTrack
862 // Float_t p[2],cov[3];
863 // track->GetImpactParametersTPC(p,cov);
864 // if(p[0]==0&&p[1]==0) // <- Default values
865 // track->RelateToVertexTPC(esd->GetPrimaryVertexTPC(),esd->GetMagneticField(),kVeryBig);
868 if(!fTPCInner)return kFALSE;
870 // fill the TPC track params to the global track parameters
871 track.Set(fTPCInner->GetX(),fTPCInner->GetAlpha(),fTPCInner->GetParameter(),fTPCInner->GetCovariance());
874 track.fCdd = fCddTPC;
875 track.fCdz = fCdzTPC;
876 track.fCzz = fCzzTPC;
878 // copy the TPCinner parameters
879 if(track.fTPCInner) *track.fTPCInner = *fTPCInner;
880 else track.fTPCInner = new AliExternalTrackParam(*fTPCInner);
883 track.fCddTPC = fCddTPC;
884 track.fCdzTPC = fCdzTPC;
885 track.fCzzTPC = fCzzTPC;
886 track.fCchi2TPC = fCchi2TPC;
889 // copy all other TPC specific parameters
891 // replace label by TPC label
892 track.fLabel = fTPCLabel;
893 track.fTPCLabel = fTPCLabel;
895 track.fTPCchi2 = fTPCchi2;
896 track.fTPCsignal = fTPCsignal;
897 track.fTPCsignalS = fTPCsignalS;
898 for(int i = 0;i<4;++i)track.fTPCPoints[i] = fTPCPoints[i];
900 track.fTPCncls = fTPCncls;
901 track.fTPCnclsF = fTPCnclsF;
902 track.fTPCsignalN = fTPCsignalN;
905 for(int i=0;i<AliPID::kSPECIES;++i){
906 track.fTPCr[i] = fTPCr[i];
907 // combined PID is TPC only!
908 track.fR[i] = fTPCr[i];
910 track.fTPCClusterMap = fTPCClusterMap;
911 track.fTPCSharedMap = fTPCSharedMap;
915 track.fFlags = kTPCin;
918 track.fFlags |= fFlags & kTPCpid; //copy the TPCpid status flag
920 for (Int_t i=0;i<3;i++) track.fKinkIndexes[i] = fKinkIndexes[i];
926 //_______________________________________________________________________
927 void AliESDtrack::MakeMiniESDtrack(){
928 // Resets everything except
929 // fFlags: Reconstruction status flags
930 // fLabel: Track label
931 // fID: Unique ID of the track
932 // Impact parameter information
933 // fR[AliPID::kSPECIES]: combined "detector response probability"
934 // Running track parameters in the base class (AliExternalTrackParam)
938 for (Int_t i=0;i<AliPID::kSPECIES;i++) fTrackTime[i] = 0;
940 // Reset track parameters constrained to the primary vertex
943 // Reset track parameters at the inner wall of TPC
945 delete fTPCInner;fTPCInner=0;
946 // Reset track parameters at the inner wall of the TRD
950 // Reset ITS track related information
955 for (Int_t i=0;i<AliPID::kSPECIES;i++) fITSr[i]=0;
958 // Reset TPC related track information
967 for (Int_t i=0;i<AliPID::kSPECIES;i++) fTPCr[i]=0;
969 for (Int_t i=0;i<4;i++) fTPCPoints[i] = 0;
970 for (Int_t i=0; i<3;i++) fKinkIndexes[i] = 0;
971 for (Int_t i=0; i<3;i++) fV0Indexes[i] = 0;
973 // Reset TRD related track information
978 for (Int_t i=0;i<kTRDnPlanes;i++) {
981 for (Int_t i=0;i<AliPID::kSPECIES;i++) fTRDr[i] = 0;
991 // Reset TOF related track information
999 for (Int_t i=0;i<AliPID::kSPECIES;i++) fTOFr[i] = 0;
1000 for (Int_t i=0;i<3;i++) fTOFLabel[i] = 0;
1001 for (Int_t i=0;i<10;i++) fTOFInfo[i] = 0;
1003 // Reset HMPID related track information
1008 for (Int_t i=0;i<AliPID::kSPECIES;i++) fHMPIDr[i] = 0;
1015 fEMCALindex = kEMCALNoMatch;
1017 delete fFriendTrack; fFriendTrack = 0;
1019 //_______________________________________________________________________
1020 Double_t AliESDtrack::GetMass() const {
1021 // Returns the mass of the most probable particle type
1024 for (Int_t i=0; i<AliPID::kSPECIES; i++) {
1025 if (fR[i]>max) {k=i; max=fR[i];}
1027 if (k==0) { // dE/dx "crossing points" in the TPC
1029 if ((p>0.38)&&(p<0.48))
1030 if (fR[0]<fR[3]*10.) return AliPID::ParticleMass(AliPID::kKaon);
1031 if ((p>0.75)&&(p<0.85))
1032 if (fR[0]<fR[4]*10.) return AliPID::ParticleMass(AliPID::kProton);
1035 if (k==1) return AliPID::ParticleMass(AliPID::kMuon);
1036 if (k==2||k==-1) return AliPID::ParticleMass(AliPID::kPion);
1037 if (k==3) return AliPID::ParticleMass(AliPID::kKaon);
1038 if (k==4) return AliPID::ParticleMass(AliPID::kProton);
1039 AliWarning("Undefined mass !");
1040 return AliPID::ParticleMass(AliPID::kPion);
1043 //______________________________________________________________________________
1044 Double_t AliESDtrack::E() const
1046 // Returns the energy of the particle given its assumed mass.
1047 // Assumes the pion mass if the particle can't be identified properly.
1051 return TMath::Sqrt(p*p + m*m);
1054 //______________________________________________________________________________
1055 Double_t AliESDtrack::Y() const
1057 // Returns the rapidity of a particle given its assumed mass.
1058 // Assumes the pion mass if the particle can't be identified properly.
1062 if (e != TMath::Abs(pz)) { // energy was not equal to pz
1063 return 0.5*TMath::Log((e+pz)/(e-pz));
1064 } else { // energy was equal to pz
1069 //_______________________________________________________________________
1070 Bool_t AliESDtrack::UpdateTrackParams(const AliKalmanTrack *t, ULong_t flags){
1072 // This function updates track's running parameters
1078 fLabel=t->GetLabel();
1080 if (t->IsStartedTimeIntegral()) {
1082 Double_t times[10];t->GetIntegratedTimes(times); SetIntegratedTimes(times);
1083 SetIntegratedLength(t->GetIntegratedLength());
1086 Set(t->GetX(),t->GetAlpha(),t->GetParameter(),t->GetCovariance());
1090 case kITSin: case kITSout: case kITSrefit:
1092 fITSncls=t->GetNumberOfClusters();
1093 index=fFriendTrack->GetITSindices();
1094 for (Int_t i=0;i<AliESDfriendTrack::kMaxITScluster;i++) {
1095 index[i]=t->GetClusterIndex(i);
1097 Int_t l=(index[i] & 0xf0000000) >> 28;
1098 SETBIT(fITSClusterMap,l);
1101 fITSchi2=t->GetChi2();
1102 fITSsignal=t->GetPIDsignal();
1103 fITSLabel = t->GetLabel();
1104 // keep in fOp the parameters outside ITS for ITS stand-alone tracks
1105 if (flags==kITSout) {
1106 if (!fOp) fOp=new AliExternalTrackParam(*t);
1108 fOp->Set(t->GetX(),t->GetAlpha(),t->GetParameter(),t->GetCovariance());
1112 case kTPCin: case kTPCrefit:
1113 fTPCLabel = t->GetLabel();
1114 if (flags==kTPCin) fTPCInner=new AliExternalTrackParam(*t);
1115 if (!fIp) fIp=new AliExternalTrackParam(*t);
1117 fIp->Set(t->GetX(),t->GetAlpha(),t->GetParameter(),t->GetCovariance());
1119 index=fFriendTrack->GetTPCindices();
1120 if (flags & kTPCout){
1121 if (!fOp) fOp=new AliExternalTrackParam(*t);
1123 fOp->Set(t->GetX(),t->GetAlpha(),t->GetParameter(),t->GetCovariance());
1125 fTPCncls=t->GetNumberOfClusters();
1126 fTPCchi2=t->GetChi2();
1128 {//prevrow must be declared in separate namespace, otherwise compiler cries:
1129 //"jump to case label crosses initialization of `Int_t prevrow'"
1131 // for (Int_t i=0;i<fTPCncls;i++)
1132 for (Int_t i=0;i<AliESDfriendTrack::kMaxTPCcluster;i++)
1134 index[i]=t->GetClusterIndex(i);
1135 Int_t idx = index[i];
1137 if (idx<0) continue;
1139 // Piotr's Cluster Map for HBT
1140 // ### please change accordingly if cluster array is changing
1141 // to "New TPC Tracking" style (with gaps in array)
1142 Int_t sect = (idx&0xff000000)>>24;
1143 Int_t row = (idx&0x00ff0000)>>16;
1144 if (sect > 18) row +=63; //if it is outer sector, add number of inner sectors
1146 fTPCClusterMap.SetBitNumber(row,kTRUE);
1148 //Fill the gap between previous row and this row with 0 bits
1149 //In case ### pleas change it as well - just set bit 0 in case there
1150 //is no associated clusters for current "i"
1153 prevrow = row;//if previous bit was not assigned yet == this is the first one
1156 { //we don't know the order (inner to outer or reverse)
1157 //just to be save in case it is going to change
1170 for (Int_t j = n+1; j < m; j++)
1172 fTPCClusterMap.SetBitNumber(j,kFALSE);
1176 // End Of Piotr's Cluster Map for HBT
1179 fTPCsignal=t->GetPIDsignal();
1182 case kTRDout: case kTRDin: case kTRDrefit:
1183 index = fFriendTrack->GetTRDindices();
1184 fTRDLabel = t->GetLabel();
1185 fTRDchi2 = t->GetChi2();
1186 fTRDncls = t->GetNumberOfClusters();
1187 for (Int_t i=0;i<6;i++) index[i]=t->GetTrackletIndex(i);
1189 fTRDsignal=t->GetPIDsignal();
1192 if (!fOp) fOp=new AliExternalTrackParam(*t);
1194 fOp->Set(t->GetX(),t->GetAlpha(),t->GetParameter(),t->GetCovariance());
1195 fTRDncls0 = t->GetNumberOfClusters();
1204 AliError("Wrong flag !");
1211 //_______________________________________________________________________
1212 void AliESDtrack::GetExternalParameters(Double_t &x, Double_t p[5]) const {
1213 //---------------------------------------------------------------------
1214 // This function returns external representation of the track parameters
1215 //---------------------------------------------------------------------
1217 for (Int_t i=0; i<5; i++) p[i]=GetParameter()[i];
1220 //_______________________________________________________________________
1221 void AliESDtrack::GetExternalCovariance(Double_t cov[15]) const {
1222 //---------------------------------------------------------------------
1223 // This function returns external representation of the cov. matrix
1224 //---------------------------------------------------------------------
1225 for (Int_t i=0; i<15; i++) cov[i]=AliExternalTrackParam::GetCovariance()[i];
1228 //_______________________________________________________________________
1229 Bool_t AliESDtrack::GetConstrainedExternalParameters
1230 (Double_t &alpha, Double_t &x, Double_t p[5]) const {
1231 //---------------------------------------------------------------------
1232 // This function returns the constrained external track parameters
1233 //---------------------------------------------------------------------
1234 if (!fCp) return kFALSE;
1235 alpha=fCp->GetAlpha();
1237 for (Int_t i=0; i<5; i++) p[i]=fCp->GetParameter()[i];
1241 //_______________________________________________________________________
1243 AliESDtrack::GetConstrainedExternalCovariance(Double_t c[15]) const {
1244 //---------------------------------------------------------------------
1245 // This function returns the constrained external cov. matrix
1246 //---------------------------------------------------------------------
1247 if (!fCp) return kFALSE;
1248 for (Int_t i=0; i<15; i++) c[i]=fCp->GetCovariance()[i];
1253 AliESDtrack::GetInnerExternalParameters
1254 (Double_t &alpha, Double_t &x, Double_t p[5]) const {
1255 //---------------------------------------------------------------------
1256 // This function returns external representation of the track parameters
1257 // at the inner layer of TPC
1258 //---------------------------------------------------------------------
1259 if (!fIp) return kFALSE;
1260 alpha=fIp->GetAlpha();
1262 for (Int_t i=0; i<5; i++) p[i]=fIp->GetParameter()[i];
1267 AliESDtrack::GetInnerExternalCovariance(Double_t cov[15]) const {
1268 //---------------------------------------------------------------------
1269 // This function returns external representation of the cov. matrix
1270 // at the inner layer of TPC
1271 //---------------------------------------------------------------------
1272 if (!fIp) return kFALSE;
1273 for (Int_t i=0; i<15; i++) cov[i]=fIp->GetCovariance()[i];
1278 AliESDtrack::SetOuterParam(const AliExternalTrackParam *p, ULong_t flags) {
1280 // This is a direct setter for the outer track parameters
1283 if (fOp) delete fOp;
1284 fOp=new AliExternalTrackParam(*p);
1288 AliESDtrack::GetOuterExternalParameters
1289 (Double_t &alpha, Double_t &x, Double_t p[5]) const {
1290 //---------------------------------------------------------------------
1291 // This function returns external representation of the track parameters
1292 // at the inner layer of TRD
1293 //---------------------------------------------------------------------
1294 if (!fOp) return kFALSE;
1295 alpha=fOp->GetAlpha();
1297 for (Int_t i=0; i<5; i++) p[i]=fOp->GetParameter()[i];
1302 AliESDtrack::GetOuterExternalCovariance(Double_t cov[15]) const {
1303 //---------------------------------------------------------------------
1304 // This function returns external representation of the cov. matrix
1305 // at the inner layer of TRD
1306 //---------------------------------------------------------------------
1307 if (!fOp) return kFALSE;
1308 for (Int_t i=0; i<15; i++) cov[i]=fOp->GetCovariance()[i];
1312 Int_t AliESDtrack::GetNcls(Int_t idet) const
1314 // Get number of clusters by subdetector index
1328 if (fTOFindex != -1)
1334 if ((fHMPIDcluIdx >= 0) && (fHMPIDcluIdx < 7000000)) {
1335 if ((fHMPIDcluIdx%1000000 != 9999) && (fHMPIDcluIdx%1000000 != 99999)) {
1346 Int_t AliESDtrack::GetClusters(Int_t idet, Int_t *idx) const
1348 // Get cluster index array by subdetector index
1353 ncls = GetITSclusters(idx);
1356 ncls = GetTPCclusters(idx);
1359 ncls = GetTRDclusters(idx);
1362 if (fTOFindex != -1) {
1370 if ((fHMPIDcluIdx >= 0) && (fHMPIDcluIdx < 7000000)) {
1371 if ((fHMPIDcluIdx%1000000 != 9999) && (fHMPIDcluIdx%1000000 != 99999)) {
1372 idx[0] = GetHMPIDcluIdx();
1385 //_______________________________________________________________________
1386 void AliESDtrack::GetIntegratedTimes(Double_t *times) const {
1387 // Returns the array with integrated times for each particle hypothesis
1388 for (Int_t i=0; i<AliPID::kSPECIES; i++) times[i]=fTrackTime[i];
1391 //_______________________________________________________________________
1392 void AliESDtrack::SetIntegratedTimes(const Double_t *times) {
1393 // Sets the array with integrated times for each particle hypotesis
1394 for (Int_t i=0; i<AliPID::kSPECIES; i++) fTrackTime[i]=times[i];
1397 //_______________________________________________________________________
1398 void AliESDtrack::SetITSpid(const Double_t *p) {
1399 // Sets values for the probability of each particle type (in ITS)
1400 SetPIDValues(fITSr,p,AliPID::kSPECIES);
1401 SetStatus(AliESDtrack::kITSpid);
1404 //_______________________________________________________________________
1405 void AliESDtrack::GetITSpid(Double_t *p) const {
1406 // Gets the probability of each particle type (in ITS)
1407 for (Int_t i=0; i<AliPID::kSPECIES; i++) p[i]=fITSr[i];
1410 //_______________________________________________________________________
1411 Char_t AliESDtrack::GetITSclusters(Int_t *idx) const {
1412 //---------------------------------------------------------------------
1413 // This function returns indices of the assgined ITS clusters
1414 //---------------------------------------------------------------------
1416 Int_t *index=fFriendTrack->GetITSindices();
1417 for (Int_t i=0; i<AliESDfriendTrack::kMaxITScluster; i++) {
1418 if ( (i>=fITSncls) && (i<6) ) idx[i]=-1;
1419 else idx[i]=index[i];
1425 //_______________________________________________________________________
1426 Bool_t AliESDtrack::GetITSModuleIndexInfo(Int_t ilayer,Int_t &idet,Int_t &status,
1427 Float_t &xloc,Float_t &zloc) const {
1428 //----------------------------------------------------------------------
1429 // This function encodes in the module number also the status of cluster association
1430 // "status" can have the following values:
1431 // 1 "found" (cluster is associated),
1432 // 2 "dead" (module is dead from OCDB),
1433 // 3 "skipped" (module or layer forced to be skipped),
1434 // 4 "outinz" (track out of z acceptance),
1435 // 5 "nocls" (no clusters in the road),
1436 // 6 "norefit" (cluster rejected during refit),
1437 // 7 "deadzspd" (holes in z in SPD)
1438 // Also given are the coordinates of the crossing point of track and module
1439 // (in the local module ref. system)
1440 // WARNING: THIS METHOD HAS TO BE SYNCHRONIZED WITH AliITStrackV2::GetModuleIndexInfo()!
1441 //----------------------------------------------------------------------
1443 if(fITSModule[ilayer]==-1) {
1446 xloc=-99.; zloc=-99.;
1450 Int_t module = fITSModule[ilayer];
1452 idet = Int_t(module/1000000);
1454 module -= idet*1000000;
1456 status = Int_t(module/100000);
1458 module -= status*100000;
1460 Int_t signs = Int_t(module/10000);
1462 module-=signs*10000;
1464 Int_t xInt = Int_t(module/100);
1467 Int_t zInt = module;
1469 if(signs==1) { xInt*=1; zInt*=1; }
1470 if(signs==2) { xInt*=1; zInt*=-1; }
1471 if(signs==3) { xInt*=-1; zInt*=1; }
1472 if(signs==4) { xInt*=-1; zInt*=-1; }
1474 xloc = 0.1*(Float_t)xInt;
1475 zloc = 0.1*(Float_t)zInt;
1477 if(status==4) idet = -1;
1482 //_______________________________________________________________________
1483 UShort_t AliESDtrack::GetTPCclusters(Int_t *idx) const {
1484 //---------------------------------------------------------------------
1485 // This function returns indices of the assgined ITS clusters
1486 //---------------------------------------------------------------------
1488 Int_t *index=fFriendTrack->GetTPCindices();
1489 for (Int_t i=0; i<AliESDfriendTrack::kMaxTPCcluster; i++) idx[i]=index[i];
1494 Double_t AliESDtrack::GetTPCdensity(Int_t row0, Int_t row1) const{
1496 // GetDensity of the clusters on given region between row0 and row1
1497 // Dead zone effect takin into acoount
1502 Int_t *index=fFriendTrack->GetTPCindices();
1503 for (Int_t i=row0;i<=row1;i++){
1504 Int_t idx = index[i];
1505 if (idx!=-1) good++; // track outside of dead zone
1508 Float_t density=0.5;
1509 if (good>(row1-row0)*0.5) density = Float_t(found)/Float_t(good);
1513 //_______________________________________________________________________
1514 void AliESDtrack::SetTPCpid(const Double_t *p) {
1515 // Sets values for the probability of each particle type (in TPC)
1516 SetPIDValues(fTPCr,p,AliPID::kSPECIES);
1517 SetStatus(AliESDtrack::kTPCpid);
1520 //_______________________________________________________________________
1521 void AliESDtrack::GetTPCpid(Double_t *p) const {
1522 // Gets the probability of each particle type (in TPC)
1523 for (Int_t i=0; i<AliPID::kSPECIES; i++) p[i]=fTPCr[i];
1526 //_______________________________________________________________________
1527 UChar_t AliESDtrack::GetTRDclusters(Int_t *idx) const {
1528 //---------------------------------------------------------------------
1529 // This function returns indices of the assgined TRD clusters
1530 //---------------------------------------------------------------------
1532 Int_t *index=fFriendTrack->GetTRDindices();
1533 for (Int_t i=0; i<AliESDfriendTrack::kMaxTRDcluster; i++) idx[i]=index[i];
1538 //_______________________________________________________________________
1539 UChar_t AliESDtrack::GetTRDtracklets(Int_t *idx) const {
1540 //---------------------------------------------------------------------
1541 // This function returns indices of the assigned TRD tracklets
1542 //---------------------------------------------------------------------
1544 Int_t *index=fFriendTrack->GetTRDindices();
1545 for (Int_t i=0; i<6/*AliESDfriendTrack::kMaxTRDcluster*/; i++) idx[i]=index[i];
1550 //_______________________________________________________________________
1551 void AliESDtrack::SetTRDpid(const Double_t *p) {
1552 // Sets values for the probability of each particle type (in TRD)
1553 SetPIDValues(fTRDr,p,AliPID::kSPECIES);
1554 SetStatus(AliESDtrack::kTRDpid);
1557 //_______________________________________________________________________
1558 void AliESDtrack::GetTRDpid(Double_t *p) const {
1559 // Gets the probability of each particle type (in TRD)
1560 for (Int_t i=0; i<AliPID::kSPECIES; i++) p[i]=fTRDr[i];
1563 //_______________________________________________________________________
1564 void AliESDtrack::SetTRDpid(Int_t iSpecies, Float_t p)
1566 // Sets the probability of particle type iSpecies to p (in TRD)
1567 fTRDr[iSpecies] = p;
1570 Double_t AliESDtrack::GetTRDpid(Int_t iSpecies) const
1572 // Returns the probability of particle type iSpecies (in TRD)
1573 return fTRDr[iSpecies];
1576 void AliESDtrack::SetNumberOfTRDslices(Int_t n) {
1577 //Sets the number of slices used for PID
1578 if (fTRDnSlices != 0) return;
1579 fTRDnSlices=kTRDnPlanes*n;
1580 fTRDslices=new Double32_t[fTRDnSlices];
1581 for (Int_t i=0; i<fTRDnSlices; i++) fTRDslices[i]=-1.;
1584 void AliESDtrack::SetTRDslice(Double_t q, Int_t plane, Int_t slice) {
1585 //Sets the charge q in the slice of the plane
1586 Int_t ns=GetNumberOfTRDslices();
1588 AliError("No TRD slices allocated for this track !");
1592 if ((plane<0) || (plane>=kTRDnPlanes)) {
1593 AliError("Wrong TRD plane !");
1596 if ((slice<0) || (slice>=ns)) {
1597 AliError("Wrong TRD slice !");
1600 Int_t n=plane*ns + slice;
1604 Double_t AliESDtrack::GetTRDslice(Int_t plane, Int_t slice) const {
1605 //Gets the charge from the slice of the plane
1606 Int_t ns=GetNumberOfTRDslices();
1608 //AliError("No TRD slices allocated for this track !");
1612 if ((plane<0) || (plane>=kTRDnPlanes)) {
1613 AliError("Wrong TRD plane !");
1616 if ((slice<-1) || (slice>=ns)) {
1617 //AliError("Wrong TRD slice !");
1623 for (Int_t i=0; i<ns; i++) q+=fTRDslices[plane*ns + i];
1627 return fTRDslices[plane*ns + slice];
1631 //_______________________________________________________________________
1632 void AliESDtrack::SetTOFpid(const Double_t *p) {
1633 // Sets the probability of each particle type (in TOF)
1634 SetPIDValues(fTOFr,p,AliPID::kSPECIES);
1635 SetStatus(AliESDtrack::kTOFpid);
1638 //_______________________________________________________________________
1639 void AliESDtrack::SetTOFLabel(const Int_t *p) {
1641 for (Int_t i=0; i<3; i++) fTOFLabel[i]=p[i];
1644 //_______________________________________________________________________
1645 void AliESDtrack::GetTOFpid(Double_t *p) const {
1646 // Gets probabilities of each particle type (in TOF)
1647 for (Int_t i=0; i<AliPID::kSPECIES; i++) p[i]=fTOFr[i];
1650 //_______________________________________________________________________
1651 void AliESDtrack::GetTOFLabel(Int_t *p) const {
1653 for (Int_t i=0; i<3; i++) p[i]=fTOFLabel[i];
1656 //_______________________________________________________________________
1657 void AliESDtrack::GetTOFInfo(Float_t *info) const {
1659 for (Int_t i=0; i<10; i++) info[i]=fTOFInfo[i];
1662 //_______________________________________________________________________
1663 void AliESDtrack::SetTOFInfo(Float_t*info) {
1665 for (Int_t i=0; i<10; i++) fTOFInfo[i]=info[i];
1670 //_______________________________________________________________________
1671 void AliESDtrack::SetHMPIDpid(const Double_t *p) {
1672 // Sets the probability of each particle type (in HMPID)
1673 SetPIDValues(fHMPIDr,p,AliPID::kSPECIES);
1674 SetStatus(AliESDtrack::kHMPIDpid);
1677 //_______________________________________________________________________
1678 void AliESDtrack::GetHMPIDpid(Double_t *p) const {
1679 // Gets probabilities of each particle type (in HMPID)
1680 for (Int_t i=0; i<AliPID::kSPECIES; i++) p[i]=fHMPIDr[i];
1685 //_______________________________________________________________________
1686 void AliESDtrack::SetESDpid(const Double_t *p) {
1687 // Sets the probability of each particle type for the ESD track
1688 SetPIDValues(fR,p,AliPID::kSPECIES);
1689 SetStatus(AliESDtrack::kESDpid);
1692 //_______________________________________________________________________
1693 void AliESDtrack::GetESDpid(Double_t *p) const {
1694 // Gets probability of each particle type for the ESD track
1695 for (Int_t i=0; i<AliPID::kSPECIES; i++) p[i]=fR[i];
1698 //_______________________________________________________________________
1699 Bool_t AliESDtrack::RelateToVertexTPC(const AliESDVertex *vtx,
1700 Double_t b, Double_t maxd, AliExternalTrackParam *cParam) {
1702 // Try to relate the TPC-only track parameters to the vertex "vtx",
1703 // if the (rough) transverse impact parameter is not bigger then "maxd".
1704 // Magnetic field is "b" (kG).
1706 // a) The TPC-only paramters are extapolated to the DCA to the vertex.
1707 // b) The impact parameters and their covariance matrix are calculated.
1708 // c) An attempt to constrain the TPC-only params to the vertex is done.
1709 // The constrained params are returned via "cParam".
1711 // In the case of success, the returned value is kTRUE
1712 // otherwise, it's kFALSE)
1715 if (!fTPCInner) return kFALSE;
1716 if (!vtx) return kFALSE;
1718 Double_t dz[2],cov[3];
1719 if (!fTPCInner->PropagateToDCA(vtx, b, maxd, dz, cov)) return kFALSE;
1727 Double_t covar[6]; vtx->GetCovMatrix(covar);
1728 Double_t p[2]={GetParameter()[0]-dz[0],GetParameter()[1]-dz[1]};
1729 Double_t c[3]={covar[2],0.,covar[5]};
1731 Double_t chi2=GetPredictedChi2(p,c);
1732 if (chi2>kVeryBig) return kFALSE;
1736 if (!cParam) return kTRUE;
1738 *cParam = *fTPCInner;
1739 if (!cParam->Update(p,c)) return kFALSE;
1744 //_______________________________________________________________________
1745 Bool_t AliESDtrack::RelateToVertex(const AliESDVertex *vtx,
1746 Double_t b, Double_t maxd, AliExternalTrackParam *cParam) {
1748 // Try to relate this track to the vertex "vtx",
1749 // if the (rough) transverse impact parameter is not bigger then "maxd".
1750 // Magnetic field is "b" (kG).
1752 // a) The track gets extapolated to the DCA to the vertex.
1753 // b) The impact parameters and their covariance matrix are calculated.
1754 // c) An attempt to constrain this track to the vertex is done.
1755 // The constrained params are returned via "cParam".
1757 // In the case of success, the returned value is kTRUE
1758 // (otherwise, it's kFALSE)
1761 if (!vtx) return kFALSE;
1763 Double_t dz[2],cov[3];
1764 if (!PropagateToDCA(vtx, b, maxd, dz, cov)) return kFALSE;
1772 Double_t covar[6]; vtx->GetCovMatrix(covar);
1773 Double_t p[2]={GetParameter()[0]-dz[0],GetParameter()[1]-dz[1]};
1774 Double_t c[3]={covar[2],0.,covar[5]};
1776 Double_t chi2=GetPredictedChi2(p,c);
1777 if (chi2>kVeryBig) return kFALSE;
1782 //--- Could now these lines be removed ? ---
1784 fCp=new AliExternalTrackParam(*this);
1786 if (!fCp->Update(p,c)) {delete fCp; fCp=0; return kFALSE;}
1787 //----------------------------------------
1790 if (!cParam) return kTRUE;
1793 if (!cParam->Update(p,c)) return kFALSE;
1798 //_______________________________________________________________________
1799 void AliESDtrack::Print(Option_t *) const {
1800 // Prints info on the track
1801 AliExternalTrackParam::Print();
1802 printf("ESD track info\n") ;
1803 Double_t p[AliPID::kSPECIESN] ;
1805 if( IsOn(kITSpid) ){
1806 printf("From ITS: ") ;
1808 for(index = 0 ; index < AliPID::kSPECIES; index++)
1809 printf("%f, ", p[index]) ;
1810 printf("\n signal = %f\n", GetITSsignal()) ;
1812 if( IsOn(kTPCpid) ){
1813 printf("From TPC: ") ;
1815 for(index = 0 ; index < AliPID::kSPECIES; index++)
1816 printf("%f, ", p[index]) ;
1817 printf("\n signal = %f\n", GetTPCsignal()) ;
1819 if( IsOn(kTRDpid) ){
1820 printf("From TRD: ") ;
1822 for(index = 0 ; index < AliPID::kSPECIES; index++)
1823 printf("%f, ", p[index]) ;
1824 printf("\n signal = %f\n", GetTRDsignal()) ;
1826 if( IsOn(kTOFpid) ){
1827 printf("From TOF: ") ;
1829 for(index = 0 ; index < AliPID::kSPECIES; index++)
1830 printf("%f, ", p[index]) ;
1831 printf("\n signal = %f\n", GetTOFsignal()) ;
1833 if( IsOn(kHMPIDpid) ){
1834 printf("From HMPID: ") ;
1836 for(index = 0 ; index < AliPID::kSPECIES; index++)
1837 printf("%f, ", p[index]) ;
1838 printf("\n signal = %f\n", GetHMPIDsignal()) ;
1844 // Draw functionality
1845 // Origin: Marian Ivanov, Marian.Ivanov@cern.ch
1847 void AliESDtrack::FillPolymarker(TPolyMarker3D *pol, Float_t magF, Float_t minR, Float_t maxR, Float_t stepR){
1849 // Fill points in the polymarker
1852 arrayRef.AddLast(new AliExternalTrackParam(*this));
1853 if (fIp) arrayRef.AddLast(new AliExternalTrackParam(*fIp));
1854 if (fOp) arrayRef.AddLast(new AliExternalTrackParam(*fOp));
1856 Double_t mpos[3]={0,0,0};
1857 Int_t entries=arrayRef.GetEntries();
1858 for (Int_t i=0;i<entries;i++){
1860 ((AliExternalTrackParam*)arrayRef.At(i))->GetXYZ(pos);
1861 mpos[0]+=pos[0]/entries;
1862 mpos[1]+=pos[1]/entries;
1863 mpos[2]+=pos[2]/entries;
1865 // Rotate to the mean position
1867 Float_t fi= TMath::ATan2(mpos[1],mpos[0]);
1868 for (Int_t i=0;i<entries;i++){
1869 Bool_t res = ((AliExternalTrackParam*)arrayRef.At(i))->Rotate(fi);
1870 if (!res) delete arrayRef.RemoveAt(i);
1873 for (Double_t r=minR; r<maxR; r+=stepR){
1875 Double_t mlpos[3]={0,0,0};
1876 for (Int_t i=0;i<entries;i++){
1877 Double_t point[3]={0,0,0};
1878 AliExternalTrackParam *param = ((AliExternalTrackParam*)arrayRef.At(i));
1879 if (!param) continue;
1880 if (param->GetXYZAt(r,magF,point)){
1881 Double_t weight = 1./(10.+(r-param->GetX())*(r-param->GetX()));
1883 mlpos[0]+=point[0]*weight;
1884 mlpos[1]+=point[1]*weight;
1885 mlpos[2]+=point[2]*weight;
1892 pol->SetPoint(counter,mlpos[0],mlpos[1], mlpos[2]);
1893 printf("xyz\t%f\t%f\t%f\n",mlpos[0], mlpos[1],mlpos[2]);