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 **************************************************************************/
16 //-----------------------------------------------------------------
17 // Implementation of the ESD track class
18 // This is the class to deal with during the phisical analysis of data
20 // Origin: Iouri Belikov, CERN, Jouri.Belikov@cern.ch
21 //-----------------------------------------------------------------
25 #include "AliESDtrack.h"
26 #include "AliKalmanTrack.h"
30 //_______________________________________________________________________
31 AliESDtrack::AliESDtrack() :
37 // The default ESD constructor
39 for (Int_t i=0; i<kSPECIES; i++) fR[i]=0.;
42 //_______________________________________________________________________
43 Float_t AliESDtrack::GetMass() const {
46 for (Int_t i=0; i<kSPECIES; i++) {
47 if (fR[i]>max) {k=i; max=fR[i];}
49 if (k==0) return 0.00051;
50 if (k==1) return 0.10566;
51 if (k==2||k==-1) return 0.13957;
52 if (k==3) return 0.49368;
53 if (k==4) return 0.93827;
54 Warning("GetMass()","Undefined mass !");
58 //_______________________________________________________________________
59 Bool_t AliESDtrack::UpdateTrackParams(const AliKalmanTrack *t, ULong_t flags) {
61 // This function updates track's running parameters
64 case kITSin: case kITSout: case kITSrefit:
65 fITSncls=t->GetNumberOfClusters();
66 fITSchi2=t->GetChi2();
67 for (Int_t i=0;i<fITSncls;i++) fITSindex[i]=t->GetClusterIndex(i);
68 fITSsignal=t->GetPIDsignal();
70 case kTPCin: case kTPCout: case kTPCrefit:
71 fTPCncls=t->GetNumberOfClusters();
72 fTPCchi2=t->GetChi2();
73 for (Int_t i=0;i<fTPCncls;i++) fTPCindex[i]=t->GetClusterIndex(i);
74 fTPCsignal=t->GetPIDsignal();
75 {Double_t mass=t->GetMass(); // preliminary mass setting
76 if (mass>0.5) fR[4]=1.; // used by
77 else if (mass<0.4) fR[2]=1.; // the ITS reconstruction
81 Error("UpdateTrackParams()","Wrong flag !\n");
88 if (t->IsStartedTimeIntegral()) {
90 Double_t times[10];t->GetIntegratedTimes(times); SetIntegratedTimes(times);
91 SetIntegratedLength(t->GetIntegratedLength());
94 fRalpha=t->GetAlpha();
95 t->GetExternalParameters(fRx,fRp);
96 t->GetExternalCovariance(fRc);
100 //_______________________________________________________________________
101 void AliESDtrack::GetExternalParameters(Double_t &x, Double_t p[5]) const {
102 //---------------------------------------------------------------------
103 // This function returns external representation of the track parameters
104 //---------------------------------------------------------------------
106 for (Int_t i=0; i<5; i++) p[i]=fRp[i];
109 Double_t AliESDtrack::GetP() const {
110 //---------------------------------------------------------------------
111 // This function returns the track momentum
112 //---------------------------------------------------------------------
113 Double_t lam=TMath::ATan(fRp[3]);
114 Double_t pt=1./TMath::Abs(fRp[4]);
115 return pt/TMath::Cos(lam);
118 void AliESDtrack::GetPxPyPz(Double_t *p) const {
119 //---------------------------------------------------------------------
120 // This function returns the global track momentum components
121 //---------------------------------------------------------------------
122 Double_t phi=TMath::ASin(fRp[2]) + fRalpha;
123 Double_t pt=1./TMath::Abs(fRp[4]);
124 p[0]=pt*TMath::Cos(phi); p[1]=pt*TMath::Sin(phi); p[2]=pt*fRp[3];
127 void AliESDtrack::GetXYZ(Double_t *xyz) const {
128 //---------------------------------------------------------------------
129 // This function returns the global track position
130 //---------------------------------------------------------------------
131 Double_t phi=TMath::ASin(fRp[2]) + fRalpha;
132 Double_t r=TMath::Sqrt(fRx*fRx + fRp[0]*fRp[0]);
133 xyz[0]=r*TMath::Cos(phi); xyz[1]=r*TMath::Sin(phi); xyz[2]=fRp[1];
136 //_______________________________________________________________________
137 void AliESDtrack::GetExternalCovariance(Double_t c[15]) const {
138 //---------------------------------------------------------------------
139 // This function returns external representation of the cov. matrix
140 //---------------------------------------------------------------------
141 for (Int_t i=0; i<15; i++) c[i]=fRc[i];
144 //_______________________________________________________________________
145 void AliESDtrack::GetIntegratedTimes(Double_t *times) const {
146 for (Int_t i=0; i<kSPECIES; i++) times[i]=fTrackTime[i];
149 //_______________________________________________________________________
150 void AliESDtrack::SetIntegratedTimes(const Double_t *times) {
151 for (Int_t i=0; i<kSPECIES; i++) fTrackTime[i]=times[i];
154 //_______________________________________________________________________
155 Int_t AliESDtrack::GetITSclusters(UInt_t *idx) const {
156 //---------------------------------------------------------------------
157 // This function returns indices of the assgined ITS clusters
158 //---------------------------------------------------------------------
159 for (Int_t i=0; i<fITSncls; i++) idx[i]=fITSindex[i];
163 //_______________________________________________________________________
164 Int_t AliESDtrack::GetTPCclusters(UInt_t *idx) const {
165 //---------------------------------------------------------------------
166 // This function returns indices of the assgined ITS clusters
167 //---------------------------------------------------------------------
168 for (Int_t i=0; i<fTPCncls; i++) idx[i]=fTPCindex[i];
172 //_______________________________________________________________________
173 void AliESDtrack::SetTPCpid(const Double_t *p) {
174 for (Int_t i=0; i<kSPECIES; i++) fTPCr[i]=p[i];
175 SetStatus(AliESDtrack::kTPCpid);
178 //_______________________________________________________________________
179 void AliESDtrack::GetTPCpid(Double_t *p) const {
180 for (Int_t i=0; i<kSPECIES; i++) p[i]=fTPCr[i];
183 //_______________________________________________________________________
184 void AliESDtrack::SetESDpid(const Double_t *p) {
185 for (Int_t i=0; i<kSPECIES; i++) fR[i]=p[i];
186 SetStatus(AliESDtrack::kESDpid);
189 //_______________________________________________________________________
190 void AliESDtrack::GetESDpid(Double_t *p) const {
191 for (Int_t i=0; i<kSPECIES; i++) p[i]=fR[i];