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
118 for (i=0; i<AliPID::kSPECIES; i++) {
128 for (i=0; i<kMaxITScluster; i++) fITSchi2MIP[i]=1e10;
129 for (i=0; i<kMaxITScluster; i++) { fITSindex[i]=-1; }
130 for (i=0; i<kMaxTPCcluster; i++) { fTPCindex[i]=-2; }
131 for (i=0; i<3; i++) { fKinkIndexes[i]=0;}
132 for (i=0; i<3; i++) { fV0Indexes[i]=-1;}
133 for (i=0; i<kMaxTRDcluster; i++) { fTRDindex[i]=-2; }
134 for (i=0;i<kNPlane;i++) {fTRDsignals[i]=0.; fTRDTimBin[i]=-1;}
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 fITSsignal(track.fITSsignal),
157 fITSLabel(track.fITSLabel),
158 fITSFakeRatio(track.fITSFakeRatio),
159 fITStrack(0), //coping separatelly - in user code
160 fTPCchi2(track.fTPCchi2),
161 fTPCncls(track.fTPCncls),
162 fTPCnclsF(track.fTPCnclsF),
163 fTPCClusterMap(track.fTPCClusterMap),
164 fTPCsignal(track.fTPCsignal),
165 fTPCsignalN(track.fTPCsignalN),
166 fTPCsignalS(track.fTPCsignalS),
167 fTPCLabel(track.fTPCLabel),
168 fTRDchi2(track.fTRDchi2),
169 fTRDncls(track.fTRDncls),
170 fTRDncls0(track.fTRDncls0),
171 fTRDsignal(track.fTRDsignal),
172 fTRDLabel(track.fTRDLabel),
173 fTRDQuality(track.fTRDQuality),
174 fTRDBudget(track.fTRDBudget),
176 fTOFchi2(track.fTOFchi2),
177 fTOFindex(track.fTOFindex),
178 fTOFCalChannel(track.fTOFCalChannel),
179 fTOFsignal(track.fTOFsignal),
180 fTOFsignalToT(track.fTOFsignalToT),
181 //fPHOSsignal(track.fPHOSsignal),
182 fRICHchi2(track.fRICHchi2),
183 fRICHncls(track.fRICHncls),
184 fRICHindex(track.fRICHindex),
185 fRICHsignal(track.fRICHsignal),
186 fRICHtheta(track.fRICHtheta),
187 fRICHphi(track.fRICHphi),
188 fRICHdx(track.fRICHdx),
189 fRICHdy(track.fRICHdy),
190 fRICHmipX(track.fRICHmipX),
191 fRICHmipY(track.fRICHmipY)
196 for (Int_t i=0;i<AliPID::kSPECIES;i++) fTrackTime[i]=track.fTrackTime[i];
197 for (Int_t i=0;i<AliPID::kSPECIES;i++) fR[i]=track.fR[i];
199 for (Int_t i=0;i<kMaxITScluster;i++) fITSchi2MIP[i]=track.fITSchi2MIP[i];
200 for (Int_t i=0;i<kMaxITScluster;i++) fITSindex[i]=track.fITSindex[i];
201 for (Int_t i=0;i<AliPID::kSPECIES;i++) fITSr[i]=track.fITSr[i];
203 for (Int_t i=0;i<kMaxTPCcluster;i++) fTPCindex[i]=track.fTPCindex[i];
204 for (Int_t i=0;i<AliPID::kSPECIES;i++) fTPCr[i]=track.fTPCr[i];
205 for (Int_t i=0;i<4;i++) {fTPCPoints[i]=track.fTPCPoints[i];}
206 for (Int_t i=0; i<3;i++) { fKinkIndexes[i]=track.fKinkIndexes[i];}
207 for (Int_t i=0; i<3;i++) { fV0Indexes[i]=track.fV0Indexes[i];}
209 for (Int_t i=0;i<kMaxTRDcluster;i++) fTRDindex[i]=track.fTRDindex[i];
210 for (Int_t i=0;i<kNPlane;i++) {
211 fTRDsignals[i]=track.fTRDsignals[i];
212 fTRDTimBin[i]=track.fTRDTimBin[i];
214 for (Int_t i=0;i<AliPID::kSPECIES;i++) fTRDr[i]=track.fTRDr[i];
215 for (Int_t i=0;i<AliPID::kSPECIES;i++) fTOFr[i]=track.fTOFr[i];
216 for (Int_t i=0;i<3;i++) fTOFLabel[i]=track.fTOFLabel[i];
217 for (Int_t i=0;i<10;i++) fTOFInfo[i]=track.fTOFInfo[i];
218 for (Int_t i=0;i<AliPID::kSPECIES;i++) fRICHr[i]=track.fRICHr[i];
220 if (track.fCp) fCp=new AliExternalTrackParam(*track.fCp);
221 if (track.fIp) fIp=new AliExternalTrackParam(*track.fIp);
222 if (track.fOp) fOp=new AliExternalTrackParam(*track.fOp);
225 fPoints = new AliTrackPointArray(*(track.fPoints));
228 //_______________________________________________________________________
229 AliESDtrack::~AliESDtrack(){
231 // This is destructor according Coding Conventrions
233 //printf("Delete track\n");
242 //_______________________________________________________________________
243 void AliESDtrack::MakeMiniESDtrack(){
244 // Resets everything except
245 // fFlags: Reconstruction status flags
246 // fLabel: Track label
247 // fID: Unique ID of the track
248 // fD: Impact parameter in XY-plane
249 // fZ: Impact parameter in Z
250 // fR[AliPID::kSPECIES]: combined "detector response probability"
251 // Running track parameters
252 // fRalpha: track rotation angle
253 // fRx: X-coordinate of the track reference plane
254 // fRp[5]: external track parameters
255 // fRc[15]: external cov. matrix of the track parameters
258 for (Int_t i=0;i<AliPID::kSPECIES;i++) fTrackTime[i] = 0;
261 // Reset track parameters constrained to the primary vertex
265 // Reset track parameters at the inner wall of TPC
268 // Reset track parameters at the inner wall of the TRD
271 // Reset ITS track related information
273 for (Int_t i=0;i<kMaxITScluster;i++) fITSchi2MIP[i]=0;
275 for (Int_t i=0;i<kMaxITScluster;i++) fITSindex[i]=-1;
277 for (Int_t i=0;i<AliPID::kSPECIES;i++) fITSr[i]=0;
282 // Reset TPC related track information
286 for (Int_t i=0;i<kMaxTPCcluster;i++) fTPCindex[i] = -2;
291 for (Int_t i=0;i<AliPID::kSPECIES;i++) fTPCr[i]=0;
293 for (Int_t i=0;i<4;i++) fTPCPoints[i] = 0;
294 for (Int_t i=0; i<3;i++) fKinkIndexes[i] = 0;
295 for (Int_t i=0; i<3;i++) fV0Indexes[i] = 0;
297 // Reset TRD related track information
301 for (Int_t i=0;i<kMaxTRDcluster;i++) fTRDindex[i] = -2;
303 for (Int_t i=0;i<kNPlane;i++) {
307 for (Int_t i=0;i<AliPID::kSPECIES;i++) fTRDr[i] = 0;
313 // Reset TOF related track information
319 for (Int_t i=0;i<AliPID::kSPECIES;i++) fTOFr[i] = 0;
320 for (Int_t i=0;i<3;i++) fTOFLabel[i] = 0;
321 for (Int_t i=0;i<10;i++) fTOFInfo[i] = 0;
323 // Reset PHOS related track information
324 //for (Int_t i=0;i<3;i++) fPHOSpos[i] = 0;
326 //for (Int_t i=0;i<AliPID::kSPECIESN;i++) fPHOSr[i] = 0;
328 // Reset RICH related track information
333 for (Int_t i=0;i<AliPID::kSPECIES;i++) fRICHr[i] = 0;
341 //_______________________________________________________________________
342 Double_t AliESDtrack::GetMass() const {
343 // Returns the mass of the most probable particle type
346 for (Int_t i=0; i<AliPID::kSPECIES; i++) {
347 if (fR[i]>max) {k=i; max=fR[i];}
349 if (k==0) { // dE/dx "crossing points" in the TPC
351 if ((p>0.38)&&(p<0.48))
352 if (fR[0]<fR[3]*10.) return AliPID::ParticleMass(AliPID::kKaon);
353 if ((p>0.75)&&(p<0.85))
354 if (fR[0]<fR[4]*10.) return AliPID::ParticleMass(AliPID::kProton);
357 if (k==1) return AliPID::ParticleMass(AliPID::kMuon);
358 if (k==2||k==-1) return AliPID::ParticleMass(AliPID::kPion);
359 if (k==3) return AliPID::ParticleMass(AliPID::kKaon);
360 if (k==4) return AliPID::ParticleMass(AliPID::kProton);
361 AliWarning("Undefined mass !");
362 return AliPID::ParticleMass(AliPID::kPion);
365 //_______________________________________________________________________
366 Bool_t AliESDtrack::UpdateTrackParams(const AliKalmanTrack *t, ULong_t flags){
368 // This function updates track's running parameters
373 fLabel=t->GetLabel();
375 if (t->IsStartedTimeIntegral()) {
377 Double_t times[10];t->GetIntegratedTimes(times); SetIntegratedTimes(times);
378 SetIntegratedLength(t->GetIntegratedLength());
385 case kITSin: case kITSout: case kITSrefit:
386 fITSncls=t->GetNumberOfClusters();
387 fITSchi2=t->GetChi2();
388 for (Int_t i=0;i<kMaxITScluster;i++) fITSindex[i]=t->GetClusterIndex(i);
389 fITSsignal=t->GetPIDsignal();
390 fITSLabel = t->GetLabel();
391 fITSFakeRatio = t->GetFakeRatio();
394 case kTPCin: case kTPCrefit:
395 fTPCLabel = t->GetLabel();
396 if (!fIp) fIp=new AliExternalTrackParam(*t);
399 if (flags & kTPCout){
400 if (!fOp) fOp=new AliExternalTrackParam(*t);
403 fTPCncls=t->GetNumberOfClusters();
404 fTPCchi2=t->GetChi2();
406 {//prevrow must be declared in separate namespace, otherwise compiler cries:
407 //"jump to case label crosses initialization of `Int_t prevrow'"
409 // for (Int_t i=0;i<fTPCncls;i++)
410 for (Int_t i=0;i<kMaxTPCcluster;i++)
412 fTPCindex[i]=t->GetClusterIndex(i);
414 if (fTPCindex[i]<0) continue;
416 // Piotr's Cluster Map for HBT
417 // ### please change accordingly if cluster array is changing
418 // to "New TPC Tracking" style (with gaps in array)
419 Int_t idx = fTPCindex[i];
420 Int_t sect = (idx&0xff000000)>>24;
421 Int_t row = (idx&0x00ff0000)>>16;
422 if (sect > 18) row +=63; //if it is outer sector, add number of inner sectors
424 fTPCClusterMap.SetBitNumber(row,kTRUE);
426 //Fill the gap between previous row and this row with 0 bits
427 //In case ### pleas change it as well - just set bit 0 in case there
428 //is no associated clusters for current "i"
431 prevrow = row;//if previous bit was not assigned yet == this is the first one
434 { //we don't know the order (inner to outer or reverse)
435 //just to be save in case it is going to change
448 for (Int_t j = n+1; j < m; j++)
450 fTPCClusterMap.SetBitNumber(j,kFALSE);
454 // End Of Piotr's Cluster Map for HBT
457 fTPCsignal=t->GetPIDsignal();
460 case kTRDout: case kTRDin: case kTRDrefit:
461 fTRDLabel = t->GetLabel();
462 fTRDncls=t->GetNumberOfClusters();
463 fTRDchi2=t->GetChi2();
464 for (Int_t i=0;i<fTRDncls;i++) fTRDindex[i]=t->GetClusterIndex(i);
465 fTRDsignal=t->GetPIDsignal();
468 if (!fOp) fOp=new AliExternalTrackParam(*t);
470 fTRDncls0 = t->GetNumberOfClusters();
479 AliError("Wrong flag !");
486 //_______________________________________________________________________
487 void AliESDtrack::GetExternalParameters(Double_t &x, Double_t p[5]) const {
488 //---------------------------------------------------------------------
489 // This function returns external representation of the track parameters
490 //---------------------------------------------------------------------
492 for (Int_t i=0; i<5; i++) p[i]=GetParameter()[i];
495 //_______________________________________________________________________
496 void AliESDtrack::GetExternalCovariance(Double_t cov[15]) const {
497 //---------------------------------------------------------------------
498 // This function returns external representation of the cov. matrix
499 //---------------------------------------------------------------------
500 for (Int_t i=0; i<15; i++) cov[i]=AliExternalTrackParam::GetCovariance()[i];
503 //_______________________________________________________________________
504 Bool_t AliESDtrack::GetConstrainedExternalParameters
505 (Double_t &alpha, Double_t &x, Double_t p[5]) const {
506 //---------------------------------------------------------------------
507 // This function returns the constrained external track parameters
508 //---------------------------------------------------------------------
509 if (!fCp) return kFALSE;
510 alpha=fCp->GetAlpha();
512 for (Int_t i=0; i<5; i++) p[i]=fCp->GetParameter()[i];
516 //_______________________________________________________________________
518 AliESDtrack::GetConstrainedExternalCovariance(Double_t c[15]) const {
519 //---------------------------------------------------------------------
520 // This function returns the constrained external cov. matrix
521 //---------------------------------------------------------------------
522 if (!fCp) return kFALSE;
523 for (Int_t i=0; i<15; i++) c[i]=fCp->GetCovariance()[i];
528 AliESDtrack::GetInnerExternalParameters
529 (Double_t &alpha, Double_t &x, Double_t p[5]) const {
530 //---------------------------------------------------------------------
531 // This function returns external representation of the track parameters
532 // at the inner layer of TPC
533 //---------------------------------------------------------------------
534 if (!fIp) return kFALSE;
535 alpha=fIp->GetAlpha();
537 for (Int_t i=0; i<5; i++) p[i]=fIp->GetParameter()[i];
542 AliESDtrack::GetInnerExternalCovariance(Double_t cov[15]) const {
543 //---------------------------------------------------------------------
544 // This function returns external representation of the cov. matrix
545 // at the inner layer of TPC
546 //---------------------------------------------------------------------
547 if (!fIp) return kFALSE;
548 for (Int_t i=0; i<15; i++) cov[i]=fIp->GetCovariance()[i];
553 AliESDtrack::GetOuterExternalParameters
554 (Double_t &alpha, Double_t &x, Double_t p[5]) const {
555 //---------------------------------------------------------------------
556 // This function returns external representation of the track parameters
557 // at the inner layer of TRD
558 //---------------------------------------------------------------------
559 if (!fOp) return kFALSE;
560 alpha=fOp->GetAlpha();
562 for (Int_t i=0; i<5; i++) p[i]=fOp->GetParameter()[i];
567 AliESDtrack::GetOuterExternalCovariance(Double_t cov[15]) const {
568 //---------------------------------------------------------------------
569 // This function returns external representation of the cov. matrix
570 // at the inner layer of TRD
571 //---------------------------------------------------------------------
572 if (!fOp) return kFALSE;
573 for (Int_t i=0; i<15; i++) cov[i]=fOp->GetCovariance()[i];
577 Int_t AliESDtrack::GetNcls(Int_t idet) const
579 // Get number of clusters by subdetector index
602 Int_t AliESDtrack::GetClusters(Int_t idet, Int_t *idx) const
604 // Get cluster index array by subdetector index
609 ncls = GetITSclusters(idx);
612 ncls = GetTPCclusters(idx);
615 ncls = GetTRDclusters(idx);
618 if (fTOFindex != 0) {
619 idx[0] = GetTOFcluster();
629 //_______________________________________________________________________
630 void AliESDtrack::GetIntegratedTimes(Double_t *times) const {
631 // Returns the array with integrated times for each particle hypothesis
632 for (Int_t i=0; i<AliPID::kSPECIES; i++) times[i]=fTrackTime[i];
635 //_______________________________________________________________________
636 void AliESDtrack::SetIntegratedTimes(const Double_t *times) {
637 // Sets the array with integrated times for each particle hypotesis
638 for (Int_t i=0; i<AliPID::kSPECIES; i++) fTrackTime[i]=times[i];
641 //_______________________________________________________________________
642 void AliESDtrack::SetITSpid(const Double_t *p) {
643 // Sets values for the probability of each particle type (in ITS)
644 SetPIDValues(fITSr,p,AliPID::kSPECIES);
645 SetStatus(AliESDtrack::kITSpid);
648 void AliESDtrack::SetITSChi2MIP(const Float_t *chi2mip){
649 for (Int_t i=0; i<kMaxITScluster; i++) fITSchi2MIP[i]=chi2mip[i];
651 //_______________________________________________________________________
652 void AliESDtrack::GetITSpid(Double_t *p) const {
653 // Gets the probability of each particle type (in ITS)
654 for (Int_t i=0; i<AliPID::kSPECIES; i++) p[i]=fITSr[i];
657 //_______________________________________________________________________
658 Int_t AliESDtrack::GetITSclusters(Int_t *idx) const {
659 //---------------------------------------------------------------------
660 // This function returns indices of the assgined ITS clusters
661 //---------------------------------------------------------------------
662 for (Int_t i=0; i<kMaxITScluster; i++) idx[i]=fITSindex[i];
666 //_______________________________________________________________________
667 Int_t AliESDtrack::GetTPCclusters(Int_t *idx) const {
668 //---------------------------------------------------------------------
669 // This function returns indices of the assgined ITS clusters
670 //---------------------------------------------------------------------
672 for (Int_t i=0; i<kMaxTPCcluster; i++) idx[i]=fTPCindex[i]; // MI I prefer some constant
676 Float_t AliESDtrack::GetTPCdensity(Int_t row0, Int_t row1) const{
678 // GetDensity of the clusters on given region between row0 and row1
679 // Dead zone effect takin into acoount
684 for (Int_t i=row0;i<=row1;i++){
685 Int_t index = fTPCindex[i];
686 if (index!=-1) good++; // track outside of dead zone
687 if (index>0) found++;
690 if (good>(row1-row0)*0.5) density = Float_t(found)/Float_t(good);
694 //_______________________________________________________________________
695 void AliESDtrack::SetTPCpid(const Double_t *p) {
696 // Sets values for the probability of each particle type (in TPC)
697 SetPIDValues(fTPCr,p,AliPID::kSPECIES);
698 SetStatus(AliESDtrack::kTPCpid);
701 //_______________________________________________________________________
702 void AliESDtrack::GetTPCpid(Double_t *p) const {
703 // Gets the probability of each particle type (in TPC)
704 for (Int_t i=0; i<AliPID::kSPECIES; i++) p[i]=fTPCr[i];
707 //_______________________________________________________________________
708 Int_t AliESDtrack::GetTRDclusters(Int_t *idx) const {
709 //---------------------------------------------------------------------
710 // This function returns indices of the assgined TRD clusters
711 //---------------------------------------------------------------------
713 for (Int_t i=0; i<kMaxTRDcluster; i++) idx[i]=fTRDindex[i]; // MI I prefer some constant
717 //_______________________________________________________________________
718 void AliESDtrack::SetTRDpid(const Double_t *p) {
719 // Sets values for the probability of each particle type (in TRD)
720 SetPIDValues(fTRDr,p,AliPID::kSPECIES);
721 SetStatus(AliESDtrack::kTRDpid);
724 //_______________________________________________________________________
725 void AliESDtrack::GetTRDpid(Double_t *p) const {
726 // Gets the probability of each particle type (in TRD)
727 for (Int_t i=0; i<AliPID::kSPECIES; i++) p[i]=fTRDr[i];
730 //_______________________________________________________________________
731 void AliESDtrack::SetTRDpid(Int_t iSpecies, Float_t p)
733 // Sets the probability of particle type iSpecies to p (in TRD)
737 Float_t AliESDtrack::GetTRDpid(Int_t iSpecies) const
739 // Returns the probability of particle type iSpecies (in TRD)
740 return fTRDr[iSpecies];
743 //_______________________________________________________________________
744 void AliESDtrack::SetTOFpid(const Double_t *p) {
745 // Sets the probability of each particle type (in TOF)
746 SetPIDValues(fTOFr,p,AliPID::kSPECIES);
747 SetStatus(AliESDtrack::kTOFpid);
750 //_______________________________________________________________________
751 void AliESDtrack::SetTOFLabel(const Int_t *p) {
753 for (Int_t i=0; i<3; i++) fTOFLabel[i]=p[i];
756 //_______________________________________________________________________
757 void AliESDtrack::GetTOFpid(Double_t *p) const {
758 // Gets probabilities of each particle type (in TOF)
759 for (Int_t i=0; i<AliPID::kSPECIES; i++) p[i]=fTOFr[i];
762 //_______________________________________________________________________
763 void AliESDtrack::GetTOFLabel(Int_t *p) const {
765 for (Int_t i=0; i<3; i++) p[i]=fTOFLabel[i];
768 //_______________________________________________________________________
769 void AliESDtrack::GetTOFInfo(Float_t *info) const {
771 for (Int_t i=0; i<10; i++) info[i]=fTOFInfo[i];
774 //_______________________________________________________________________
775 void AliESDtrack::SetTOFInfo(Float_t*info) {
777 for (Int_t i=0; i<10; i++) fTOFInfo[i]=info[i];
782 //_______________________________________________________________________
783 void AliESDtrack::SetRICHpid(const Double_t *p) {
784 // Sets the probability of each particle type (in RICH)
785 SetPIDValues(fRICHr,p,AliPID::kSPECIES);
786 SetStatus(AliESDtrack::kRICHpid);
789 //_______________________________________________________________________
790 void AliESDtrack::GetRICHpid(Double_t *p) const {
791 // Gets probabilities of each particle type (in RICH)
792 for (Int_t i=0; i<AliPID::kSPECIES; i++) p[i]=fRICHr[i];
797 //_______________________________________________________________________
798 void AliESDtrack::SetESDpid(const Double_t *p) {
799 // Sets the probability of each particle type for the ESD track
800 SetPIDValues(fR,p,AliPID::kSPECIES);
801 SetStatus(AliESDtrack::kESDpid);
804 //_______________________________________________________________________
805 void AliESDtrack::GetESDpid(Double_t *p) const {
806 // Gets probability of each particle type for the ESD track
807 for (Int_t i=0; i<AliPID::kSPECIES; i++) p[i]=fR[i];
810 //_______________________________________________________________________
811 Bool_t AliESDtrack::RelateToVertex
812 (const AliESDVertex *vtx, Double_t b, Double_t maxd) {
814 // Try to relate this track to the vertex "vtx",
815 // if the (rough) transverse impact parameter is not bigger then "maxd".
816 // Magnetic field is "b" (kG).
818 // a) The track gets extapolated to the DCA to the vertex.
819 // b) The impact parameters and their covariance matrix are calculated.
820 // c) An attempt to constrain this track to the vertex is done.
822 // In the case of success, the returned value is kTRUE
823 // (otherwise, it's kFALSE)
825 Double_t alpha=GetAlpha();
826 Double_t sn=TMath::Sin(alpha), cs=TMath::Cos(alpha);
827 Double_t x=GetX(), y=GetParameter()[0], snp=GetParameter()[2];
828 Double_t xv= vtx->GetXv()*cs + vtx->GetYv()*sn;
829 Double_t yv=-vtx->GetXv()*sn + vtx->GetYv()*cs, zv=vtx->GetZv();
832 //Estimate the impact parameter neglecting the track curvature
833 Double_t d=TMath::Abs(x*snp - y*TMath::Sqrt(1.- snp*snp));
834 if (d > maxd) return kFALSE;
836 //Propagate to the DCA
837 Double_t crv=0.299792458e-3*b*GetParameter()[4];
838 Double_t tgfv=-(crv*x - snp)/(crv*y + TMath::Sqrt(1.-snp*snp));
839 sn=tgfv/TMath::Sqrt(1.+ tgfv*tgfv); cs=TMath::Sqrt(1.- sn*sn);
842 yv=-xv*sn + yv*cs; xv=x;
844 if (!Propagate(alpha+TMath::ASin(sn),xv,b)) return kFALSE;
846 fD = GetParameter()[0] - yv;
847 fZ = GetParameter()[1] - zv;
849 Double_t cov[6]; vtx->GetCovMatrix(cov);
850 fCdd = GetCovariance()[0] + cov[2]; // neglecting non-diagonals
851 fCdz = GetCovariance()[1]; // in the vertex's
852 fCzz = GetCovariance()[2] + cov[5]; // covariance matrix
855 Double_t p[2]={yv,zv}, c[3]={cov[2],0.,cov[5]};
856 Double_t chi2=GetPredictedChi2(p,c);
858 if (chi2>77.) return kFALSE;
860 AliExternalTrackParam tmp(*this);
861 if (!tmp.Update(p,c)) return kFALSE;
864 if (!fCp) fCp=new AliExternalTrackParam();
865 new (fCp) AliExternalTrackParam(tmp);
871 //_______________________________________________________________________
872 void AliESDtrack::Print(Option_t *) const {
873 // Prints info on the track
875 printf("ESD track info\n") ;
876 Double_t p[AliPID::kSPECIESN] ;
879 printf("From ITS: ") ;
881 for(index = 0 ; index < AliPID::kSPECIES; index++)
882 printf("%f, ", p[index]) ;
883 printf("\n signal = %f\n", GetITSsignal()) ;
886 printf("From TPC: ") ;
888 for(index = 0 ; index < AliPID::kSPECIES; index++)
889 printf("%f, ", p[index]) ;
890 printf("\n signal = %f\n", GetTPCsignal()) ;
893 printf("From TRD: ") ;
895 for(index = 0 ; index < AliPID::kSPECIES; index++)
896 printf("%f, ", p[index]) ;
897 printf("\n signal = %f\n", GetTRDsignal()) ;
900 printf("From TOF: ") ;
902 for(index = 0 ; index < AliPID::kSPECIES; index++)
903 printf("%f, ", p[index]) ;
904 printf("\n signal = %f\n", GetTOFsignal()) ;
906 if( IsOn(kRICHpid) ){
907 printf("From RICH: ") ;
909 for(index = 0 ; index < AliPID::kSPECIES; index++)
910 printf("%f, ", p[index]) ;
911 printf("\n signal = %f\n", GetRICHsignal()) ;