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
21 //-----------------------------------------------------------------
24 #include <TParticle.h>
26 #include "AliESDVertex.h"
27 #include "AliESDtrack.h"
28 #include "AliKalmanTrack.h"
30 #include "AliTrackPointArray.h"
34 void SetPIDValues(Float_t * dest, const Double_t * src, Int_t n) {
35 // This function copies "n" PID weights from "scr" to "dest"
36 // and normalizes their sum to 1 thus producing conditional probabilities.
37 // The negative weights are set to 0.
38 // In case all the weights are non-positive they are replaced by
39 // uniform probabilities
43 Float_t uniform = 1./(Float_t)n;
46 for (Int_t i=0; i<n; i++)
56 for (Int_t i=0; i<n; i++) dest[i] /= sum;
58 for (Int_t i=0; i<n; i++) dest[i] = uniform;
61 //_______________________________________________________________________
62 AliESDtrack::AliESDtrack() :
63 AliExternalTrackParam(),
69 fCdd(0),fCdz(0),fCzz(0),
83 fTPCClusterMap(159),//number of padrows
110 fEMCALindex(kEMCALNoMatch),
111 fFriendTrack(new AliESDfriendTrack())
114 // The default ESD constructor
117 for (i=0; i<AliPID::kSPECIES; i++) {
127 for (i=0; i<3; i++) { fKinkIndexes[i]=0;}
128 for (i=0; i<3; i++) { fV0Indexes[i]=-1;}
129 for (i=0;i<kNPlane;i++) {
130 for (j=0;j<kNSlice;j++) {
131 fTRDsignals[i][j]=0.;
135 for (i=0;i<4;i++) {fTPCPoints[i]=-1;}
136 for (i=0;i<3;i++) {fTOFLabel[i]=-1;}
137 for (i=0;i<10;i++) {fTOFInfo[i]=-1;}
140 //_______________________________________________________________________
141 AliESDtrack::AliESDtrack(const AliESDtrack& track):
142 AliExternalTrackParam(track),
143 fFlags(track.fFlags),
144 fLabel(track.fLabel),
146 fTrackLength(track.fTrackLength),
147 fD(track.fD),fZ(track.fZ),
148 fCdd(track.fCdd),fCdz(track.fCdz),fCzz(track.fCzz),
149 fStopVertex(track.fStopVertex),
151 fCchi2(track.fCchi2),
154 fITSchi2(track.fITSchi2),
155 fITSncls(track.fITSncls),
156 fITSClusterMap(track.fITSClusterMap),
157 fITSsignal(track.fITSsignal),
158 fITSLabel(track.fITSLabel),
159 fTPCchi2(track.fTPCchi2),
160 fTPCncls(track.fTPCncls),
161 fTPCnclsF(track.fTPCnclsF),
162 fTPCClusterMap(track.fTPCClusterMap),
163 fTPCsignal(track.fTPCsignal),
164 fTPCsignalN(track.fTPCsignalN),
165 fTPCsignalS(track.fTPCsignalS),
166 fTPCLabel(track.fTPCLabel),
167 fTRDchi2(track.fTRDchi2),
168 fTRDncls(track.fTRDncls),
169 fTRDncls0(track.fTRDncls0),
170 fTRDsignal(track.fTRDsignal),
171 fTRDLabel(track.fTRDLabel),
172 fTRDQuality(track.fTRDQuality),
173 fTRDBudget(track.fTRDBudget),
174 fTOFchi2(track.fTOFchi2),
175 fTOFindex(track.fTOFindex),
176 fTOFCalChannel(track.fTOFCalChannel),
177 fTOFsignal(track.fTOFsignal),
178 fTOFsignalToT(track.fTOFsignalToT),
179 fHMPIDchi2(track.fHMPIDchi2),
180 fHMPIDqn(track.fHMPIDqn),
181 fHMPIDcluIdx(track.fHMPIDcluIdx),
182 fHMPIDsignal(track.fHMPIDsignal),
183 fHMPIDtrkTheta(track.fHMPIDtrkTheta),
184 fHMPIDtrkPhi(track.fHMPIDtrkPhi),
185 fHMPIDtrkX(track.fHMPIDtrkX),
186 fHMPIDtrkY(track.fHMPIDtrkY),
187 fHMPIDmipX(track.fHMPIDmipX),
188 fHMPIDmipY(track.fHMPIDmipY),
189 fEMCALindex(track.fEMCALindex),
195 for (Int_t i=0;i<AliPID::kSPECIES;i++) fTrackTime[i]=track.fTrackTime[i];
196 for (Int_t i=0;i<AliPID::kSPECIES;i++) fR[i]=track.fR[i];
198 for (Int_t i=0;i<AliPID::kSPECIES;i++) fITSr[i]=track.fITSr[i];
200 for (Int_t i=0;i<AliPID::kSPECIES;i++) fTPCr[i]=track.fTPCr[i];
201 for (Int_t i=0;i<4;i++) {fTPCPoints[i]=track.fTPCPoints[i];}
202 for (Int_t i=0; i<3;i++) { fKinkIndexes[i]=track.fKinkIndexes[i];}
203 for (Int_t i=0; i<3;i++) { fV0Indexes[i]=track.fV0Indexes[i];}
205 for (Int_t i=0;i<kNPlane;i++) {
206 for (Int_t j=0;j<kNSlice;j++) {
207 fTRDsignals[i][j]=track.fTRDsignals[i][j];
209 fTRDTimBin[i]=track.fTRDTimBin[i];
211 for (Int_t i=0;i<AliPID::kSPECIES;i++) fTRDr[i]=track.fTRDr[i];
212 for (Int_t i=0;i<AliPID::kSPECIES;i++) fTOFr[i]=track.fTOFr[i];
213 for (Int_t i=0;i<3;i++) fTOFLabel[i]=track.fTOFLabel[i];
214 for (Int_t i=0;i<10;i++) fTOFInfo[i]=track.fTOFInfo[i];
215 for (Int_t i=0;i<AliPID::kSPECIES;i++) fHMPIDr[i]=track.fHMPIDr[i];
217 if (track.fCp) fCp=new AliExternalTrackParam(*track.fCp);
218 if (track.fIp) fIp=new AliExternalTrackParam(*track.fIp);
219 if (track.fOp) fOp=new AliExternalTrackParam(*track.fOp);
221 if (track.fFriendTrack) fFriendTrack=new AliESDfriendTrack(*(track.fFriendTrack));
224 //_______________________________________________________________________
225 AliESDtrack::AliESDtrack(TParticle * part) :
226 AliExternalTrackParam(),
232 fCdd(0),fCdz(0),fCzz(0),
246 fTPCClusterMap(159),//number of padrows
273 fEMCALindex(kEMCALNoMatch),
277 // ESD track from TParticle
280 // Reset all the arrays
282 for (i=0; i<AliPID::kSPECIES; i++) {
292 for (i=0; i<3; i++) { fKinkIndexes[i]=0;}
293 for (i=0; i<3; i++) { fV0Indexes[i]=-1;}
294 for (i=0;i<kNPlane;i++) {
295 for (j=0;j<kNSlice;j++) {
296 fTRDsignals[i][j]=0.;
300 for (i=0;i<4;i++) {fTPCPoints[i]=-1;}
301 for (i=0;i<3;i++) {fTOFLabel[i]=-1;}
302 for (i=0;i<10;i++) {fTOFInfo[i]=-1;}
304 // Calculate the AliExternalTrackParam content
311 // Calculate alpha: the rotation angle of the corresponding local system (TPC sector)
312 alpha = part->Phi()*180./TMath::Pi();
313 if (alpha<0) alpha+= 360.;
314 if (alpha>360) alpha -= 360.;
316 Int_t sector = (Int_t)(alpha/20.);
317 alpha = 10. + 20.*sector;
319 alpha *= TMath::Pi();
321 // Covariance matrix: no errors, the parameters are exact
322 for (i=0; i<15; i++) covar[i]=0.;
324 // Get the vertex of origin and the momentum
325 TVector3 ver(part->Vx(),part->Vy(),part->Vz());
326 TVector3 mom(part->Px(),part->Py(),part->Pz());
328 // Rotate to the local coordinate system (TPC sector)
332 // X of the referense plane
335 Int_t pdgCode = part->GetPdgCode();
338 TDatabasePDG::Instance()->GetParticle(pdgCode)->Charge();
342 param[2] = TMath::Sin(mom.Phi());
343 param[3] = mom.Pz()/mom.Pt();
344 param[4] = TMath::Sign(1/mom.Pt(),charge);
346 // Set AliExternalTrackParam
347 Set(xref, alpha, param, covar);
352 switch (TMath::Abs(pdgCode)) {
378 // If the particle is not e,mu,pi,K or p the PID probabilities are set to 0
379 if (indexPID < AliPID::kSPECIES) {
385 fHMPIDr[indexPID]=1.;
388 // AliESD track label
389 SetLabel(part->GetUniqueID());
393 //_______________________________________________________________________
394 AliESDtrack::~AliESDtrack(){
396 // This is destructor according Coding Conventrions
398 //printf("Delete track\n");
405 void AliESDtrack::AddCalibObject(TObject * object){
407 // add calib object to the list
409 if (!fFriendTrack) fFriendTrack = new AliESDfriendTrack;
410 fFriendTrack->AddCalibObject(object);
413 TObject * AliESDtrack::GetCalibObject(Int_t index){
415 // return calib objct at given position
417 if (!fFriendTrack) return 0;
418 return fFriendTrack->GetCalibObject(index);
422 //_______________________________________________________________________
423 void AliESDtrack::MakeMiniESDtrack(){
424 // Resets everything except
425 // fFlags: Reconstruction status flags
426 // fLabel: Track label
427 // fID: Unique ID of the track
428 // fD: Impact parameter in XY-plane
429 // fZ: Impact parameter in Z
430 // fR[AliPID::kSPECIES]: combined "detector response probability"
431 // Running track parameters in the base class (AliExternalTrackParam)
434 for (Int_t i=0;i<AliPID::kSPECIES;i++) fTrackTime[i] = 0;
437 // Reset track parameters constrained to the primary vertex
441 // Reset track parameters at the inner wall of TPC
444 // Reset track parameters at the inner wall of the TRD
447 // Reset ITS track related information
452 for (Int_t i=0;i<AliPID::kSPECIES;i++) fITSr[i]=0;
455 // Reset TPC related track information
463 for (Int_t i=0;i<AliPID::kSPECIES;i++) fTPCr[i]=0;
465 for (Int_t i=0;i<4;i++) fTPCPoints[i] = 0;
466 for (Int_t i=0; i<3;i++) fKinkIndexes[i] = 0;
467 for (Int_t i=0; i<3;i++) fV0Indexes[i] = 0;
469 // Reset TRD related track information
474 for (Int_t i=0;i<kNPlane;i++) {
475 for (Int_t j=0;j<kNSlice;j++) {
476 fTRDsignals[i][j] = 0;
480 for (Int_t i=0;i<AliPID::kSPECIES;i++) fTRDr[i] = 0;
485 // Reset TOF related track information
491 for (Int_t i=0;i<AliPID::kSPECIES;i++) fTOFr[i] = 0;
492 for (Int_t i=0;i<3;i++) fTOFLabel[i] = 0;
493 for (Int_t i=0;i<10;i++) fTOFInfo[i] = 0;
495 // Reset HMPID related track information
500 for (Int_t i=0;i<AliPID::kSPECIES;i++) fHMPIDr[i] = 0;
507 fEMCALindex = kEMCALNoMatch;
509 delete fFriendTrack; fFriendTrack = 0;
511 //_______________________________________________________________________
512 Double_t AliESDtrack::GetMass() const {
513 // Returns the mass of the most probable particle type
516 for (Int_t i=0; i<AliPID::kSPECIES; i++) {
517 if (fR[i]>max) {k=i; max=fR[i];}
519 if (k==0) { // dE/dx "crossing points" in the TPC
521 if ((p>0.38)&&(p<0.48))
522 if (fR[0]<fR[3]*10.) return AliPID::ParticleMass(AliPID::kKaon);
523 if ((p>0.75)&&(p<0.85))
524 if (fR[0]<fR[4]*10.) return AliPID::ParticleMass(AliPID::kProton);
527 if (k==1) return AliPID::ParticleMass(AliPID::kMuon);
528 if (k==2||k==-1) return AliPID::ParticleMass(AliPID::kPion);
529 if (k==3) return AliPID::ParticleMass(AliPID::kKaon);
530 if (k==4) return AliPID::ParticleMass(AliPID::kProton);
531 AliWarning("Undefined mass !");
532 return AliPID::ParticleMass(AliPID::kPion);
535 //_______________________________________________________________________
536 Bool_t AliESDtrack::UpdateTrackParams(const AliKalmanTrack *t, ULong_t flags){
538 // This function updates track's running parameters
544 fLabel=t->GetLabel();
546 if (t->IsStartedTimeIntegral()) {
548 Double_t times[10];t->GetIntegratedTimes(times); SetIntegratedTimes(times);
549 SetIntegratedLength(t->GetIntegratedLength());
552 Set(t->GetX(),t->GetAlpha(),t->GetParameter(),t->GetCovariance());
556 case kITSin: case kITSout: case kITSrefit:
557 fITSncls=t->GetNumberOfClusters();
558 index=fFriendTrack->GetITSindices();
559 for (Int_t i=0;i<AliESDfriendTrack::kMaxITScluster;i++) {
560 index[i]=t->GetClusterIndex(i);
562 Int_t l=(index[i] & 0xf0000000) >> 28;
563 SETBIT(fITSClusterMap,l);
566 fITSchi2=t->GetChi2();
567 fITSsignal=t->GetPIDsignal();
568 fITSLabel = t->GetLabel();
571 case kTPCin: case kTPCrefit:
572 fTPCLabel = t->GetLabel();
573 if (!fIp) fIp=new AliExternalTrackParam(*t);
575 fIp->Set(t->GetX(),t->GetAlpha(),t->GetParameter(),t->GetCovariance());
577 index=fFriendTrack->GetTPCindices();
578 if (flags & kTPCout){
579 if (!fOp) fOp=new AliExternalTrackParam(*t);
581 fOp->Set(t->GetX(),t->GetAlpha(),t->GetParameter(),t->GetCovariance());
583 fTPCncls=t->GetNumberOfClusters();
584 fTPCchi2=t->GetChi2();
586 {//prevrow must be declared in separate namespace, otherwise compiler cries:
587 //"jump to case label crosses initialization of `Int_t prevrow'"
589 // for (Int_t i=0;i<fTPCncls;i++)
590 for (Int_t i=0;i<AliESDfriendTrack::kMaxTPCcluster;i++)
592 index[i]=t->GetClusterIndex(i);
593 Int_t idx = index[i];
597 // Piotr's Cluster Map for HBT
598 // ### please change accordingly if cluster array is changing
599 // to "New TPC Tracking" style (with gaps in array)
600 Int_t sect = (idx&0xff000000)>>24;
601 Int_t row = (idx&0x00ff0000)>>16;
602 if (sect > 18) row +=63; //if it is outer sector, add number of inner sectors
604 fTPCClusterMap.SetBitNumber(row,kTRUE);
606 //Fill the gap between previous row and this row with 0 bits
607 //In case ### pleas change it as well - just set bit 0 in case there
608 //is no associated clusters for current "i"
611 prevrow = row;//if previous bit was not assigned yet == this is the first one
614 { //we don't know the order (inner to outer or reverse)
615 //just to be save in case it is going to change
628 for (Int_t j = n+1; j < m; j++)
630 fTPCClusterMap.SetBitNumber(j,kFALSE);
634 // End Of Piotr's Cluster Map for HBT
637 fTPCsignal=t->GetPIDsignal();
640 case kTRDout: case kTRDin: case kTRDrefit:
641 index=fFriendTrack->GetTRDindices();
642 fTRDLabel = t->GetLabel();
643 fTRDncls=t->GetNumberOfClusters();
644 fTRDchi2=t->GetChi2();
645 for (Int_t i=0;i<fTRDncls;i++) index[i]=t->GetClusterIndex(i);
646 fTRDsignal=t->GetPIDsignal();
649 if (!fOp) fOp=new AliExternalTrackParam(*t);
651 fOp->Set(t->GetX(),t->GetAlpha(),t->GetParameter(),t->GetCovariance());
652 fTRDncls0 = t->GetNumberOfClusters();
661 AliError("Wrong flag !");
668 //_______________________________________________________________________
669 void AliESDtrack::GetExternalParameters(Double_t &x, Double_t p[5]) const {
670 //---------------------------------------------------------------------
671 // This function returns external representation of the track parameters
672 //---------------------------------------------------------------------
674 for (Int_t i=0; i<5; i++) p[i]=GetParameter()[i];
677 //_______________________________________________________________________
678 void AliESDtrack::GetExternalCovariance(Double_t cov[15]) const {
679 //---------------------------------------------------------------------
680 // This function returns external representation of the cov. matrix
681 //---------------------------------------------------------------------
682 for (Int_t i=0; i<15; i++) cov[i]=AliExternalTrackParam::GetCovariance()[i];
685 //_______________________________________________________________________
686 Bool_t AliESDtrack::GetConstrainedExternalParameters
687 (Double_t &alpha, Double_t &x, Double_t p[5]) const {
688 //---------------------------------------------------------------------
689 // This function returns the constrained external track parameters
690 //---------------------------------------------------------------------
691 if (!fCp) return kFALSE;
692 alpha=fCp->GetAlpha();
694 for (Int_t i=0; i<5; i++) p[i]=fCp->GetParameter()[i];
698 //_______________________________________________________________________
700 AliESDtrack::GetConstrainedExternalCovariance(Double_t c[15]) const {
701 //---------------------------------------------------------------------
702 // This function returns the constrained external cov. matrix
703 //---------------------------------------------------------------------
704 if (!fCp) return kFALSE;
705 for (Int_t i=0; i<15; i++) c[i]=fCp->GetCovariance()[i];
710 AliESDtrack::GetInnerExternalParameters
711 (Double_t &alpha, Double_t &x, Double_t p[5]) const {
712 //---------------------------------------------------------------------
713 // This function returns external representation of the track parameters
714 // at the inner layer of TPC
715 //---------------------------------------------------------------------
716 if (!fIp) return kFALSE;
717 alpha=fIp->GetAlpha();
719 for (Int_t i=0; i<5; i++) p[i]=fIp->GetParameter()[i];
724 AliESDtrack::GetInnerExternalCovariance(Double_t cov[15]) const {
725 //---------------------------------------------------------------------
726 // This function returns external representation of the cov. matrix
727 // at the inner layer of TPC
728 //---------------------------------------------------------------------
729 if (!fIp) return kFALSE;
730 for (Int_t i=0; i<15; i++) cov[i]=fIp->GetCovariance()[i];
735 AliESDtrack::GetOuterExternalParameters
736 (Double_t &alpha, Double_t &x, Double_t p[5]) const {
737 //---------------------------------------------------------------------
738 // This function returns external representation of the track parameters
739 // at the inner layer of TRD
740 //---------------------------------------------------------------------
741 if (!fOp) return kFALSE;
742 alpha=fOp->GetAlpha();
744 for (Int_t i=0; i<5; i++) p[i]=fOp->GetParameter()[i];
749 AliESDtrack::GetOuterExternalCovariance(Double_t cov[15]) const {
750 //---------------------------------------------------------------------
751 // This function returns external representation of the cov. matrix
752 // at the inner layer of TRD
753 //---------------------------------------------------------------------
754 if (!fOp) return kFALSE;
755 for (Int_t i=0; i<15; i++) cov[i]=fOp->GetCovariance()[i];
759 Int_t AliESDtrack::GetNcls(Int_t idet) const
761 // Get number of clusters by subdetector index
784 Int_t AliESDtrack::GetClusters(Int_t idet, Int_t *idx) const
786 // Get cluster index array by subdetector index
791 ncls = GetITSclusters(idx);
794 ncls = GetTPCclusters(idx);
797 ncls = GetTRDclusters(idx);
800 if (fTOFindex != 0) {
801 idx[0] = GetTOFcluster();
811 //_______________________________________________________________________
812 void AliESDtrack::GetIntegratedTimes(Double_t *times) const {
813 // Returns the array with integrated times for each particle hypothesis
814 for (Int_t i=0; i<AliPID::kSPECIES; i++) times[i]=fTrackTime[i];
817 //_______________________________________________________________________
818 void AliESDtrack::SetIntegratedTimes(const Double_t *times) {
819 // Sets the array with integrated times for each particle hypotesis
820 for (Int_t i=0; i<AliPID::kSPECIES; i++) fTrackTime[i]=times[i];
823 //_______________________________________________________________________
824 void AliESDtrack::SetITSpid(const Double_t *p) {
825 // Sets values for the probability of each particle type (in ITS)
826 SetPIDValues(fITSr,p,AliPID::kSPECIES);
827 SetStatus(AliESDtrack::kITSpid);
830 //_______________________________________________________________________
831 void AliESDtrack::GetITSpid(Double_t *p) const {
832 // Gets the probability of each particle type (in ITS)
833 for (Int_t i=0; i<AliPID::kSPECIES; i++) p[i]=fITSr[i];
836 //_______________________________________________________________________
837 Int_t AliESDtrack::GetITSclusters(Int_t *idx) const {
838 //---------------------------------------------------------------------
839 // This function returns indices of the assgined ITS clusters
840 //---------------------------------------------------------------------
842 Int_t *index=fFriendTrack->GetITSindices();
843 for (Int_t i=0; i<AliESDfriendTrack::kMaxITScluster; i++) idx[i]=index[i];
848 //_______________________________________________________________________
849 Int_t AliESDtrack::GetTPCclusters(Int_t *idx) const {
850 //---------------------------------------------------------------------
851 // This function returns indices of the assgined ITS clusters
852 //---------------------------------------------------------------------
854 Int_t *index=fFriendTrack->GetTPCindices();
855 for (Int_t i=0; i<AliESDfriendTrack::kMaxTPCcluster; i++) idx[i]=index[i];
860 Float_t AliESDtrack::GetTPCdensity(Int_t row0, Int_t row1) const{
862 // GetDensity of the clusters on given region between row0 and row1
863 // Dead zone effect takin into acoount
868 Int_t *index=fFriendTrack->GetTPCindices();
869 for (Int_t i=row0;i<=row1;i++){
870 Int_t idx = index[i];
871 if (idx!=-1) good++; // track outside of dead zone
875 if (good>(row1-row0)*0.5) density = Float_t(found)/Float_t(good);
879 //_______________________________________________________________________
880 void AliESDtrack::SetTPCpid(const Double_t *p) {
881 // Sets values for the probability of each particle type (in TPC)
882 SetPIDValues(fTPCr,p,AliPID::kSPECIES);
883 SetStatus(AliESDtrack::kTPCpid);
886 //_______________________________________________________________________
887 void AliESDtrack::GetTPCpid(Double_t *p) const {
888 // Gets the probability of each particle type (in TPC)
889 for (Int_t i=0; i<AliPID::kSPECIES; i++) p[i]=fTPCr[i];
892 //_______________________________________________________________________
893 Int_t AliESDtrack::GetTRDclusters(Int_t *idx) const {
894 //---------------------------------------------------------------------
895 // This function returns indices of the assgined TRD clusters
896 //---------------------------------------------------------------------
898 Int_t *index=fFriendTrack->GetTRDindices();
899 for (Int_t i=0; i<AliESDfriendTrack::kMaxTRDcluster; i++) idx[i]=index[i];
904 //_______________________________________________________________________
905 void AliESDtrack::SetTRDpid(const Double_t *p) {
906 // Sets values for the probability of each particle type (in TRD)
907 SetPIDValues(fTRDr,p,AliPID::kSPECIES);
908 SetStatus(AliESDtrack::kTRDpid);
911 //_______________________________________________________________________
912 void AliESDtrack::GetTRDpid(Double_t *p) const {
913 // Gets the probability of each particle type (in TRD)
914 for (Int_t i=0; i<AliPID::kSPECIES; i++) p[i]=fTRDr[i];
917 //_______________________________________________________________________
918 void AliESDtrack::SetTRDpid(Int_t iSpecies, Float_t p)
920 // Sets the probability of particle type iSpecies to p (in TRD)
924 Float_t AliESDtrack::GetTRDpid(Int_t iSpecies) const
926 // Returns the probability of particle type iSpecies (in TRD)
927 return fTRDr[iSpecies];
930 //_______________________________________________________________________
931 void AliESDtrack::SetTOFpid(const Double_t *p) {
932 // Sets the probability of each particle type (in TOF)
933 SetPIDValues(fTOFr,p,AliPID::kSPECIES);
934 SetStatus(AliESDtrack::kTOFpid);
937 //_______________________________________________________________________
938 void AliESDtrack::SetTOFLabel(const Int_t *p) {
940 for (Int_t i=0; i<3; i++) fTOFLabel[i]=p[i];
943 //_______________________________________________________________________
944 void AliESDtrack::GetTOFpid(Double_t *p) const {
945 // Gets probabilities of each particle type (in TOF)
946 for (Int_t i=0; i<AliPID::kSPECIES; i++) p[i]=fTOFr[i];
949 //_______________________________________________________________________
950 void AliESDtrack::GetTOFLabel(Int_t *p) const {
952 for (Int_t i=0; i<3; i++) p[i]=fTOFLabel[i];
955 //_______________________________________________________________________
956 void AliESDtrack::GetTOFInfo(Float_t *info) const {
958 for (Int_t i=0; i<10; i++) info[i]=fTOFInfo[i];
961 //_______________________________________________________________________
962 void AliESDtrack::SetTOFInfo(Float_t*info) {
964 for (Int_t i=0; i<10; i++) fTOFInfo[i]=info[i];
969 //_______________________________________________________________________
970 void AliESDtrack::SetHMPIDpid(const Double_t *p) {
971 // Sets the probability of each particle type (in HMPID)
972 SetPIDValues(fHMPIDr,p,AliPID::kSPECIES);
973 SetStatus(AliESDtrack::kHMPIDpid);
976 //_______________________________________________________________________
977 void AliESDtrack::GetHMPIDpid(Double_t *p) const {
978 // Gets probabilities of each particle type (in HMPID)
979 for (Int_t i=0; i<AliPID::kSPECIES; i++) p[i]=fHMPIDr[i];
984 //_______________________________________________________________________
985 void AliESDtrack::SetESDpid(const Double_t *p) {
986 // Sets the probability of each particle type for the ESD track
987 SetPIDValues(fR,p,AliPID::kSPECIES);
988 SetStatus(AliESDtrack::kESDpid);
991 //_______________________________________________________________________
992 void AliESDtrack::GetESDpid(Double_t *p) const {
993 // Gets probability of each particle type for the ESD track
994 for (Int_t i=0; i<AliPID::kSPECIES; i++) p[i]=fR[i];
997 //_______________________________________________________________________
998 Bool_t AliESDtrack::RelateToVertex
999 (const AliESDVertex *vtx, Double_t b, Double_t maxd) {
1001 // Try to relate this track to the vertex "vtx",
1002 // if the (rough) transverse impact parameter is not bigger then "maxd".
1003 // Magnetic field is "b" (kG).
1005 // a) The track gets extapolated to the DCA to the vertex.
1006 // b) The impact parameters and their covariance matrix are calculated.
1007 // c) An attempt to constrain this track to the vertex is done.
1009 // In the case of success, the returned value is kTRUE
1010 // (otherwise, it's kFALSE)
1013 if (!vtx) return kFALSE;
1015 Double_t alpha=GetAlpha();
1016 Double_t sn=TMath::Sin(alpha), cs=TMath::Cos(alpha);
1017 Double_t x=GetX(), y=GetParameter()[0], snp=GetParameter()[2];
1018 Double_t xv= vtx->GetXv()*cs + vtx->GetYv()*sn;
1019 Double_t yv=-vtx->GetXv()*sn + vtx->GetYv()*cs, zv=vtx->GetZv();
1022 //Estimate the impact parameter neglecting the track curvature
1023 Double_t d=TMath::Abs(x*snp - y*TMath::Sqrt(1.- snp*snp));
1024 if (d > maxd) return kFALSE;
1026 //Propagate to the DCA
1027 Double_t crv=kB2C*b*GetParameter()[4];
1028 if (TMath::Abs(b) < kAlmost0Field) crv=0.;
1030 Double_t tgfv=-(crv*x - snp)/(crv*y + TMath::Sqrt(1.-snp*snp));
1031 sn=tgfv/TMath::Sqrt(1.+ tgfv*tgfv);
1032 if (TMath::Abs(tgfv)>0.) cs = sn/tgfv;
1036 yv=-xv*sn + yv*cs; xv=x;
1038 if (!Propagate(alpha+TMath::ASin(sn),xv,b)) return kFALSE;
1040 fD = GetParameter()[0] - yv;
1041 fZ = GetParameter()[1] - zv;
1043 Double_t cov[6]; vtx->GetCovMatrix(cov);
1045 //***** Improvements by A.Dainese
1046 alpha=GetAlpha(); sn=TMath::Sin(alpha); cs=TMath::Cos(alpha);
1047 Double_t s2ylocvtx = cov[0]*sn*sn + cov[2]*cs*cs - 2.*cov[1]*cs*sn;
1048 fCdd = GetCovariance()[0] + s2ylocvtx; // neglecting correlations
1049 fCdz = GetCovariance()[1]; // between (x,y) and z
1050 fCzz = GetCovariance()[2] + cov[5]; // in vertex's covariance matrix
1054 Double_t p[2]={yv,zv}, c[3]={cov[2],0.,cov[5]};
1055 Double_t chi2=GetPredictedChi2(p,c);
1057 if (chi2>77.) return kFALSE;
1059 AliExternalTrackParam tmp(*this);
1060 if (!tmp.Update(p,c)) return kFALSE;
1063 if (!fCp) fCp=new AliExternalTrackParam();
1064 new (fCp) AliExternalTrackParam(tmp);
1070 //_______________________________________________________________________
1071 void AliESDtrack::Print(Option_t *) const {
1072 // Prints info on the track
1074 printf("ESD track info\n") ;
1075 Double_t p[AliPID::kSPECIESN] ;
1077 if( IsOn(kITSpid) ){
1078 printf("From ITS: ") ;
1080 for(index = 0 ; index < AliPID::kSPECIES; index++)
1081 printf("%f, ", p[index]) ;
1082 printf("\n signal = %f\n", GetITSsignal()) ;
1084 if( IsOn(kTPCpid) ){
1085 printf("From TPC: ") ;
1087 for(index = 0 ; index < AliPID::kSPECIES; index++)
1088 printf("%f, ", p[index]) ;
1089 printf("\n signal = %f\n", GetTPCsignal()) ;
1091 if( IsOn(kTRDpid) ){
1092 printf("From TRD: ") ;
1094 for(index = 0 ; index < AliPID::kSPECIES; index++)
1095 printf("%f, ", p[index]) ;
1096 printf("\n signal = %f\n", GetTRDsignal()) ;
1098 if( IsOn(kTOFpid) ){
1099 printf("From TOF: ") ;
1101 for(index = 0 ; index < AliPID::kSPECIES; index++)
1102 printf("%f, ", p[index]) ;
1103 printf("\n signal = %f\n", GetTOFsignal()) ;
1105 if( IsOn(kHMPIDpid) ){
1106 printf("From HMPID: ") ;
1108 for(index = 0 ; index < AliPID::kSPECIES; index++)
1109 printf("%f, ", p[index]) ;
1110 printf("\n signal = %f\n", GetHMPIDsignal()) ;
1114 Bool_t AliESDtrack::PropagateTo(Double_t xToGo, Double_t b, Double_t mass,
1115 Double_t maxStep, Bool_t rotateTo, Double_t maxSnp){
1116 //----------------------------------------------------------------
1120 // Propagates this track to the plane X=xk (cm)
1121 // in the magnetic field "b" (kG),
1122 // the correction for the material is included
1124 // mass - mass used in propagation - used for energy loss correction
1125 // maxStep - maximal step for propagation
1126 //----------------------------------------------------------------
1127 const Double_t kEpsilon = 0.00001;
1128 Double_t xpos = GetX();
1129 Double_t dir = (xpos<xToGo) ? 1.:-1.;
1131 while ( (xToGo-xpos)*dir > kEpsilon){
1132 Double_t step = dir*TMath::Min(TMath::Abs(xToGo-xpos), maxStep);
1133 Double_t x = xpos+step;
1134 Double_t xyz0[3],xyz1[3],param[7];
1135 GetXYZ(xyz0); //starting global position
1136 if (!GetXYZAt(x,b,xyz1)) return kFALSE; // no prolongation
1137 xyz1[2]+=kEpsilon; // waiting for bug correction in geo
1138 AliKalmanTrack::MeanMaterialBudget(xyz0,xyz1,param);
1139 if (TMath::Abs(GetSnpAt(x,b)) >= maxSnp) return kFALSE;
1140 if (!AliExternalTrackParam::PropagateTo(x,b)) return kFALSE;
1142 Double_t rho=param[0],x0=param[1],distance=param[4];
1143 Double_t d=distance*rho/x0;
1145 if (!CorrectForMaterial(d,x0,mass)) return kFALSE;
1147 if (TMath::Abs(GetSnp()) >= maxSnp) return kFALSE;
1148 GetXYZ(xyz0); // global position
1149 Double_t alphan = TMath::ATan2(xyz0[1], xyz0[0]);
1151 Double_t ca=TMath::Cos(alphan-GetAlpha()),
1152 sa=TMath::Sin(alphan-GetAlpha());
1153 Double_t sf=GetSnp(), cf=TMath::Sqrt(1.- sf*sf);
1154 Double_t sinNew = sf*ca - cf*sa;
1155 if (TMath::Abs(sinNew) >= maxSnp) return kFALSE;
1156 if (!Rotate(alphan)) return kFALSE;