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
113 // The default ESD constructor
115 for (Int_t i=0; i<AliPID::kSPECIES; i++) {
125 // for (Int_t i=0; i<AliPID::kSPECIESN; i++) {
128 // fPHOSpos[0]=fPHOSpos[1]=fPHOSpos[2]=0.;
131 for (i=0; i<12; i++) fITSchi2MIP[i]=1e10;
132 for (i=0; i<12; i++) { fITSindex[i]=-1; }
133 for (i=0; i<180; i++) { fTPCindex[i]=0; }
134 for (i=0; i<3; i++) { fKinkIndexes[i]=0;}
135 for (i=0; i<3; i++) { fV0Indexes[i]=-1;}
136 for (i=0; i<180; i++) { fTRDindex[i]=0; }
137 for (i=0;i<kNPlane;i++) {fTRDsignals[i]=0.; fTRDTimBin[i]=-1;}
138 for (i=0;i<4;i++) {fTPCPoints[i]=-1;}
139 for (i=0;i<3;i++) {fTOFLabel[i]=-1;}
140 for (i=0;i<10;i++) {fTOFInfo[i]=-1;}
150 //_______________________________________________________________________
151 AliESDtrack::AliESDtrack(const AliESDtrack& track):
152 AliExternalTrackParam(track),
153 fFlags(track.fFlags),
154 fLabel(track.fLabel),
156 fTrackLength(track.fTrackLength),
157 fD(track.fD),fZ(track.fZ),
158 fCdd(track.fCdd),fCdz(track.fCdz),fCzz(track.fCzz),
159 fStopVertex(track.fStopVertex),
161 fCchi2(track.fCchi2),
164 fITSchi2(track.fITSchi2),
165 fITSncls(track.fITSncls),
166 fITSsignal(track.fITSsignal),
167 fITSLabel(track.fITSLabel),
168 fITSFakeRatio(track.fITSFakeRatio),
169 fITStrack(0), //coping separatelly - in user code
170 fTPCchi2(track.fTPCchi2),
171 fTPCncls(track.fTPCncls),
172 fTPCnclsF(track.fTPCnclsF),
173 fTPCClusterMap(track.fTPCClusterMap),
174 fTPCsignal(track.fTPCsignal),
175 fTPCsignalN(track.fTPCsignalN),
176 fTPCsignalS(track.fTPCsignalS),
177 fTPCLabel(track.fTPCLabel),
178 fTRDchi2(track.fTRDchi2),
179 fTRDncls(track.fTRDncls),
180 fTRDncls0(track.fTRDncls0),
181 fTRDsignal(track.fTRDsignal),
182 fTRDLabel(track.fTRDLabel),
183 fTRDQuality(track.fTRDQuality),
184 fTRDBudget(track.fTRDBudget),
186 fTOFchi2(track.fTOFchi2),
187 fTOFindex(track.fTOFindex),
188 fTOFCalChannel(track.fTOFCalChannel),
189 fTOFsignal(track.fTOFsignal),
190 fTOFsignalToT(track.fTOFsignalToT),
191 //fPHOSsignal(track.fPHOSsignal),
192 fRICHchi2(track.fRICHchi2),
193 fRICHncls(track.fRICHncls),
194 fRICHindex(track.fRICHindex),
195 fRICHsignal(track.fRICHsignal),
196 fRICHtheta(track.fRICHtheta),
197 fRICHphi(track.fRICHphi),
198 fRICHdx(track.fRICHdx),
199 fRICHdy(track.fRICHdy)
204 for (Int_t i=0;i<AliPID::kSPECIES;i++) fTrackTime[i]=track.fTrackTime[i];
205 for (Int_t i=0;i<AliPID::kSPECIES;i++) fR[i]=track.fR[i];
207 for (Int_t i=0;i<12;i++) fITSchi2MIP[i]=track.fITSchi2MIP[i];
208 for (Int_t i=0;i<12;i++) fITSindex[i]=track.fITSindex[i];
209 for (Int_t i=0;i<AliPID::kSPECIES;i++) fITSr[i]=track.fITSr[i];
211 for (Int_t i=0;i<180;i++) fTPCindex[i]=track.fTPCindex[i];
212 for (Int_t i=0;i<AliPID::kSPECIES;i++) fTPCr[i]=track.fTPCr[i];
213 for (Int_t i=0;i<4;i++) {fTPCPoints[i]=track.fTPCPoints[i];}
214 for (Int_t i=0; i<3;i++) { fKinkIndexes[i]=track.fKinkIndexes[i];}
215 for (Int_t i=0; i<3;i++) { fV0Indexes[i]=track.fV0Indexes[i];}
217 for (Int_t i=0;i<180;i++) fTRDindex[i]=track.fTRDindex[i];
218 for (Int_t i=0;i<kNPlane;i++) {
219 fTRDsignals[i]=track.fTRDsignals[i];
220 fTRDTimBin[i]=track.fTRDTimBin[i];
222 for (Int_t i=0;i<AliPID::kSPECIES;i++) fTRDr[i]=track.fTRDr[i];
224 for (Int_t i=0;i<AliPID::kSPECIES;i++) fTOFr[i]=track.fTOFr[i];
225 for (Int_t i=0;i<3;i++) fTOFLabel[i]=track.fTOFLabel[i];
226 for (Int_t i=0;i<10;i++) fTOFInfo[i]=track.fTOFInfo[i];
228 // for (Int_t i=0;i<3;i++) fPHOSpos[i]=track.fPHOSpos[i];
229 //for (Int_t i=0;i<AliPID::kSPECIESN;i++) fPHOSr[i]=track.fPHOSr[i];
231 for (Int_t i=0;i<AliPID::kSPECIES;i++) fRICHr[i]=track.fRICHr[i];
233 if (track.fCp) fCp=new AliExternalTrackParam(*track.fCp);
234 if (track.fIp) fIp=new AliExternalTrackParam(*track.fIp);
235 if (track.fOp) fOp=new AliExternalTrackParam(*track.fOp);
238 fPoints = new AliTrackPointArray(*(track.fPoints));
241 //_______________________________________________________________________
242 AliESDtrack::~AliESDtrack(){
244 // This is destructor according Coding Conventrions
246 //printf("Delete track\n");
255 //_______________________________________________________________________
256 void AliESDtrack::MakeMiniESDtrack(){
257 // Resets everything except
258 // fFlags: Reconstruction status flags
259 // fLabel: Track label
260 // fID: Unique ID of the track
261 // fD: Impact parameter in XY-plane
262 // fZ: Impact parameter in Z
263 // fR[AliPID::kSPECIES]: combined "detector response probability"
264 // Running track parameters
265 // fRalpha: track rotation angle
266 // fRx: X-coordinate of the track reference plane
267 // fRp[5]: external track parameters
268 // fRc[15]: external cov. matrix of the track parameters
271 for (Int_t i=0;i<AliPID::kSPECIES;i++) fTrackTime[i] = 0;
274 // Reset track parameters constrained to the primary vertex
278 // Reset track parameters at the inner wall of TPC
281 // Reset track parameters at the inner wall of the TRD
284 // Reset ITS track related information
286 for (Int_t i=0;i<12;i++) fITSchi2MIP[i]=0;
288 for (Int_t i=0;i<12;i++) fITSindex[i]=0;
290 for (Int_t i=0;i<AliPID::kSPECIES;i++) fITSr[i]=0;
295 // Reset TPC related track information
299 for (Int_t i=0;i<180;i++) fTPCindex[i] = 0;
304 for (Int_t i=0;i<AliPID::kSPECIES;i++) fTPCr[i]=0;
306 for (Int_t i=0;i<4;i++) fTPCPoints[i] = 0;
307 for (Int_t i=0; i<3;i++) fKinkIndexes[i] = 0;
308 for (Int_t i=0; i<3;i++) fV0Indexes[i] = 0;
310 // Reset TRD related track information
314 for (Int_t i=0;i<180;i++) fTRDindex[i] = 0;
316 for (Int_t i=0;i<kNPlane;i++) {
320 for (Int_t i=0;i<AliPID::kSPECIES;i++) fTRDr[i] = 0;
326 // Reset TOF related track information
332 for (Int_t i=0;i<AliPID::kSPECIES;i++) fTOFr[i] = 0;
333 for (Int_t i=0;i<3;i++) fTOFLabel[i] = 0;
334 for (Int_t i=0;i<10;i++) fTOFInfo[i] = 0;
336 // Reset PHOS related track information
337 //for (Int_t i=0;i<3;i++) fPHOSpos[i] = 0;
339 //for (Int_t i=0;i<AliPID::kSPECIESN;i++) fPHOSr[i] = 0;
341 // Reset RICH related track information
346 for (Int_t i=0;i<AliPID::kSPECIES;i++) fRICHr[i] = 0;
354 //_______________________________________________________________________
355 Double_t AliESDtrack::GetMass() const {
356 // Returns the mass of the most probable particle type
359 for (Int_t i=0; i<AliPID::kSPECIES; i++) {
360 if (fR[i]>max) {k=i; max=fR[i];}
362 if (k==0) { // dE/dx "crossing points" in the TPC
364 if ((p>0.38)&&(p<0.48))
365 if (fR[0]<fR[3]*10.) return AliPID::ParticleMass(AliPID::kKaon);
366 if ((p>0.75)&&(p<0.85))
367 if (fR[0]<fR[4]*10.) return AliPID::ParticleMass(AliPID::kProton);
370 if (k==1) return AliPID::ParticleMass(AliPID::kMuon);
371 if (k==2||k==-1) return AliPID::ParticleMass(AliPID::kPion);
372 if (k==3) return AliPID::ParticleMass(AliPID::kKaon);
373 if (k==4) return AliPID::ParticleMass(AliPID::kProton);
374 AliWarning("Undefined mass !");
375 return AliPID::ParticleMass(AliPID::kPion);
378 //_______________________________________________________________________
379 Bool_t AliESDtrack::UpdateTrackParams(const AliKalmanTrack *t, ULong_t flags){
381 // This function updates track's running parameters
386 fLabel=t->GetLabel();
388 if (t->IsStartedTimeIntegral()) {
390 Double_t times[10];t->GetIntegratedTimes(times); SetIntegratedTimes(times);
391 SetIntegratedLength(t->GetIntegratedLength());
398 case kITSin: case kITSout: case kITSrefit:
399 fITSncls=t->GetNumberOfClusters();
400 fITSchi2=t->GetChi2();
401 for (Int_t i=0;i<12;i++) fITSindex[i]=t->GetClusterIndex(i);
402 fITSsignal=t->GetPIDsignal();
403 fITSLabel = t->GetLabel();
404 fITSFakeRatio = t->GetFakeRatio();
407 case kTPCin: case kTPCrefit:
408 fTPCLabel = t->GetLabel();
409 if (!fIp) fIp=new AliExternalTrackParam(*t);
412 if (flags & kTPCout){
413 if (!fOp) fOp=new AliExternalTrackParam(*t);
416 fTPCncls=t->GetNumberOfClusters();
417 fTPCchi2=t->GetChi2();
419 {//prevrow must be declared in separate namespace, otherwise compiler cries:
420 //"jump to case label crosses initialization of `Int_t prevrow'"
422 // for (Int_t i=0;i<fTPCncls;i++)
423 for (Int_t i=0;i<160;i++)
425 fTPCindex[i]=t->GetClusterIndex(i);
427 // Piotr's Cluster Map for HBT
428 // ### please change accordingly if cluster array is changing
429 // to "New TPC Tracking" style (with gaps in array)
430 Int_t idx = fTPCindex[i];
431 Int_t sect = (idx&0xff000000)>>24;
432 Int_t row = (idx&0x00ff0000)>>16;
433 if (sect > 18) row +=63; //if it is outer sector, add number of inner sectors
435 fTPCClusterMap.SetBitNumber(row,kTRUE);
437 //Fill the gap between previous row and this row with 0 bits
438 //In case ### pleas change it as well - just set bit 0 in case there
439 //is no associated clusters for current "i"
442 prevrow = row;//if previous bit was not assigned yet == this is the first one
445 { //we don't know the order (inner to outer or reverse)
446 //just to be save in case it is going to change
459 for (Int_t j = n+1; j < m; j++)
461 fTPCClusterMap.SetBitNumber(j,kFALSE);
465 // End Of Piotr's Cluster Map for HBT
468 fTPCsignal=t->GetPIDsignal();
471 case kTRDout: case kTRDin: case kTRDrefit:
472 fTRDLabel = t->GetLabel();
473 fTRDncls=t->GetNumberOfClusters();
474 fTRDchi2=t->GetChi2();
475 for (Int_t i=0;i<fTRDncls;i++) fTRDindex[i]=t->GetClusterIndex(i);
476 fTRDsignal=t->GetPIDsignal();
479 if (!fOp) fOp=new AliExternalTrackParam(*t);
481 fTRDncls0 = t->GetNumberOfClusters();
490 AliError("Wrong flag !");
497 //_______________________________________________________________________
498 void AliESDtrack::GetExternalParameters(Double_t &x, Double_t p[5]) const {
499 //---------------------------------------------------------------------
500 // This function returns external representation of the track parameters
501 //---------------------------------------------------------------------
503 for (Int_t i=0; i<5; i++) p[i]=GetParameter()[i];
506 //_______________________________________________________________________
507 void AliESDtrack::GetExternalCovariance(Double_t cov[15]) const {
508 //---------------------------------------------------------------------
509 // This function returns external representation of the cov. matrix
510 //---------------------------------------------------------------------
511 for (Int_t i=0; i<15; i++) cov[i]=AliExternalTrackParam::GetCovariance()[i];
514 //_______________________________________________________________________
515 Bool_t AliESDtrack::GetConstrainedExternalParameters
516 (Double_t &alpha, Double_t &x, Double_t p[5]) const {
517 //---------------------------------------------------------------------
518 // This function returns the constrained external track parameters
519 //---------------------------------------------------------------------
520 if (!fCp) return kFALSE;
521 alpha=fCp->GetAlpha();
523 for (Int_t i=0; i<5; i++) p[i]=fCp->GetParameter()[i];
527 //_______________________________________________________________________
529 AliESDtrack::GetConstrainedExternalCovariance(Double_t c[15]) const {
530 //---------------------------------------------------------------------
531 // This function returns the constrained external cov. matrix
532 //---------------------------------------------------------------------
533 if (!fCp) return kFALSE;
534 for (Int_t i=0; i<15; i++) c[i]=fCp->GetCovariance()[i];
539 AliESDtrack::GetInnerExternalParameters
540 (Double_t &alpha, Double_t &x, Double_t p[5]) const {
541 //---------------------------------------------------------------------
542 // This function returns external representation of the track parameters
543 // at the inner layer of TPC
544 //---------------------------------------------------------------------
545 if (!fIp) return kFALSE;
546 alpha=fIp->GetAlpha();
548 for (Int_t i=0; i<5; i++) p[i]=fIp->GetParameter()[i];
553 AliESDtrack::GetInnerExternalCovariance(Double_t cov[15]) const {
554 //---------------------------------------------------------------------
555 // This function returns external representation of the cov. matrix
556 // at the inner layer of TPC
557 //---------------------------------------------------------------------
558 if (!fIp) return kFALSE;
559 for (Int_t i=0; i<15; i++) cov[i]=fIp->GetCovariance()[i];
564 AliESDtrack::GetOuterExternalParameters
565 (Double_t &alpha, Double_t &x, Double_t p[5]) const {
566 //---------------------------------------------------------------------
567 // This function returns external representation of the track parameters
568 // at the inner layer of TRD
569 //---------------------------------------------------------------------
570 if (!fOp) return kFALSE;
571 alpha=fOp->GetAlpha();
573 for (Int_t i=0; i<5; i++) p[i]=fOp->GetParameter()[i];
578 AliESDtrack::GetOuterExternalCovariance(Double_t cov[15]) const {
579 //---------------------------------------------------------------------
580 // This function returns external representation of the cov. matrix
581 // at the inner layer of TRD
582 //---------------------------------------------------------------------
583 if (!fOp) return kFALSE;
584 for (Int_t i=0; i<15; i++) cov[i]=fOp->GetCovariance()[i];
588 Int_t AliESDtrack::GetNcls(Int_t idet) const
590 // Get number of clusters by subdetector index
613 Int_t AliESDtrack::GetClusters(Int_t idet, Int_t *idx) const
615 // Get cluster index array by subdetector index
620 ncls = GetITSclusters(idx);
623 ncls = GetTPCclusters(idx);
626 ncls = GetTRDclusters(idx);
629 if (fTOFindex != 0) {
630 idx[0] = GetTOFcluster();
640 //_______________________________________________________________________
641 void AliESDtrack::GetIntegratedTimes(Double_t *times) const {
642 // Returns the array with integrated times for each particle hypothesis
643 for (Int_t i=0; i<AliPID::kSPECIES; i++) times[i]=fTrackTime[i];
646 //_______________________________________________________________________
647 void AliESDtrack::SetIntegratedTimes(const Double_t *times) {
648 // Sets the array with integrated times for each particle hypotesis
649 for (Int_t i=0; i<AliPID::kSPECIES; i++) fTrackTime[i]=times[i];
652 //_______________________________________________________________________
653 void AliESDtrack::SetITSpid(const Double_t *p) {
654 // Sets values for the probability of each particle type (in ITS)
655 SetPIDValues(fITSr,p,AliPID::kSPECIES);
656 SetStatus(AliESDtrack::kITSpid);
659 void AliESDtrack::SetITSChi2MIP(const Float_t *chi2mip){
660 for (Int_t i=0; i<12; i++) fITSchi2MIP[i]=chi2mip[i];
662 //_______________________________________________________________________
663 void AliESDtrack::GetITSpid(Double_t *p) const {
664 // Gets the probability of each particle type (in ITS)
665 for (Int_t i=0; i<AliPID::kSPECIES; i++) p[i]=fITSr[i];
668 //_______________________________________________________________________
669 Int_t AliESDtrack::GetITSclusters(Int_t *idx) const {
670 //---------------------------------------------------------------------
671 // This function returns indices of the assgined ITS clusters
672 //---------------------------------------------------------------------
673 for (Int_t i=0; i<12; i++) idx[i]=fITSindex[i];
677 //_______________________________________________________________________
678 Int_t AliESDtrack::GetTPCclusters(Int_t *idx) const {
679 //---------------------------------------------------------------------
680 // This function returns indices of the assgined ITS clusters
681 //---------------------------------------------------------------------
683 for (Int_t i=0; i<180; i++) idx[i]=fTPCindex[i]; // MI I prefer some constant
687 Float_t AliESDtrack::GetTPCdensity(Int_t row0, Int_t row1) const{
689 // GetDensity of the clusters on given region between row0 and row1
690 // Dead zone effect takin into acoount
695 for (Int_t i=row0;i<=row1;i++){
696 Int_t index = fTPCindex[i];
697 if (index!=-1) good++; // track outside of dead zone
698 if (index>0) found++;
701 if (good>(row1-row0)*0.5) density = Float_t(found)/Float_t(good);
705 //_______________________________________________________________________
706 void AliESDtrack::SetTPCpid(const Double_t *p) {
707 // Sets values for the probability of each particle type (in TPC)
708 SetPIDValues(fTPCr,p,AliPID::kSPECIES);
709 SetStatus(AliESDtrack::kTPCpid);
712 //_______________________________________________________________________
713 void AliESDtrack::GetTPCpid(Double_t *p) const {
714 // Gets the probability of each particle type (in TPC)
715 for (Int_t i=0; i<AliPID::kSPECIES; i++) p[i]=fTPCr[i];
718 //_______________________________________________________________________
719 Int_t AliESDtrack::GetTRDclusters(Int_t *idx) const {
720 //---------------------------------------------------------------------
721 // This function returns indices of the assgined TRD clusters
722 //---------------------------------------------------------------------
724 for (Int_t i=0; i<180; i++) idx[i]=fTRDindex[i]; // MI I prefer some constant
728 //_______________________________________________________________________
729 void AliESDtrack::SetTRDpid(const Double_t *p) {
730 // Sets values for the probability of each particle type (in TRD)
731 SetPIDValues(fTRDr,p,AliPID::kSPECIES);
732 SetStatus(AliESDtrack::kTRDpid);
735 //_______________________________________________________________________
736 void AliESDtrack::GetTRDpid(Double_t *p) const {
737 // Gets the probability of each particle type (in TRD)
738 for (Int_t i=0; i<AliPID::kSPECIES; i++) p[i]=fTRDr[i];
741 //_______________________________________________________________________
742 void AliESDtrack::SetTRDpid(Int_t iSpecies, Float_t p)
744 // Sets the probability of particle type iSpecies to p (in TRD)
748 Float_t AliESDtrack::GetTRDpid(Int_t iSpecies) const
750 // Returns the probability of particle type iSpecies (in TRD)
751 return fTRDr[iSpecies];
754 //_______________________________________________________________________
755 void AliESDtrack::SetTOFpid(const Double_t *p) {
756 // Sets the probability of each particle type (in TOF)
757 SetPIDValues(fTOFr,p,AliPID::kSPECIES);
758 SetStatus(AliESDtrack::kTOFpid);
761 //_______________________________________________________________________
762 void AliESDtrack::SetTOFLabel(const Int_t *p) {
764 for (Int_t i=0; i<3; i++) fTOFLabel[i]=p[i];
767 //_______________________________________________________________________
768 void AliESDtrack::GetTOFpid(Double_t *p) const {
769 // Gets probabilities of each particle type (in TOF)
770 for (Int_t i=0; i<AliPID::kSPECIES; i++) p[i]=fTOFr[i];
773 //_______________________________________________________________________
774 void AliESDtrack::GetTOFLabel(Int_t *p) const {
776 for (Int_t i=0; i<3; i++) p[i]=fTOFLabel[i];
779 //_______________________________________________________________________
780 void AliESDtrack::GetTOFInfo(Float_t *info) const {
782 for (Int_t i=0; i<10; i++) info[i]=fTOFInfo[i];
785 //_______________________________________________________________________
786 void AliESDtrack::SetTOFInfo(Float_t*info) {
788 for (Int_t i=0; i<10; i++) fTOFInfo[i]=info[i];
793 //_______________________________________________________________________
794 void AliESDtrack::SetRICHpid(const Double_t *p) {
795 // Sets the probability of each particle type (in RICH)
796 SetPIDValues(fRICHr,p,AliPID::kSPECIES);
797 SetStatus(AliESDtrack::kRICHpid);
800 //_______________________________________________________________________
801 void AliESDtrack::GetRICHpid(Double_t *p) const {
802 // Gets probabilities of each particle type (in RICH)
803 for (Int_t i=0; i<AliPID::kSPECIES; i++) p[i]=fRICHr[i];
808 //_______________________________________________________________________
809 void AliESDtrack::SetESDpid(const Double_t *p) {
810 // Sets the probability of each particle type for the ESD track
811 SetPIDValues(fR,p,AliPID::kSPECIES);
812 SetStatus(AliESDtrack::kESDpid);
815 //_______________________________________________________________________
816 void AliESDtrack::GetESDpid(Double_t *p) const {
817 // Gets probability of each particle type for the ESD track
818 for (Int_t i=0; i<AliPID::kSPECIES; i++) p[i]=fR[i];
821 //_______________________________________________________________________
822 Bool_t AliESDtrack::RelateToVertex
823 (const AliESDVertex *vtx, Double_t b, Double_t maxd) {
825 // Try to relate this track to the vertex "vtx",
826 // if the (rough) transverse impact parameter is not bigger then "maxd".
827 // Magnetic field is "b" (kG).
829 // a) The track gets extapolated to the DCA to the vertex.
830 // b) The impact parameters and their covariance matrix are calculated.
831 // c) An attempt to constrain this track to the vertex is done.
833 // In the case of success, the returned value is kTRUE
834 // (otherwise, it's kFALSE)
836 Double_t alpha=GetAlpha();
837 Double_t sn=TMath::Sin(alpha), cs=TMath::Cos(alpha);
838 Double_t x=GetX(), y=GetParameter()[0], snp=GetParameter()[2];
839 Double_t xv= vtx->GetXv()*cs + vtx->GetYv()*sn;
840 Double_t yv=-vtx->GetXv()*sn + vtx->GetYv()*cs, zv=vtx->GetZv();
843 //Estimate the impact parameter neglecting the track curvature
844 Double_t d=TMath::Abs(x*snp - y*TMath::Sqrt(1.- snp*snp));
845 if (d > maxd) return kFALSE;
847 //Propagate to the DCA
848 Double_t crv=0.299792458e-3*b*GetParameter()[4];
849 Double_t tgfv=-(crv*x - snp)/(crv*y + TMath::Sqrt(1.-snp*snp));
850 sn=tgfv/TMath::Sqrt(1.+ tgfv*tgfv); cs=TMath::Sqrt(1.- sn*sn);
853 yv=-xv*sn + yv*cs; xv=x;
855 if (!Propagate(alpha+TMath::ASin(sn),xv,b)) return kFALSE;
857 fD = GetParameter()[0] - yv;
858 fZ = GetParameter()[1] - zv;
860 Double_t cov[6]; vtx->GetCovMatrix(cov);
861 fCdd = GetCovariance()[0] + cov[2]; // neglecting non-diagonals
862 fCdz = GetCovariance()[1]; // in the vertex's
863 fCzz = GetCovariance()[2] + cov[5]; // covariance matrix
866 Double_t p[2]={yv,zv}, c[3]={cov[2],0.,cov[5]};
867 Double_t chi2=GetPredictedChi2(p,c);
869 if (chi2>77.) return kFALSE;
871 AliExternalTrackParam tmp(*this);
872 if (!tmp.Update(p,c)) return kFALSE;
875 if (!fCp) fCp=new AliExternalTrackParam();
876 new (fCp) AliExternalTrackParam(tmp);
882 //_______________________________________________________________________
883 void AliESDtrack::Print(Option_t *) const {
884 // Prints info on the track
886 printf("ESD track info\n") ;
887 Double_t p[AliPID::kSPECIESN] ;
890 printf("From ITS: ") ;
892 for(index = 0 ; index < AliPID::kSPECIES; index++)
893 printf("%f, ", p[index]) ;
894 printf("\n signal = %f\n", GetITSsignal()) ;
897 printf("From TPC: ") ;
899 for(index = 0 ; index < AliPID::kSPECIES; index++)
900 printf("%f, ", p[index]) ;
901 printf("\n signal = %f\n", GetTPCsignal()) ;
904 printf("From TRD: ") ;
906 for(index = 0 ; index < AliPID::kSPECIES; index++)
907 printf("%f, ", p[index]) ;
908 printf("\n signal = %f\n", GetTRDsignal()) ;
911 printf("From TOF: ") ;
913 for(index = 0 ; index < AliPID::kSPECIES; index++)
914 printf("%f, ", p[index]) ;
915 printf("\n signal = %f\n", GetTOFsignal()) ;
917 if( IsOn(kRICHpid) ){
918 printf("From RICH: ") ;
920 for(index = 0 ; index < AliPID::kSPECIES; index++)
921 printf("%f, ", p[index]) ;
922 printf("\n signal = %f\n", GetRICHsignal()) ;
924 // Since 9 March 2006 PHOS left ESDtrack for ESDCaloCluster
925 // and cannot participate in the global PID for the moment
926 // if( IsOn(kPHOSpid) ){
927 // printf("From PHOS: ") ;
929 // for(index = 0 ; index < AliPID::kSPECIESN; index++)
930 // printf("%f, ", p[index]) ;
931 // printf("\n signal = %f\n", GetPHOSsignal()) ;