1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictly for non-commercial purposes is hereby granted *
9 * without fee, provided that the above copyright notice appears in all *
10 * copies and that both the copyright notice and this permission notice *
11 * appear in the supporting documentation. The authors make no claims *
12 * about the suitability of this software for any purpose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
15 //-----------------------------------------------------------------
16 // Implementation of the ESD track class
17 // ESD = Event Summary Data
18 // This is the class to deal with during the phisics analysis of data
19 // Origin: Iouri Belikov, CERN
20 // e-mail: Jouri.Belikov@cern.ch
24 // What do you need to know before starting analysis
25 // (by Marian Ivanov: marian.ivanov@cern.ch)
29 // 1. What is the AliESDtrack
30 // 2. What informations do we store
31 // 3. How to use the information for analysis
34 // 1.AliESDtrack is the container of the information about the track/particle
35 // reconstructed during Barrel Tracking.
36 // The track information is propagated from one tracking detector to
37 // other using the functionality of AliESDtrack - Current parameters.
39 // No global fit model is used.
40 // Barrel tracking use Kalman filtering technique, it gives optimal local
41 // track parameters at given point under certian assumptions.
43 // Kalman filter take into account additional effect which are
44 // difficult to handle using global fit.
46 // a.) Multiple scattering
48 // c.) Non homogenous magnetic field
50 // In general case, following barrel detectors are contributing to
51 // the Kalman track information:
56 // In general 3 reconstruction itteration are performed:
57 // 1. Find tracks - sequence TPC->ITS
58 // 2. PropagateBack - sequence ITS->TPC->TRD -> Outer PID detectors
59 // 3. Refit invward - sequence TRD->TPC->ITS
60 // The current tracks are updated after each detector (see bellow).
61 // In specical cases a track sanpshots are stored.
64 // For some type of analysis (+visualization) track local parameters at
65 // different position are neccesary. A snapshots during the track
66 // propagation are created.
67 // (See AliExternalTrackParam class for desctiption of variables and
70 // a. Current parameters - class itself (AliExternalTrackParam)
71 // Contributors: general case TRD->TPC->ITS
72 // Preferable usage: Decission - primary or secondary track
73 // NOTICE - By default the track parameters are stored at the DCA point
74 // to the primary vertex. optimal for primary tracks,
75 // far from optimal for secondary tracks.
76 // b. Constrained parameters - Kalman information updated with
77 // the Primary vertex information
78 // Contributors: general case TRD->TPC->ITS
79 // Preferable usage: Use only for tracks selected as primary
80 // NOTICE - not real constrain - taken as additional measurement
81 // with corresponding error
83 // const AliExternalTrackParam *GetConstrainedParam() const {return fCp;}
84 // c. Inner parameters - Track parameters at inner wall of the TPC
85 // Contributors: general case TRD->TPC
87 // const AliExternalTrackParam *GetInnerParam() const { return fIp;}
89 // d. TPCinnerparam - contributors - TPC only
91 // Preferable usage: Requested for HBT study
92 // (smaller correlations as using also ITS information)
93 // NOTICE - the track parameters are propagated to the DCA to
95 // Optimal for primary, far from optimal for secondary tracks
97 // const AliExternalTrackParam *GetTPCInnerParam() const {return fTPCInner;}
99 // e. Outer parameters -
100 // Contributors- general case - ITS-> TPC -> TRD
101 // The last point - Outer parameters radius is determined
102 // e.a) Local inclination angle bigger than threshold -
103 // Low momenta tracks
104 // e.a) Catastrofic energy losss in material
105 // e.b) Not further improvement (no space points)
107 // a.) Tracking: Starting parameter for Refit inward
110 // NOTICE: Should be not used for the physic analysis
112 // const AliExternalTrackParam *GetOuterParam() const { return fOp;}
114 //-----------------------------------------------------------------
117 #include <TParticle.h>
118 #include <TDatabasePDG.h>
119 #include <TMatrixD.h>
121 #include "AliESDVertex.h"
122 #include "AliESDtrack.h"
123 #include "AliESDEvent.h"
124 #include "AliKalmanTrack.h"
125 #include "AliVTrack.h"
127 #include "AliTrackPointArray.h"
128 #include "TPolyMarker3D.h"
129 #include "AliTrackerBase.h"
130 #include "AliTPCdEdxInfo.h"
132 ClassImp(AliESDtrack)
134 void SetPIDValues(Double_t * dest, const Double_t * src, Int_t n) {
135 // This function copies "n" PID weights from "scr" to "dest"
136 // and normalizes their sum to 1 thus producing conditional probabilities.
137 // The negative weights are set to 0.
138 // In case all the weights are non-positive they are replaced by
139 // uniform probabilities
143 Float_t uniform = 1./(Float_t)n;
146 for (Int_t i=0; i<n; i++)
156 for (Int_t i=0; i<n; i++) dest[i] /= sum;
158 for (Int_t i=0; i<n; i++) dest[i] = uniform;
161 //_______________________________________________________________________
162 AliESDtrack::AliESDtrack() :
163 AliExternalTrackParam(),
170 fTPCFitMap(159),//number of padrows
171 fTPCClusterMap(159),//number of padrows
172 fTPCSharedMap(159),//number of padrows
183 fCaloIndex(kEMCALNoMatch),
189 fCddTPC(0),fCdzTPC(0),fCzzTPC(0),
192 fCdd(0),fCdz(0),fCzz(0),
210 fTOFsignalToT(99999),
211 fTOFsignalRaw(99999),
237 fVertexID(-2),// -2 means an orphan track
239 fCacheNCrossedRows(-10),
240 fCacheChi2TPCConstrainedVsGlobal(-10),
241 fCacheChi2TPCConstrainedVsGlobalVertex(0),
242 fTrackPhiOnEMCal(-999),
243 fTrackEtaOnEMCal(-999)
246 // The default ESD constructor
248 if (!OnlineMode()) fFriendTrack=new AliESDfriendTrack();
251 for (i=kNITSchi2Std;i--;) fITSchi2Std[i] = 0;
252 for (i=0; i<AliPID::kSPECIES; i++) {
262 for (i=0; i<3; i++) { fKinkIndexes[i]=0;}
263 for (i=0; i<3; i++) { fV0Indexes[i]=0;}
264 for (i=0;i<kTRDnPlanes;i++) {
267 for (i=0;i<4;i++) {fITSdEdxSamples[i]=0.;}
268 for (i=0;i<4;i++) {fTPCPoints[i]=0;}
269 for (i=0;i<3;i++) {fTOFLabel[i]=-1;}
270 for (i=0;i<10;i++) {fTOFInfo[i]=0;}
271 for (i=0;i<12;i++) {fITSModule[i]=-1;}
274 bool AliESDtrack::fgkOnlineMode=false;
276 //_______________________________________________________________________
277 AliESDtrack::AliESDtrack(const AliESDtrack& track):
278 AliExternalTrackParam(track),
285 fTPCFitMap(track.fTPCFitMap),
286 fTPCClusterMap(track.fTPCClusterMap),
287 fTPCSharedMap(track.fTPCSharedMap),
288 fFlags(track.fFlags),
290 fLabel(track.fLabel),
291 fITSLabel(track.fITSLabel),
292 fTPCLabel(track.fTPCLabel),
293 fTRDLabel(track.fTRDLabel),
294 fTOFCalChannel(track.fTOFCalChannel),
295 fTOFindex(track.fTOFindex),
296 fHMPIDqn(track.fHMPIDqn),
297 fHMPIDcluIdx(track.fHMPIDcluIdx),
298 fCaloIndex(track.fCaloIndex),
299 fHMPIDtrkTheta(track.fHMPIDtrkTheta),
300 fHMPIDtrkPhi(track.fHMPIDtrkPhi),
301 fHMPIDsignal(track.fHMPIDsignal),
302 fTrackLength(track.fTrackLength),
303 fdTPC(track.fdTPC),fzTPC(track.fzTPC),
304 fCddTPC(track.fCddTPC),fCdzTPC(track.fCdzTPC),fCzzTPC(track.fCzzTPC),
305 fCchi2TPC(track.fCchi2TPC),
306 fD(track.fD),fZ(track.fZ),
307 fCdd(track.fCdd),fCdz(track.fCdz),fCzz(track.fCzz),
308 fCchi2(track.fCchi2),
309 fITSchi2(track.fITSchi2),
310 fTPCchi2(track.fTPCchi2),
311 fTPCchi2Iter1(track.fTPCchi2Iter1),
312 fTRDchi2(track.fTRDchi2),
313 fTOFchi2(track.fTOFchi2),
314 fHMPIDchi2(track.fHMPIDchi2),
315 fGlobalChi2(track.fGlobalChi2),
316 fITSsignal(track.fITSsignal),
317 fTPCsignal(track.fTPCsignal),
318 fTPCsignalTuned(track.fTPCsignalTuned),
319 fTPCsignalS(track.fTPCsignalS),
321 fTRDsignal(track.fTRDsignal),
322 fTRDQuality(track.fTRDQuality),
323 fTRDBudget(track.fTRDBudget),
324 fTOFsignal(track.fTOFsignal),
325 fTOFsignalToT(track.fTOFsignalToT),
326 fTOFsignalRaw(track.fTOFsignalRaw),
327 fTOFsignalDz(track.fTOFsignalDz),
328 fTOFsignalDx(track.fTOFsignalDx),
329 fTOFdeltaBC(track.fTOFdeltaBC),
330 fTOFl0l1(track.fTOFl0l1),
331 fCaloDx(track.fCaloDx),
332 fCaloDz(track.fCaloDz),
333 fHMPIDtrkX(track.fHMPIDtrkX),
334 fHMPIDtrkY(track.fHMPIDtrkY),
335 fHMPIDmipX(track.fHMPIDmipX),
336 fHMPIDmipY(track.fHMPIDmipY),
337 fTPCncls(track.fTPCncls),
338 fTPCnclsF(track.fTPCnclsF),
339 fTPCsignalN(track.fTPCsignalN),
340 fTPCnclsIter1(track.fTPCnclsIter1),
341 fTPCnclsFIter1(track.fTPCnclsIter1),
342 fITSncls(track.fITSncls),
343 fITSClusterMap(track.fITSClusterMap),
344 fITSSharedMap(track.fITSSharedMap),
345 fTRDncls(track.fTRDncls),
346 fTRDncls0(track.fTRDncls0),
347 fTRDntracklets(track.fTRDntracklets),
348 fTRDNchamberdEdx(track.fTRDNchamberdEdx),
349 fTRDNclusterdEdx(track.fTRDNclusterdEdx),
350 fTRDnSlices(track.fTRDnSlices),
352 fVertexID(track.fVertexID),
353 fESDEvent(track.fESDEvent),
354 fCacheNCrossedRows(track.fCacheNCrossedRows),
355 fCacheChi2TPCConstrainedVsGlobal(track.fCacheChi2TPCConstrainedVsGlobal),
356 fCacheChi2TPCConstrainedVsGlobalVertex(track.fCacheChi2TPCConstrainedVsGlobalVertex),
357 fTrackPhiOnEMCal(track.fTrackPhiOnEMCal),
358 fTrackEtaOnEMCal(track.fTrackEtaOnEMCal)
363 for (Int_t i=kNITSchi2Std;i--;) fITSchi2Std[i] = track.fTrackTime[i];
364 for (Int_t i=0;i<AliPID::kSPECIES;i++) fTrackTime[i]=track.fTrackTime[i];
365 for (Int_t i=0;i<AliPID::kSPECIES;i++) fR[i]=track.fR[i];
367 for (Int_t i=0;i<AliPID::kSPECIES;i++) fITSr[i]=track.fITSr[i];
369 for (Int_t i=0;i<AliPID::kSPECIES;i++) fTPCr[i]=track.fTPCr[i];
370 for (Int_t i=0;i<4;i++) {fITSdEdxSamples[i]=track.fITSdEdxSamples[i];}
371 for (Int_t i=0;i<4;i++) {fTPCPoints[i]=track.fTPCPoints[i];}
372 for (Int_t i=0; i<3;i++) { fKinkIndexes[i]=track.fKinkIndexes[i];}
373 for (Int_t i=0; i<3;i++) { fV0Indexes[i]=track.fV0Indexes[i];}
375 for (Int_t i=0;i<kTRDnPlanes;i++) {
376 fTRDTimBin[i]=track.fTRDTimBin[i];
380 fTRDslices=new Double32_t[fTRDnSlices];
381 for (Int_t i=0; i<fTRDnSlices; i++) fTRDslices[i]=track.fTRDslices[i];
385 for (Int_t i=0;i<AliPID::kSPECIES;i++) fTRDr[i]=track.fTRDr[i];
386 for (Int_t i=0;i<AliPID::kSPECIES;i++) fTOFr[i]=track.fTOFr[i];
387 for (Int_t i=0;i<3;i++) fTOFLabel[i]=track.fTOFLabel[i];
388 for (Int_t i=0;i<10;i++) fTOFInfo[i]=track.fTOFInfo[i];
389 for (Int_t i=0;i<12;i++) fITSModule[i]=track.fITSModule[i];
390 for (Int_t i=0;i<AliPID::kSPECIES;i++) fHMPIDr[i]=track.fHMPIDr[i];
392 if (track.fCp) fCp=new AliExternalTrackParam(*track.fCp);
393 if (track.fIp) fIp=new AliExternalTrackParam(*track.fIp);
394 if (track.fTPCInner) fTPCInner=new AliExternalTrackParam(*track.fTPCInner);
395 if (track.fOp) fOp=new AliExternalTrackParam(*track.fOp);
396 if (track.fHMPIDp) fHMPIDp=new AliExternalTrackParam(*track.fHMPIDp);
397 if (track.fTPCdEdxInfo) fTPCdEdxInfo = new AliTPCdEdxInfo(*track.fTPCdEdxInfo);
400 if (track.fFriendTrack) fFriendTrack=new AliESDfriendTrack(*(track.fFriendTrack));
403 //_______________________________________________________________________
404 AliESDtrack::AliESDtrack(const AliVTrack *track) :
405 AliExternalTrackParam(track),
412 fTPCFitMap(159),//number of padrows
413 fTPCClusterMap(159),//number of padrows
414 fTPCSharedMap(159),//number of padrows
425 fCaloIndex(kEMCALNoMatch),
431 fCddTPC(0),fCdzTPC(0),fCzzTPC(0),
434 fCdd(0),fCdz(0),fCzz(0),
452 fTOFsignalToT(99999),
453 fTOFsignalRaw(99999),
479 fVertexID(-2), // -2 means an orphan track
481 fCacheNCrossedRows(-10),
482 fCacheChi2TPCConstrainedVsGlobal(-10),
483 fCacheChi2TPCConstrainedVsGlobalVertex(0),
484 fTrackPhiOnEMCal(-999),
485 fTrackEtaOnEMCal(-999)
488 // ESD track from AliVTrack.
489 // This is not a copy constructor !
492 if (track->InheritsFrom("AliExternalTrackParam")) {
493 AliError("This is not a copy constructor. Use AliESDtrack(const AliESDtrack &) !");
494 AliWarning("Calling the default constructor...");
499 // Reset all the arrays
501 for (i=kNITSchi2Std;i--;) fITSchi2Std[i] = 0;
502 for (i=0; i<AliPID::kSPECIES; i++) {
512 for (i=0; i<3; i++) { fKinkIndexes[i]=0;}
513 for (i=0; i<3; i++) { fV0Indexes[i]=-1;}
514 for (i=0;i<kTRDnPlanes;i++) {
517 for (i=0;i<4;i++) {fITSdEdxSamples[i]=0.;}
518 for (i=0;i<4;i++) {fTPCPoints[i]=0;}
519 for (i=0;i<3;i++) {fTOFLabel[i]=-1;}
520 for (i=0;i<10;i++) {fTOFInfo[i]=0;}
521 for (i=0;i<12;i++) {fITSModule[i]=-1;}
524 SetID(track->GetID());
526 // Set ITS cluster map
527 fITSClusterMap=track->GetITSClusterMap();
532 if(HasPointOnITSLayer(i)) fITSncls++;
536 fTPCncls=track->GetTPCNcls();
539 // Set the combined PID
540 const Double_t *pid = track->PID();
542 for (i=0; i<AliPID::kSPECIES; i++) fR[i]=pid[i];
544 // AliESD track label
545 SetLabel(track->GetLabel());
547 SetStatus(track->GetStatus());
550 //_______________________________________________________________________
551 AliESDtrack::AliESDtrack(TParticle * part) :
552 AliExternalTrackParam(),
559 fTPCFitMap(159),//number of padrows
560 fTPCClusterMap(159),//number of padrows
561 fTPCSharedMap(159),//number of padrows
572 fCaloIndex(kEMCALNoMatch),
578 fCddTPC(0),fCdzTPC(0),fCzzTPC(0),
581 fCdd(0),fCdz(0),fCzz(0),
599 fTOFsignalToT(99999),
600 fTOFsignalRaw(99999),
626 fVertexID(-2), // -2 means an orphan track
628 fCacheNCrossedRows(-10),
629 fCacheChi2TPCConstrainedVsGlobal(-10),
630 fCacheChi2TPCConstrainedVsGlobalVertex(0),
631 fTrackPhiOnEMCal(-999),
632 fTrackEtaOnEMCal(-999)
635 // ESD track from TParticle
638 // Reset all the arrays
640 for (i=kNITSchi2Std;i--;) fITSchi2Std[i] = 0;
641 for (i=0; i<AliPID::kSPECIES; i++) {
651 for (i=0; i<3; i++) { fKinkIndexes[i]=0;}
652 for (i=0; i<3; i++) { fV0Indexes[i]=-1;}
653 for (i=0;i<kTRDnPlanes;i++) {
656 for (i=0;i<4;i++) {fITSdEdxSamples[i]=0.;}
657 for (i=0;i<4;i++) {fTPCPoints[i]=0;}
658 for (i=0;i<3;i++) {fTOFLabel[i]=-1;}
659 for (i=0;i<10;i++) {fTOFInfo[i]=0;}
660 for (i=0;i<12;i++) {fITSModule[i]=-1;}
662 // Calculate the AliExternalTrackParam content
669 // Calculate alpha: the rotation angle of the corresponding local system (TPC sector)
670 alpha = part->Phi()*180./TMath::Pi();
671 if (alpha<0) alpha+= 360.;
672 if (alpha>360) alpha -= 360.;
674 Int_t sector = (Int_t)(alpha/20.);
675 alpha = 10. + 20.*sector;
677 alpha *= TMath::Pi();
679 // Covariance matrix: no errors, the parameters are exact
680 for (i=0; i<15; i++) covar[i]=0.;
682 // Get the vertex of origin and the momentum
683 TVector3 ver(part->Vx(),part->Vy(),part->Vz());
684 TVector3 mom(part->Px(),part->Py(),part->Pz());
686 // Rotate to the local coordinate system (TPC sector)
690 // X of the referense plane
693 Int_t pdgCode = part->GetPdgCode();
696 TDatabasePDG::Instance()->GetParticle(pdgCode)->Charge();
700 param[2] = TMath::Sin(mom.Phi());
701 param[3] = mom.Pz()/mom.Pt();
702 param[4] = TMath::Sign(1/mom.Pt(),charge);
704 // Set AliExternalTrackParam
705 Set(xref, alpha, param, covar);
710 switch (TMath::Abs(pdgCode)) {
736 // If the particle is not e,mu,pi,K or p the PID probabilities are set to 0
737 if (indexPID < AliPID::kSPECIES) {
743 fHMPIDr[indexPID]=1.;
746 // AliESD track label
747 SetLabel(part->GetUniqueID());
751 //_______________________________________________________________________
752 AliESDtrack::~AliESDtrack(){
754 // This is destructor according Coding Conventrions
756 //printf("Delete track\n");
767 //Reset cached values - needed for TClonesArray in AliESDInputHandler
768 fCacheNCrossedRows = -10.;
769 fCacheChi2TPCConstrainedVsGlobal = -10.;
770 if(fCacheChi2TPCConstrainedVsGlobalVertex) fCacheChi2TPCConstrainedVsGlobalVertex = 0;
774 AliESDtrack &AliESDtrack::operator=(const AliESDtrack &source){
777 if(&source == this) return *this;
778 AliExternalTrackParam::operator=(source);
782 // we have the trackparam: assign or copy construct
783 if(fCp)*fCp = *source.fCp;
784 else fCp = new AliExternalTrackParam(*source.fCp);
787 // no track param delete the old one
793 // we have the trackparam: assign or copy construct
794 if(fIp)*fIp = *source.fIp;
795 else fIp = new AliExternalTrackParam(*source.fIp);
798 // no track param delete the old one
804 if(source.fTPCInner){
805 // we have the trackparam: assign or copy construct
806 if(fTPCInner) *fTPCInner = *source.fTPCInner;
807 else fTPCInner = new AliExternalTrackParam(*source.fTPCInner);
810 // no track param delete the old one
815 if(source.fTPCdEdxInfo) {
816 if(fTPCdEdxInfo) *fTPCdEdxInfo = *source.fTPCdEdxInfo;
817 fTPCdEdxInfo = new AliTPCdEdxInfo(*source.fTPCdEdxInfo);
821 // we have the trackparam: assign or copy construct
822 if(fOp) *fOp = *source.fOp;
823 else fOp = new AliExternalTrackParam(*source.fOp);
826 // no track param delete the old one
833 // we have the trackparam: assign or copy construct
834 if(fHMPIDp) *fHMPIDp = *source.fHMPIDp;
835 else fHMPIDp = new AliExternalTrackParam(*source.fHMPIDp);
838 // no track param delete the old one
843 // copy also the friend track
844 // use copy constructor
845 if(source.fFriendTrack){
846 // we have the trackparam: assign or copy construct
847 delete fFriendTrack; fFriendTrack=new AliESDfriendTrack(*source.fFriendTrack);
850 // no track param delete the old one
851 delete fFriendTrack; fFriendTrack= 0;
854 fTPCFitMap = source.fTPCFitMap;
855 fTPCClusterMap = source.fTPCClusterMap;
856 fTPCSharedMap = source.fTPCSharedMap;
858 fFlags = source.fFlags;
860 fLabel = source.fLabel;
861 fITSLabel = source.fITSLabel;
862 for(int i = 0; i< 12;++i){
863 fITSModule[i] = source.fITSModule[i];
865 fTPCLabel = source.fTPCLabel;
866 fTRDLabel = source.fTRDLabel;
867 for(int i = 0; i< 3;++i){
868 fTOFLabel[i] = source.fTOFLabel[i];
870 fTOFCalChannel = source.fTOFCalChannel;
871 fTOFindex = source.fTOFindex;
872 fHMPIDqn = source.fHMPIDqn;
873 fHMPIDcluIdx = source.fHMPIDcluIdx;
874 fCaloIndex = source.fCaloIndex;
875 for (int i=kNITSchi2Std;i--;) fITSchi2Std[i] = source.fITSchi2Std[i];
876 for(int i = 0; i< 3;++i){
877 fKinkIndexes[i] = source.fKinkIndexes[i];
878 fV0Indexes[i] = source.fV0Indexes[i];
881 for(int i = 0; i< AliPID::kSPECIES;++i){
882 fR[i] = source.fR[i];
883 fITSr[i] = source.fITSr[i];
884 fTPCr[i] = source.fTPCr[i];
885 fTRDr[i] = source.fTRDr[i];
886 fTOFr[i] = source.fTOFr[i];
887 fHMPIDr[i] = source.fHMPIDr[i];
888 fTrackTime[i] = source.fTrackTime[i];
891 fHMPIDtrkTheta = source.fHMPIDtrkTheta;
892 fHMPIDtrkPhi = source.fHMPIDtrkPhi;
893 fHMPIDsignal = source.fHMPIDsignal;
896 fTrackLength = source. fTrackLength;
897 fdTPC = source.fdTPC;
898 fzTPC = source.fzTPC;
899 fCddTPC = source.fCddTPC;
900 fCdzTPC = source.fCdzTPC;
901 fCzzTPC = source.fCzzTPC;
902 fCchi2TPC = source.fCchi2TPC;
909 fCchi2 = source.fCchi2;
911 fITSchi2 = source.fITSchi2;
912 fTPCchi2 = source.fTPCchi2;
913 fTPCchi2Iter1 = source.fTPCchi2Iter1;
914 fTRDchi2 = source.fTRDchi2;
915 fTOFchi2 = source.fTOFchi2;
916 fHMPIDchi2 = source.fHMPIDchi2;
918 fGlobalChi2 = source.fGlobalChi2;
920 fITSsignal = source.fITSsignal;
921 for (Int_t i=0;i<4;i++) {fITSdEdxSamples[i]=source.fITSdEdxSamples[i];}
922 fTPCsignal = source.fTPCsignal;
923 fTPCsignalTuned = source.fTPCsignalTuned;
924 fTPCsignalS = source.fTPCsignalS;
925 for(int i = 0; i< 4;++i){
926 fTPCPoints[i] = source.fTPCPoints[i];
928 fTRDsignal = source.fTRDsignal;
929 fTRDNchamberdEdx = source.fTRDNchamberdEdx;
930 fTRDNclusterdEdx = source.fTRDNclusterdEdx;
932 for(int i = 0;i < kTRDnPlanes;++i){
933 fTRDTimBin[i] = source.fTRDTimBin[i];
939 fTRDnSlices=source.fTRDnSlices;
941 fTRDslices=new Double32_t[fTRDnSlices];
942 for(int j = 0;j < fTRDnSlices;++j) fTRDslices[j] = source.fTRDslices[j];
945 fTRDQuality = source.fTRDQuality;
946 fTRDBudget = source.fTRDBudget;
947 fTOFsignal = source.fTOFsignal;
948 fTOFsignalToT = source.fTOFsignalToT;
949 fTOFsignalRaw = source.fTOFsignalRaw;
950 fTOFsignalDz = source.fTOFsignalDz;
951 fTOFsignalDx = source.fTOFsignalDx;
952 fTOFdeltaBC = source.fTOFdeltaBC;
953 fTOFl0l1 = source.fTOFl0l1;
955 for(int i = 0;i<10;++i){
956 fTOFInfo[i] = source.fTOFInfo[i];
959 fHMPIDtrkX = source.fHMPIDtrkX;
960 fHMPIDtrkY = source.fHMPIDtrkY;
961 fHMPIDmipX = source.fHMPIDmipX;
962 fHMPIDmipY = source.fHMPIDmipY;
964 fTPCncls = source.fTPCncls;
965 fTPCnclsF = source.fTPCnclsF;
966 fTPCsignalN = source.fTPCsignalN;
967 fTPCnclsIter1 = source.fTPCnclsIter1;
968 fTPCnclsFIter1 = source.fTPCnclsFIter1;
970 fITSncls = source.fITSncls;
971 fITSClusterMap = source.fITSClusterMap;
972 fITSSharedMap = source.fITSSharedMap;
973 fTRDncls = source.fTRDncls;
974 fTRDncls0 = source.fTRDncls0;
975 fTRDntracklets = source.fTRDntracklets;
976 fVertexID = source.fVertexID;
978 fCacheNCrossedRows = source.fCacheNCrossedRows;
979 fCacheChi2TPCConstrainedVsGlobal = source.fCacheChi2TPCConstrainedVsGlobal;
980 fCacheChi2TPCConstrainedVsGlobalVertex = source.fCacheChi2TPCConstrainedVsGlobalVertex;
982 fTrackPhiOnEMCal= source.fTrackPhiOnEMCal;
983 fTrackEtaOnEMCal= source.fTrackEtaOnEMCal;
990 void AliESDtrack::Copy(TObject &obj) const {
992 // this overwrites the virtual TOBject::Copy()
993 // to allow run time copying without casting
996 if(this==&obj)return;
997 AliESDtrack *robj = dynamic_cast<AliESDtrack*>(&obj);
998 if(!robj)return; // not an AliESDtrack
1005 void AliESDtrack::AddCalibObject(TObject * object){
1007 // add calib object to the list
1009 if (!fFriendTrack) fFriendTrack = new AliESDfriendTrack;
1010 if (!fFriendTrack) return;
1011 fFriendTrack->AddCalibObject(object);
1014 TObject * AliESDtrack::GetCalibObject(Int_t index){
1016 // return calib objct at given position
1018 if (!fFriendTrack) return 0;
1019 return fFriendTrack->GetCalibObject(index);
1023 Bool_t AliESDtrack::FillTPCOnlyTrack(AliESDtrack &track){
1025 // Fills the information of the TPC-only first reconstruction pass
1026 // into the passed ESDtrack object. For consistency fTPCInner is also filled
1031 // For data produced before r26675
1032 // RelateToVertexTPC was not properly called during reco
1033 // so you'll have to call it again, before FillTPCOnlyTrack
1034 // Float_t p[2],cov[3];
1035 // track->GetImpactParametersTPC(p,cov);
1036 // if(p[0]==0&&p[1]==0) // <- Default values
1037 // track->RelateToVertexTPC(esd->GetPrimaryVertexTPC(),esd->GetMagneticField(),kVeryBig);
1040 if(!fTPCInner)return kFALSE;
1042 // fill the TPC track params to the global track parameters
1043 track.Set(fTPCInner->GetX(),fTPCInner->GetAlpha(),fTPCInner->GetParameter(),fTPCInner->GetCovariance());
1046 track.fCdd = fCddTPC;
1047 track.fCdz = fCdzTPC;
1048 track.fCzz = fCzzTPC;
1050 // copy the inner params
1051 if(track.fIp) *track.fIp = *fIp;
1052 else track.fIp = new AliExternalTrackParam(*fIp);
1054 // copy the TPCinner parameters
1055 if(track.fTPCInner) *track.fTPCInner = *fTPCInner;
1056 else track.fTPCInner = new AliExternalTrackParam(*fTPCInner);
1057 track.fdTPC = fdTPC;
1058 track.fzTPC = fzTPC;
1059 track.fCddTPC = fCddTPC;
1060 track.fCdzTPC = fCdzTPC;
1061 track.fCzzTPC = fCzzTPC;
1062 track.fCchi2TPC = fCchi2TPC;
1064 // copy all other TPC specific parameters
1066 // replace label by TPC label
1067 track.fLabel = fTPCLabel;
1068 track.fTPCLabel = fTPCLabel;
1070 track.fTPCchi2 = fTPCchi2;
1071 track.fTPCchi2Iter1 = fTPCchi2Iter1;
1072 track.fTPCsignal = fTPCsignal;
1073 track.fTPCsignalTuned = fTPCsignalTuned;
1074 track.fTPCsignalS = fTPCsignalS;
1075 for(int i = 0;i<4;++i)track.fTPCPoints[i] = fTPCPoints[i];
1077 track.fTPCncls = fTPCncls;
1078 track.fTPCnclsF = fTPCnclsF;
1079 track.fTPCsignalN = fTPCsignalN;
1080 track.fTPCnclsIter1 = fTPCnclsIter1;
1081 track.fTPCnclsFIter1 = fTPCnclsFIter1;
1084 for(int i=0;i<AliPID::kSPECIES;++i){
1085 track.fTPCr[i] = fTPCr[i];
1086 // combined PID is TPC only!
1087 track.fR[i] = fTPCr[i];
1089 track.fTPCFitMap = fTPCFitMap;
1090 track.fTPCClusterMap = fTPCClusterMap;
1091 track.fTPCSharedMap = fTPCSharedMap;
1095 track.fFlags = kTPCin;
1098 track.fFlags |= fFlags & kTPCpid; //copy the TPCpid status flag
1100 for (Int_t i=0;i<3;i++) track.fKinkIndexes[i] = fKinkIndexes[i];
1106 //_______________________________________________________________________
1107 void AliESDtrack::MakeMiniESDtrack(){
1108 // Resets everything except
1109 // fFlags: Reconstruction status flags
1110 // fLabel: Track label
1111 // fID: Unique ID of the track
1112 // Impact parameter information
1113 // fR[AliPID::kSPECIES]: combined "detector response probability"
1114 // Running track parameters in the base class (AliExternalTrackParam)
1118 for (Int_t i=0;i<AliPID::kSPECIES;i++) fTrackTime[i] = 0;
1120 // Reset track parameters constrained to the primary vertex
1123 // Reset track parameters at the inner wall of TPC
1125 delete fTPCInner;fTPCInner=0;
1126 // Reset track parameters at the inner wall of the TRD
1128 // Reset track parameters at the HMPID
1129 delete fHMPIDp;fHMPIDp = 0;
1132 // Reset ITS track related information
1138 for (Int_t i=0;i<4;i++) fITSdEdxSamples[i] = 0.;
1139 for (Int_t i=0;i<AliPID::kSPECIES;i++) fITSr[i]=0;
1142 // Reset TPC related track information
1156 for (Int_t i=0;i<AliPID::kSPECIES;i++) fTPCr[i]=0;
1158 for (Int_t i=0;i<4;i++) fTPCPoints[i] = 0;
1159 for (Int_t i=0; i<3;i++) fKinkIndexes[i] = 0;
1160 for (Int_t i=0; i<3;i++) fV0Indexes[i] = 0;
1162 // Reset TRD related track information
1167 fTRDNchamberdEdx = 0;
1168 fTRDNclusterdEdx = 0;
1170 for (Int_t i=0;i<kTRDnPlanes;i++) {
1173 for (Int_t i=0;i<AliPID::kSPECIES;i++) fTRDr[i] = 0;
1178 delete[] fTRDslices;
1183 // Reset TOF related track information
1187 fTOFCalChannel = -1;
1188 fTOFsignalToT = 99999;
1189 fTOFsignalRaw = 99999;
1194 for (Int_t i=0;i<AliPID::kSPECIES;i++) fTOFr[i] = 0;
1195 for (Int_t i=0;i<3;i++) fTOFLabel[i] = -1;
1196 for (Int_t i=0;i<10;i++) fTOFInfo[i] = 0;
1198 // Reset HMPID related track information
1203 for (Int_t i=0;i<AliPID::kSPECIES;i++) fHMPIDr[i] = 0;
1210 fCaloIndex = kEMCALNoMatch;
1212 // reset global track chi2
1215 fVertexID = -2; // an orphan track
1217 delete fFriendTrack; fFriendTrack = 0;
1220 //_______________________________________________________________________
1221 Int_t AliESDtrack::GetPID(Bool_t tpcOnly) const
1223 // Returns the particle most probable id
1225 const Double32_t *prob = 0;
1226 if (tpcOnly) { // check if TPCpid is valid
1228 for (i=0; i<AliPID::kSPECIES-1; i++) if (prob[i] != prob[i+1]) break;
1229 if (i == AliPID::kSPECIES-1) prob = 0; // not valid, try with combined pid
1231 if (!prob) { // either requested TPCpid is not valid or comb.pid is requested
1233 for (i=0; i<AliPID::kSPECIES-1; i++) if (prob[i] != prob[i+1]) break;
1234 if (i == AliPID::kSPECIES-1) return AliPID::kPion; // If all the probabilities are equal, return the pion mass
1239 for (i=0; i<AliPID::kSPECIES; i++) if (prob[i]>max) {k=i; max=prob[i];}
1241 if (k==0) { // dE/dx "crossing points" in the TPC
1243 if ((p>0.38)&&(p<0.48))
1244 if (prob[0]<prob[3]*10.) return AliPID::kKaon;
1245 if ((p>0.75)&&(p<0.85))
1246 if (prob[0]<prob[4]*10.) return AliPID::kProton;
1247 return AliPID::kElectron;
1249 if (k==1) return AliPID::kMuon;
1250 if (k==2||k==-1) return AliPID::kPion;
1251 if (k==3) return AliPID::kKaon;
1252 if (k==4) return AliPID::kProton;
1253 AliWarning("Undefined PID !");
1254 return AliPID::kPion;
1257 //_______________________________________________________________________
1258 Int_t AliESDtrack::GetTOFBunchCrossing(Double_t b, Bool_t pidTPConly) const
1260 // Returns the number of bunch crossings after trigger (assuming 25ns spacing)
1261 const double kSpacing = 25e3; // min interbanch spacing
1262 const double kShift = 0;
1263 Int_t bcid = kTOFBCNA; // defualt one
1264 if (!IsOn(kTOFout) || !IsOn(kESDpid)) return bcid; // no info
1266 double tdif = fTOFsignal;
1267 if (IsOn(kTIME)) { // integrated time info is there
1268 int pid = GetPID(pidTPConly);
1269 tdif -= fTrackTime[pid];
1271 else { // assume integrated time info from TOF radius and momentum
1272 const double kRTOF = 385.;
1273 const double kCSpeed = 3.e-2; // cm/ps
1275 if (p<0.01) return bcid;
1276 double m = GetMass(pidTPConly);
1277 double curv = GetC(b);
1278 double path = TMath::Abs(curv)>kAlmost0 ? // account for curvature
1279 2./curv*TMath::ASin(kRTOF*curv/2.)*TMath::Sqrt(1.+GetTgl()*GetTgl()) : kRTOF;
1280 tdif -= path/kCSpeed*TMath::Sqrt(1.+m*m/(p*p));
1282 bcid = TMath::Nint((tdif - kShift)/kSpacing);
1286 //______________________________________________________________________________
1287 Double_t AliESDtrack::M() const
1289 // Returns the assumed mass
1290 // (the pion mass, if the particle can't be identified properly).
1291 static Bool_t printerr=kTRUE;
1293 AliWarning("WARNING !!! ... THIS WILL BE PRINTED JUST ONCE !!!");
1295 AliWarning("This is the ESD mass. Use it with care !");
1300 //______________________________________________________________________________
1301 Double_t AliESDtrack::E() const
1303 // Returns the energy of the particle given its assumed mass.
1304 // Assumes the pion mass if the particle can't be identified properly.
1308 return TMath::Sqrt(p*p + m*m);
1311 //______________________________________________________________________________
1312 Double_t AliESDtrack::Y() const
1314 // Returns the rapidity of a particle given its assumed mass.
1315 // Assumes the pion mass if the particle can't be identified properly.
1319 if (e != TMath::Abs(pz)) { // energy was not equal to pz
1320 return 0.5*TMath::Log((e+pz)/(e-pz));
1321 } else { // energy was equal to pz
1326 //_______________________________________________________________________
1327 Bool_t AliESDtrack::UpdateTrackParams(const AliKalmanTrack *t, ULong_t flags){
1329 // This function updates track's running parameters
1334 fLabel=t->GetLabel();
1336 if (t->IsStartedTimeIntegral()) {
1338 Double_t times[10];t->GetIntegratedTimes(times); SetIntegratedTimes(times);
1339 SetIntegratedLength(t->GetIntegratedLength());
1342 Set(t->GetX(),t->GetAlpha(),t->GetParameter(),t->GetCovariance());
1344 if (flags==kITSout) fFriendTrack->SetITSOut(*t);
1345 if (flags==kTPCout) fFriendTrack->SetTPCOut(*t);
1346 if (flags==kTRDrefit) fFriendTrack->SetTRDIn(*t);
1352 fITSchi2Std[0] = t->GetChi2();
1355 fITSchi2Std[1] = t->GetChi2();
1358 fITSchi2Std[2] = t->GetChi2();
1360 fITSncls=t->GetNumberOfClusters();
1362 Int_t* indexITS = new Int_t[AliESDfriendTrack::kMaxITScluster];
1363 for (Int_t i=0;i<AliESDfriendTrack::kMaxITScluster;i++) {
1364 indexITS[i]=t->GetClusterIndex(i);
1367 Int_t l=(indexITS[i] & 0xf0000000) >> 28;
1368 SETBIT(fITSClusterMap,l);
1371 fFriendTrack->SetITSIndices(indexITS,AliESDfriendTrack::kMaxITScluster);
1375 fITSchi2=t->GetChi2();
1376 fITSsignal=t->GetPIDsignal();
1377 fITSLabel = t->GetLabel();
1378 // keep in fOp the parameters outside ITS for ITS stand-alone tracks
1379 if (flags==kITSout) {
1380 if (!fOp) fOp=new AliExternalTrackParam(*t);
1382 fOp->Set(t->GetX(),t->GetAlpha(),t->GetParameter(),t->GetCovariance());
1387 case kTPCin: case kTPCrefit:
1389 fTPCLabel = t->GetLabel();
1390 if (flags==kTPCin) {
1391 fTPCInner=new AliExternalTrackParam(*t);
1392 fTPCnclsIter1=t->GetNumberOfClusters();
1393 fTPCchi2Iter1=t->GetChi2();
1395 if (!fIp) fIp=new AliExternalTrackParam(*t);
1397 fIp->Set(t->GetX(),t->GetAlpha(),t->GetParameter(),t->GetCovariance());
1399 // Intentionally no break statement; need to set general TPC variables as well
1402 if (flags & kTPCout){
1403 if (!fOp) fOp=new AliExternalTrackParam(*t);
1405 fOp->Set(t->GetX(),t->GetAlpha(),t->GetParameter(),t->GetCovariance());
1407 fTPCncls=t->GetNumberOfClusters();
1408 fTPCchi2=t->GetChi2();
1410 if (fFriendTrack) { // Copy cluster indices
1411 Int_t* indexTPC = new Int_t[AliESDfriendTrack::kMaxTPCcluster];
1412 for (Int_t i=0;i<AliESDfriendTrack::kMaxTPCcluster;i++)
1413 indexTPC[i]=t->GetClusterIndex(i);
1414 fFriendTrack->SetTPCIndices(indexTPC,AliESDfriendTrack::kMaxTPCcluster);
1417 fTPCsignal=t->GetPIDsignal();
1421 case kTRDin: case kTRDrefit:
1425 fTRDLabel = t->GetLabel();
1426 fTRDchi2 = t->GetChi2();
1427 fTRDncls = t->GetNumberOfClusters();
1429 Int_t* indexTRD = new Int_t[AliESDfriendTrack::kMaxTRDcluster];
1430 for (Int_t i=0;i<AliESDfriendTrack::kMaxTRDcluster;i++) indexTRD[i]=-2;
1431 for (Int_t i=0;i<6;i++) indexTRD[i]=t->GetTrackletIndex(i);
1432 fFriendTrack->SetTRDIndices(indexTRD,AliESDfriendTrack::kMaxTRDcluster);
1436 //commented out by Xianguo
1437 //fTRDsignal=t->GetPIDsignal();
1441 if (!fOp) fOp=new AliExternalTrackParam(*t);
1443 fOp->Set(t->GetX(),t->GetAlpha(),t->GetParameter(),t->GetCovariance());
1444 fTRDncls0 = t->GetNumberOfClusters();
1453 if (!fHMPIDp) fHMPIDp=new AliExternalTrackParam(*t);
1455 fHMPIDp->Set(t->GetX(),t->GetAlpha(),t->GetParameter(),t->GetCovariance());
1458 AliError("Wrong flag !");
1465 //_______________________________________________________________________
1466 void AliESDtrack::GetExternalParameters(Double_t &x, Double_t p[5]) const {
1467 //---------------------------------------------------------------------
1468 // This function returns external representation of the track parameters
1469 //---------------------------------------------------------------------
1471 for (Int_t i=0; i<5; i++) p[i]=GetParameter()[i];
1474 //_______________________________________________________________________
1475 void AliESDtrack::GetExternalCovariance(Double_t cov[15]) const {
1476 //---------------------------------------------------------------------
1477 // This function returns external representation of the cov. matrix
1478 //---------------------------------------------------------------------
1479 for (Int_t i=0; i<15; i++) cov[i]=AliExternalTrackParam::GetCovariance()[i];
1482 //_______________________________________________________________________
1483 Bool_t AliESDtrack::GetConstrainedExternalParameters
1484 (Double_t &alpha, Double_t &x, Double_t p[5]) const {
1485 //---------------------------------------------------------------------
1486 // This function returns the constrained external track parameters
1487 //---------------------------------------------------------------------
1488 if (!fCp) return kFALSE;
1489 alpha=fCp->GetAlpha();
1491 for (Int_t i=0; i<5; i++) p[i]=fCp->GetParameter()[i];
1495 //_______________________________________________________________________
1497 AliESDtrack::GetConstrainedExternalCovariance(Double_t c[15]) const {
1498 //---------------------------------------------------------------------
1499 // This function returns the constrained external cov. matrix
1500 //---------------------------------------------------------------------
1501 if (!fCp) return kFALSE;
1502 for (Int_t i=0; i<15; i++) c[i]=fCp->GetCovariance()[i];
1507 AliESDtrack::GetInnerExternalParameters
1508 (Double_t &alpha, Double_t &x, Double_t p[5]) const {
1509 //---------------------------------------------------------------------
1510 // This function returns external representation of the track parameters
1511 // at the inner layer of TPC
1512 //---------------------------------------------------------------------
1513 if (!fIp) return kFALSE;
1514 alpha=fIp->GetAlpha();
1516 for (Int_t i=0; i<5; i++) p[i]=fIp->GetParameter()[i];
1521 AliESDtrack::GetInnerExternalCovariance(Double_t cov[15]) const {
1522 //---------------------------------------------------------------------
1523 // This function returns external representation of the cov. matrix
1524 // at the inner layer of TPC
1525 //---------------------------------------------------------------------
1526 if (!fIp) return kFALSE;
1527 for (Int_t i=0; i<15; i++) cov[i]=fIp->GetCovariance()[i];
1532 AliESDtrack::SetOuterParam(const AliExternalTrackParam *p, ULong_t flags) {
1534 // This is a direct setter for the outer track parameters
1537 if (fOp) delete fOp;
1538 fOp=new AliExternalTrackParam(*p);
1542 AliESDtrack::SetOuterHmpParam(const AliExternalTrackParam *p, ULong_t flags) {
1544 // This is a direct setter for the outer track parameters
1547 if (fHMPIDp) delete fHMPIDp;
1548 fHMPIDp=new AliExternalTrackParam(*p);
1552 AliESDtrack::GetOuterExternalParameters
1553 (Double_t &alpha, Double_t &x, Double_t p[5]) const {
1554 //---------------------------------------------------------------------
1555 // This function returns external representation of the track parameters
1556 // at the inner layer of TRD
1557 //---------------------------------------------------------------------
1558 if (!fOp) return kFALSE;
1559 alpha=fOp->GetAlpha();
1561 for (Int_t i=0; i<5; i++) p[i]=fOp->GetParameter()[i];
1566 AliESDtrack::GetOuterHmpExternalParameters
1567 (Double_t &alpha, Double_t &x, Double_t p[5]) const {
1568 //---------------------------------------------------------------------
1569 // This function returns external representation of the track parameters
1570 // at the inner layer of TRD
1571 //---------------------------------------------------------------------
1572 if (!fHMPIDp) return kFALSE;
1573 alpha=fHMPIDp->GetAlpha();
1575 for (Int_t i=0; i<5; i++) p[i]=fHMPIDp->GetParameter()[i];
1580 AliESDtrack::GetOuterExternalCovariance(Double_t cov[15]) const {
1581 //---------------------------------------------------------------------
1582 // This function returns external representation of the cov. matrix
1583 // at the inner layer of TRD
1584 //---------------------------------------------------------------------
1585 if (!fOp) return kFALSE;
1586 for (Int_t i=0; i<15; i++) cov[i]=fOp->GetCovariance()[i];
1591 AliESDtrack::GetOuterHmpExternalCovariance(Double_t cov[15]) const {
1592 //---------------------------------------------------------------------
1593 // This function returns external representation of the cov. matrix
1594 // at the inner layer of TRD
1595 //---------------------------------------------------------------------
1596 if (!fHMPIDp) return kFALSE;
1597 for (Int_t i=0; i<15; i++) cov[i]=fHMPIDp->GetCovariance()[i];
1601 Int_t AliESDtrack::GetNcls(Int_t idet) const
1603 // Get number of clusters by subdetector index
1617 if (fTOFindex != -1)
1623 if ((fHMPIDcluIdx >= 0) && (fHMPIDcluIdx < 7000000)) {
1624 if ((fHMPIDcluIdx%1000000 != 9999) && (fHMPIDcluIdx%1000000 != 99999)) {
1635 Int_t AliESDtrack::GetClusters(Int_t idet, Int_t *idx) const
1637 // Get cluster index array by subdetector index
1642 ncls = GetITSclusters(idx);
1645 ncls = GetTPCclusters(idx);
1648 ncls = GetTRDclusters(idx);
1651 if (fTOFindex != -1) {
1659 if ((fHMPIDcluIdx >= 0) && (fHMPIDcluIdx < 7000000)) {
1660 if ((fHMPIDcluIdx%1000000 != 9999) && (fHMPIDcluIdx%1000000 != 99999)) {
1661 idx[0] = GetHMPIDcluIdx();
1674 //_______________________________________________________________________
1675 void AliESDtrack::GetIntegratedTimes(Double_t *times) const {
1676 // Returns the array with integrated times for each particle hypothesis
1677 for (Int_t i=0; i<AliPID::kSPECIES; i++) times[i]=fTrackTime[i];
1680 //_______________________________________________________________________
1681 void AliESDtrack::SetIntegratedTimes(const Double_t *times) {
1682 // Sets the array with integrated times for each particle hypotesis
1683 for (Int_t i=0; i<AliPID::kSPECIES; i++) fTrackTime[i]=times[i];
1686 //_______________________________________________________________________
1687 void AliESDtrack::SetITSpid(const Double_t *p) {
1688 // Sets values for the probability of each particle type (in ITS)
1689 SetPIDValues(fITSr,p,AliPID::kSPECIES);
1690 SetStatus(AliESDtrack::kITSpid);
1693 //_______________________________________________________________________
1694 void AliESDtrack::GetITSpid(Double_t *p) const {
1695 // Gets the probability of each particle type (in ITS)
1696 for (Int_t i=0; i<AliPID::kSPECIES; i++) p[i]=fITSr[i];
1699 //_______________________________________________________________________
1700 Char_t AliESDtrack::GetITSclusters(Int_t *idx) const {
1701 //---------------------------------------------------------------------
1702 // This function returns indices of the assgined ITS clusters
1703 //---------------------------------------------------------------------
1704 if (idx && fFriendTrack) {
1705 Int_t *index=fFriendTrack->GetITSindices();
1706 for (Int_t i=0; i<AliESDfriendTrack::kMaxITScluster; i++) {
1707 if ( (i>=fITSncls) && (i<6) ) idx[i]=-1;
1719 //_______________________________________________________________________
1720 Bool_t AliESDtrack::GetITSModuleIndexInfo(Int_t ilayer,Int_t &idet,Int_t &status,
1721 Float_t &xloc,Float_t &zloc) const {
1722 //----------------------------------------------------------------------
1723 // This function encodes in the module number also the status of cluster association
1724 // "status" can have the following values:
1725 // 1 "found" (cluster is associated),
1726 // 2 "dead" (module is dead from OCDB),
1727 // 3 "skipped" (module or layer forced to be skipped),
1728 // 4 "outinz" (track out of z acceptance),
1729 // 5 "nocls" (no clusters in the road),
1730 // 6 "norefit" (cluster rejected during refit),
1731 // 7 "deadzspd" (holes in z in SPD)
1732 // Also given are the coordinates of the crossing point of track and module
1733 // (in the local module ref. system)
1734 // WARNING: THIS METHOD HAS TO BE SYNCHRONIZED WITH AliITStrackV2::GetModuleIndexInfo()!
1735 //----------------------------------------------------------------------
1737 if(fITSModule[ilayer]==-1) {
1740 xloc=-99.; zloc=-99.;
1744 Int_t module = fITSModule[ilayer];
1746 idet = Int_t(module/1000000);
1748 module -= idet*1000000;
1750 status = Int_t(module/100000);
1752 module -= status*100000;
1754 Int_t signs = Int_t(module/10000);
1756 module-=signs*10000;
1758 Int_t xInt = Int_t(module/100);
1761 Int_t zInt = module;
1763 if(signs==1) { xInt*=1; zInt*=1; }
1764 if(signs==2) { xInt*=1; zInt*=-1; }
1765 if(signs==3) { xInt*=-1; zInt*=1; }
1766 if(signs==4) { xInt*=-1; zInt*=-1; }
1768 xloc = 0.1*(Float_t)xInt;
1769 zloc = 0.1*(Float_t)zInt;
1771 if(status==4) idet = -1;
1776 //_______________________________________________________________________
1777 UShort_t AliESDtrack::GetTPCclusters(Int_t *idx) const {
1778 //---------------------------------------------------------------------
1779 // This function returns indices of the assgined ITS clusters
1780 //---------------------------------------------------------------------
1781 if (idx && fFriendTrack) {
1782 Int_t *index=fFriendTrack->GetTPCindices();
1785 for (Int_t i=0; i<AliESDfriendTrack::kMaxTPCcluster; i++) idx[i]=index[i];
1788 for (Int_t i=0; i<AliESDfriendTrack::kMaxTPCcluster; i++) idx[i]=-2;
1794 //_______________________________________________________________________
1795 Float_t AliESDtrack::GetTPCCrossedRows() const
1797 // This function calls GetTPCClusterInfo with some default parameters which are used in the track selection and caches the outcome
1798 // because GetTPCClusterInfo is quite time-consuming
1800 if (fCacheNCrossedRows > -1)
1801 return fCacheNCrossedRows;
1803 fCacheNCrossedRows = GetTPCClusterInfo(2, 1);
1804 return fCacheNCrossedRows;
1807 //_______________________________________________________________________
1808 Float_t AliESDtrack::GetTPCClusterInfo(Int_t nNeighbours/*=3*/, Int_t type/*=0*/, Int_t row0, Int_t row1, Int_t bitType ) const
1811 // TPC cluster information
1812 // type 0: get fraction of found/findable clusters with neighbourhood definition
1813 // 1: findable clusters with neighbourhood definition
1814 // 2: found clusters
1816 // 0 - all cluster used
1817 // 1 - clusters used for the kalman update
1818 // definition of findable clusters:
1819 // a cluster is defined as findable if there is another cluster
1820 // within +- nNeighbours pad rows. The idea is to overcome threshold
1821 // effects with a very simple algorithm.
1827 Int_t last=-nNeighbours;
1828 const TBits & clusterMap = (bitType%2==0) ? fTPCClusterMap : fTPCFitMap;
1830 Int_t upperBound=clusterMap.GetNbits();
1831 if (upperBound>row1) upperBound=row1;
1832 for (Int_t i=row0; i<upperBound; ++i){
1833 //look to current row
1834 if (clusterMap[i]) {
1840 //look to nNeighbours before
1841 if ((i-last)<=nNeighbours) {
1845 //look to nNeighbours after
1846 for (Int_t j=i+1; j<i+1+nNeighbours; ++j){
1853 if (type==2) return found;
1854 if (type==1) return findable;
1859 fraction=(Float_t)found/(Float_t)findable;
1864 return 0; // undefined type - default value
1867 //_______________________________________________________________________
1868 Float_t AliESDtrack::GetTPCClusterDensity(Int_t nNeighbours/*=3*/, Int_t type/*=0*/, Int_t row0, Int_t row1, Int_t bitType ) const
1871 // TPC cluster density - only rows where signal before and after given row are used
1872 // - slower function
1873 // type 0: get fraction of found/findable clusters with neighbourhood definition
1874 // 1: findable clusters with neighbourhood definition
1875 // 2: found clusters
1877 // 0 - all cluster used
1878 // 1 - clusters used for the kalman update
1879 // definition of findable clusters:
1880 // a cluster is defined as findable if there is another cluster
1881 // within +- nNeighbours pad rows. The idea is to overcome threshold
1882 // effects with a very simple algorithm.
1886 // Int_t last=-nNeighbours;
1887 const TBits & clusterMap = (bitType%2==0) ? fTPCClusterMap : fTPCFitMap;
1888 Int_t upperBound=clusterMap.GetNbits();
1889 if (upperBound>row1) upperBound=row1;
1890 for (Int_t i=row0; i<upperBound; ++i){
1892 Bool_t isDown=kFALSE;
1893 for (Int_t idelta=1; idelta<=nNeighbours; idelta++){
1894 if (i-idelta>=0 && clusterMap[i-idelta]) isDown=kTRUE;
1895 if (i+idelta<upperBound && clusterMap[i+idelta]) isUp=kTRUE;
1899 if (clusterMap[i]) ++found;
1902 if (type==2) return found;
1903 if (type==1) return findable;
1908 fraction=(Float_t)found/(Float_t)findable;
1913 return 0; // undefined type - default value
1919 //_______________________________________________________________________
1920 Double_t AliESDtrack::GetTPCdensity(Int_t row0, Int_t row1) const{
1922 // GetDensity of the clusters on given region between row0 and row1
1923 // Dead zone effect takin into acoount
1925 if (!fFriendTrack) return 0.0;
1929 Int_t *index=fFriendTrack->GetTPCindices();
1930 for (Int_t i=row0;i<=row1;i++){
1931 Int_t idx = index[i];
1932 if (idx!=-1) good++; // track outside of dead zone
1935 Float_t density=0.5;
1936 if (good>TMath::Max((row1-row0)*0.5,0.0)) density = Float_t(found)/Float_t(good);
1940 //_______________________________________________________________________
1941 void AliESDtrack::SetTPCpid(const Double_t *p) {
1942 // Sets values for the probability of each particle type (in TPC)
1943 SetPIDValues(fTPCr,p,AliPID::kSPECIES);
1944 SetStatus(AliESDtrack::kTPCpid);
1947 //_______________________________________________________________________
1948 void AliESDtrack::GetTPCpid(Double_t *p) const {
1949 // Gets the probability of each particle type (in TPC)
1950 for (Int_t i=0; i<AliPID::kSPECIES; i++) p[i]=fTPCr[i];
1953 //_______________________________________________________________________
1954 UChar_t AliESDtrack::GetTRDclusters(Int_t *idx) const {
1955 //---------------------------------------------------------------------
1956 // This function returns indices of the assgined TRD clusters
1957 //---------------------------------------------------------------------
1958 if (idx && fFriendTrack) {
1959 Int_t *index=fFriendTrack->GetTRDindices();
1962 for (Int_t i=0; i<AliESDfriendTrack::kMaxTRDcluster; i++) idx[i]=index[i];
1965 for (Int_t i=0; i<AliESDfriendTrack::kMaxTRDcluster; i++) idx[i]=-2;
1971 //_______________________________________________________________________
1972 UChar_t AliESDtrack::GetTRDtracklets(Int_t *idx) const {
1974 // This function returns the number of TRD tracklets used in tracking
1975 // and it fills the indices of these tracklets in the array "idx" as they
1976 // are registered in the TRD track list.
1979 // 1. The idx array has to be allocated with a size >= AliESDtrack::kTRDnPlanes
1980 // 2. The idx array store not only the index but also the layer of the tracklet.
1981 // Therefore tracks with TRD gaps contain default values for indices [-1]
1983 if (!fFriendTrack) return 0;
1984 if (!idx) return GetTRDntracklets();
1985 Int_t *index=fFriendTrack->GetTRDindices();
1987 for (Int_t i=0; i<kTRDnPlanes; i++){
1989 if(index[i]>=0) n++;
1997 //_______________________________________________________________________
1998 void AliESDtrack::SetTRDpid(const Double_t *p) {
1999 // Sets values for the probability of each particle type (in TRD)
2000 SetPIDValues(fTRDr,p,AliPID::kSPECIES);
2001 SetStatus(AliESDtrack::kTRDpid);
2004 //_______________________________________________________________________
2005 void AliESDtrack::GetTRDpid(Double_t *p) const {
2006 // Gets the probability of each particle type (in TRD)
2007 for (Int_t i=0; i<AliPID::kSPECIES; i++) p[i]=fTRDr[i];
2010 //_______________________________________________________________________
2011 void AliESDtrack::SetTRDpid(Int_t iSpecies, Float_t p)
2013 // Sets the probability of particle type iSpecies to p (in TRD)
2014 fTRDr[iSpecies] = p;
2017 Double_t AliESDtrack::GetTRDpid(Int_t iSpecies) const
2019 // Returns the probability of particle type iSpecies (in TRD)
2020 return fTRDr[iSpecies];
2023 //____________________________________________________
2024 Int_t AliESDtrack::GetNumberOfTRDslices() const
2026 // built in backward compatibility
2027 Int_t idx = fTRDnSlices - (kTRDnPlanes<<1);
2028 return idx<18 ? fTRDnSlices/kTRDnPlanes : idx/kTRDnPlanes;
2031 //____________________________________________________
2032 Double_t AliESDtrack::GetTRDmomentum(Int_t plane, Double_t *sp) const
2034 //Returns momentum estimation and optional its error (sp)
2035 // in TRD layer "plane".
2038 AliDebug(2, "No TRD info allocated for this track.");
2041 if ((plane<0) || (plane>=kTRDnPlanes)) {
2042 AliWarning(Form("Request for TRD plane[%d] outside range.", plane));
2046 Int_t idx = fTRDnSlices-(kTRDnPlanes<<1)+plane;
2047 // Protection for backward compatibility
2048 if(idx<(GetNumberOfTRDslices()*kTRDnPlanes)) return -1.;
2050 if(sp) (*sp) = fTRDslices[idx+kTRDnPlanes];
2051 return fTRDslices[idx];
2054 //____________________________________________________
2055 Double_t AliESDtrack::GetTRDslice(Int_t plane, Int_t slice) const {
2056 //Gets the charge from the slice of the plane
2059 //AliError("No TRD slices allocated for this track !");
2062 if ((plane<0) || (plane>=kTRDnPlanes)) {
2063 AliError("Info for TRD plane not available !");
2066 Int_t ns=GetNumberOfTRDslices();
2067 if ((slice<-1) || (slice>=ns)) {
2068 //AliError("Wrong TRD slice !");
2072 if(slice>=0) return fTRDslices[plane*ns + slice];
2074 // return average of the dEdx measurements
2075 Double_t q=0.; Double32_t *s = &fTRDslices[plane*ns];
2076 for (Int_t i=0; i<ns; i++, s++) if((*s)>0.) q+=(*s);
2080 //____________________________________________________
2081 void AliESDtrack::SetNumberOfTRDslices(Int_t n) {
2082 //Sets the number of slices used for PID
2083 if (fTRDnSlices) return;
2086 fTRDslices=new Double32_t[fTRDnSlices];
2088 // set-up correctly the allocated memory
2089 memset(fTRDslices, 0, n*sizeof(Double32_t));
2090 for (Int_t i=GetNumberOfTRDslices(); i--;) fTRDslices[i]=-1.;
2093 //____________________________________________________
2094 void AliESDtrack::SetTRDslice(Double_t q, Int_t plane, Int_t slice) {
2095 //Sets the charge q in the slice of the plane
2097 AliError("No TRD slices allocated for this track !");
2100 if ((plane<0) || (plane>=kTRDnPlanes)) {
2101 AliError("Info for TRD plane not allocated !");
2104 Int_t ns=GetNumberOfTRDslices();
2105 if ((slice<0) || (slice>=ns)) {
2106 AliError("Wrong TRD slice !");
2109 Int_t n=plane*ns + slice;
2114 //____________________________________________________
2115 void AliESDtrack::SetTRDmomentum(Double_t p, Int_t plane, Double_t *sp)
2118 AliError("No TRD slices allocated for this track !");
2121 if ((plane<0) || (plane>=kTRDnPlanes)) {
2122 AliError("Info for TRD plane not allocated !");
2126 Int_t idx = fTRDnSlices-(kTRDnPlanes<<1)+plane;
2127 // Protection for backward compatibility
2128 if(idx<GetNumberOfTRDslices()*kTRDnPlanes) return;
2130 if(sp) fTRDslices[idx+kTRDnPlanes] = (*sp);
2131 fTRDslices[idx] = p;
2135 //_______________________________________________________________________
2136 void AliESDtrack::SetTOFpid(const Double_t *p) {
2137 // Sets the probability of each particle type (in TOF)
2138 SetPIDValues(fTOFr,p,AliPID::kSPECIES);
2139 SetStatus(AliESDtrack::kTOFpid);
2142 //_______________________________________________________________________
2143 void AliESDtrack::SetTOFLabel(const Int_t *p) {
2145 for (Int_t i=0; i<3; i++) fTOFLabel[i]=p[i];
2148 //_______________________________________________________________________
2149 void AliESDtrack::GetTOFpid(Double_t *p) const {
2150 // Gets probabilities of each particle type (in TOF)
2151 for (Int_t i=0; i<AliPID::kSPECIES; i++) p[i]=fTOFr[i];
2154 //_______________________________________________________________________
2155 void AliESDtrack::GetTOFLabel(Int_t *p) const {
2157 for (Int_t i=0; i<3; i++) p[i]=fTOFLabel[i];
2160 //_______________________________________________________________________
2161 void AliESDtrack::GetTOFInfo(Float_t *info) const {
2163 for (Int_t i=0; i<10; i++) info[i]=fTOFInfo[i];
2166 //_______________________________________________________________________
2167 void AliESDtrack::SetTOFInfo(Float_t*info) {
2169 for (Int_t i=0; i<10; i++) fTOFInfo[i]=info[i];
2174 //_______________________________________________________________________
2175 void AliESDtrack::SetHMPIDpid(const Double_t *p) {
2176 // Sets the probability of each particle type (in HMPID)
2177 SetPIDValues(fHMPIDr,p,AliPID::kSPECIES);
2178 SetStatus(AliESDtrack::kHMPIDpid);
2181 //_______________________________________________________________________
2182 void AliESDtrack::SetTPCdEdxInfo(AliTPCdEdxInfo * dEdxInfo){
2183 if(fTPCdEdxInfo) delete fTPCdEdxInfo;
2184 fTPCdEdxInfo = dEdxInfo;
2187 //_______________________________________________________________________
2188 void AliESDtrack::GetHMPIDpid(Double_t *p) const {
2189 // Gets probabilities of each particle type (in HMPID)
2190 for (Int_t i=0; i<AliPID::kSPECIES; i++) p[i]=fHMPIDr[i];
2195 //_______________________________________________________________________
2196 void AliESDtrack::SetESDpid(const Double_t *p) {
2197 // Sets the probability of each particle type for the ESD track
2198 SetPIDValues(fR,p,AliPID::kSPECIES);
2199 SetStatus(AliESDtrack::kESDpid);
2202 //_______________________________________________________________________
2203 void AliESDtrack::GetESDpid(Double_t *p) const {
2204 // Gets probability of each particle type for the ESD track
2205 for (Int_t i=0; i<AliPID::kSPECIES; i++) p[i]=fR[i];
2208 //_______________________________________________________________________
2209 Bool_t AliESDtrack::RelateToVertexTPC(const AliESDVertex *vtx,
2210 Double_t b, Double_t maxd, AliExternalTrackParam *cParam) {
2212 // Try to relate the TPC-only track parameters to the vertex "vtx",
2213 // if the (rough) transverse impact parameter is not bigger then "maxd".
2214 // Magnetic field is "b" (kG).
2216 // a) The TPC-only paramters are extapolated to the DCA to the vertex.
2217 // b) The impact parameters and their covariance matrix are calculated.
2218 // c) An attempt to constrain the TPC-only params to the vertex is done.
2219 // The constrained params are returned via "cParam".
2221 // In the case of success, the returned value is kTRUE
2222 // otherwise, it's kFALSE)
2225 if (!fTPCInner) return kFALSE;
2226 if (!vtx) return kFALSE;
2228 Double_t dz[2],cov[3];
2229 if (!fTPCInner->PropagateToDCA(vtx, b, maxd, dz, cov)) return kFALSE;
2237 Double_t covar[6]; vtx->GetCovMatrix(covar);
2238 Double_t p[2]={GetParameter()[0]-dz[0],GetParameter()[1]-dz[1]};
2239 Double_t c[3]={covar[2],0.,covar[5]};
2241 Double_t chi2=GetPredictedChi2(p,c);
2242 if (chi2>kVeryBig) return kFALSE;
2246 if (!cParam) return kTRUE;
2248 *cParam = *fTPCInner;
2249 if (!cParam->Update(p,c)) return kFALSE;
2254 //_______________________________________________________________________
2255 Bool_t AliESDtrack::RelateToVertexTPCBxByBz(const AliESDVertex *vtx,
2256 Double_t b[3], Double_t maxd, AliExternalTrackParam *cParam) {
2258 // Try to relate the TPC-only track parameters to the vertex "vtx",
2259 // if the (rough) transverse impact parameter is not bigger then "maxd".
2261 // All three components of the magnetic field ,"b[3]" (kG),
2262 // are taken into account.
2264 // a) The TPC-only paramters are extapolated to the DCA to the vertex.
2265 // b) The impact parameters and their covariance matrix are calculated.
2266 // c) An attempt to constrain the TPC-only params to the vertex is done.
2267 // The constrained params are returned via "cParam".
2269 // In the case of success, the returned value is kTRUE
2270 // otherwise, it's kFALSE)
2273 if (!fTPCInner) return kFALSE;
2274 if (!vtx) return kFALSE;
2276 Double_t dz[2],cov[3];
2277 if (!fTPCInner->PropagateToDCABxByBz(vtx, b, maxd, dz, cov)) return kFALSE;
2285 Double_t covar[6]; vtx->GetCovMatrix(covar);
2286 Double_t p[2]={GetParameter()[0]-dz[0],GetParameter()[1]-dz[1]};
2287 Double_t c[3]={covar[2],0.,covar[5]};
2289 Double_t chi2=GetPredictedChi2(p,c);
2290 if (chi2>kVeryBig) return kFALSE;
2294 if (!cParam) return kTRUE;
2296 *cParam = *fTPCInner;
2297 if (!cParam->Update(p,c)) return kFALSE;
2302 //_______________________________________________________________________
2303 Bool_t AliESDtrack::RelateToVertex(const AliESDVertex *vtx,
2304 Double_t b, Double_t maxd, AliExternalTrackParam *cParam) {
2306 // Try to relate this track to the vertex "vtx",
2307 // if the (rough) transverse impact parameter is not bigger then "maxd".
2308 // Magnetic field is "b" (kG).
2310 // a) The track gets extapolated to the DCA to the vertex.
2311 // b) The impact parameters and their covariance matrix are calculated.
2312 // c) An attempt to constrain this track to the vertex is done.
2313 // The constrained params are returned via "cParam".
2315 // In the case of success, the returned value is kTRUE
2316 // (otherwise, it's kFALSE)
2319 if (!vtx) return kFALSE;
2321 Double_t dz[2],cov[3];
2322 if (!PropagateToDCA(vtx, b, maxd, dz, cov)) return kFALSE;
2330 Double_t covar[6]; vtx->GetCovMatrix(covar);
2331 Double_t p[2]={GetParameter()[0]-dz[0],GetParameter()[1]-dz[1]};
2332 Double_t c[3]={covar[2],0.,covar[5]};
2334 Double_t chi2=GetPredictedChi2(p,c);
2335 if (chi2>kVeryBig) return kFALSE;
2340 //--- Could now these lines be removed ? ---
2342 fCp=new AliExternalTrackParam(*this);
2344 if (!fCp->Update(p,c)) {delete fCp; fCp=0; return kFALSE;}
2345 //----------------------------------------
2347 fVertexID = vtx->GetID();
2349 if (!cParam) return kTRUE;
2352 if (!cParam->Update(p,c)) return kFALSE;
2357 //_______________________________________________________________________
2358 Bool_t AliESDtrack::RelateToVertexBxByBz(const AliESDVertex *vtx,
2359 Double_t b[3], Double_t maxd, AliExternalTrackParam *cParam) {
2361 // Try to relate this track to the vertex "vtx",
2362 // if the (rough) transverse impact parameter is not bigger then "maxd".
2363 // Magnetic field is "b" (kG).
2365 // a) The track gets extapolated to the DCA to the vertex.
2366 // b) The impact parameters and their covariance matrix are calculated.
2367 // c) An attempt to constrain this track to the vertex is done.
2368 // The constrained params are returned via "cParam".
2370 // In the case of success, the returned value is kTRUE
2371 // (otherwise, it's kFALSE)
2374 if (!vtx) return kFALSE;
2376 Double_t dz[2],cov[3];
2377 if (!PropagateToDCABxByBz(vtx, b, maxd, dz, cov)) return kFALSE;
2385 Double_t covar[6]; vtx->GetCovMatrix(covar);
2386 Double_t p[2]={GetParameter()[0]-dz[0],GetParameter()[1]-dz[1]};
2387 Double_t c[3]={covar[2],0.,covar[5]};
2389 Double_t chi2=GetPredictedChi2(p,c);
2390 if (chi2>kVeryBig) return kFALSE;
2395 //--- Could now these lines be removed ? ---
2397 fCp=new AliExternalTrackParam(*this);
2399 if (!fCp->Update(p,c)) {delete fCp; fCp=0; return kFALSE;}
2400 //----------------------------------------
2402 fVertexID = vtx->GetID();
2404 if (!cParam) return kTRUE;
2407 if (!cParam->Update(p,c)) return kFALSE;
2412 //_______________________________________________________________________
2413 void AliESDtrack::Print(Option_t *) const {
2414 // Prints info on the track
2415 AliExternalTrackParam::Print();
2416 printf("ESD track info\n") ;
2417 Double_t p[AliPID::kSPECIESN] ;
2419 if( IsOn(kITSpid) ){
2420 printf("From ITS: ") ;
2422 for(index = 0 ; index < AliPID::kSPECIES; index++)
2423 printf("%f, ", p[index]) ;
2424 printf("\n signal = %f\n", GetITSsignal()) ;
2426 if( IsOn(kTPCpid) ){
2427 printf("From TPC: ") ;
2429 for(index = 0 ; index < AliPID::kSPECIES; index++)
2430 printf("%f, ", p[index]) ;
2431 printf("\n signal = %f\n", GetTPCsignal()) ;
2433 if( IsOn(kTRDpid) ){
2434 printf("From TRD: ") ;
2436 for(index = 0 ; index < AliPID::kSPECIES; index++)
2437 printf("%f, ", p[index]) ;
2438 printf("\n signal = %f\n", GetTRDsignal()) ;
2439 printf("\n NchamberdEdx = %d\n", GetTRDNchamberdEdx()) ;
2440 printf("\n NclusterdEdx = %d\n", GetTRDNclusterdEdx()) ;
2442 if( IsOn(kTOFpid) ){
2443 printf("From TOF: ") ;
2445 for(index = 0 ; index < AliPID::kSPECIES; index++)
2446 printf("%f, ", p[index]) ;
2447 printf("\n signal = %f\n", GetTOFsignal()) ;
2449 if( IsOn(kHMPIDpid) ){
2450 printf("From HMPID: ") ;
2452 for(index = 0 ; index < AliPID::kSPECIES; index++)
2453 printf("%f, ", p[index]) ;
2454 printf("\n signal = %f\n", GetHMPIDsignal()) ;
2460 // Draw functionality
2461 // Origin: Marian Ivanov, Marian.Ivanov@cern.ch
2463 void AliESDtrack::FillPolymarker(TPolyMarker3D *pol, Float_t magF, Float_t minR, Float_t maxR, Float_t stepR){
2465 // Fill points in the polymarker
2468 arrayRef.AddLast(new AliExternalTrackParam(*this));
2469 if (fIp) arrayRef.AddLast(new AliExternalTrackParam(*fIp));
2470 if (fOp) arrayRef.AddLast(new AliExternalTrackParam(*fOp));
2471 if (fHMPIDp) arrayRef.AddLast(new AliExternalTrackParam(*fHMPIDp));
2473 Double_t mpos[3]={0,0,0};
2474 Int_t entries=arrayRef.GetEntries();
2475 for (Int_t i=0;i<entries;i++){
2477 ((AliExternalTrackParam*)arrayRef.At(i))->GetXYZ(pos);
2478 mpos[0]+=pos[0]/entries;
2479 mpos[1]+=pos[1]/entries;
2480 mpos[2]+=pos[2]/entries;
2482 // Rotate to the mean position
2484 Float_t fi= TMath::ATan2(mpos[1],mpos[0]);
2485 for (Int_t i=0;i<entries;i++){
2486 Bool_t res = ((AliExternalTrackParam*)arrayRef.At(i))->Rotate(fi);
2487 if (!res) delete arrayRef.RemoveAt(i);
2490 for (Double_t r=minR; r<maxR; r+=stepR){
2492 Double_t mlpos[3]={0,0,0};
2493 for (Int_t i=0;i<entries;i++){
2494 Double_t point[3]={0,0,0};
2495 AliExternalTrackParam *param = ((AliExternalTrackParam*)arrayRef.At(i));
2496 if (!param) continue;
2497 if (param->GetXYZAt(r,magF,point)){
2498 Double_t weight = 1./(10.+(r-param->GetX())*(r-param->GetX()));
2500 mlpos[0]+=point[0]*weight;
2501 mlpos[1]+=point[1]*weight;
2502 mlpos[2]+=point[2]*weight;
2509 pol->SetPoint(counter,mlpos[0],mlpos[1], mlpos[2]);
2510 // printf("xyz\t%f\t%f\t%f\n",mlpos[0], mlpos[1],mlpos[2]);
2516 //_______________________________________________________________________
2517 void AliESDtrack::SetITSdEdxSamples(const Double_t s[4]) {
2519 // Store the dE/dx samples measured by the two SSD and two SDD layers.
2520 // These samples are corrected for the track segment length.
2522 for (Int_t i=0; i<4; i++) fITSdEdxSamples[i]=s[i];
2525 //_______________________________________________________________________
2526 void AliESDtrack::GetITSdEdxSamples(Double_t *s) const {
2528 // Get the dE/dx samples measured by the two SSD and two SDD layers.
2529 // These samples are corrected for the track segment length.
2531 for (Int_t i=0; i<4; i++) s[i]=fITSdEdxSamples[i];
2535 UShort_t AliESDtrack::GetTPCnclsS(Int_t i0,Int_t i1) const{
2537 // get number of shared TPC clusters
2539 return fTPCSharedMap.CountBits(i0)-fTPCSharedMap.CountBits(i1);
2542 UShort_t AliESDtrack::GetTPCncls(Int_t i0,Int_t i1) const{
2544 // get number of TPC clusters
2546 return fTPCClusterMap.CountBits(i0)-fTPCClusterMap.CountBits(i1);
2549 //____________________________________________________________________
2550 Double_t AliESDtrack::GetChi2TPCConstrainedVsGlobal(const AliESDVertex* vtx) const
2552 // Calculates the chi2 between the TPC track (TPCinner) constrained to the primary vertex and the global track
2554 // Returns -1 in case the calculation failed
2556 // Value is cached as a non-persistent member.
2558 // Code adapted from original code by GSI group (Jacek, Marian, Michael)
2560 // cache, ignoring that a different vertex might be passed
2561 if (fCacheChi2TPCConstrainedVsGlobalVertex == vtx)
2562 return fCacheChi2TPCConstrainedVsGlobal;
2564 fCacheChi2TPCConstrainedVsGlobal = -1;
2565 fCacheChi2TPCConstrainedVsGlobalVertex = vtx;
2570 AliTrackerBase::GetBxByBz(x,b);
2573 AliWarning("Could not get TPC Inner Param.");
2574 return fCacheChi2TPCConstrainedVsGlobal;
2577 // clone for constraining
2578 AliExternalTrackParam* tpcInnerC = new AliExternalTrackParam(*fTPCInner);
2580 AliWarning("Clone of TPCInnerParam failed.");
2581 return fCacheChi2TPCConstrainedVsGlobal;
2584 // transform to the track reference frame
2585 Bool_t isOK = tpcInnerC->Rotate(GetAlpha());
2586 isOK &= tpcInnerC->PropagateTo(GetX(), b[2]);
2590 AliWarning("Rotation/Propagation of track failed.") ;
2591 return fCacheChi2TPCConstrainedVsGlobal;
2594 // constrain TPCinner
2595 isOK = tpcInnerC->ConstrainToVertex(vtx, b);
2597 // transform to the track reference frame
2598 isOK &= tpcInnerC->Rotate(GetAlpha());
2599 isOK &= tpcInnerC->PropagateTo(GetX(), b[2]);
2602 AliWarning("ConstrainTPCInner failed.") ;
2605 return fCacheChi2TPCConstrainedVsGlobal;
2608 // calculate chi2 between vi and vj vectors
2609 // with covi and covj covariance matrices
2610 // chi2ij = (vi-vj)^(T)*(covi+covj)^(-1)*(vi-vj)
2611 TMatrixD deltaT(5,1);
2612 TMatrixD delta(1,5);
2613 TMatrixD covarM(5,5);
2615 for (Int_t ipar=0; ipar<5; ipar++) {
2616 deltaT(ipar,0) = tpcInnerC->GetParameter()[ipar] - GetParameter()[ipar];
2617 delta(0,ipar) = tpcInnerC->GetParameter()[ipar] - GetParameter()[ipar];
2619 for (Int_t jpar=0; jpar<5; jpar++) {
2620 Int_t index = GetIndex(ipar,jpar);
2621 covarM(ipar,jpar) = GetCovariance()[index]+tpcInnerC->GetCovariance()[index];
2624 // chi2 distance TPC constrained and TPC+ITS
2625 TMatrixD covarMInv = covarM.Invert();
2626 TMatrixD mat2 = covarMInv*deltaT;
2627 TMatrixD chi2 = delta*mat2;
2632 fCacheChi2TPCConstrainedVsGlobal = chi2(0,0);
2633 return fCacheChi2TPCConstrainedVsGlobal;