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),
83 fTPCClusterMap(159),//number of padrows
115 // The default ESD constructor
117 for (Int_t i=0; i<AliPID::kSPECIES; i++) {
127 // for (Int_t i=0; i<AliPID::kSPECIESN; i++) {
130 // fPHOSpos[0]=fPHOSpos[1]=fPHOSpos[2]=0.;
133 for (i=0; i<kMaxITScluster; i++) fITSchi2MIP[i]=1e10;
134 for (i=0; i<kMaxITScluster; i++) { fITSindex[i]=-1; }
135 for (i=0; i<kMaxTPCcluster; i++) { fTPCindex[i]=-2; }
136 for (i=0; i<3; i++) { fKinkIndexes[i]=0;}
137 for (i=0; i<3; i++) { fV0Indexes[i]=-1;}
138 for (i=0; i<kMaxTRDcluster; i++) { fTRDindex[i]=-2; }
139 for (i=0;i<kNPlane;i++) {fTRDsignals[i]=0.; fTRDTimBin[i]=-1;}
140 for (i=0;i<4;i++) {fTPCPoints[i]=-1;}
141 for (i=0;i<3;i++) {fTOFLabel[i]=-1;}
142 for (i=0;i<10;i++) {fTOFInfo[i]=-1;}
152 //_______________________________________________________________________
153 AliESDtrack::AliESDtrack(const AliESDtrack& track):
154 AliExternalTrackParam(track),
155 fFlags(track.fFlags),
156 fLabel(track.fLabel),
158 fTrackLength(track.fTrackLength),
159 fD(track.fD),fZ(track.fZ),
160 fCdd(track.fCdd),fCdz(track.fCdz),fCzz(track.fCzz),
161 fStopVertex(track.fStopVertex),
163 fCchi2(track.fCchi2),
166 fITSchi2(track.fITSchi2),
167 fITSncls(track.fITSncls),
168 fITSsignal(track.fITSsignal),
169 fITSLabel(track.fITSLabel),
170 fITSFakeRatio(track.fITSFakeRatio),
171 fITStrack(0), //coping separatelly - in user code
172 fTPCchi2(track.fTPCchi2),
173 fTPCncls(track.fTPCncls),
174 fTPCnclsF(track.fTPCnclsF),
175 fTPCClusterMap(track.fTPCClusterMap),
176 fTPCsignal(track.fTPCsignal),
177 fTPCsignalN(track.fTPCsignalN),
178 fTPCsignalS(track.fTPCsignalS),
179 fTPCLabel(track.fTPCLabel),
180 fTRDchi2(track.fTRDchi2),
181 fTRDncls(track.fTRDncls),
182 fTRDncls0(track.fTRDncls0),
183 fTRDsignal(track.fTRDsignal),
184 fTRDLabel(track.fTRDLabel),
185 fTRDQuality(track.fTRDQuality),
186 fTRDBudget(track.fTRDBudget),
188 fTOFchi2(track.fTOFchi2),
189 fTOFindex(track.fTOFindex),
190 fTOFCalChannel(track.fTOFCalChannel),
191 fTOFsignal(track.fTOFsignal),
192 fTOFsignalToT(track.fTOFsignalToT),
193 //fPHOSsignal(track.fPHOSsignal),
194 fRICHchi2(track.fRICHchi2),
195 fRICHncls(track.fRICHncls),
196 fRICHindex(track.fRICHindex),
197 fRICHsignal(track.fRICHsignal),
198 fRICHtheta(track.fRICHtheta),
199 fRICHphi(track.fRICHphi),
200 fRICHdx(track.fRICHdx),
201 fRICHdy(track.fRICHdy)
206 for (Int_t i=0;i<AliPID::kSPECIES;i++) fTrackTime[i]=track.fTrackTime[i];
207 for (Int_t i=0;i<AliPID::kSPECIES;i++) fR[i]=track.fR[i];
209 for (Int_t i=0;i<kMaxITScluster;i++) fITSchi2MIP[i]=track.fITSchi2MIP[i];
210 for (Int_t i=0;i<kMaxITScluster;i++) fITSindex[i]=track.fITSindex[i];
211 for (Int_t i=0;i<AliPID::kSPECIES;i++) fITSr[i]=track.fITSr[i];
213 for (Int_t i=0;i<kMaxTPCcluster;i++) fTPCindex[i]=track.fTPCindex[i];
214 for (Int_t i=0;i<AliPID::kSPECIES;i++) fTPCr[i]=track.fTPCr[i];
215 for (Int_t i=0;i<4;i++) {fTPCPoints[i]=track.fTPCPoints[i];}
216 for (Int_t i=0; i<3;i++) { fKinkIndexes[i]=track.fKinkIndexes[i];}
217 for (Int_t i=0; i<3;i++) { fV0Indexes[i]=track.fV0Indexes[i];}
219 for (Int_t i=0;i<kMaxTRDcluster;i++) fTRDindex[i]=track.fTRDindex[i];
220 for (Int_t i=0;i<kNPlane;i++) {
221 fTRDsignals[i]=track.fTRDsignals[i];
222 fTRDTimBin[i]=track.fTRDTimBin[i];
224 for (Int_t i=0;i<AliPID::kSPECIES;i++) fTRDr[i]=track.fTRDr[i];
226 for (Int_t i=0;i<AliPID::kSPECIES;i++) fTOFr[i]=track.fTOFr[i];
227 for (Int_t i=0;i<3;i++) fTOFLabel[i]=track.fTOFLabel[i];
228 for (Int_t i=0;i<10;i++) fTOFInfo[i]=track.fTOFInfo[i];
230 // for (Int_t i=0;i<3;i++) fPHOSpos[i]=track.fPHOSpos[i];
231 //for (Int_t i=0;i<AliPID::kSPECIESN;i++) fPHOSr[i]=track.fPHOSr[i];
233 for (Int_t i=0;i<AliPID::kSPECIES;i++) fRICHr[i]=track.fRICHr[i];
235 if (track.fCp) fCp=new AliExternalTrackParam(*track.fCp);
236 if (track.fIp) fIp=new AliExternalTrackParam(*track.fIp);
237 if (track.fOp) fOp=new AliExternalTrackParam(*track.fOp);
240 fPoints = new AliTrackPointArray(*(track.fPoints));
243 //_______________________________________________________________________
244 AliESDtrack::~AliESDtrack(){
246 // This is destructor according Coding Conventrions
248 //printf("Delete track\n");
257 //_______________________________________________________________________
258 void AliESDtrack::MakeMiniESDtrack(){
259 // Resets everything except
260 // fFlags: Reconstruction status flags
261 // fLabel: Track label
262 // fID: Unique ID of the track
263 // fD: Impact parameter in XY-plane
264 // fZ: Impact parameter in Z
265 // fR[AliPID::kSPECIES]: combined "detector response probability"
266 // Running track parameters
267 // fRalpha: track rotation angle
268 // fRx: X-coordinate of the track reference plane
269 // fRp[5]: external track parameters
270 // fRc[15]: external cov. matrix of the track parameters
273 for (Int_t i=0;i<AliPID::kSPECIES;i++) fTrackTime[i] = 0;
276 // Reset track parameters constrained to the primary vertex
280 // Reset track parameters at the inner wall of TPC
283 // Reset track parameters at the inner wall of the TRD
286 // Reset ITS track related information
288 for (Int_t i=0;i<kMaxITScluster;i++) fITSchi2MIP[i]=0;
290 for (Int_t i=0;i<kMaxITScluster;i++) fITSindex[i]=-1;
292 for (Int_t i=0;i<AliPID::kSPECIES;i++) fITSr[i]=0;
297 // Reset TPC related track information
301 for (Int_t i=0;i<kMaxTPCcluster;i++) fTPCindex[i] = -2;
306 for (Int_t i=0;i<AliPID::kSPECIES;i++) fTPCr[i]=0;
308 for (Int_t i=0;i<4;i++) fTPCPoints[i] = 0;
309 for (Int_t i=0; i<3;i++) fKinkIndexes[i] = 0;
310 for (Int_t i=0; i<3;i++) fV0Indexes[i] = 0;
312 // Reset TRD related track information
316 for (Int_t i=0;i<kMaxTRDcluster;i++) fTRDindex[i] = -2;
318 for (Int_t i=0;i<kNPlane;i++) {
322 for (Int_t i=0;i<AliPID::kSPECIES;i++) fTRDr[i] = 0;
328 // Reset TOF related track information
334 for (Int_t i=0;i<AliPID::kSPECIES;i++) fTOFr[i] = 0;
335 for (Int_t i=0;i<3;i++) fTOFLabel[i] = 0;
336 for (Int_t i=0;i<10;i++) fTOFInfo[i] = 0;
338 // Reset PHOS related track information
339 //for (Int_t i=0;i<3;i++) fPHOSpos[i] = 0;
341 //for (Int_t i=0;i<AliPID::kSPECIESN;i++) fPHOSr[i] = 0;
343 // Reset RICH related track information
348 for (Int_t i=0;i<AliPID::kSPECIES;i++) fRICHr[i] = 0;
356 //_______________________________________________________________________
357 Double_t AliESDtrack::GetMass() const {
358 // Returns the mass of the most probable particle type
361 for (Int_t i=0; i<AliPID::kSPECIES; i++) {
362 if (fR[i]>max) {k=i; max=fR[i];}
364 if (k==0) { // dE/dx "crossing points" in the TPC
366 if ((p>0.38)&&(p<0.48))
367 if (fR[0]<fR[3]*10.) return AliPID::ParticleMass(AliPID::kKaon);
368 if ((p>0.75)&&(p<0.85))
369 if (fR[0]<fR[4]*10.) return AliPID::ParticleMass(AliPID::kProton);
372 if (k==1) return AliPID::ParticleMass(AliPID::kMuon);
373 if (k==2||k==-1) return AliPID::ParticleMass(AliPID::kPion);
374 if (k==3) return AliPID::ParticleMass(AliPID::kKaon);
375 if (k==4) return AliPID::ParticleMass(AliPID::kProton);
376 AliWarning("Undefined mass !");
377 return AliPID::ParticleMass(AliPID::kPion);
380 //_______________________________________________________________________
381 Bool_t AliESDtrack::UpdateTrackParams(const AliKalmanTrack *t, ULong_t flags){
383 // This function updates track's running parameters
388 fLabel=t->GetLabel();
390 if (t->IsStartedTimeIntegral()) {
392 Double_t times[10];t->GetIntegratedTimes(times); SetIntegratedTimes(times);
393 SetIntegratedLength(t->GetIntegratedLength());
400 case kITSin: case kITSout: case kITSrefit:
401 fITSncls=t->GetNumberOfClusters();
402 fITSchi2=t->GetChi2();
403 for (Int_t i=0;i<kMaxITScluster;i++) fITSindex[i]=t->GetClusterIndex(i);
404 fITSsignal=t->GetPIDsignal();
405 fITSLabel = t->GetLabel();
406 fITSFakeRatio = t->GetFakeRatio();
409 case kTPCin: case kTPCrefit:
410 fTPCLabel = t->GetLabel();
411 if (!fIp) fIp=new AliExternalTrackParam(*t);
414 if (flags & kTPCout){
415 if (!fOp) fOp=new AliExternalTrackParam(*t);
418 fTPCncls=t->GetNumberOfClusters();
419 fTPCchi2=t->GetChi2();
421 {//prevrow must be declared in separate namespace, otherwise compiler cries:
422 //"jump to case label crosses initialization of `Int_t prevrow'"
424 // for (Int_t i=0;i<fTPCncls;i++)
425 for (Int_t i=0;i<kMaxTPCcluster;i++)
427 fTPCindex[i]=t->GetClusterIndex(i);
429 if (fTPCindex[i]<0) continue;
431 // Piotr's Cluster Map for HBT
432 // ### please change accordingly if cluster array is changing
433 // to "New TPC Tracking" style (with gaps in array)
434 Int_t idx = fTPCindex[i];
435 Int_t sect = (idx&0xff000000)>>24;
436 Int_t row = (idx&0x00ff0000)>>16;
437 if (sect > 18) row +=63; //if it is outer sector, add number of inner sectors
439 fTPCClusterMap.SetBitNumber(row,kTRUE);
441 //Fill the gap between previous row and this row with 0 bits
442 //In case ### pleas change it as well - just set bit 0 in case there
443 //is no associated clusters for current "i"
446 prevrow = row;//if previous bit was not assigned yet == this is the first one
449 { //we don't know the order (inner to outer or reverse)
450 //just to be save in case it is going to change
463 for (Int_t j = n+1; j < m; j++)
465 fTPCClusterMap.SetBitNumber(j,kFALSE);
469 // End Of Piotr's Cluster Map for HBT
472 fTPCsignal=t->GetPIDsignal();
475 case kTRDout: case kTRDin: case kTRDrefit:
476 fTRDLabel = t->GetLabel();
477 fTRDncls=t->GetNumberOfClusters();
478 fTRDchi2=t->GetChi2();
479 for (Int_t i=0;i<fTRDncls;i++) fTRDindex[i]=t->GetClusterIndex(i);
480 fTRDsignal=t->GetPIDsignal();
483 if (!fOp) fOp=new AliExternalTrackParam(*t);
485 fTRDncls0 = t->GetNumberOfClusters();
494 AliError("Wrong flag !");
501 //_______________________________________________________________________
502 void AliESDtrack::GetExternalParameters(Double_t &x, Double_t p[5]) const {
503 //---------------------------------------------------------------------
504 // This function returns external representation of the track parameters
505 //---------------------------------------------------------------------
507 for (Int_t i=0; i<5; i++) p[i]=GetParameter()[i];
510 //_______________________________________________________________________
511 void AliESDtrack::GetExternalCovariance(Double_t cov[15]) const {
512 //---------------------------------------------------------------------
513 // This function returns external representation of the cov. matrix
514 //---------------------------------------------------------------------
515 for (Int_t i=0; i<15; i++) cov[i]=AliExternalTrackParam::GetCovariance()[i];
518 //_______________________________________________________________________
519 Bool_t AliESDtrack::GetConstrainedExternalParameters
520 (Double_t &alpha, Double_t &x, Double_t p[5]) const {
521 //---------------------------------------------------------------------
522 // This function returns the constrained external track parameters
523 //---------------------------------------------------------------------
524 if (!fCp) return kFALSE;
525 alpha=fCp->GetAlpha();
527 for (Int_t i=0; i<5; i++) p[i]=fCp->GetParameter()[i];
531 //_______________________________________________________________________
533 AliESDtrack::GetConstrainedExternalCovariance(Double_t c[15]) const {
534 //---------------------------------------------------------------------
535 // This function returns the constrained external cov. matrix
536 //---------------------------------------------------------------------
537 if (!fCp) return kFALSE;
538 for (Int_t i=0; i<15; i++) c[i]=fCp->GetCovariance()[i];
543 AliESDtrack::GetInnerExternalParameters
544 (Double_t &alpha, Double_t &x, Double_t p[5]) const {
545 //---------------------------------------------------------------------
546 // This function returns external representation of the track parameters
547 // at the inner layer of TPC
548 //---------------------------------------------------------------------
549 if (!fIp) return kFALSE;
550 alpha=fIp->GetAlpha();
552 for (Int_t i=0; i<5; i++) p[i]=fIp->GetParameter()[i];
557 AliESDtrack::GetInnerExternalCovariance(Double_t cov[15]) const {
558 //---------------------------------------------------------------------
559 // This function returns external representation of the cov. matrix
560 // at the inner layer of TPC
561 //---------------------------------------------------------------------
562 if (!fIp) return kFALSE;
563 for (Int_t i=0; i<15; i++) cov[i]=fIp->GetCovariance()[i];
568 AliESDtrack::GetOuterExternalParameters
569 (Double_t &alpha, Double_t &x, Double_t p[5]) const {
570 //---------------------------------------------------------------------
571 // This function returns external representation of the track parameters
572 // at the inner layer of TRD
573 //---------------------------------------------------------------------
574 if (!fOp) return kFALSE;
575 alpha=fOp->GetAlpha();
577 for (Int_t i=0; i<5; i++) p[i]=fOp->GetParameter()[i];
582 AliESDtrack::GetOuterExternalCovariance(Double_t cov[15]) const {
583 //---------------------------------------------------------------------
584 // This function returns external representation of the cov. matrix
585 // at the inner layer of TRD
586 //---------------------------------------------------------------------
587 if (!fOp) return kFALSE;
588 for (Int_t i=0; i<15; i++) cov[i]=fOp->GetCovariance()[i];
592 Int_t AliESDtrack::GetNcls(Int_t idet) const
594 // Get number of clusters by subdetector index
617 Int_t AliESDtrack::GetClusters(Int_t idet, Int_t *idx) const
619 // Get cluster index array by subdetector index
624 ncls = GetITSclusters(idx);
627 ncls = GetTPCclusters(idx);
630 ncls = GetTRDclusters(idx);
633 if (fTOFindex != 0) {
634 idx[0] = GetTOFcluster();
644 //_______________________________________________________________________
645 void AliESDtrack::GetIntegratedTimes(Double_t *times) const {
646 // Returns the array with integrated times for each particle hypothesis
647 for (Int_t i=0; i<AliPID::kSPECIES; i++) times[i]=fTrackTime[i];
650 //_______________________________________________________________________
651 void AliESDtrack::SetIntegratedTimes(const Double_t *times) {
652 // Sets the array with integrated times for each particle hypotesis
653 for (Int_t i=0; i<AliPID::kSPECIES; i++) fTrackTime[i]=times[i];
656 //_______________________________________________________________________
657 void AliESDtrack::SetITSpid(const Double_t *p) {
658 // Sets values for the probability of each particle type (in ITS)
659 SetPIDValues(fITSr,p,AliPID::kSPECIES);
660 SetStatus(AliESDtrack::kITSpid);
663 void AliESDtrack::SetITSChi2MIP(const Float_t *chi2mip){
664 for (Int_t i=0; i<kMaxITScluster; i++) fITSchi2MIP[i]=chi2mip[i];
666 //_______________________________________________________________________
667 void AliESDtrack::GetITSpid(Double_t *p) const {
668 // Gets the probability of each particle type (in ITS)
669 for (Int_t i=0; i<AliPID::kSPECIES; i++) p[i]=fITSr[i];
672 //_______________________________________________________________________
673 Int_t AliESDtrack::GetITSclusters(Int_t *idx) const {
674 //---------------------------------------------------------------------
675 // This function returns indices of the assgined ITS clusters
676 //---------------------------------------------------------------------
677 for (Int_t i=0; i<kMaxITScluster; i++) idx[i]=fITSindex[i];
681 //_______________________________________________________________________
682 Int_t AliESDtrack::GetTPCclusters(Int_t *idx) const {
683 //---------------------------------------------------------------------
684 // This function returns indices of the assgined ITS clusters
685 //---------------------------------------------------------------------
687 for (Int_t i=0; i<kMaxTPCcluster; i++) idx[i]=fTPCindex[i]; // MI I prefer some constant
691 Float_t AliESDtrack::GetTPCdensity(Int_t row0, Int_t row1) const{
693 // GetDensity of the clusters on given region between row0 and row1
694 // Dead zone effect takin into acoount
699 for (Int_t i=row0;i<=row1;i++){
700 Int_t index = fTPCindex[i];
701 if (index!=-1) good++; // track outside of dead zone
702 if (index>0) found++;
705 if (good>(row1-row0)*0.5) density = Float_t(found)/Float_t(good);
709 //_______________________________________________________________________
710 void AliESDtrack::SetTPCpid(const Double_t *p) {
711 // Sets values for the probability of each particle type (in TPC)
712 SetPIDValues(fTPCr,p,AliPID::kSPECIES);
713 SetStatus(AliESDtrack::kTPCpid);
716 //_______________________________________________________________________
717 void AliESDtrack::GetTPCpid(Double_t *p) const {
718 // Gets the probability of each particle type (in TPC)
719 for (Int_t i=0; i<AliPID::kSPECIES; i++) p[i]=fTPCr[i];
722 //_______________________________________________________________________
723 Int_t AliESDtrack::GetTRDclusters(Int_t *idx) const {
724 //---------------------------------------------------------------------
725 // This function returns indices of the assgined TRD clusters
726 //---------------------------------------------------------------------
728 for (Int_t i=0; i<kMaxTRDcluster; i++) idx[i]=fTRDindex[i]; // MI I prefer some constant
732 //_______________________________________________________________________
733 void AliESDtrack::SetTRDpid(const Double_t *p) {
734 // Sets values for the probability of each particle type (in TRD)
735 SetPIDValues(fTRDr,p,AliPID::kSPECIES);
736 SetStatus(AliESDtrack::kTRDpid);
739 //_______________________________________________________________________
740 void AliESDtrack::GetTRDpid(Double_t *p) const {
741 // Gets the probability of each particle type (in TRD)
742 for (Int_t i=0; i<AliPID::kSPECIES; i++) p[i]=fTRDr[i];
745 //_______________________________________________________________________
746 void AliESDtrack::SetTRDpid(Int_t iSpecies, Float_t p)
748 // Sets the probability of particle type iSpecies to p (in TRD)
752 Float_t AliESDtrack::GetTRDpid(Int_t iSpecies) const
754 // Returns the probability of particle type iSpecies (in TRD)
755 return fTRDr[iSpecies];
758 //_______________________________________________________________________
759 void AliESDtrack::SetTOFpid(const Double_t *p) {
760 // Sets the probability of each particle type (in TOF)
761 SetPIDValues(fTOFr,p,AliPID::kSPECIES);
762 SetStatus(AliESDtrack::kTOFpid);
765 //_______________________________________________________________________
766 void AliESDtrack::SetTOFLabel(const Int_t *p) {
768 for (Int_t i=0; i<3; i++) fTOFLabel[i]=p[i];
771 //_______________________________________________________________________
772 void AliESDtrack::GetTOFpid(Double_t *p) const {
773 // Gets probabilities of each particle type (in TOF)
774 for (Int_t i=0; i<AliPID::kSPECIES; i++) p[i]=fTOFr[i];
777 //_______________________________________________________________________
778 void AliESDtrack::GetTOFLabel(Int_t *p) const {
780 for (Int_t i=0; i<3; i++) p[i]=fTOFLabel[i];
783 //_______________________________________________________________________
784 void AliESDtrack::GetTOFInfo(Float_t *info) const {
786 for (Int_t i=0; i<10; i++) info[i]=fTOFInfo[i];
789 //_______________________________________________________________________
790 void AliESDtrack::SetTOFInfo(Float_t*info) {
792 for (Int_t i=0; i<10; i++) fTOFInfo[i]=info[i];
797 //_______________________________________________________________________
798 void AliESDtrack::SetRICHpid(const Double_t *p) {
799 // Sets the probability of each particle type (in RICH)
800 SetPIDValues(fRICHr,p,AliPID::kSPECIES);
801 SetStatus(AliESDtrack::kRICHpid);
804 //_______________________________________________________________________
805 void AliESDtrack::GetRICHpid(Double_t *p) const {
806 // Gets probabilities of each particle type (in RICH)
807 for (Int_t i=0; i<AliPID::kSPECIES; i++) p[i]=fRICHr[i];
812 //_______________________________________________________________________
813 void AliESDtrack::SetESDpid(const Double_t *p) {
814 // Sets the probability of each particle type for the ESD track
815 SetPIDValues(fR,p,AliPID::kSPECIES);
816 SetStatus(AliESDtrack::kESDpid);
819 //_______________________________________________________________________
820 void AliESDtrack::GetESDpid(Double_t *p) const {
821 // Gets probability of each particle type for the ESD track
822 for (Int_t i=0; i<AliPID::kSPECIES; i++) p[i]=fR[i];
825 //_______________________________________________________________________
826 Bool_t AliESDtrack::RelateToVertex
827 (const AliESDVertex *vtx, Double_t b, Double_t maxd) {
829 // Try to relate this track to the vertex "vtx",
830 // if the (rough) transverse impact parameter is not bigger then "maxd".
831 // Magnetic field is "b" (kG).
833 // a) The track gets extapolated to the DCA to the vertex.
834 // b) The impact parameters and their covariance matrix are calculated.
835 // c) An attempt to constrain this track to the vertex is done.
837 // In the case of success, the returned value is kTRUE
838 // (otherwise, it's kFALSE)
840 Double_t alpha=GetAlpha();
841 Double_t sn=TMath::Sin(alpha), cs=TMath::Cos(alpha);
842 Double_t x=GetX(), y=GetParameter()[0], snp=GetParameter()[2];
843 Double_t xv= vtx->GetXv()*cs + vtx->GetYv()*sn;
844 Double_t yv=-vtx->GetXv()*sn + vtx->GetYv()*cs, zv=vtx->GetZv();
847 //Estimate the impact parameter neglecting the track curvature
848 Double_t d=TMath::Abs(x*snp - y*TMath::Sqrt(1.- snp*snp));
849 if (d > maxd) return kFALSE;
851 //Propagate to the DCA
852 Double_t crv=0.299792458e-3*b*GetParameter()[4];
853 Double_t tgfv=-(crv*x - snp)/(crv*y + TMath::Sqrt(1.-snp*snp));
854 sn=tgfv/TMath::Sqrt(1.+ tgfv*tgfv); cs=TMath::Sqrt(1.- sn*sn);
857 yv=-xv*sn + yv*cs; xv=x;
859 if (!Propagate(alpha+TMath::ASin(sn),xv,b)) return kFALSE;
861 fD = GetParameter()[0] - yv;
862 fZ = GetParameter()[1] - zv;
864 Double_t cov[6]; vtx->GetCovMatrix(cov);
865 fCdd = GetCovariance()[0] + cov[2]; // neglecting non-diagonals
866 fCdz = GetCovariance()[1]; // in the vertex's
867 fCzz = GetCovariance()[2] + cov[5]; // covariance matrix
870 Double_t p[2]={yv,zv}, c[3]={cov[2],0.,cov[5]};
871 Double_t chi2=GetPredictedChi2(p,c);
873 if (chi2>77.) return kFALSE;
875 AliExternalTrackParam tmp(*this);
876 if (!tmp.Update(p,c)) return kFALSE;
879 if (!fCp) fCp=new AliExternalTrackParam();
880 new (fCp) AliExternalTrackParam(tmp);
886 //_______________________________________________________________________
887 void AliESDtrack::Print(Option_t *) const {
888 // Prints info on the track
890 printf("ESD track info\n") ;
891 Double_t p[AliPID::kSPECIESN] ;
894 printf("From ITS: ") ;
896 for(index = 0 ; index < AliPID::kSPECIES; index++)
897 printf("%f, ", p[index]) ;
898 printf("\n signal = %f\n", GetITSsignal()) ;
901 printf("From TPC: ") ;
903 for(index = 0 ; index < AliPID::kSPECIES; index++)
904 printf("%f, ", p[index]) ;
905 printf("\n signal = %f\n", GetTPCsignal()) ;
908 printf("From TRD: ") ;
910 for(index = 0 ; index < AliPID::kSPECIES; index++)
911 printf("%f, ", p[index]) ;
912 printf("\n signal = %f\n", GetTRDsignal()) ;
915 printf("From TOF: ") ;
917 for(index = 0 ; index < AliPID::kSPECIES; index++)
918 printf("%f, ", p[index]) ;
919 printf("\n signal = %f\n", GetTOFsignal()) ;
921 if( IsOn(kRICHpid) ){
922 printf("From RICH: ") ;
924 for(index = 0 ; index < AliPID::kSPECIES; index++)
925 printf("%f, ", p[index]) ;
926 printf("\n signal = %f\n", GetRICHsignal()) ;