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"
27 #include "../ITS/AliITStrackV2.h"
31 //_______________________________________________________________________
32 AliESDtrack::AliESDtrack() :
39 // The default ESD constructor
41 for (Int_t i=0; i<kSPECIES; i++) fR[i]=0.;
44 //_______________________________________________________________________
45 Float_t AliESDtrack::GetMass() const {
48 for (Int_t i=0; i<kSPECIES; i++) {
49 if (fR[i]>max) {k=i; max=fR[i];}
51 if (k==0) return 0.00051;
52 if (k==1) return 0.10566;
53 if (k==2||k==-1) return 0.13957;
54 if (k==3) return 0.49368;
55 if (k==4) return 0.93827;
56 Warning("GetMass()","Undefined mass !");
60 //_______________________________________________________________________
61 Bool_t AliESDtrack::UpdateTrackParams(AliKalmanTrack *t, ULong_t flags) {
63 // This function updates track's running parameters
70 fITSncls=t->GetNumberOfClusters();
71 fITSchi2=t->GetChi2();
72 for (Int_t i=0;i<fITSncls;i++) fITSindex[i]=t->GetClusterIndex(i);
73 fITSsignal=t->GetPIDsignal();
76 case kTPCin: case kTPCout: case kTPCrefit:
77 fTPCncls=t->GetNumberOfClusters();
78 fTPCchi2=t->GetChi2();
79 for (Int_t i=0;i<fTPCncls;i++) fTPCindex[i]=t->GetClusterIndex(i);
80 fTPCsignal=t->GetPIDsignal();
81 {Double_t mass=t->GetMass(); // preliminary mass setting
82 if (mass>0.5) fR[4]=1.; // used by
83 else if (mass<0.4) fR[2]=1.; // the ITS reconstruction
86 case kTRDin: case kTRDout: case kTRDrefit:
87 fTRDncls=t->GetNumberOfClusters();
88 fTRDchi2=t->GetChi2();
89 fTRDsignal=t->GetPIDsignal();
92 Error("UpdateTrackParams()","Wrong flag !\n");
99 if (t->IsStartedTimeIntegral()) {
101 Double_t times[10];t->GetIntegratedTimes(times); SetIntegratedTimes(times);
102 SetIntegratedLength(t->GetIntegratedLength());
105 fRalpha=t->GetAlpha();
106 t->GetExternalParameters(fRx,fRp);
107 t->GetExternalCovariance(fRc);
111 AliITStrackV2* itstrack = dynamic_cast<AliITStrackV2*>(t);
114 itstrack->PropagateTo(3.,0.0028,65.19);
115 itstrack->PropagateToVertex();
117 Double_t ralpha=t->GetAlpha();
118 Double_t rx; // X-coordinate of the track reference plane
119 Double_t rp[5]; // external track parameters
120 t->GetExternalParameters(rx,rp);
122 Double_t phi=TMath::ASin(rp[2]) + ralpha;
123 Double_t pt=1./TMath::Abs(rp[4]);
124 Double_t r=TMath::Sqrt(rx*rx + rp[0]*rp[0]);
126 fVertexX=r*TMath::Cos(phi);
127 fVertexY=r*TMath::Sin(phi);
130 fVertexPx = pt*TMath::Cos(phi);
131 fVertexPy = pt*TMath::Sin(phi);
132 fVertexPz = pt*rp[3];
140 //_______________________________________________________________________
141 void AliESDtrack::GetExternalParametersAt(Double_t x, Double_t p[5]) const {
142 //---------------------------------------------------------------------
143 // This function returns external representation of the track parameters
145 //---------------------------------------------------------------------
147 Double_t c=fRp[4]/AliKalmanTrack::GetConvConst();
148 Double_t f1=fRp[2], f2=f1 + c*dx;
149 Double_t r1=sqrt(1.- f1*f1), r2=sqrt(1.- f2*f2);
151 p[0]=fRp[0]+dx*(f1+f2)/(r1+r2);
152 p[1]=fRp[1]+dx*(f1+f2)/(f1*r2 + f2*r1)*fRp[3];
158 //_______________________________________________________________________
159 void AliESDtrack::GetExternalParameters(Double_t &x, Double_t p[5]) const {
160 //---------------------------------------------------------------------
161 // This function returns external representation of the track parameters
162 //---------------------------------------------------------------------
164 for (Int_t i=0; i<5; i++) p[i]=fRp[i];
167 Double_t AliESDtrack::GetP() const {
168 //---------------------------------------------------------------------
169 // This function returns the track momentum
170 //---------------------------------------------------------------------
171 Double_t lam=TMath::ATan(fRp[3]);
172 Double_t pt=1./TMath::Abs(fRp[4]);
173 return pt/TMath::Cos(lam);
176 void AliESDtrack::GetPxPyPz(Double_t *p) const {
177 //---------------------------------------------------------------------
178 // This function returns the global track momentum components
179 //---------------------------------------------------------------------
180 Double_t phi=TMath::ASin(fRp[2]) + fRalpha;
181 Double_t pt=1./TMath::Abs(fRp[4]);
182 p[0]=pt*TMath::Cos(phi); p[1]=pt*TMath::Sin(phi); p[2]=pt*fRp[3];
185 void AliESDtrack::GetXYZ(Double_t *xyz) const {
186 //---------------------------------------------------------------------
187 // This function returns the global track position
188 //---------------------------------------------------------------------
189 Double_t phi=TMath::ASin(fRp[2]) + fRalpha;
190 Double_t r=TMath::Sqrt(fRx*fRx + fRp[0]*fRp[0]);
191 xyz[0]=r*TMath::Cos(phi); xyz[1]=r*TMath::Sin(phi); xyz[2]=fRp[1];
194 //_______________________________________________________________________
195 void AliESDtrack::GetExternalCovariance(Double_t c[15]) const {
196 //---------------------------------------------------------------------
197 // This function returns external representation of the cov. matrix
198 //---------------------------------------------------------------------
199 for (Int_t i=0; i<15; i++) c[i]=fRc[i];
202 //_______________________________________________________________________
203 void AliESDtrack::GetIntegratedTimes(Double_t *times) const {
204 for (Int_t i=0; i<kSPECIES; i++) times[i]=fTrackTime[i];
207 //_______________________________________________________________________
208 void AliESDtrack::SetIntegratedTimes(const Double_t *times) {
209 for (Int_t i=0; i<kSPECIES; i++) fTrackTime[i]=times[i];
212 //_______________________________________________________________________
213 void AliESDtrack::SetITSpid(const Double_t *p) {
214 for (Int_t i=0; i<kSPECIES; i++) fITSr[i]=p[i];
215 SetStatus(AliESDtrack::kITSpid);
218 //_______________________________________________________________________
219 void AliESDtrack::GetITSpid(Double_t *p) const {
220 for (Int_t i=0; i<kSPECIES; i++) p[i]=fITSr[i];
223 //_______________________________________________________________________
224 Int_t AliESDtrack::GetITSclusters(UInt_t *idx) const {
225 //---------------------------------------------------------------------
226 // This function returns indices of the assgined ITS clusters
227 //---------------------------------------------------------------------
228 for (Int_t i=0; i<fITSncls; i++) idx[i]=fITSindex[i];
232 //_______________________________________________________________________
233 Int_t AliESDtrack::GetTPCclusters(UInt_t *idx) const {
234 //---------------------------------------------------------------------
235 // This function returns indices of the assgined ITS clusters
236 //---------------------------------------------------------------------
237 for (Int_t i=0; i<fTPCncls; i++) idx[i]=fTPCindex[i];
241 //_______________________________________________________________________
242 void AliESDtrack::SetTPCpid(const Double_t *p) {
243 for (Int_t i=0; i<kSPECIES; i++) fTPCr[i]=p[i];
244 SetStatus(AliESDtrack::kTPCpid);
247 //_______________________________________________________________________
248 void AliESDtrack::GetTPCpid(Double_t *p) const {
249 for (Int_t i=0; i<kSPECIES; i++) p[i]=fTPCr[i];
252 //_______________________________________________________________________
253 void AliESDtrack::SetTRDpid(const Double_t *p) {
254 for (Int_t i=0; i<kSPECIES; i++) fTRDr[i]=p[i];
255 SetStatus(AliESDtrack::kTRDpid);
258 //_______________________________________________________________________
259 void AliESDtrack::GetTRDpid(Double_t *p) const {
260 for (Int_t i=0; i<kSPECIES; i++) p[i]=fTRDr[i];
263 //_______________________________________________________________________
264 void AliESDtrack::SetTRDpid(Int_t iSpecies, Float_t p)
269 Float_t AliESDtrack::GetTRDpid(Int_t iSpecies) const
271 return fTRDr[iSpecies];
274 //_______________________________________________________________________
275 void AliESDtrack::SetTOFpid(const Double_t *p) {
276 for (Int_t i=0; i<kSPECIES; i++) fTOFr[i]=p[i];
277 SetStatus(AliESDtrack::kTOFpid);
280 //_______________________________________________________________________
281 void AliESDtrack::GetTOFpid(Double_t *p) const {
282 for (Int_t i=0; i<kSPECIES; i++) p[i]=fTOFr[i];
285 //_______________________________________________________________________
286 void AliESDtrack::SetESDpid(const Double_t *p) {
287 for (Int_t i=0; i<kSPECIES; i++) fR[i]=p[i];
288 SetStatus(AliESDtrack::kESDpid);
291 //_______________________________________________________________________
292 void AliESDtrack::GetESDpid(Double_t *p) const {
293 for (Int_t i=0; i<kSPECIES; i++) p[i]=fR[i];
296 void AliESDtrack::GetVertexXYZ(Double_t& x,Double_t& y, Double_t&z) const
298 //returns track position in DCA to vertex
303 void AliESDtrack::GetVertexPxPyPz(Double_t& px,Double_t& py, Double_t& pz) const
305 //returns track momentum in DCA to vertex