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 //-----------------------------------------------------------------
25 #include "AliESDVertex.h"
26 #include "AliESDtrack.h"
27 #include "AliKalmanTrack.h"
28 #include "AliTrackPointArray.h"
33 void SetPIDValues(Float_t * dest, const Double_t * src, Int_t n) {
34 // This function copies "n" PID weights from "scr" to "dest"
35 // and normalizes their sum to 1 thus producing conditional probabilities.
36 // The negative weights are set to 0.
37 // In case all the weights are non-positive they are replaced by
38 // uniform probabilities
42 Float_t uniform = 1./(Float_t)n;
45 for (Int_t i=0; i<n; i++)
55 for (Int_t i=0; i<n; i++) dest[i] /= sum;
57 for (Int_t i=0; i<n; i++) dest[i] = uniform;
60 //_______________________________________________________________________
61 AliESDtrack::AliESDtrack() :
62 AliExternalTrackParam(),
68 fCdd(0),fCdz(0),fCzz(0),
82 fTPCClusterMap(159),//number of padrows
109 // The default ESD constructor
111 for (Int_t i=0; i<AliPID::kSPECIES; i++) {
121 for (Int_t i=0; i<AliPID::kSPECIESN; i++) {
127 fPHOSpos[0]=fPHOSpos[1]=fPHOSpos[2]=0.;
128 fEMCALpos[0]=fEMCALpos[1]=fEMCALpos[2]=0.;
130 for (i=0;i<12;i++) fITSchi2MIP[i] =1e10;
131 for (i=0; i<6; i++) { fITSindex[i]=0; }
132 for (i=0; i<180; i++){ fTPCindex[i]=0; }
133 for (i=0; i<3;i++) { fKinkIndexes[i]=0;}
134 for (i=0; i<3;i++) { fV0Indexes[i]=-1;}
135 for (i=0; i<130; i++) { fTRDindex[i]=0; }
136 for (i=0;i<kNPlane;i++) {fTRDsignals[i]=0.; fTRDTimBin[i]=-1;}
137 for (i=0;i<4;i++) {fTPCPoints[i]=-1;}
138 for (i=0;i<3;i++) {fTOFLabel[i]=-1;}
139 for (i=0;i<10;i++) {fTOFInfo[i]=-1;}
149 //_______________________________________________________________________
150 AliESDtrack::AliESDtrack(const AliESDtrack& track):
151 AliExternalTrackParam(track),
152 fFlags(track.fFlags),
153 fLabel(track.fLabel),
155 fTrackLength(track.fTrackLength),
156 fD(track.fD),fZ(track.fZ),
157 fCdd(track.fCdd),fCdz(track.fCdz),fCzz(track.fCzz),
158 fStopVertex(track.fStopVertex),
160 fCchi2(track.fCchi2),
163 fITSchi2(track.fITSchi2),
164 fITSncls(track.fITSncls),
165 fITSsignal(track.fITSsignal),
166 fITSLabel(track.fITSLabel),
167 fITSFakeRatio(track.fITSFakeRatio),
168 fITStrack(0), //coping separatelly - in user code
169 fTPCchi2(track.fTPCchi2),
170 fTPCncls(track.fTPCncls),
171 fTPCClusterMap(track.fTPCClusterMap),
172 fTPCsignal(track.fTPCsignal),
173 fTPCLabel(track.fTPCLabel),
174 fTRDchi2(track.fTRDchi2),
175 fTRDncls(track.fTRDncls),
176 fTRDncls0(track.fTRDncls0),
177 fTRDsignal(track.fTRDsignal),
178 fTRDLabel(track.fTRDLabel),
179 fTRDQuality(track.fTRDQuality),
180 fTRDBudget(track.fTRDBudget),
182 fTOFchi2(track.fTOFchi2),
183 fTOFindex(track.fTOFindex),
184 fTOFsignal(track.fTOFsignal),
185 fPHOSsignal(track.fPHOSsignal),
186 fEMCALsignal(track.fEMCALsignal),
187 fRICHchi2(track.fRICHchi2),
188 fRICHncls(track.fRICHncls),
189 fRICHindex(track.fRICHindex),
190 fRICHsignal(track.fRICHsignal),
191 fRICHtheta(track.fRICHtheta),
192 fRICHphi(track.fRICHphi),
193 fRICHdx(track.fRICHdx),
194 fRICHdy(track.fRICHdy),
195 fPoints(track.fPoints)
200 for (Int_t i=0;i<AliPID::kSPECIES;i++) fTrackTime[i] =track.fTrackTime[i];
201 for (Int_t i=0;i<AliPID::kSPECIES;i++) fR[i] =track.fR[i];
203 for (Int_t i=0;i<12;i++) fITSchi2MIP[i] =track.fITSchi2MIP[i];
204 for (Int_t i=0;i<6;i++) fITSindex[i]=track.fITSindex[i];
205 for (Int_t i=0;i<AliPID::kSPECIES;i++) fITSr[i]=track.fITSr[i];
207 for (Int_t i=0;i<180;i++) fTPCindex[i]=track.fTPCindex[i];
208 for (Int_t i=0;i<AliPID::kSPECIES;i++) fTPCr[i]=track.fTPCr[i];
209 for (Int_t i=0;i<4;i++) {fTPCPoints[i]=track.fTPCPoints[i];}
210 for (Int_t i=0; i<3;i++) { fKinkIndexes[i]=track.fKinkIndexes[i];}
211 for (Int_t i=0; i<3;i++) { fV0Indexes[i]=track.fV0Indexes[i];}
213 for (Int_t i=0;i<130;i++) fTRDindex[i]=track.fTRDindex[i];
214 for (Int_t i=0;i<kNPlane;i++) {
215 fTRDsignals[i]=track.fTRDsignals[i];
216 fTRDTimBin[i]=track.fTRDTimBin[i];
218 for (Int_t i=0;i<AliPID::kSPECIES;i++) fTRDr[i]=track.fTRDr[i];
220 for (Int_t i=0;i<AliPID::kSPECIES;i++) fTOFr[i]=track.fTOFr[i];
221 for (Int_t i=0;i<3;i++) fTOFLabel[i]=track.fTOFLabel[i];
222 for (Int_t i=0;i<10;i++) fTOFInfo[i]=track.fTOFInfo[i];
224 for (Int_t i=0;i<3;i++) fPHOSpos[i]=track.fPHOSpos[i];
225 for (Int_t i=0;i<AliPID::kSPECIESN;i++) fPHOSr[i]=track.fPHOSr[i];
227 for (Int_t i=0;i<3;i++) fEMCALpos[i]=track.fEMCALpos[i];
228 for (Int_t i=0;i<AliPID::kSPECIESN;i++) fEMCALr[i]=track.fEMCALr[i];
230 for (Int_t i=0;i<AliPID::kSPECIES;i++) fRICHr[i]=track.fRICHr[i];
232 if (track.fCp) fCp=new AliExternalTrackParam(*track.fCp);
233 if (track.fIp) fIp=new AliExternalTrackParam(*track.fIp);
234 if (track.fOp) fOp=new AliExternalTrackParam(*track.fOp);
236 //_______________________________________________________________________
237 AliESDtrack::~AliESDtrack(){
239 // This is destructor according Coding Conventrions
241 //printf("Delete track\n");
250 //_______________________________________________________________________
251 void AliESDtrack::MakeMiniESDtrack(){
252 // Resets everything except
253 // fFlags: Reconstruction status flags
254 // fLabel: Track label
255 // fID: Unique ID of the track
256 // fD: Impact parameter in XY-plane
257 // fZ: Impact parameter in Z
258 // fR[AliPID::kSPECIES]: combined "detector response probability"
259 // Running track parameters
260 // fRalpha: track rotation angle
261 // fRx: X-coordinate of the track reference plane
262 // fRp[5]: external track parameters
263 // fRc[15]: external cov. matrix of the track parameters
266 for (Int_t i=0;i<AliPID::kSPECIES;i++) fTrackTime[i] = 0;
269 // Reset track parameters constrained to the primary vertex
273 // Reset track parameters at the inner wall of TPC
276 // Reset track parameters at the inner wall of the TRD
279 // Reset ITS track related information
281 for (Int_t i=0;i<12;i++) fITSchi2MIP[i] = 0;
283 for (Int_t i=0;i<6;i++) fITSindex[i]= 0;
285 for (Int_t i=0;i<AliPID::kSPECIES;i++) fITSr[i]= 0;
290 // Reset TPC related track information
293 for (Int_t i=0;i<180;i++) fTPCindex[i] = 0;
296 for (Int_t i=0;i<AliPID::kSPECIES;i++) fTPCr[i]=0;
298 for (Int_t i=0;i<4;i++) fTPCPoints[i] = 0;
299 for (Int_t i=0; i<3;i++) fKinkIndexes[i] = 0;
300 for (Int_t i=0; i<3;i++) fV0Indexes[i] = 0;
302 // Reset TRD related track information
306 for (Int_t i=0;i<130;i++) fTRDindex[i] = 0;
308 for (Int_t i=0;i<kNPlane;i++) {
312 for (Int_t i=0;i<AliPID::kSPECIES;i++) fTRDr[i] = 0;
318 // Reset TOF related track information
322 for (Int_t i=0;i<AliPID::kSPECIES;i++) fTOFr[i] = 0;
323 for (Int_t i=0;i<3;i++) fTOFLabel[i] = 0;
324 for (Int_t i=0;i<10;i++) fTOFInfo[i] = 0;
326 // Reset PHOS related track information
327 for (Int_t i=0;i<3;i++) fPHOSpos[i] = 0;
329 for (Int_t i=0;i<AliPID::kSPECIESN;i++) fPHOSr[i] = 0;
331 // Reset EMCAL related track information
332 for (Int_t i=0;i<3;i++) fEMCALpos[i] = 0;
334 for (Int_t i=0;i<AliPID::kSPECIESN;i++) fEMCALr[i] = 0;
336 // Reset RICH related track information
341 for (Int_t i=0;i<AliPID::kSPECIES;i++) fRICHr[i] = 0;
349 //_______________________________________________________________________
350 Double_t AliESDtrack::GetMass() const {
351 // Returns the mass of the most probable particle type
354 for (Int_t i=0; i<AliPID::kSPECIES; i++) {
355 if (fR[i]>max) {k=i; max=fR[i];}
357 if (k==0) { // dE/dx "crossing points" in the TPC
359 if ((p>0.38)&&(p<0.48))
360 if (fR[0]<fR[3]*10.) return AliPID::ParticleMass(AliPID::kKaon);
361 if ((p>0.75)&&(p<0.85))
362 if (fR[0]<fR[4]*10.) return AliPID::ParticleMass(AliPID::kProton);
365 if (k==1) return AliPID::ParticleMass(AliPID::kMuon);
366 if (k==2||k==-1) return AliPID::ParticleMass(AliPID::kPion);
367 if (k==3) return AliPID::ParticleMass(AliPID::kKaon);
368 if (k==4) return AliPID::ParticleMass(AliPID::kProton);
369 AliWarning("Undefined mass !");
370 return AliPID::ParticleMass(AliPID::kPion);
373 //_______________________________________________________________________
374 Bool_t AliESDtrack::UpdateTrackParams(const AliKalmanTrack *t, ULong_t flags){
376 // This function updates track's running parameters
381 fLabel=t->GetLabel();
383 if (t->IsStartedTimeIntegral()) {
385 Double_t times[10];t->GetIntegratedTimes(times); SetIntegratedTimes(times);
386 SetIntegratedLength(t->GetIntegratedLength());
393 case kITSin: case kITSout: case kITSrefit:
394 fITSncls=t->GetNumberOfClusters();
395 fITSchi2=t->GetChi2();
396 for (Int_t i=0;i<fITSncls;i++) fITSindex[i]=t->GetClusterIndex(i);
397 fITSsignal=t->GetPIDsignal();
398 fITSLabel = t->GetLabel();
399 fITSFakeRatio = t->GetFakeRatio();
402 case kTPCin: case kTPCrefit:
403 fTPCLabel = t->GetLabel();
404 if (!fIp) fIp=new AliExternalTrackParam(*t);
409 fTPCncls=t->GetNumberOfClusters();
410 fTPCchi2=t->GetChi2();
412 {//prevrow must be declared in separate namespace, otherwise compiler cries:
413 //"jump to case label crosses initialization of `Int_t prevrow'"
415 // for (Int_t i=0;i<fTPCncls;i++)
416 for (Int_t i=0;i<160;i++)
418 fTPCindex[i]=t->GetClusterIndex(i);
420 // Piotr's Cluster Map for HBT
421 // ### please change accordingly if cluster array is changing
422 // to "New TPC Tracking" style (with gaps in array)
423 Int_t idx = fTPCindex[i];
424 Int_t sect = (idx&0xff000000)>>24;
425 Int_t row = (idx&0x00ff0000)>>16;
426 if (sect > 18) row +=63; //if it is outer sector, add number of inner sectors
428 fTPCClusterMap.SetBitNumber(row,kTRUE);
430 //Fill the gap between previous row and this row with 0 bits
431 //In case ### pleas change it as well - just set bit 0 in case there
432 //is no associated clusters for current "i"
435 prevrow = row;//if previous bit was not assigned yet == this is the first one
438 { //we don't know the order (inner to outer or reverse)
439 //just to be save in case it is going to change
452 for (Int_t j = n+1; j < m; j++)
454 fTPCClusterMap.SetBitNumber(j,kFALSE);
458 // End Of Piotr's Cluster Map for HBT
461 fTPCsignal=t->GetPIDsignal();
462 {Double_t mass=t->GetMass(); // preliminary mass setting
463 if (mass>0.5) fR[4]=1.; // used by
464 else if (mass<0.4) fR[2]=1.; // the ITS reconstruction
469 case kTRDout: case kTRDin: case kTRDrefit:
470 fTRDLabel = t->GetLabel();
471 fTRDncls=t->GetNumberOfClusters();
472 fTRDchi2=t->GetChi2();
473 for (Int_t i=0;i<fTRDncls;i++) fTRDindex[i]=t->GetClusterIndex(i);
474 fTRDsignal=t->GetPIDsignal();
477 if (!fOp) fOp=new AliExternalTrackParam(*t);
479 fTRDncls0 = t->GetNumberOfClusters();
488 AliError("Wrong flag !");
495 //_______________________________________________________________________
496 void AliESDtrack::GetExternalParameters(Double_t &x, Double_t p[5]) const {
497 //---------------------------------------------------------------------
498 // This function returns external representation of the track parameters
499 //---------------------------------------------------------------------
501 for (Int_t i=0; i<5; i++) p[i]=GetParameter()[i];
504 //_______________________________________________________________________
505 void AliESDtrack::GetExternalCovariance(Double_t cov[15]) const {
506 //---------------------------------------------------------------------
507 // This function returns external representation of the cov. matrix
508 //---------------------------------------------------------------------
509 for (Int_t i=0; i<15; i++) cov[i]=AliExternalTrackParam::GetCovariance()[i];
512 //_______________________________________________________________________
513 Bool_t AliESDtrack::GetConstrainedExternalParameters
514 (Double_t &alpha, Double_t &x, Double_t p[5]) const {
515 //---------------------------------------------------------------------
516 // This function returns the constrained external track parameters
517 //---------------------------------------------------------------------
518 if (!fCp) return kFALSE;
519 alpha=fCp->GetAlpha();
521 for (Int_t i=0; i<5; i++) p[i]=fCp->GetParameter()[i];
525 //_______________________________________________________________________
527 AliESDtrack::GetConstrainedExternalCovariance(Double_t c[15]) const {
528 //---------------------------------------------------------------------
529 // This function returns the constrained external cov. matrix
530 //---------------------------------------------------------------------
531 if (!fCp) return kFALSE;
532 for (Int_t i=0; i<15; i++) c[i]=fCp->GetCovariance()[i];
537 AliESDtrack::GetInnerExternalParameters
538 (Double_t &alpha, Double_t &x, Double_t p[5]) const {
539 //---------------------------------------------------------------------
540 // This function returns external representation of the track parameters
541 // at the inner layer of TPC
542 //---------------------------------------------------------------------
543 if (!fIp) return kFALSE;
544 alpha=fIp->GetAlpha();
546 for (Int_t i=0; i<5; i++) p[i]=fIp->GetParameter()[i];
551 AliESDtrack::GetInnerExternalCovariance(Double_t cov[15]) const {
552 //---------------------------------------------------------------------
553 // This function returns external representation of the cov. matrix
554 // at the inner layer of TPC
555 //---------------------------------------------------------------------
556 if (!fIp) return kFALSE;
557 for (Int_t i=0; i<15; i++) cov[i]=fIp->GetCovariance()[i];
562 AliESDtrack::GetOuterExternalParameters
563 (Double_t &alpha, Double_t &x, Double_t p[5]) const {
564 //---------------------------------------------------------------------
565 // This function returns external representation of the track parameters
566 // at the inner layer of TRD
567 //---------------------------------------------------------------------
568 if (!fOp) return kFALSE;
569 alpha=fOp->GetAlpha();
571 for (Int_t i=0; i<5; i++) p[i]=fOp->GetParameter()[i];
576 AliESDtrack::GetOuterExternalCovariance(Double_t cov[15]) const {
577 //---------------------------------------------------------------------
578 // This function returns external representation of the cov. matrix
579 // at the inner layer of TRD
580 //---------------------------------------------------------------------
581 if (!fOp) return kFALSE;
582 for (Int_t i=0; i<15; i++) cov[i]=fOp->GetCovariance()[i];
586 Int_t AliESDtrack::GetNcls(Int_t idet) const
588 // Get number of clusters by subdetector index
611 Int_t AliESDtrack::GetClusters(Int_t idet, UInt_t *idx) const
613 // Get cluster index array by subdetector index
618 ncls = GetITSclusters(idx);
621 ncls = GetTPCclusters((Int_t *)idx);
624 ncls = GetTRDclusters(idx);
627 if (fTOFindex != 0) {
628 idx[0] = GetTOFcluster();
638 //_______________________________________________________________________
639 void AliESDtrack::GetIntegratedTimes(Double_t *times) const {
640 // Returns the array with integrated times for each particle hypothesis
641 for (Int_t i=0; i<AliPID::kSPECIES; i++) times[i]=fTrackTime[i];
644 //_______________________________________________________________________
645 void AliESDtrack::SetIntegratedTimes(const Double_t *times) {
646 // Sets the array with integrated times for each particle hypotesis
647 for (Int_t i=0; i<AliPID::kSPECIES; i++) fTrackTime[i]=times[i];
650 //_______________________________________________________________________
651 void AliESDtrack::SetITSpid(const Double_t *p) {
652 // Sets values for the probability of each particle type (in ITS)
653 SetPIDValues(fITSr,p,AliPID::kSPECIES);
654 SetStatus(AliESDtrack::kITSpid);
657 void AliESDtrack::SetITSChi2MIP(const Float_t *chi2mip){
658 for (Int_t i=0; i<12; i++) fITSchi2MIP[i]=chi2mip[i];
660 //_______________________________________________________________________
661 void AliESDtrack::GetITSpid(Double_t *p) const {
662 // Gets the probability of each particle type (in ITS)
663 for (Int_t i=0; i<AliPID::kSPECIES; i++) p[i]=fITSr[i];
666 //_______________________________________________________________________
667 Int_t AliESDtrack::GetITSclusters(UInt_t *idx) const {
668 //---------------------------------------------------------------------
669 // This function returns indices of the assgined ITS clusters
670 //---------------------------------------------------------------------
671 for (Int_t i=0; i<fITSncls; i++) idx[i]=fITSindex[i];
675 //_______________________________________________________________________
676 Int_t AliESDtrack::GetTPCclusters(Int_t *idx) const {
677 //---------------------------------------------------------------------
678 // This function returns indices of the assgined ITS clusters
679 //---------------------------------------------------------------------
681 for (Int_t i=0; i<180; i++) idx[i]=fTPCindex[i]; // MI I prefer some constant
685 Float_t AliESDtrack::GetTPCdensity(Int_t row0, Int_t row1) const{
687 // GetDensity of the clusters on given region between row0 and row1
688 // Dead zone effect takin into acoount
693 for (Int_t i=row0;i<=row1;i++){
694 Int_t index = fTPCindex[i];
695 if (index!=-1) good++; // track outside of dead zone
696 if (index>0) found++;
699 if (good>(row1-row0)*0.5) density = Float_t(found)/Float_t(good);
703 //_______________________________________________________________________
704 void AliESDtrack::SetTPCpid(const Double_t *p) {
705 // Sets values for the probability of each particle type (in TPC)
706 SetPIDValues(fTPCr,p,AliPID::kSPECIES);
707 SetStatus(AliESDtrack::kTPCpid);
710 //_______________________________________________________________________
711 void AliESDtrack::GetTPCpid(Double_t *p) const {
712 // Gets the probability of each particle type (in TPC)
713 for (Int_t i=0; i<AliPID::kSPECIES; i++) p[i]=fTPCr[i];
716 //_______________________________________________________________________
717 Int_t AliESDtrack::GetTRDclusters(UInt_t *idx) const {
718 //---------------------------------------------------------------------
719 // This function returns indices of the assgined TRD clusters
720 //---------------------------------------------------------------------
722 for (Int_t i=0; i<130; i++) idx[i]=fTRDindex[i]; // MI I prefer some constant
726 //_______________________________________________________________________
727 void AliESDtrack::SetTRDpid(const Double_t *p) {
728 // Sets values for the probability of each particle type (in TRD)
729 SetPIDValues(fTRDr,p,AliPID::kSPECIES);
730 SetStatus(AliESDtrack::kTRDpid);
733 //_______________________________________________________________________
734 void AliESDtrack::GetTRDpid(Double_t *p) const {
735 // Gets the probability of each particle type (in TRD)
736 for (Int_t i=0; i<AliPID::kSPECIES; i++) p[i]=fTRDr[i];
739 //_______________________________________________________________________
740 void AliESDtrack::SetTRDpid(Int_t iSpecies, Float_t p)
742 // Sets the probability of particle type iSpecies to p (in TRD)
746 Float_t AliESDtrack::GetTRDpid(Int_t iSpecies) const
748 // Returns the probability of particle type iSpecies (in TRD)
749 return fTRDr[iSpecies];
752 //_______________________________________________________________________
753 void AliESDtrack::SetTOFpid(const Double_t *p) {
754 // Sets the probability of each particle type (in TOF)
755 SetPIDValues(fTOFr,p,AliPID::kSPECIES);
756 SetStatus(AliESDtrack::kTOFpid);
759 //_______________________________________________________________________
760 void AliESDtrack::SetTOFLabel(const Int_t *p) {
762 for (Int_t i=0; i<3; i++) fTOFLabel[i]=p[i];
765 //_______________________________________________________________________
766 void AliESDtrack::GetTOFpid(Double_t *p) const {
767 // Gets probabilities of each particle type (in TOF)
768 for (Int_t i=0; i<AliPID::kSPECIES; i++) p[i]=fTOFr[i];
771 //_______________________________________________________________________
772 void AliESDtrack::GetTOFLabel(Int_t *p) const {
774 for (Int_t i=0; i<3; i++) p[i]=fTOFLabel[i];
777 //_______________________________________________________________________
778 void AliESDtrack::GetTOFInfo(Float_t *info) const {
780 for (Int_t i=0; i<10; i++) info[i]=fTOFInfo[i];
783 //_______________________________________________________________________
784 void AliESDtrack::SetTOFInfo(Float_t*info) {
786 for (Int_t i=0; i<10; i++) fTOFInfo[i]=info[i];
791 //_______________________________________________________________________
792 void AliESDtrack::SetPHOSpid(const Double_t *p) {
793 // Sets the probability of each particle type (in PHOS)
794 SetPIDValues(fPHOSr,p,AliPID::kSPECIESN);
795 SetStatus(AliESDtrack::kPHOSpid);
798 //_______________________________________________________________________
799 void AliESDtrack::GetPHOSpid(Double_t *p) const {
800 // Gets probabilities of each particle type (in PHOS)
801 for (Int_t i=0; i<AliPID::kSPECIESN; i++) p[i]=fPHOSr[i];
804 //_______________________________________________________________________
805 void AliESDtrack::SetEMCALpid(const Double_t *p) {
806 // Sets the probability of each particle type (in EMCAL)
807 SetPIDValues(fEMCALr,p,AliPID::kSPECIESN);
808 SetStatus(AliESDtrack::kEMCALpid);
811 //_______________________________________________________________________
812 void AliESDtrack::GetEMCALpid(Double_t *p) const {
813 // Gets probabilities of each particle type (in EMCAL)
814 for (Int_t i=0; i<AliPID::kSPECIESN; i++) p[i]=fEMCALr[i];
817 //_______________________________________________________________________
818 void AliESDtrack::SetRICHpid(const Double_t *p) {
819 // Sets the probability of each particle type (in RICH)
820 SetPIDValues(fRICHr,p,AliPID::kSPECIES);
821 SetStatus(AliESDtrack::kRICHpid);
824 //_______________________________________________________________________
825 void AliESDtrack::GetRICHpid(Double_t *p) const {
826 // Gets probabilities of each particle type (in RICH)
827 for (Int_t i=0; i<AliPID::kSPECIES; i++) p[i]=fRICHr[i];
832 //_______________________________________________________________________
833 void AliESDtrack::SetESDpid(const Double_t *p) {
834 // Sets the probability of each particle type for the ESD track
835 SetPIDValues(fR,p,AliPID::kSPECIES);
836 SetStatus(AliESDtrack::kESDpid);
839 //_______________________________________________________________________
840 void AliESDtrack::GetESDpid(Double_t *p) const {
841 // Gets probability of each particle type for the ESD track
842 for (Int_t i=0; i<AliPID::kSPECIES; i++) p[i]=fR[i];
845 //_______________________________________________________________________
846 Bool_t AliESDtrack::RelateToVertex
847 (const AliESDVertex *vtx, Double_t b, Double_t maxd) {
849 // Try to relate this track to the vertex "vtx",
850 // if the (rough) transverse impact parameter is not bigger then "maxd".
851 // Magnetic field is "b" (kG).
853 // a) The track gets extapolated to the DCA to the vertex.
854 // b) The impact parameters and their covariance matrix are calculated.
855 // c) An attempt to constrain this track to the vertex is done.
857 // In the case of success, the returned value is kTRUE
858 // (otherwise, it's kFALSE)
860 Double_t alpha=GetAlpha();
861 Double_t sn=TMath::Sin(alpha), cs=TMath::Cos(alpha);
862 Double_t x=GetX(), y=GetParameter()[0], snp=GetParameter()[2];
863 Double_t xv= vtx->GetXv()*cs + vtx->GetYv()*sn;
864 Double_t yv=-vtx->GetXv()*sn + vtx->GetYv()*cs, zv=vtx->GetZv();
867 //Estimate the impact parameter neglecting the track curvature
868 Double_t d=TMath::Abs(x*snp - y*TMath::Sqrt(1.- snp*snp));
869 if (d > maxd) return kFALSE;
871 //Propagate to the DCA
872 Double_t crv=0.299792458e-3*b*GetParameter()[4];
873 Double_t tgfv=-(crv*x - snp)/(crv*y + TMath::Sqrt(1.-snp*snp));
874 sn=tgfv/TMath::Sqrt(1.+ tgfv*tgfv); cs=TMath::Sqrt(1.+ sn*sn);
877 yv=-xv*sn + yv*cs; xv=x;
879 if (!Propagate(alpha+TMath::ASin(sn),xv,b)) return kFALSE;
881 fD = GetParameter()[0] - yv;
882 fZ = GetParameter()[1] - zv;
884 Double_t cov[6]; vtx->GetCovMatrix(cov);
885 fCdd = GetCovariance()[0] + cov[2]; // neglecting non-diagonals
886 fCdz = GetCovariance()[1]; // in the vertex's
887 fCzz = GetCovariance()[2] + cov[5]; // covariance matrix
890 Double_t p[2]={yv,zv}, c[3]={cov[2],0.,cov[5]};
891 Double_t chi2=GetPredictedChi2(p,c);
893 if (chi2>77.) return kFALSE;
895 AliExternalTrackParam tmp(*this);
896 if (!tmp.Update(p,c)) return kFALSE;
899 if (!fCp) fCp=new AliExternalTrackParam();
900 new (fCp) AliExternalTrackParam(tmp);
906 //_______________________________________________________________________
907 void AliESDtrack::Print(Option_t *) const {
908 // Prints info on the track
910 printf("ESD track info\n") ;
911 Double_t p[AliPID::kSPECIESN] ;
914 printf("From ITS: ") ;
916 for(index = 0 ; index < AliPID::kSPECIES; index++)
917 printf("%f, ", p[index]) ;
918 printf("\n signal = %f\n", GetITSsignal()) ;
921 printf("From TPC: ") ;
923 for(index = 0 ; index < AliPID::kSPECIES; index++)
924 printf("%f, ", p[index]) ;
925 printf("\n signal = %f\n", GetTPCsignal()) ;
928 printf("From TRD: ") ;
930 for(index = 0 ; index < AliPID::kSPECIES; index++)
931 printf("%f, ", p[index]) ;
932 printf("\n signal = %f\n", GetTRDsignal()) ;
935 printf("From TOF: ") ;
937 for(index = 0 ; index < AliPID::kSPECIES; index++)
938 printf("%f, ", p[index]) ;
939 printf("\n signal = %f\n", GetTOFsignal()) ;
941 if( IsOn(kRICHpid) ){
942 printf("From RICH: ") ;
944 for(index = 0 ; index < AliPID::kSPECIES; index++)
945 printf("%f, ", p[index]) ;
946 printf("\n signal = %f\n", GetRICHsignal()) ;
948 if( IsOn(kPHOSpid) ){
949 printf("From PHOS: ") ;
951 for(index = 0 ; index < AliPID::kSPECIESN; index++)
952 printf("%f, ", p[index]) ;
953 printf("\n signal = %f\n", GetPHOSsignal()) ;
955 if( IsOn(kEMCALpid) ){
956 printf("From EMCAL: ") ;
958 for(index = 0 ; index < AliPID::kSPECIESN; index++)
959 printf("%f, ", p[index]) ;
960 printf("\n signal = %f\n", GetEMCALsignal()) ;