1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictly for non-commercial purposes is hereby granted *
9 * without fee, provided that the above copyright notice appears in all *
10 * copies and that both the copyright notice and this permission notice *
11 * appear in the supporting documentation. The authors make no claims *
12 * about the suitability of this software for any purpose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
15 //-----------------------------------------------------------------
16 // Implementation of the ESD track class
17 // ESD = Event Summary Data
18 // This is the class to deal with during the phisics analysis of data
19 // Origin: Iouri Belikov, CERN
20 // e-mail: Jouri.Belikov@cern.ch
24 // What do you need to know before starting analysis
25 // (by Marian Ivanov: marian.ivanov@cern.ch)
29 // 1. What is the AliESDtrack
30 // 2. What informations do we store
31 // 3. How to use the information for analysis
34 // 1.AliESDtrack is the container of the information about the track/particle
35 // reconstructed during Barrel Tracking.
36 // The track information is propagated from one tracking detector to
37 // other using the functionality of AliESDtrack - Current parameters.
39 // No global fit model is used.
40 // Barrel tracking use Kalman filtering technique, it gives optimal local
41 // track parameters at given point under certian assumptions.
43 // Kalman filter take into account additional effect which are
44 // difficult to handle using global fit.
46 // a.) Multiple scattering
48 // c.) Non homogenous magnetic field
50 // In general case, following barrel detectors are contributing to
51 // the Kalman track information:
56 // In general 3 reconstruction itteration are performed:
57 // 1. Find tracks - sequence TPC->ITS
58 // 2. PropagateBack - sequence ITS->TPC->TRD -> Outer PID detectors
59 // 3. Refit invward - sequence TRD->TPC->ITS
60 // The current tracks are updated after each detector (see bellow).
61 // In specical cases a track sanpshots are stored.
64 // For some type of analysis (+visualization) track local parameters at
65 // different position are neccesary. A snapshots during the track
66 // propagation are created.
67 // (See AliExternalTrackParam class for desctiption of variables and
70 // a. Current parameters - class itself (AliExternalTrackParam)
71 // Contributors: general case TRD->TPC->ITS
72 // Preferable usage: Decission - primary or secondary track
73 // NOTICE - By default the track parameters are stored at the DCA point
74 // to the primary vertex. optimal for primary tracks,
75 // far from optimal for secondary tracks.
76 // b. Constrained parameters - Kalman information updated with
77 // the Primary vertex information
78 // Contributors: general case TRD->TPC->ITS
79 // Preferable usage: Use only for tracks selected as primary
80 // NOTICE - not real constrain - taken as additional measurement
81 // with corresponding error
83 // const AliExternalTrackParam *GetConstrainedParam() const {return fCp;}
84 // c. Inner parameters - Track parameters at inner wall of the TPC
85 // Contributors: general case TRD->TPC
87 // const AliExternalTrackParam *GetInnerParam() const { return fIp;}
89 // d. TPCinnerparam - contributors - TPC only
91 // Preferable usage: Requested for HBT study
92 // (smaller correlations as using also ITS information)
93 // NOTICE - the track parameters are propagated to the DCA to
95 // Optimal for primary, far from optimal for secondary tracks
97 // const AliExternalTrackParam *GetTPCInnerParam() const {return fTPCInner;}
99 // e. Outer parameters -
100 // Contributors- general case - ITS-> TPC -> TRD
101 // The last point - Outer parameters radius is determined
102 // e.a) Local inclination angle bigger than threshold -
103 // Low momenta tracks
104 // e.a) Catastrofic energy losss in material
105 // e.b) Not further improvement (no space points)
107 // a.) Tracking: Starting parameter for Refit inward
110 // NOTICE: Should be not used for the physic analysis
112 // const AliExternalTrackParam *GetOuterParam() const { return fOp;}
114 //-----------------------------------------------------------------
117 #include <TParticle.h>
119 #include "AliESDVertex.h"
120 #include "AliESDtrack.h"
121 #include "AliKalmanTrack.h"
122 #include "AliVTrack.h"
124 #include "AliTrackPointArray.h"
125 #include "TPolyMarker3D.h"
127 ClassImp(AliESDtrack)
129 void SetPIDValues(Double_t * dest, const Double_t * src, Int_t n) {
130 // This function copies "n" PID weights from "scr" to "dest"
131 // and normalizes their sum to 1 thus producing conditional probabilities.
132 // The negative weights are set to 0.
133 // In case all the weights are non-positive they are replaced by
134 // uniform probabilities
138 Float_t uniform = 1./(Float_t)n;
141 for (Int_t i=0; i<n; i++)
151 for (Int_t i=0; i<n; i++) dest[i] /= sum;
153 for (Int_t i=0; i<n; i++) dest[i] = uniform;
156 //_______________________________________________________________________
157 AliESDtrack::AliESDtrack() :
158 AliExternalTrackParam(),
163 fFriendTrack(new AliESDfriendTrack()),
164 fTPCClusterMap(159),//number of padrows
165 fTPCSharedMap(159),//number of padrows
176 fEMCALindex(kEMCALNoMatch),
182 fCddTPC(0),fCdzTPC(0),fCzzTPC(0),
185 fCdd(0),fCdz(0),fCzz(0),
217 fVertexID(-2) // -2 means an orphan track
220 // The default ESD constructor
223 for (i=0; i<AliPID::kSPECIES; i++) {
233 for (i=0; i<3; i++) { fKinkIndexes[i]=0;}
234 for (i=0; i<3; i++) { fV0Indexes[i]=0;}
235 for (i=0;i<kTRDnPlanes;i++) {
238 for (i=0;i<4;i++) {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 fTRDntracklets(track.fTRDntracklets),
303 fTRDnSlices(track.fTRDnSlices),
305 fVertexID(track.fVertexID)
310 for (Int_t i=0;i<AliPID::kSPECIES;i++) fTrackTime[i]=track.fTrackTime[i];
311 for (Int_t i=0;i<AliPID::kSPECIES;i++) fR[i]=track.fR[i];
313 for (Int_t i=0;i<AliPID::kSPECIES;i++) fITSr[i]=track.fITSr[i];
315 for (Int_t i=0;i<AliPID::kSPECIES;i++) fTPCr[i]=track.fTPCr[i];
316 for (Int_t i=0;i<4;i++) {fTPCPoints[i]=track.fTPCPoints[i];}
317 for (Int_t i=0; i<3;i++) { fKinkIndexes[i]=track.fKinkIndexes[i];}
318 for (Int_t i=0; i<3;i++) { fV0Indexes[i]=track.fV0Indexes[i];}
320 for (Int_t i=0;i<kTRDnPlanes;i++) {
321 fTRDTimBin[i]=track.fTRDTimBin[i];
325 fTRDslices=new Double32_t[fTRDnSlices];
326 for (Int_t i=0; i<fTRDnSlices; i++) fTRDslices[i]=track.fTRDslices[i];
329 for (Int_t i=0;i<AliPID::kSPECIES;i++) fTRDr[i]=track.fTRDr[i];
330 for (Int_t i=0;i<AliPID::kSPECIES;i++) fTOFr[i]=track.fTOFr[i];
331 for (Int_t i=0;i<3;i++) fTOFLabel[i]=track.fTOFLabel[i];
332 for (Int_t i=0;i<10;i++) fTOFInfo[i]=track.fTOFInfo[i];
333 for (Int_t i=0;i<12;i++) fITSModule[i]=track.fITSModule[i];
334 for (Int_t i=0;i<AliPID::kSPECIES;i++) fHMPIDr[i]=track.fHMPIDr[i];
336 if (track.fCp) fCp=new AliExternalTrackParam(*track.fCp);
337 if (track.fIp) fIp=new AliExternalTrackParam(*track.fIp);
338 if (track.fTPCInner) fTPCInner=new AliExternalTrackParam(*track.fTPCInner);
339 if (track.fOp) fOp=new AliExternalTrackParam(*track.fOp);
341 if (track.fFriendTrack) fFriendTrack=new AliESDfriendTrack(*(track.fFriendTrack));
344 //_______________________________________________________________________
345 AliESDtrack::AliESDtrack(const AliVTrack *track) :
346 AliExternalTrackParam(track),
352 fTPCClusterMap(159),//number of padrows
353 fTPCSharedMap(159),//number of padrows
364 fEMCALindex(kEMCALNoMatch),
370 fCddTPC(0),fCdzTPC(0),fCzzTPC(0),
373 fCdd(0),fCdz(0),fCzz(0),
405 fVertexID(-2) // -2 means an orphan track
408 // ESD track from AliVTrack.
409 // This is not a copy constructor !
412 if (track->InheritsFrom("AliExternalTrackParam")) {
413 AliError("This is not a copy constructor. Use AliESDtrack(const AliESDtrack &) !");
414 AliWarning("Calling the default constructor...");
419 // Reset all the arrays
421 for (i=0; i<AliPID::kSPECIES; i++) {
431 for (i=0; i<3; i++) { fKinkIndexes[i]=0;}
432 for (i=0; i<3; i++) { fV0Indexes[i]=-1;}
433 for (i=0;i<kTRDnPlanes;i++) {
436 for (i=0;i<4;i++) {fTPCPoints[i]=0;}
437 for (i=0;i<3;i++) {fTOFLabel[i]=0;}
438 for (i=0;i<10;i++) {fTOFInfo[i]=0;}
439 for (i=0;i<12;i++) {fITSModule[i]=-1;}
442 SetID(track->GetID());
444 // Set ITS cluster map
445 fITSClusterMap=track->GetITSClusterMap();
449 if(HasPointOnITSLayer(i)) fITSncls++;
452 // Set the combined PID
453 const Double_t *pid = track->PID();
455 for (i=0; i<AliPID::kSPECIES; i++) fR[i]=pid[i];
457 // AliESD track label
458 SetLabel(track->GetLabel());
460 SetStatus(track->GetStatus());
463 //_______________________________________________________________________
464 AliESDtrack::AliESDtrack(TParticle * part) :
465 AliExternalTrackParam(),
471 fTPCClusterMap(159),//number of padrows
472 fTPCSharedMap(159),//number of padrows
483 fEMCALindex(kEMCALNoMatch),
489 fCddTPC(0),fCdzTPC(0),fCzzTPC(0),
492 fCdd(0),fCdz(0),fCzz(0),
524 fVertexID(-2) // -2 means an orphan track
527 // ESD track from TParticle
530 // Reset all the arrays
532 for (i=0; i<AliPID::kSPECIES; i++) {
542 for (i=0; i<3; i++) { fKinkIndexes[i]=0;}
543 for (i=0; i<3; i++) { fV0Indexes[i]=-1;}
544 for (i=0;i<kTRDnPlanes;i++) {
547 for (i=0;i<4;i++) {fTPCPoints[i]=0;}
548 for (i=0;i<3;i++) {fTOFLabel[i]=0;}
549 for (i=0;i<10;i++) {fTOFInfo[i]=0;}
550 for (i=0;i<12;i++) {fITSModule[i]=-1;}
552 // Calculate the AliExternalTrackParam content
559 // Calculate alpha: the rotation angle of the corresponding local system (TPC sector)
560 alpha = part->Phi()*180./TMath::Pi();
561 if (alpha<0) alpha+= 360.;
562 if (alpha>360) alpha -= 360.;
564 Int_t sector = (Int_t)(alpha/20.);
565 alpha = 10. + 20.*sector;
567 alpha *= TMath::Pi();
569 // Covariance matrix: no errors, the parameters are exact
570 for (i=0; i<15; i++) covar[i]=0.;
572 // Get the vertex of origin and the momentum
573 TVector3 ver(part->Vx(),part->Vy(),part->Vz());
574 TVector3 mom(part->Px(),part->Py(),part->Pz());
576 // Rotate to the local coordinate system (TPC sector)
580 // X of the referense plane
583 Int_t pdgCode = part->GetPdgCode();
586 TDatabasePDG::Instance()->GetParticle(pdgCode)->Charge();
590 param[2] = TMath::Sin(mom.Phi());
591 param[3] = mom.Pz()/mom.Pt();
592 param[4] = TMath::Sign(1/mom.Pt(),charge);
594 // Set AliExternalTrackParam
595 Set(xref, alpha, param, covar);
600 switch (TMath::Abs(pdgCode)) {
626 // If the particle is not e,mu,pi,K or p the PID probabilities are set to 0
627 if (indexPID < AliPID::kSPECIES) {
633 fHMPIDr[indexPID]=1.;
636 // AliESD track label
637 SetLabel(part->GetUniqueID());
641 //_______________________________________________________________________
642 AliESDtrack::~AliESDtrack(){
644 // This is destructor according Coding Conventrions
646 //printf("Delete track\n");
656 AliESDtrack &AliESDtrack::operator=(const AliESDtrack &source){
659 if(&source == this) return *this;
660 AliExternalTrackParam::operator=(source);
664 // we have the trackparam: assign or copy construct
665 if(fCp)*fCp = *source.fCp;
666 else fCp = new AliExternalTrackParam(*source.fCp);
669 // no track param delete the old one
675 // we have the trackparam: assign or copy construct
676 if(fIp)*fIp = *source.fIp;
677 else fIp = new AliExternalTrackParam(*source.fIp);
680 // no track param delete the old one
686 if(source.fTPCInner){
687 // we have the trackparam: assign or copy construct
688 if(fTPCInner) *fTPCInner = *source.fTPCInner;
689 else fTPCInner = new AliExternalTrackParam(*source.fTPCInner);
692 // no track param delete the old one
693 if(fTPCInner)delete fTPCInner;
699 // we have the trackparam: assign or copy construct
700 if(fOp) *fOp = *source.fOp;
701 else fOp = new AliExternalTrackParam(*source.fOp);
704 // no track param delete the old one
709 // copy also the friend track
710 // use copy constructor
711 if(source.fFriendTrack){
712 // we have the trackparam: assign or copy construct
713 delete fFriendTrack; fFriendTrack=new AliESDfriendTrack(*source.fFriendTrack);
716 // no track param delete the old one
717 delete fFriendTrack; fFriendTrack= 0;
720 fTPCClusterMap = source.fTPCClusterMap;
721 fTPCSharedMap = source.fTPCSharedMap;
723 fFlags = source.fFlags;
725 fLabel = source.fLabel;
726 fITSLabel = source.fITSLabel;
727 for(int i = 0; i< 12;++i){
728 fITSModule[i] = source.fITSModule[i];
730 fTPCLabel = source.fTPCLabel;
731 fTRDLabel = source.fTRDLabel;
732 for(int i = 0; i< 3;++i){
733 fTOFLabel[i] = source.fTOFLabel[i];
735 fTOFCalChannel = source.fTOFCalChannel;
736 fTOFindex = source.fTOFindex;
737 fHMPIDqn = source.fHMPIDqn;
738 fHMPIDcluIdx = source.fHMPIDcluIdx;
739 fEMCALindex = source.fEMCALindex;
741 for(int i = 0; i< 3;++i){
742 fKinkIndexes[i] = source.fKinkIndexes[i];
743 fV0Indexes[i] = source.fV0Indexes[i];
746 for(int i = 0; i< AliPID::kSPECIES;++i){
747 fR[i] = source.fR[i];
748 fITSr[i] = source.fITSr[i];
749 fTPCr[i] = source.fTPCr[i];
750 fTRDr[i] = source.fTRDr[i];
751 fTOFr[i] = source.fTOFr[i];
752 fHMPIDr[i] = source.fHMPIDr[i];
753 fTrackTime[i] = source.fTrackTime[i];
756 fHMPIDtrkTheta = source.fHMPIDtrkTheta;
757 fHMPIDtrkPhi = source.fHMPIDtrkPhi;
758 fHMPIDsignal = source.fHMPIDsignal;
761 fTrackLength = source. fTrackLength;
762 fdTPC = source.fdTPC;
763 fzTPC = source.fzTPC;
764 fCddTPC = source.fCddTPC;
765 fCdzTPC = source.fCdzTPC;
766 fCzzTPC = source.fCzzTPC;
767 fCchi2TPC = source.fCchi2TPC;
774 fCchi2 = source.fCchi2;
776 fITSchi2 = source.fITSchi2;
777 fTPCchi2 = source.fTPCchi2;
778 fTRDchi2 = source.fTRDchi2;
779 fTOFchi2 = source.fTOFchi2;
780 fHMPIDchi2 = source.fHMPIDchi2;
782 fGlobalChi2 = source.fGlobalChi2;
784 fITSsignal = source.fITSsignal;
785 fTPCsignal = source.fTPCsignal;
786 fTPCsignalS = source.fTPCsignalS;
787 for(int i = 0; i< 4;++i){
788 fTPCPoints[i] = source.fTPCPoints[i];
790 fTRDsignal = source.fTRDsignal;
792 for(int i = 0;i < kTRDnPlanes;++i){
793 fTRDTimBin[i] = source.fTRDTimBin[i];
799 fTRDnSlices=source.fTRDnSlices;
801 fTRDslices=new Double32_t[fTRDnSlices];
802 for(int j = 0;j < fTRDnSlices;++j) fTRDslices[j] = source.fTRDslices[j];
805 fTRDQuality = source.fTRDQuality;
806 fTRDBudget = source.fTRDBudget;
807 fTOFsignal = source.fTOFsignal;
808 fTOFsignalToT = source.fTOFsignalToT;
809 fTOFsignalRaw = source.fTOFsignalRaw;
810 fTOFsignalDz = source.fTOFsignalDz;
812 for(int i = 0;i<10;++i){
813 fTOFInfo[i] = source.fTOFInfo[i];
816 fHMPIDtrkX = source.fHMPIDtrkX;
817 fHMPIDtrkY = source.fHMPIDtrkY;
818 fHMPIDmipX = source.fHMPIDmipX;
819 fHMPIDmipY = source.fHMPIDmipY;
821 fTPCncls = source.fTPCncls;
822 fTPCnclsF = source.fTPCnclsF;
823 fTPCsignalN = source.fTPCsignalN;
825 fITSncls = source.fITSncls;
826 fITSClusterMap = source.fITSClusterMap;
827 fTRDncls = source.fTRDncls;
828 fTRDncls0 = source.fTRDncls0;
829 fTRDntracklets = source.fTRDntracklets;
830 fVertexID = source.fVertexID;
836 void AliESDtrack::Copy(TObject &obj) const {
838 // this overwrites the virtual TOBject::Copy()
839 // to allow run time copying without casting
842 if(this==&obj)return;
843 AliESDtrack *robj = dynamic_cast<AliESDtrack*>(&obj);
844 if(!robj)return; // not an AliESDtrack
851 void AliESDtrack::AddCalibObject(TObject * object){
853 // add calib object to the list
855 if (!fFriendTrack) fFriendTrack = new AliESDfriendTrack;
856 fFriendTrack->AddCalibObject(object);
859 TObject * AliESDtrack::GetCalibObject(Int_t index){
861 // return calib objct at given position
863 if (!fFriendTrack) return 0;
864 return fFriendTrack->GetCalibObject(index);
868 Bool_t AliESDtrack::FillTPCOnlyTrack(AliESDtrack &track){
870 // Fills the information of the TPC-only first reconstruction pass
871 // into the passed ESDtrack object. For consistency fTPCInner is also filled
876 // For data produced before r26675
877 // RelateToVertexTPC was not properly called during reco
878 // so you'll have to call it again, before FillTPCOnlyTrack
879 // Float_t p[2],cov[3];
880 // track->GetImpactParametersTPC(p,cov);
881 // if(p[0]==0&&p[1]==0) // <- Default values
882 // track->RelateToVertexTPC(esd->GetPrimaryVertexTPC(),esd->GetMagneticField(),kVeryBig);
885 if(!fTPCInner)return kFALSE;
887 // fill the TPC track params to the global track parameters
888 track.Set(fTPCInner->GetX(),fTPCInner->GetAlpha(),fTPCInner->GetParameter(),fTPCInner->GetCovariance());
891 track.fCdd = fCddTPC;
892 track.fCdz = fCdzTPC;
893 track.fCzz = fCzzTPC;
895 // copy the TPCinner parameters
896 if(track.fTPCInner) *track.fTPCInner = *fTPCInner;
897 else track.fTPCInner = new AliExternalTrackParam(*fTPCInner);
900 track.fCddTPC = fCddTPC;
901 track.fCdzTPC = fCdzTPC;
902 track.fCzzTPC = fCzzTPC;
903 track.fCchi2TPC = fCchi2TPC;
906 // copy all other TPC specific parameters
908 // replace label by TPC label
909 track.fLabel = fTPCLabel;
910 track.fTPCLabel = fTPCLabel;
912 track.fTPCchi2 = fTPCchi2;
913 track.fTPCsignal = fTPCsignal;
914 track.fTPCsignalS = fTPCsignalS;
915 for(int i = 0;i<4;++i)track.fTPCPoints[i] = fTPCPoints[i];
917 track.fTPCncls = fTPCncls;
918 track.fTPCnclsF = fTPCnclsF;
919 track.fTPCsignalN = fTPCsignalN;
922 for(int i=0;i<AliPID::kSPECIES;++i){
923 track.fTPCr[i] = fTPCr[i];
924 // combined PID is TPC only!
925 track.fR[i] = fTPCr[i];
927 track.fTPCClusterMap = fTPCClusterMap;
928 track.fTPCSharedMap = fTPCSharedMap;
932 track.fFlags = kTPCin;
935 track.fFlags |= fFlags & kTPCpid; //copy the TPCpid status flag
937 for (Int_t i=0;i<3;i++) track.fKinkIndexes[i] = fKinkIndexes[i];
943 //_______________________________________________________________________
944 void AliESDtrack::MakeMiniESDtrack(){
945 // Resets everything except
946 // fFlags: Reconstruction status flags
947 // fLabel: Track label
948 // fID: Unique ID of the track
949 // Impact parameter information
950 // fR[AliPID::kSPECIES]: combined "detector response probability"
951 // Running track parameters in the base class (AliExternalTrackParam)
955 for (Int_t i=0;i<AliPID::kSPECIES;i++) fTrackTime[i] = 0;
957 // Reset track parameters constrained to the primary vertex
960 // Reset track parameters at the inner wall of TPC
962 delete fTPCInner;fTPCInner=0;
963 // Reset track parameters at the inner wall of the TRD
967 // Reset ITS track related information
972 for (Int_t i=0;i<AliPID::kSPECIES;i++) fITSr[i]=0;
975 // Reset TPC related track information
984 for (Int_t i=0;i<AliPID::kSPECIES;i++) fTPCr[i]=0;
986 for (Int_t i=0;i<4;i++) fTPCPoints[i] = 0;
987 for (Int_t i=0; i<3;i++) fKinkIndexes[i] = 0;
988 for (Int_t i=0; i<3;i++) fV0Indexes[i] = 0;
990 // Reset TRD related track information
995 for (Int_t i=0;i<kTRDnPlanes;i++) {
998 for (Int_t i=0;i<AliPID::kSPECIES;i++) fTRDr[i] = 0;
1003 delete[] fTRDslices;
1008 // Reset TOF related track information
1016 for (Int_t i=0;i<AliPID::kSPECIES;i++) fTOFr[i] = 0;
1017 for (Int_t i=0;i<3;i++) fTOFLabel[i] = 0;
1018 for (Int_t i=0;i<10;i++) fTOFInfo[i] = 0;
1020 // Reset HMPID related track information
1025 for (Int_t i=0;i<AliPID::kSPECIES;i++) fHMPIDr[i] = 0;
1032 fEMCALindex = kEMCALNoMatch;
1034 // reset global track chi2
1037 fVertexID = -2; // an orphan track
1039 delete fFriendTrack; fFriendTrack = 0;
1041 //_______________________________________________________________________
1042 Double_t AliESDtrack::GetMass() const {
1043 // Returns the mass of the most probable particle type
1046 for (Int_t i=0; i<AliPID::kSPECIES; i++) {
1047 if (fR[i]>max) {k=i; max=fR[i];}
1049 if (k==0) { // dE/dx "crossing points" in the TPC
1051 if ((p>0.38)&&(p<0.48))
1052 if (fR[0]<fR[3]*10.) return AliPID::ParticleMass(AliPID::kKaon);
1053 if ((p>0.75)&&(p<0.85))
1054 if (fR[0]<fR[4]*10.) return AliPID::ParticleMass(AliPID::kProton);
1057 if (k==1) return AliPID::ParticleMass(AliPID::kMuon);
1058 if (k==2||k==-1) return AliPID::ParticleMass(AliPID::kPion);
1059 if (k==3) return AliPID::ParticleMass(AliPID::kKaon);
1060 if (k==4) return AliPID::ParticleMass(AliPID::kProton);
1061 AliWarning("Undefined mass !");
1062 return AliPID::ParticleMass(AliPID::kPion);
1065 //______________________________________________________________________________
1066 Double_t AliESDtrack::E() const
1068 // Returns the energy of the particle given its assumed mass.
1069 // Assumes the pion mass if the particle can't be identified properly.
1073 return TMath::Sqrt(p*p + m*m);
1076 //______________________________________________________________________________
1077 Double_t AliESDtrack::Y() const
1079 // Returns the rapidity of a particle given its assumed mass.
1080 // Assumes the pion mass if the particle can't be identified properly.
1084 if (e != TMath::Abs(pz)) { // energy was not equal to pz
1085 return 0.5*TMath::Log((e+pz)/(e-pz));
1086 } else { // energy was equal to pz
1091 //_______________________________________________________________________
1092 Bool_t AliESDtrack::UpdateTrackParams(const AliKalmanTrack *t, ULong_t flags){
1094 // This function updates track's running parameters
1100 fLabel=t->GetLabel();
1102 if (t->IsStartedTimeIntegral()) {
1104 Double_t times[10];t->GetIntegratedTimes(times); SetIntegratedTimes(times);
1105 SetIntegratedLength(t->GetIntegratedLength());
1108 Set(t->GetX(),t->GetAlpha(),t->GetParameter(),t->GetCovariance());
1109 if (flags==kITSout) fFriendTrack->SetITSOut(*t);
1110 if (flags==kTPCout) fFriendTrack->SetTPCOut(*t);
1111 if (flags==kTRDin || flags==kTRDrefit) fFriendTrack->SetTRDIn(*t);
1115 case kITSin: case kITSout: case kITSrefit:
1117 fITSncls=t->GetNumberOfClusters();
1118 index=fFriendTrack->GetITSindices();
1119 for (Int_t i=0;i<AliESDfriendTrack::kMaxITScluster;i++) {
1120 index[i]=t->GetClusterIndex(i);
1122 Int_t l=(index[i] & 0xf0000000) >> 28;
1123 SETBIT(fITSClusterMap,l);
1126 fITSchi2=t->GetChi2();
1127 fITSsignal=t->GetPIDsignal();
1128 fITSLabel = t->GetLabel();
1129 // keep in fOp the parameters outside ITS for ITS stand-alone tracks
1130 if (flags==kITSout) {
1131 if (!fOp) fOp=new AliExternalTrackParam(*t);
1133 fOp->Set(t->GetX(),t->GetAlpha(),t->GetParameter(),t->GetCovariance());
1137 case kTPCin: case kTPCrefit:
1138 fTPCLabel = t->GetLabel();
1139 if (flags==kTPCin) fTPCInner=new AliExternalTrackParam(*t);
1140 if (!fIp) fIp=new AliExternalTrackParam(*t);
1142 fIp->Set(t->GetX(),t->GetAlpha(),t->GetParameter(),t->GetCovariance());
1144 index=fFriendTrack->GetTPCindices();
1145 if (flags & kTPCout){
1146 if (!fOp) fOp=new AliExternalTrackParam(*t);
1148 fOp->Set(t->GetX(),t->GetAlpha(),t->GetParameter(),t->GetCovariance());
1150 fTPCncls=t->GetNumberOfClusters();
1151 fTPCchi2=t->GetChi2();
1153 {//prevrow must be declared in separate namespace, otherwise compiler cries:
1154 //"jump to case label crosses initialization of `Int_t prevrow'"
1156 // for (Int_t i=0;i<fTPCncls;i++)
1157 for (Int_t i=0;i<AliESDfriendTrack::kMaxTPCcluster;i++)
1159 index[i]=t->GetClusterIndex(i);
1160 Int_t idx = index[i];
1162 if (idx<0) continue;
1164 // Piotr's Cluster Map for HBT
1165 // ### please change accordingly if cluster array is changing
1166 // to "New TPC Tracking" style (with gaps in array)
1167 Int_t sect = (idx&0xff000000)>>24;
1168 Int_t row = (idx&0x00ff0000)>>16;
1169 if (sect > 18) row +=63; //if it is outer sector, add number of inner sectors
1171 fTPCClusterMap.SetBitNumber(row,kTRUE);
1173 //Fill the gap between previous row and this row with 0 bits
1174 //In case ### pleas change it as well - just set bit 0 in case there
1175 //is no associated clusters for current "i"
1178 prevrow = row;//if previous bit was not assigned yet == this is the first one
1181 { //we don't know the order (inner to outer or reverse)
1182 //just to be save in case it is going to change
1195 for (Int_t j = n+1; j < m; j++)
1197 fTPCClusterMap.SetBitNumber(j,kFALSE);
1201 // End Of Piotr's Cluster Map for HBT
1204 fTPCsignal=t->GetPIDsignal();
1207 case kTRDin: case kTRDrefit:
1210 index = fFriendTrack->GetTRDindices();
1211 fTRDLabel = t->GetLabel();
1212 fTRDchi2 = t->GetChi2();
1213 fTRDncls = t->GetNumberOfClusters();
1214 for (Int_t i=0;i<6;i++) index[i]=t->GetTrackletIndex(i);
1216 fTRDsignal=t->GetPIDsignal();
1219 if (!fOp) fOp=new AliExternalTrackParam(*t);
1221 fOp->Set(t->GetX(),t->GetAlpha(),t->GetParameter(),t->GetCovariance());
1222 fTRDncls0 = t->GetNumberOfClusters();
1231 AliError("Wrong flag !");
1238 //_______________________________________________________________________
1239 void AliESDtrack::GetExternalParameters(Double_t &x, Double_t p[5]) const {
1240 //---------------------------------------------------------------------
1241 // This function returns external representation of the track parameters
1242 //---------------------------------------------------------------------
1244 for (Int_t i=0; i<5; i++) p[i]=GetParameter()[i];
1247 //_______________________________________________________________________
1248 void AliESDtrack::GetExternalCovariance(Double_t cov[15]) const {
1249 //---------------------------------------------------------------------
1250 // This function returns external representation of the cov. matrix
1251 //---------------------------------------------------------------------
1252 for (Int_t i=0; i<15; i++) cov[i]=AliExternalTrackParam::GetCovariance()[i];
1255 //_______________________________________________________________________
1256 Bool_t AliESDtrack::GetConstrainedExternalParameters
1257 (Double_t &alpha, Double_t &x, Double_t p[5]) const {
1258 //---------------------------------------------------------------------
1259 // This function returns the constrained external track parameters
1260 //---------------------------------------------------------------------
1261 if (!fCp) return kFALSE;
1262 alpha=fCp->GetAlpha();
1264 for (Int_t i=0; i<5; i++) p[i]=fCp->GetParameter()[i];
1268 //_______________________________________________________________________
1270 AliESDtrack::GetConstrainedExternalCovariance(Double_t c[15]) const {
1271 //---------------------------------------------------------------------
1272 // This function returns the constrained external cov. matrix
1273 //---------------------------------------------------------------------
1274 if (!fCp) return kFALSE;
1275 for (Int_t i=0; i<15; i++) c[i]=fCp->GetCovariance()[i];
1280 AliESDtrack::GetInnerExternalParameters
1281 (Double_t &alpha, Double_t &x, Double_t p[5]) const {
1282 //---------------------------------------------------------------------
1283 // This function returns external representation of the track parameters
1284 // at the inner layer of TPC
1285 //---------------------------------------------------------------------
1286 if (!fIp) return kFALSE;
1287 alpha=fIp->GetAlpha();
1289 for (Int_t i=0; i<5; i++) p[i]=fIp->GetParameter()[i];
1294 AliESDtrack::GetInnerExternalCovariance(Double_t cov[15]) const {
1295 //---------------------------------------------------------------------
1296 // This function returns external representation of the cov. matrix
1297 // at the inner layer of TPC
1298 //---------------------------------------------------------------------
1299 if (!fIp) return kFALSE;
1300 for (Int_t i=0; i<15; i++) cov[i]=fIp->GetCovariance()[i];
1305 AliESDtrack::SetOuterParam(const AliExternalTrackParam *p, ULong_t flags) {
1307 // This is a direct setter for the outer track parameters
1310 if (fOp) delete fOp;
1311 fOp=new AliExternalTrackParam(*p);
1315 AliESDtrack::GetOuterExternalParameters
1316 (Double_t &alpha, Double_t &x, Double_t p[5]) const {
1317 //---------------------------------------------------------------------
1318 // This function returns external representation of the track parameters
1319 // at the inner layer of TRD
1320 //---------------------------------------------------------------------
1321 if (!fOp) return kFALSE;
1322 alpha=fOp->GetAlpha();
1324 for (Int_t i=0; i<5; i++) p[i]=fOp->GetParameter()[i];
1329 AliESDtrack::GetOuterExternalCovariance(Double_t cov[15]) const {
1330 //---------------------------------------------------------------------
1331 // This function returns external representation of the cov. matrix
1332 // at the inner layer of TRD
1333 //---------------------------------------------------------------------
1334 if (!fOp) return kFALSE;
1335 for (Int_t i=0; i<15; i++) cov[i]=fOp->GetCovariance()[i];
1339 Int_t AliESDtrack::GetNcls(Int_t idet) const
1341 // Get number of clusters by subdetector index
1355 if (fTOFindex != -1)
1361 if ((fHMPIDcluIdx >= 0) && (fHMPIDcluIdx < 7000000)) {
1362 if ((fHMPIDcluIdx%1000000 != 9999) && (fHMPIDcluIdx%1000000 != 99999)) {
1373 Int_t AliESDtrack::GetClusters(Int_t idet, Int_t *idx) const
1375 // Get cluster index array by subdetector index
1380 ncls = GetITSclusters(idx);
1383 ncls = GetTPCclusters(idx);
1386 ncls = GetTRDclusters(idx);
1389 if (fTOFindex != -1) {
1397 if ((fHMPIDcluIdx >= 0) && (fHMPIDcluIdx < 7000000)) {
1398 if ((fHMPIDcluIdx%1000000 != 9999) && (fHMPIDcluIdx%1000000 != 99999)) {
1399 idx[0] = GetHMPIDcluIdx();
1412 //_______________________________________________________________________
1413 void AliESDtrack::GetIntegratedTimes(Double_t *times) const {
1414 // Returns the array with integrated times for each particle hypothesis
1415 for (Int_t i=0; i<AliPID::kSPECIES; i++) times[i]=fTrackTime[i];
1418 //_______________________________________________________________________
1419 void AliESDtrack::SetIntegratedTimes(const Double_t *times) {
1420 // Sets the array with integrated times for each particle hypotesis
1421 for (Int_t i=0; i<AliPID::kSPECIES; i++) fTrackTime[i]=times[i];
1424 //_______________________________________________________________________
1425 void AliESDtrack::SetITSpid(const Double_t *p) {
1426 // Sets values for the probability of each particle type (in ITS)
1427 SetPIDValues(fITSr,p,AliPID::kSPECIES);
1428 SetStatus(AliESDtrack::kITSpid);
1431 //_______________________________________________________________________
1432 void AliESDtrack::GetITSpid(Double_t *p) const {
1433 // Gets the probability of each particle type (in ITS)
1434 for (Int_t i=0; i<AliPID::kSPECIES; i++) p[i]=fITSr[i];
1437 //_______________________________________________________________________
1438 Char_t AliESDtrack::GetITSclusters(Int_t *idx) const {
1439 //---------------------------------------------------------------------
1440 // This function returns indices of the assgined ITS clusters
1441 //---------------------------------------------------------------------
1443 Int_t *index=fFriendTrack->GetITSindices();
1444 for (Int_t i=0; i<AliESDfriendTrack::kMaxITScluster; i++) {
1445 if ( (i>=fITSncls) && (i<6) ) idx[i]=-1;
1446 else idx[i]=index[i];
1452 //_______________________________________________________________________
1453 Bool_t AliESDtrack::GetITSModuleIndexInfo(Int_t ilayer,Int_t &idet,Int_t &status,
1454 Float_t &xloc,Float_t &zloc) const {
1455 //----------------------------------------------------------------------
1456 // This function encodes in the module number also the status of cluster association
1457 // "status" can have the following values:
1458 // 1 "found" (cluster is associated),
1459 // 2 "dead" (module is dead from OCDB),
1460 // 3 "skipped" (module or layer forced to be skipped),
1461 // 4 "outinz" (track out of z acceptance),
1462 // 5 "nocls" (no clusters in the road),
1463 // 6 "norefit" (cluster rejected during refit),
1464 // 7 "deadzspd" (holes in z in SPD)
1465 // Also given are the coordinates of the crossing point of track and module
1466 // (in the local module ref. system)
1467 // WARNING: THIS METHOD HAS TO BE SYNCHRONIZED WITH AliITStrackV2::GetModuleIndexInfo()!
1468 //----------------------------------------------------------------------
1470 if(fITSModule[ilayer]==-1) {
1473 xloc=-99.; zloc=-99.;
1477 Int_t module = fITSModule[ilayer];
1479 idet = Int_t(module/1000000);
1481 module -= idet*1000000;
1483 status = Int_t(module/100000);
1485 module -= status*100000;
1487 Int_t signs = Int_t(module/10000);
1489 module-=signs*10000;
1491 Int_t xInt = Int_t(module/100);
1494 Int_t zInt = module;
1496 if(signs==1) { xInt*=1; zInt*=1; }
1497 if(signs==2) { xInt*=1; zInt*=-1; }
1498 if(signs==3) { xInt*=-1; zInt*=1; }
1499 if(signs==4) { xInt*=-1; zInt*=-1; }
1501 xloc = 0.1*(Float_t)xInt;
1502 zloc = 0.1*(Float_t)zInt;
1504 if(status==4) idet = -1;
1509 //_______________________________________________________________________
1510 UShort_t AliESDtrack::GetTPCclusters(Int_t *idx) const {
1511 //---------------------------------------------------------------------
1512 // This function returns indices of the assgined ITS clusters
1513 //---------------------------------------------------------------------
1515 Int_t *index=fFriendTrack->GetTPCindices();
1516 for (Int_t i=0; i<AliESDfriendTrack::kMaxTPCcluster; i++) idx[i]=index[i];
1521 Double_t AliESDtrack::GetTPCdensity(Int_t row0, Int_t row1) const{
1523 // GetDensity of the clusters on given region between row0 and row1
1524 // Dead zone effect takin into acoount
1529 Int_t *index=fFriendTrack->GetTPCindices();
1530 for (Int_t i=row0;i<=row1;i++){
1531 Int_t idx = index[i];
1532 if (idx!=-1) good++; // track outside of dead zone
1535 Float_t density=0.5;
1536 if (good>(row1-row0)*0.5) density = Float_t(found)/Float_t(good);
1540 //_______________________________________________________________________
1541 void AliESDtrack::SetTPCpid(const Double_t *p) {
1542 // Sets values for the probability of each particle type (in TPC)
1543 SetPIDValues(fTPCr,p,AliPID::kSPECIES);
1544 SetStatus(AliESDtrack::kTPCpid);
1547 //_______________________________________________________________________
1548 void AliESDtrack::GetTPCpid(Double_t *p) const {
1549 // Gets the probability of each particle type (in TPC)
1550 for (Int_t i=0; i<AliPID::kSPECIES; i++) p[i]=fTPCr[i];
1553 //_______________________________________________________________________
1554 UChar_t AliESDtrack::GetTRDclusters(Int_t *idx) const {
1555 //---------------------------------------------------------------------
1556 // This function returns indices of the assgined TRD clusters
1557 //---------------------------------------------------------------------
1559 Int_t *index=fFriendTrack->GetTRDindices();
1560 for (Int_t i=0; i<AliESDfriendTrack::kMaxTRDcluster; i++) idx[i]=index[i];
1565 //_______________________________________________________________________
1566 UChar_t AliESDtrack::GetTRDtracklets(Int_t *idx) const {
1567 //---------------------------------------------------------------------
1568 // This function returns indices of the assigned TRD tracklets
1569 //---------------------------------------------------------------------
1571 Int_t *index=fFriendTrack->GetTRDindices();
1572 for (Int_t i=0; i<6/*AliESDfriendTrack::kMaxTRDcluster*/; i++) idx[i]=index[i];
1577 //_______________________________________________________________________
1578 void AliESDtrack::SetTRDpid(const Double_t *p) {
1579 // Sets values for the probability of each particle type (in TRD)
1580 SetPIDValues(fTRDr,p,AliPID::kSPECIES);
1581 SetStatus(AliESDtrack::kTRDpid);
1584 //_______________________________________________________________________
1585 void AliESDtrack::GetTRDpid(Double_t *p) const {
1586 // Gets the probability of each particle type (in TRD)
1587 for (Int_t i=0; i<AliPID::kSPECIES; i++) p[i]=fTRDr[i];
1590 //_______________________________________________________________________
1591 void AliESDtrack::SetTRDpid(Int_t iSpecies, Float_t p)
1593 // Sets the probability of particle type iSpecies to p (in TRD)
1594 fTRDr[iSpecies] = p;
1597 Double_t AliESDtrack::GetTRDpid(Int_t iSpecies) const
1599 // Returns the probability of particle type iSpecies (in TRD)
1600 return fTRDr[iSpecies];
1603 void AliESDtrack::SetNumberOfTRDslices(Int_t n) {
1604 //Sets the number of slices used for PID
1605 if (fTRDnSlices != 0) return;
1606 fTRDnSlices=kTRDnPlanes*n;
1607 fTRDslices=new Double32_t[fTRDnSlices];
1608 for (Int_t i=0; i<fTRDnSlices; i++) fTRDslices[i]=-1.;
1611 void AliESDtrack::SetTRDslice(Double_t q, Int_t plane, Int_t slice) {
1612 //Sets the charge q in the slice of the plane
1613 Int_t ns=GetNumberOfTRDslices();
1615 AliError("No TRD slices allocated for this track !");
1619 if ((plane<0) || (plane>=kTRDnPlanes)) {
1620 AliError("Wrong TRD plane !");
1623 if ((slice<0) || (slice>=ns)) {
1624 AliError("Wrong TRD slice !");
1627 Int_t n=plane*ns + slice;
1631 Double_t AliESDtrack::GetTRDslice(Int_t plane, Int_t slice) const {
1632 //Gets the charge from the slice of the plane
1633 Int_t ns=GetNumberOfTRDslices();
1635 //AliError("No TRD slices allocated for this track !");
1639 if ((plane<0) || (plane>=kTRDnPlanes)) {
1640 AliError("Wrong TRD plane !");
1643 if ((slice<-1) || (slice>=ns)) {
1644 //AliError("Wrong TRD slice !");
1650 for (Int_t i=0; i<ns; i++) q+=fTRDslices[plane*ns + i];
1654 return fTRDslices[plane*ns + slice];
1658 //_______________________________________________________________________
1659 void AliESDtrack::SetTOFpid(const Double_t *p) {
1660 // Sets the probability of each particle type (in TOF)
1661 SetPIDValues(fTOFr,p,AliPID::kSPECIES);
1662 SetStatus(AliESDtrack::kTOFpid);
1665 //_______________________________________________________________________
1666 void AliESDtrack::SetTOFLabel(const Int_t *p) {
1668 for (Int_t i=0; i<3; i++) fTOFLabel[i]=p[i];
1671 //_______________________________________________________________________
1672 void AliESDtrack::GetTOFpid(Double_t *p) const {
1673 // Gets probabilities of each particle type (in TOF)
1674 for (Int_t i=0; i<AliPID::kSPECIES; i++) p[i]=fTOFr[i];
1677 //_______________________________________________________________________
1678 void AliESDtrack::GetTOFLabel(Int_t *p) const {
1680 for (Int_t i=0; i<3; i++) p[i]=fTOFLabel[i];
1683 //_______________________________________________________________________
1684 void AliESDtrack::GetTOFInfo(Float_t *info) const {
1686 for (Int_t i=0; i<10; i++) info[i]=fTOFInfo[i];
1689 //_______________________________________________________________________
1690 void AliESDtrack::SetTOFInfo(Float_t*info) {
1692 for (Int_t i=0; i<10; i++) fTOFInfo[i]=info[i];
1697 //_______________________________________________________________________
1698 void AliESDtrack::SetHMPIDpid(const Double_t *p) {
1699 // Sets the probability of each particle type (in HMPID)
1700 SetPIDValues(fHMPIDr,p,AliPID::kSPECIES);
1701 SetStatus(AliESDtrack::kHMPIDpid);
1704 //_______________________________________________________________________
1705 void AliESDtrack::GetHMPIDpid(Double_t *p) const {
1706 // Gets probabilities of each particle type (in HMPID)
1707 for (Int_t i=0; i<AliPID::kSPECIES; i++) p[i]=fHMPIDr[i];
1712 //_______________________________________________________________________
1713 void AliESDtrack::SetESDpid(const Double_t *p) {
1714 // Sets the probability of each particle type for the ESD track
1715 SetPIDValues(fR,p,AliPID::kSPECIES);
1716 SetStatus(AliESDtrack::kESDpid);
1719 //_______________________________________________________________________
1720 void AliESDtrack::GetESDpid(Double_t *p) const {
1721 // Gets probability of each particle type for the ESD track
1722 for (Int_t i=0; i<AliPID::kSPECIES; i++) p[i]=fR[i];
1725 //_______________________________________________________________________
1726 Bool_t AliESDtrack::RelateToVertexTPC(const AliESDVertex *vtx,
1727 Double_t b, Double_t maxd, AliExternalTrackParam *cParam) {
1729 // Try to relate the TPC-only track parameters to the vertex "vtx",
1730 // if the (rough) transverse impact parameter is not bigger then "maxd".
1731 // Magnetic field is "b" (kG).
1733 // a) The TPC-only paramters are extapolated to the DCA to the vertex.
1734 // b) The impact parameters and their covariance matrix are calculated.
1735 // c) An attempt to constrain the TPC-only params to the vertex is done.
1736 // The constrained params are returned via "cParam".
1738 // In the case of success, the returned value is kTRUE
1739 // otherwise, it's kFALSE)
1742 if (!fTPCInner) return kFALSE;
1743 if (!vtx) return kFALSE;
1745 Double_t dz[2],cov[3];
1746 if (!fTPCInner->PropagateToDCA(vtx, b, maxd, dz, cov)) return kFALSE;
1754 Double_t covar[6]; vtx->GetCovMatrix(covar);
1755 Double_t p[2]={GetParameter()[0]-dz[0],GetParameter()[1]-dz[1]};
1756 Double_t c[3]={covar[2],0.,covar[5]};
1758 Double_t chi2=GetPredictedChi2(p,c);
1759 if (chi2>kVeryBig) return kFALSE;
1763 if (!cParam) return kTRUE;
1765 *cParam = *fTPCInner;
1766 if (!cParam->Update(p,c)) return kFALSE;
1771 //_______________________________________________________________________
1772 Bool_t AliESDtrack::RelateToVertex(const AliESDVertex *vtx,
1773 Double_t b, Double_t maxd, AliExternalTrackParam *cParam) {
1775 // Try to relate this track to the vertex "vtx",
1776 // if the (rough) transverse impact parameter is not bigger then "maxd".
1777 // Magnetic field is "b" (kG).
1779 // a) The track gets extapolated to the DCA to the vertex.
1780 // b) The impact parameters and their covariance matrix are calculated.
1781 // c) An attempt to constrain this track to the vertex is done.
1782 // The constrained params are returned via "cParam".
1784 // In the case of success, the returned value is kTRUE
1785 // (otherwise, it's kFALSE)
1788 if (!vtx) return kFALSE;
1790 Double_t dz[2],cov[3];
1791 if (!PropagateToDCA(vtx, b, maxd, dz, cov)) return kFALSE;
1799 Double_t covar[6]; vtx->GetCovMatrix(covar);
1800 Double_t p[2]={GetParameter()[0]-dz[0],GetParameter()[1]-dz[1]};
1801 Double_t c[3]={covar[2],0.,covar[5]};
1803 Double_t chi2=GetPredictedChi2(p,c);
1804 if (chi2>kVeryBig) return kFALSE;
1809 //--- Could now these lines be removed ? ---
1811 fCp=new AliExternalTrackParam(*this);
1813 if (!fCp->Update(p,c)) {delete fCp; fCp=0; return kFALSE;}
1814 //----------------------------------------
1816 fVertexID = vtx->GetID();
1818 if (!cParam) return kTRUE;
1821 if (!cParam->Update(p,c)) return kFALSE;
1826 //_______________________________________________________________________
1827 void AliESDtrack::Print(Option_t *) const {
1828 // Prints info on the track
1829 AliExternalTrackParam::Print();
1830 printf("ESD track info\n") ;
1831 Double_t p[AliPID::kSPECIESN] ;
1833 if( IsOn(kITSpid) ){
1834 printf("From ITS: ") ;
1836 for(index = 0 ; index < AliPID::kSPECIES; index++)
1837 printf("%f, ", p[index]) ;
1838 printf("\n signal = %f\n", GetITSsignal()) ;
1840 if( IsOn(kTPCpid) ){
1841 printf("From TPC: ") ;
1843 for(index = 0 ; index < AliPID::kSPECIES; index++)
1844 printf("%f, ", p[index]) ;
1845 printf("\n signal = %f\n", GetTPCsignal()) ;
1847 if( IsOn(kTRDpid) ){
1848 printf("From TRD: ") ;
1850 for(index = 0 ; index < AliPID::kSPECIES; index++)
1851 printf("%f, ", p[index]) ;
1852 printf("\n signal = %f\n", GetTRDsignal()) ;
1854 if( IsOn(kTOFpid) ){
1855 printf("From TOF: ") ;
1857 for(index = 0 ; index < AliPID::kSPECIES; index++)
1858 printf("%f, ", p[index]) ;
1859 printf("\n signal = %f\n", GetTOFsignal()) ;
1861 if( IsOn(kHMPIDpid) ){
1862 printf("From HMPID: ") ;
1864 for(index = 0 ; index < AliPID::kSPECIES; index++)
1865 printf("%f, ", p[index]) ;
1866 printf("\n signal = %f\n", GetHMPIDsignal()) ;
1872 // Draw functionality
1873 // Origin: Marian Ivanov, Marian.Ivanov@cern.ch
1875 void AliESDtrack::FillPolymarker(TPolyMarker3D *pol, Float_t magF, Float_t minR, Float_t maxR, Float_t stepR){
1877 // Fill points in the polymarker
1880 arrayRef.AddLast(new AliExternalTrackParam(*this));
1881 if (fIp) arrayRef.AddLast(new AliExternalTrackParam(*fIp));
1882 if (fOp) arrayRef.AddLast(new AliExternalTrackParam(*fOp));
1884 Double_t mpos[3]={0,0,0};
1885 Int_t entries=arrayRef.GetEntries();
1886 for (Int_t i=0;i<entries;i++){
1888 ((AliExternalTrackParam*)arrayRef.At(i))->GetXYZ(pos);
1889 mpos[0]+=pos[0]/entries;
1890 mpos[1]+=pos[1]/entries;
1891 mpos[2]+=pos[2]/entries;
1893 // Rotate to the mean position
1895 Float_t fi= TMath::ATan2(mpos[1],mpos[0]);
1896 for (Int_t i=0;i<entries;i++){
1897 Bool_t res = ((AliExternalTrackParam*)arrayRef.At(i))->Rotate(fi);
1898 if (!res) delete arrayRef.RemoveAt(i);
1901 for (Double_t r=minR; r<maxR; r+=stepR){
1903 Double_t mlpos[3]={0,0,0};
1904 for (Int_t i=0;i<entries;i++){
1905 Double_t point[3]={0,0,0};
1906 AliExternalTrackParam *param = ((AliExternalTrackParam*)arrayRef.At(i));
1907 if (!param) continue;
1908 if (param->GetXYZAt(r,magF,point)){
1909 Double_t weight = 1./(10.+(r-param->GetX())*(r-param->GetX()));
1911 mlpos[0]+=point[0]*weight;
1912 mlpos[1]+=point[1]*weight;
1913 mlpos[2]+=point[2]*weight;
1920 pol->SetPoint(counter,mlpos[0],mlpos[1], mlpos[2]);
1921 printf("xyz\t%f\t%f\t%f\n",mlpos[0], mlpos[1],mlpos[2]);