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
111 // The default ESD constructor
113 for (Int_t i=0; i<AliPID::kSPECIES; i++) {
123 // for (Int_t i=0; i<AliPID::kSPECIESN; i++) {
126 // fPHOSpos[0]=fPHOSpos[1]=fPHOSpos[2]=0.;
129 for (i=0;i<12;i++) fITSchi2MIP[i] =1e10;
130 for (i=0; i<6; i++) { fITSindex[i]=0; }
131 for (i=0; i<180; i++){ fTPCindex[i]=0; }
132 for (i=0; i<3;i++) { fKinkIndexes[i]=0;}
133 for (i=0; i<3;i++) { fV0Indexes[i]=-1;}
134 for (i=0; i<180; i++) { fTRDindex[i]=0; }
135 for (i=0;i<kNPlane;i++) {fTRDsignals[i]=0.; fTRDTimBin[i]=-1;}
136 for (i=0;i<4;i++) {fTPCPoints[i]=-1;}
137 for (i=0;i<3;i++) {fTOFLabel[i]=-1;}
138 for (i=0;i<10;i++) {fTOFInfo[i]=-1;}
148 //_______________________________________________________________________
149 AliESDtrack::AliESDtrack(const AliESDtrack& track):
150 AliExternalTrackParam(track),
151 fFlags(track.fFlags),
152 fLabel(track.fLabel),
154 fTrackLength(track.fTrackLength),
155 fD(track.fD),fZ(track.fZ),
156 fCdd(track.fCdd),fCdz(track.fCdz),fCzz(track.fCzz),
157 fStopVertex(track.fStopVertex),
159 fCchi2(track.fCchi2),
162 fITSchi2(track.fITSchi2),
163 fITSncls(track.fITSncls),
164 fITSsignal(track.fITSsignal),
165 fITSLabel(track.fITSLabel),
166 fITSFakeRatio(track.fITSFakeRatio),
167 fITStrack(0), //coping separatelly - in user code
168 fTPCchi2(track.fTPCchi2),
169 fTPCncls(track.fTPCncls),
170 fTPCnclsF(track.fTPCnclsF),
171 fTPCClusterMap(track.fTPCClusterMap),
172 fTPCsignal(track.fTPCsignal),
173 fTPCsignalN(track.fTPCsignalN),
174 fTPCsignalS(track.fTPCsignalS),
175 fTPCLabel(track.fTPCLabel),
176 fTRDchi2(track.fTRDchi2),
177 fTRDncls(track.fTRDncls),
178 fTRDncls0(track.fTRDncls0),
179 fTRDsignal(track.fTRDsignal),
180 fTRDLabel(track.fTRDLabel),
181 fTRDQuality(track.fTRDQuality),
182 fTRDBudget(track.fTRDBudget),
184 fTOFchi2(track.fTOFchi2),
185 fTOFindex(track.fTOFindex),
186 fTOFsignal(track.fTOFsignal),
187 //fPHOSsignal(track.fPHOSsignal),
188 fRICHchi2(track.fRICHchi2),
189 fRICHncls(track.fRICHncls),
190 fRICHindex(track.fRICHindex),
191 fRICHsignal(track.fRICHsignal),
192 fRICHtheta(track.fRICHtheta),
193 fRICHphi(track.fRICHphi),
194 fRICHdx(track.fRICHdx),
195 fRICHdy(track.fRICHdy)
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<180;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<AliPID::kSPECIES;i++) fRICHr[i]=track.fRICHr[i];
229 if (track.fCp) fCp=new AliExternalTrackParam(*track.fCp);
230 if (track.fIp) fIp=new AliExternalTrackParam(*track.fIp);
231 if (track.fOp) fOp=new AliExternalTrackParam(*track.fOp);
234 fPoints = new AliTrackPointArray(*(track.fPoints));
237 //_______________________________________________________________________
238 AliESDtrack::~AliESDtrack(){
240 // This is destructor according Coding Conventrions
242 //printf("Delete track\n");
251 //_______________________________________________________________________
252 void AliESDtrack::MakeMiniESDtrack(){
253 // Resets everything except
254 // fFlags: Reconstruction status flags
255 // fLabel: Track label
256 // fID: Unique ID of the track
257 // fD: Impact parameter in XY-plane
258 // fZ: Impact parameter in Z
259 // fR[AliPID::kSPECIES]: combined "detector response probability"
260 // Running track parameters
261 // fRalpha: track rotation angle
262 // fRx: X-coordinate of the track reference plane
263 // fRp[5]: external track parameters
264 // fRc[15]: external cov. matrix of the track parameters
267 for (Int_t i=0;i<AliPID::kSPECIES;i++) fTrackTime[i] = 0;
270 // Reset track parameters constrained to the primary vertex
274 // Reset track parameters at the inner wall of TPC
277 // Reset track parameters at the inner wall of the TRD
280 // Reset ITS track related information
282 for (Int_t i=0;i<12;i++) fITSchi2MIP[i] = 0;
284 for (Int_t i=0;i<6;i++) fITSindex[i]= 0;
286 for (Int_t i=0;i<AliPID::kSPECIES;i++) fITSr[i]= 0;
291 // Reset TPC related track information
295 for (Int_t i=0;i<180;i++) fTPCindex[i] = 0;
300 for (Int_t i=0;i<AliPID::kSPECIES;i++) fTPCr[i]=0;
302 for (Int_t i=0;i<4;i++) fTPCPoints[i] = 0;
303 for (Int_t i=0; i<3;i++) fKinkIndexes[i] = 0;
304 for (Int_t i=0; i<3;i++) fV0Indexes[i] = 0;
306 // Reset TRD related track information
310 for (Int_t i=0;i<180;i++) fTRDindex[i] = 0;
312 for (Int_t i=0;i<kNPlane;i++) {
316 for (Int_t i=0;i<AliPID::kSPECIES;i++) fTRDr[i] = 0;
322 // Reset TOF related track information
326 for (Int_t i=0;i<AliPID::kSPECIES;i++) fTOFr[i] = 0;
327 for (Int_t i=0;i<3;i++) fTOFLabel[i] = 0;
328 for (Int_t i=0;i<10;i++) fTOFInfo[i] = 0;
330 // Reset PHOS related track information
331 //for (Int_t i=0;i<3;i++) fPHOSpos[i] = 0;
333 //for (Int_t i=0;i<AliPID::kSPECIESN;i++) fPHOSr[i] = 0;
335 // Reset RICH related track information
340 for (Int_t i=0;i<AliPID::kSPECIES;i++) fRICHr[i] = 0;
348 //_______________________________________________________________________
349 Double_t AliESDtrack::GetMass() const {
350 // Returns the mass of the most probable particle type
353 for (Int_t i=0; i<AliPID::kSPECIES; i++) {
354 if (fR[i]>max) {k=i; max=fR[i];}
356 if (k==0) { // dE/dx "crossing points" in the TPC
358 if ((p>0.38)&&(p<0.48))
359 if (fR[0]<fR[3]*10.) return AliPID::ParticleMass(AliPID::kKaon);
360 if ((p>0.75)&&(p<0.85))
361 if (fR[0]<fR[4]*10.) return AliPID::ParticleMass(AliPID::kProton);
364 if (k==1) return AliPID::ParticleMass(AliPID::kMuon);
365 if (k==2||k==-1) return AliPID::ParticleMass(AliPID::kPion);
366 if (k==3) return AliPID::ParticleMass(AliPID::kKaon);
367 if (k==4) return AliPID::ParticleMass(AliPID::kProton);
368 AliWarning("Undefined mass !");
369 return AliPID::ParticleMass(AliPID::kPion);
372 //_______________________________________________________________________
373 Bool_t AliESDtrack::UpdateTrackParams(const AliKalmanTrack *t, ULong_t flags){
375 // This function updates track's running parameters
380 fLabel=t->GetLabel();
382 if (t->IsStartedTimeIntegral()) {
384 Double_t times[10];t->GetIntegratedTimes(times); SetIntegratedTimes(times);
385 SetIntegratedLength(t->GetIntegratedLength());
392 case kITSin: case kITSout: case kITSrefit:
393 fITSncls=t->GetNumberOfClusters();
394 fITSchi2=t->GetChi2();
395 for (Int_t i=0;i<fITSncls;i++) fITSindex[i]=t->GetClusterIndex(i);
396 fITSsignal=t->GetPIDsignal();
397 fITSLabel = t->GetLabel();
398 fITSFakeRatio = t->GetFakeRatio();
401 case kTPCin: case kTPCrefit:
402 fTPCLabel = t->GetLabel();
403 if (!fIp) fIp=new AliExternalTrackParam(*t);
406 fTPCncls=t->GetNumberOfClusters();
407 fTPCchi2=t->GetChi2();
409 {//prevrow must be declared in separate namespace, otherwise compiler cries:
410 //"jump to case label crosses initialization of `Int_t prevrow'"
412 // for (Int_t i=0;i<fTPCncls;i++)
413 for (Int_t i=0;i<160;i++)
415 fTPCindex[i]=t->GetClusterIndex(i);
417 // Piotr's Cluster Map for HBT
418 // ### please change accordingly if cluster array is changing
419 // to "New TPC Tracking" style (with gaps in array)
420 Int_t idx = fTPCindex[i];
421 Int_t sect = (idx&0xff000000)>>24;
422 Int_t row = (idx&0x00ff0000)>>16;
423 if (sect > 18) row +=63; //if it is outer sector, add number of inner sectors
425 fTPCClusterMap.SetBitNumber(row,kTRUE);
427 //Fill the gap between previous row and this row with 0 bits
428 //In case ### pleas change it as well - just set bit 0 in case there
429 //is no associated clusters for current "i"
432 prevrow = row;//if previous bit was not assigned yet == this is the first one
435 { //we don't know the order (inner to outer or reverse)
436 //just to be save in case it is going to change
449 for (Int_t j = n+1; j < m; j++)
451 fTPCClusterMap.SetBitNumber(j,kFALSE);
455 // End Of Piotr's Cluster Map for HBT
458 fTPCsignal=t->GetPIDsignal();
461 case kTRDout: case kTRDin: case kTRDrefit:
462 fTRDLabel = t->GetLabel();
463 fTRDncls=t->GetNumberOfClusters();
464 fTRDchi2=t->GetChi2();
465 for (Int_t i=0;i<fTRDncls;i++) fTRDindex[i]=t->GetClusterIndex(i);
466 fTRDsignal=t->GetPIDsignal();
469 if (!fOp) fOp=new AliExternalTrackParam(*t);
471 fTRDncls0 = t->GetNumberOfClusters();
480 AliError("Wrong flag !");
487 //_______________________________________________________________________
488 void AliESDtrack::GetExternalParameters(Double_t &x, Double_t p[5]) const {
489 //---------------------------------------------------------------------
490 // This function returns external representation of the track parameters
491 //---------------------------------------------------------------------
493 for (Int_t i=0; i<5; i++) p[i]=GetParameter()[i];
496 //_______________________________________________________________________
497 void AliESDtrack::GetExternalCovariance(Double_t cov[15]) const {
498 //---------------------------------------------------------------------
499 // This function returns external representation of the cov. matrix
500 //---------------------------------------------------------------------
501 for (Int_t i=0; i<15; i++) cov[i]=AliExternalTrackParam::GetCovariance()[i];
504 //_______________________________________________________________________
505 Bool_t AliESDtrack::GetConstrainedExternalParameters
506 (Double_t &alpha, Double_t &x, Double_t p[5]) const {
507 //---------------------------------------------------------------------
508 // This function returns the constrained external track parameters
509 //---------------------------------------------------------------------
510 if (!fCp) return kFALSE;
511 alpha=fCp->GetAlpha();
513 for (Int_t i=0; i<5; i++) p[i]=fCp->GetParameter()[i];
517 //_______________________________________________________________________
519 AliESDtrack::GetConstrainedExternalCovariance(Double_t c[15]) const {
520 //---------------------------------------------------------------------
521 // This function returns the constrained external cov. matrix
522 //---------------------------------------------------------------------
523 if (!fCp) return kFALSE;
524 for (Int_t i=0; i<15; i++) c[i]=fCp->GetCovariance()[i];
529 AliESDtrack::GetInnerExternalParameters
530 (Double_t &alpha, Double_t &x, Double_t p[5]) const {
531 //---------------------------------------------------------------------
532 // This function returns external representation of the track parameters
533 // at the inner layer of TPC
534 //---------------------------------------------------------------------
535 if (!fIp) return kFALSE;
536 alpha=fIp->GetAlpha();
538 for (Int_t i=0; i<5; i++) p[i]=fIp->GetParameter()[i];
543 AliESDtrack::GetInnerExternalCovariance(Double_t cov[15]) const {
544 //---------------------------------------------------------------------
545 // This function returns external representation of the cov. matrix
546 // at the inner layer of TPC
547 //---------------------------------------------------------------------
548 if (!fIp) return kFALSE;
549 for (Int_t i=0; i<15; i++) cov[i]=fIp->GetCovariance()[i];
554 AliESDtrack::GetOuterExternalParameters
555 (Double_t &alpha, Double_t &x, Double_t p[5]) const {
556 //---------------------------------------------------------------------
557 // This function returns external representation of the track parameters
558 // at the inner layer of TRD
559 //---------------------------------------------------------------------
560 if (!fOp) return kFALSE;
561 alpha=fOp->GetAlpha();
563 for (Int_t i=0; i<5; i++) p[i]=fOp->GetParameter()[i];
568 AliESDtrack::GetOuterExternalCovariance(Double_t cov[15]) const {
569 //---------------------------------------------------------------------
570 // This function returns external representation of the cov. matrix
571 // at the inner layer of TRD
572 //---------------------------------------------------------------------
573 if (!fOp) return kFALSE;
574 for (Int_t i=0; i<15; i++) cov[i]=fOp->GetCovariance()[i];
578 Int_t AliESDtrack::GetNcls(Int_t idet) const
580 // Get number of clusters by subdetector index
603 Int_t AliESDtrack::GetClusters(Int_t idet, UInt_t *idx) const
605 // Get cluster index array by subdetector index
610 ncls = GetITSclusters(idx);
613 ncls = GetTPCclusters((Int_t *)idx);
616 ncls = GetTRDclusters(idx);
619 if (fTOFindex != 0) {
620 idx[0] = GetTOFcluster();
630 //_______________________________________________________________________
631 void AliESDtrack::GetIntegratedTimes(Double_t *times) const {
632 // Returns the array with integrated times for each particle hypothesis
633 for (Int_t i=0; i<AliPID::kSPECIES; i++) times[i]=fTrackTime[i];
636 //_______________________________________________________________________
637 void AliESDtrack::SetIntegratedTimes(const Double_t *times) {
638 // Sets the array with integrated times for each particle hypotesis
639 for (Int_t i=0; i<AliPID::kSPECIES; i++) fTrackTime[i]=times[i];
642 //_______________________________________________________________________
643 void AliESDtrack::SetITSpid(const Double_t *p) {
644 // Sets values for the probability of each particle type (in ITS)
645 SetPIDValues(fITSr,p,AliPID::kSPECIES);
646 SetStatus(AliESDtrack::kITSpid);
649 void AliESDtrack::SetITSChi2MIP(const Float_t *chi2mip){
650 for (Int_t i=0; i<12; i++) fITSchi2MIP[i]=chi2mip[i];
652 //_______________________________________________________________________
653 void AliESDtrack::GetITSpid(Double_t *p) const {
654 // Gets the probability of each particle type (in ITS)
655 for (Int_t i=0; i<AliPID::kSPECIES; i++) p[i]=fITSr[i];
658 //_______________________________________________________________________
659 Int_t AliESDtrack::GetITSclusters(UInt_t *idx) const {
660 //---------------------------------------------------------------------
661 // This function returns indices of the assgined ITS clusters
662 //---------------------------------------------------------------------
663 for (Int_t i=0; i<fITSncls; i++) idx[i]=fITSindex[i];
667 //_______________________________________________________________________
668 Int_t AliESDtrack::GetTPCclusters(Int_t *idx) const {
669 //---------------------------------------------------------------------
670 // This function returns indices of the assgined ITS clusters
671 //---------------------------------------------------------------------
673 for (Int_t i=0; i<180; i++) idx[i]=fTPCindex[i]; // MI I prefer some constant
677 Float_t AliESDtrack::GetTPCdensity(Int_t row0, Int_t row1) const{
679 // GetDensity of the clusters on given region between row0 and row1
680 // Dead zone effect takin into acoount
685 for (Int_t i=row0;i<=row1;i++){
686 Int_t index = fTPCindex[i];
687 if (index!=-1) good++; // track outside of dead zone
688 if (index>0) found++;
691 if (good>(row1-row0)*0.5) density = Float_t(found)/Float_t(good);
695 //_______________________________________________________________________
696 void AliESDtrack::SetTPCpid(const Double_t *p) {
697 // Sets values for the probability of each particle type (in TPC)
698 SetPIDValues(fTPCr,p,AliPID::kSPECIES);
699 SetStatus(AliESDtrack::kTPCpid);
702 //_______________________________________________________________________
703 void AliESDtrack::GetTPCpid(Double_t *p) const {
704 // Gets the probability of each particle type (in TPC)
705 for (Int_t i=0; i<AliPID::kSPECIES; i++) p[i]=fTPCr[i];
708 //_______________________________________________________________________
709 Int_t AliESDtrack::GetTRDclusters(UInt_t *idx) const {
710 //---------------------------------------------------------------------
711 // This function returns indices of the assgined TRD clusters
712 //---------------------------------------------------------------------
714 for (Int_t i=0; i<180; i++) idx[i]=fTRDindex[i]; // MI I prefer some constant
718 //_______________________________________________________________________
719 void AliESDtrack::SetTRDpid(const Double_t *p) {
720 // Sets values for the probability of each particle type (in TRD)
721 SetPIDValues(fTRDr,p,AliPID::kSPECIES);
722 SetStatus(AliESDtrack::kTRDpid);
725 //_______________________________________________________________________
726 void AliESDtrack::GetTRDpid(Double_t *p) const {
727 // Gets the probability of each particle type (in TRD)
728 for (Int_t i=0; i<AliPID::kSPECIES; i++) p[i]=fTRDr[i];
731 //_______________________________________________________________________
732 void AliESDtrack::SetTRDpid(Int_t iSpecies, Float_t p)
734 // Sets the probability of particle type iSpecies to p (in TRD)
738 Float_t AliESDtrack::GetTRDpid(Int_t iSpecies) const
740 // Returns the probability of particle type iSpecies (in TRD)
741 return fTRDr[iSpecies];
744 //_______________________________________________________________________
745 void AliESDtrack::SetTOFpid(const Double_t *p) {
746 // Sets the probability of each particle type (in TOF)
747 SetPIDValues(fTOFr,p,AliPID::kSPECIES);
748 SetStatus(AliESDtrack::kTOFpid);
751 //_______________________________________________________________________
752 void AliESDtrack::SetTOFLabel(const Int_t *p) {
754 for (Int_t i=0; i<3; i++) fTOFLabel[i]=p[i];
757 //_______________________________________________________________________
758 void AliESDtrack::GetTOFpid(Double_t *p) const {
759 // Gets probabilities of each particle type (in TOF)
760 for (Int_t i=0; i<AliPID::kSPECIES; i++) p[i]=fTOFr[i];
763 //_______________________________________________________________________
764 void AliESDtrack::GetTOFLabel(Int_t *p) const {
766 for (Int_t i=0; i<3; i++) p[i]=fTOFLabel[i];
769 //_______________________________________________________________________
770 void AliESDtrack::GetTOFInfo(Float_t *info) const {
772 for (Int_t i=0; i<10; i++) info[i]=fTOFInfo[i];
775 //_______________________________________________________________________
776 void AliESDtrack::SetTOFInfo(Float_t*info) {
778 for (Int_t i=0; i<10; i++) fTOFInfo[i]=info[i];
783 //_______________________________________________________________________
784 void AliESDtrack::SetRICHpid(const Double_t *p) {
785 // Sets the probability of each particle type (in RICH)
786 SetPIDValues(fRICHr,p,AliPID::kSPECIES);
787 SetStatus(AliESDtrack::kRICHpid);
790 //_______________________________________________________________________
791 void AliESDtrack::GetRICHpid(Double_t *p) const {
792 // Gets probabilities of each particle type (in RICH)
793 for (Int_t i=0; i<AliPID::kSPECIES; i++) p[i]=fRICHr[i];
798 //_______________________________________________________________________
799 void AliESDtrack::SetESDpid(const Double_t *p) {
800 // Sets the probability of each particle type for the ESD track
801 SetPIDValues(fR,p,AliPID::kSPECIES);
802 SetStatus(AliESDtrack::kESDpid);
805 //_______________________________________________________________________
806 void AliESDtrack::GetESDpid(Double_t *p) const {
807 // Gets probability of each particle type for the ESD track
808 for (Int_t i=0; i<AliPID::kSPECIES; i++) p[i]=fR[i];
811 //_______________________________________________________________________
812 Bool_t AliESDtrack::RelateToVertex
813 (const AliESDVertex *vtx, Double_t b, Double_t maxd) {
815 // Try to relate this track to the vertex "vtx",
816 // if the (rough) transverse impact parameter is not bigger then "maxd".
817 // Magnetic field is "b" (kG).
819 // a) The track gets extapolated to the DCA to the vertex.
820 // b) The impact parameters and their covariance matrix are calculated.
821 // c) An attempt to constrain this track to the vertex is done.
823 // In the case of success, the returned value is kTRUE
824 // (otherwise, it's kFALSE)
826 Double_t alpha=GetAlpha();
827 Double_t sn=TMath::Sin(alpha), cs=TMath::Cos(alpha);
828 Double_t x=GetX(), y=GetParameter()[0], snp=GetParameter()[2];
829 Double_t xv= vtx->GetXv()*cs + vtx->GetYv()*sn;
830 Double_t yv=-vtx->GetXv()*sn + vtx->GetYv()*cs, zv=vtx->GetZv();
833 //Estimate the impact parameter neglecting the track curvature
834 Double_t d=TMath::Abs(x*snp - y*TMath::Sqrt(1.- snp*snp));
835 if (d > maxd) return kFALSE;
837 //Propagate to the DCA
838 Double_t crv=0.299792458e-3*b*GetParameter()[4];
839 Double_t tgfv=-(crv*x - snp)/(crv*y + TMath::Sqrt(1.-snp*snp));
840 sn=tgfv/TMath::Sqrt(1.+ tgfv*tgfv); cs=TMath::Sqrt(1.+ sn*sn);
843 yv=-xv*sn + yv*cs; xv=x;
845 if (!Propagate(alpha+TMath::ASin(sn),xv,b)) return kFALSE;
847 fD = GetParameter()[0] - yv;
848 fZ = GetParameter()[1] - zv;
850 Double_t cov[6]; vtx->GetCovMatrix(cov);
851 fCdd = GetCovariance()[0] + cov[2]; // neglecting non-diagonals
852 fCdz = GetCovariance()[1]; // in the vertex's
853 fCzz = GetCovariance()[2] + cov[5]; // covariance matrix
856 Double_t p[2]={yv,zv}, c[3]={cov[2],0.,cov[5]};
857 Double_t chi2=GetPredictedChi2(p,c);
859 if (chi2>77.) return kFALSE;
861 AliExternalTrackParam tmp(*this);
862 if (!tmp.Update(p,c)) return kFALSE;
865 if (!fCp) fCp=new AliExternalTrackParam();
866 new (fCp) AliExternalTrackParam(tmp);
872 //_______________________________________________________________________
873 void AliESDtrack::Print(Option_t *) const {
874 // Prints info on the track
876 printf("ESD track info\n") ;
877 Double_t p[AliPID::kSPECIESN] ;
880 printf("From ITS: ") ;
882 for(index = 0 ; index < AliPID::kSPECIES; index++)
883 printf("%f, ", p[index]) ;
884 printf("\n signal = %f\n", GetITSsignal()) ;
887 printf("From TPC: ") ;
889 for(index = 0 ; index < AliPID::kSPECIES; index++)
890 printf("%f, ", p[index]) ;
891 printf("\n signal = %f\n", GetTPCsignal()) ;
894 printf("From TRD: ") ;
896 for(index = 0 ; index < AliPID::kSPECIES; index++)
897 printf("%f, ", p[index]) ;
898 printf("\n signal = %f\n", GetTRDsignal()) ;
901 printf("From TOF: ") ;
903 for(index = 0 ; index < AliPID::kSPECIES; index++)
904 printf("%f, ", p[index]) ;
905 printf("\n signal = %f\n", GetTOFsignal()) ;
907 if( IsOn(kRICHpid) ){
908 printf("From RICH: ") ;
910 for(index = 0 ; index < AliPID::kSPECIES; index++)
911 printf("%f, ", p[index]) ;
912 printf("\n signal = %f\n", GetRICHsignal()) ;
914 // Since 9 March 2006 PHOS left ESDtrack for ESDCaloCluster
915 // and cannot participate in the global PID for the moment
916 // if( IsOn(kPHOSpid) ){
917 // printf("From PHOS: ") ;
919 // for(index = 0 ; index < AliPID::kSPECIESN; index++)
920 // printf("%f, ", p[index]) ;
921 // printf("\n signal = %f\n", GetPHOSsignal()) ;