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() :
38 // The default ESD constructor
40 for (Int_t i=0; i<kSPECIES; i++) fR[i]=0.;
43 //_______________________________________________________________________
44 Float_t AliESDtrack::GetMass() const {
47 for (Int_t i=0; i<kSPECIES; i++) {
48 if (fR[i]>max) {k=i; max=fR[i];}
50 if (k==0) return 0.00051;
51 if (k==1) return 0.10566;
52 if (k==2||k==-1) return 0.13957;
53 if (k==3) return 0.49368;
54 if (k==4) return 0.93827;
55 Warning("GetMass()","Undefined mass !");
59 //_______________________________________________________________________
60 Bool_t AliESDtrack::UpdateTrackParams(AliKalmanTrack *t, ULong_t flags) {
62 // This function updates track's running parameters
69 fITSncls=t->GetNumberOfClusters();
70 fITSchi2=t->GetChi2();
71 for (Int_t i=0;i<fITSncls;i++) fITSindex[i]=t->GetClusterIndex(i);
72 fITSsignal=t->GetPIDsignal();
75 case kTPCin: case kTPCout: case kTPCrefit:
76 fTPCncls=t->GetNumberOfClusters();
77 fTPCchi2=t->GetChi2();
78 for (Int_t i=0;i<fTPCncls;i++) fTPCindex[i]=t->GetClusterIndex(i);
79 fTPCsignal=t->GetPIDsignal();
80 {Double_t mass=t->GetMass(); // preliminary mass setting
81 if (mass>0.5) fR[4]=1.; // used by
82 else if (mass<0.4) fR[2]=1.; // the ITS reconstruction
85 case kTRDin: case kTRDout: case kTRDrefit:
86 fTRDncls=t->GetNumberOfClusters();
87 fTRDchi2=t->GetChi2();
88 fTRDsignal=t->GetPIDsignal();
91 Error("UpdateTrackParams()","Wrong flag !\n");
98 if (t->IsStartedTimeIntegral()) {
100 Double_t times[10];t->GetIntegratedTimes(times); SetIntegratedTimes(times);
101 SetIntegratedLength(t->GetIntegratedLength());
104 fRalpha=t->GetAlpha();
105 t->GetExternalParameters(fRx,fRp);
106 t->GetExternalCovariance(fRc);
110 t->PropagateTo(3.,0.0028,65.19);
111 t->PropagateToPrimVertex(0.,0.);
113 Double_t ralpha=t->GetAlpha();
114 Double_t rx; // X-coordinate of the track reference plane
115 Double_t rp[5]; // external track parameters
116 t->GetExternalParameters(rx,rp);
118 Double_t phi=TMath::ASin(rp[2]) + ralpha;
119 Double_t pt=1./TMath::Abs(rp[4]);
120 Double_t r=TMath::Sqrt(rx*rx + rp[0]*rp[0]);
122 fVertexX=r*TMath::Cos(phi);
123 fVertexY=r*TMath::Sin(phi);
126 fVertexPx = pt*TMath::Cos(phi);
127 fVertexPy = pt*TMath::Sin(phi);
128 fVertexPz = pt*rp[3];
135 //_______________________________________________________________________
136 void AliESDtrack::GetExternalParametersAt(Double_t x, Double_t p[5]) const {
137 //---------------------------------------------------------------------
138 // This function returns external representation of the track parameters
140 //---------------------------------------------------------------------
142 Double_t c=fRp[4]/AliKalmanTrack::GetConvConst();
143 Double_t f1=fRp[2], f2=f1 + c*dx;
144 Double_t r1=sqrt(1.- f1*f1), r2=sqrt(1.- f2*f2);
146 p[0]=fRp[0]+dx*(f1+f2)/(r1+r2);
147 p[1]=fRp[1]+dx*(f1+f2)/(f1*r2 + f2*r1)*fRp[3];
153 //_______________________________________________________________________
154 void AliESDtrack::GetExternalParameters(Double_t &x, Double_t p[5]) const {
155 //---------------------------------------------------------------------
156 // This function returns external representation of the track parameters
157 //---------------------------------------------------------------------
159 for (Int_t i=0; i<5; i++) p[i]=fRp[i];
162 Double_t AliESDtrack::GetP() const {
163 //---------------------------------------------------------------------
164 // This function returns the track momentum
165 //---------------------------------------------------------------------
166 Double_t lam=TMath::ATan(fRp[3]);
167 Double_t pt=1./TMath::Abs(fRp[4]);
168 return pt/TMath::Cos(lam);
171 void AliESDtrack::GetPxPyPz(Double_t *p) const {
172 //---------------------------------------------------------------------
173 // This function returns the global track momentum components
174 //---------------------------------------------------------------------
175 Double_t phi=TMath::ASin(fRp[2]) + fRalpha;
176 Double_t pt=1./TMath::Abs(fRp[4]);
177 p[0]=pt*TMath::Cos(phi); p[1]=pt*TMath::Sin(phi); p[2]=pt*fRp[3];
180 void AliESDtrack::GetXYZ(Double_t *xyz) const {
181 //---------------------------------------------------------------------
182 // This function returns the global track position
183 //---------------------------------------------------------------------
184 Double_t phi=TMath::ASin(fRp[2]) + fRalpha;
185 Double_t r=TMath::Sqrt(fRx*fRx + fRp[0]*fRp[0]);
186 xyz[0]=r*TMath::Cos(phi); xyz[1]=r*TMath::Sin(phi); xyz[2]=fRp[1];
189 //_______________________________________________________________________
190 void AliESDtrack::GetExternalCovariance(Double_t c[15]) const {
191 //---------------------------------------------------------------------
192 // This function returns external representation of the cov. matrix
193 //---------------------------------------------------------------------
194 for (Int_t i=0; i<15; i++) c[i]=fRc[i];
197 //_______________________________________________________________________
198 void AliESDtrack::GetIntegratedTimes(Double_t *times) const {
199 for (Int_t i=0; i<kSPECIES; i++) times[i]=fTrackTime[i];
202 //_______________________________________________________________________
203 void AliESDtrack::SetIntegratedTimes(const Double_t *times) {
204 for (Int_t i=0; i<kSPECIES; i++) fTrackTime[i]=times[i];
207 //_______________________________________________________________________
208 void AliESDtrack::SetITSpid(const Double_t *p) {
209 for (Int_t i=0; i<kSPECIES; i++) fITSr[i]=p[i];
210 SetStatus(AliESDtrack::kITSpid);
213 //_______________________________________________________________________
214 void AliESDtrack::GetITSpid(Double_t *p) const {
215 for (Int_t i=0; i<kSPECIES; i++) p[i]=fITSr[i];
218 //_______________________________________________________________________
219 Int_t AliESDtrack::GetITSclusters(UInt_t *idx) const {
220 //---------------------------------------------------------------------
221 // This function returns indices of the assgined ITS clusters
222 //---------------------------------------------------------------------
223 for (Int_t i=0; i<fITSncls; i++) idx[i]=fITSindex[i];
227 //_______________________________________________________________________
228 Int_t AliESDtrack::GetTPCclusters(UInt_t *idx) const {
229 //---------------------------------------------------------------------
230 // This function returns indices of the assgined ITS clusters
231 //---------------------------------------------------------------------
232 for (Int_t i=0; i<fTPCncls; i++) idx[i]=fTPCindex[i];
236 //_______________________________________________________________________
237 void AliESDtrack::SetTPCpid(const Double_t *p) {
238 for (Int_t i=0; i<kSPECIES; i++) fTPCr[i]=p[i];
239 SetStatus(AliESDtrack::kTPCpid);
242 //_______________________________________________________________________
243 void AliESDtrack::GetTPCpid(Double_t *p) const {
244 for (Int_t i=0; i<kSPECIES; i++) p[i]=fTPCr[i];
247 //_______________________________________________________________________
248 void AliESDtrack::SetTRDpid(const Double_t *p) {
249 for (Int_t i=0; i<kSPECIES; i++) fTRDr[i]=p[i];
250 SetStatus(AliESDtrack::kTRDpid);
253 //_______________________________________________________________________
254 void AliESDtrack::GetTRDpid(Double_t *p) const {
255 for (Int_t i=0; i<kSPECIES; i++) p[i]=fTRDr[i];
258 //_______________________________________________________________________
259 void AliESDtrack::SetTRDpid(Int_t iSpecies, Float_t p)
264 Float_t AliESDtrack::GetTRDpid(Int_t iSpecies) const
266 return fTRDr[iSpecies];
269 //_______________________________________________________________________
270 void AliESDtrack::SetTOFpid(const Double_t *p) {
271 for (Int_t i=0; i<kSPECIES; i++) fTOFr[i]=p[i];
272 SetStatus(AliESDtrack::kTOFpid);
275 //_______________________________________________________________________
276 void AliESDtrack::GetTOFpid(Double_t *p) const {
277 for (Int_t i=0; i<kSPECIES; i++) p[i]=fTOFr[i];
280 //_______________________________________________________________________
281 void AliESDtrack::SetESDpid(const Double_t *p) {
282 for (Int_t i=0; i<kSPECIES; i++) fR[i]=p[i];
283 SetStatus(AliESDtrack::kESDpid);
286 //_______________________________________________________________________
287 void AliESDtrack::GetESDpid(Double_t *p) const {
288 for (Int_t i=0; i<kSPECIES; i++) p[i]=fR[i];
291 void AliESDtrack::GetVertexXYZ(Double_t& x,Double_t& y, Double_t&z) const
293 //returns track position in DCA to vertex
298 void AliESDtrack::GetVertexPxPyPz(Double_t& px,Double_t& py, Double_t& pz) const
300 //returns track momentum in DCA to vertex