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() :
60 // The default ESD constructor
62 for (Int_t i=0; i<kSPECIES; i++) {
70 for (Int_t i=0; i<5; fRp[i++]);
71 for (Int_t i=0; i<15; fRc[i++]);
72 for (Int_t i=0; i<6; fITSindex[i++]);
73 for (Int_t i=0; i<180; fTPCindex[i++]);
76 //_______________________________________________________________________
77 Float_t AliESDtrack::GetMass() const {
80 for (Int_t i=0; i<kSPECIES; i++) {
81 if (fR[i]>max) {k=i; max=fR[i];}
83 if (k==0) return 0.00051;
84 if (k==1) return 0.10566;
85 if (k==2||k==-1) return 0.13957;
86 if (k==3) return 0.49368;
87 if (k==4) return 0.93827;
88 Warning("GetMass()","Undefined mass !");
92 //_______________________________________________________________________
93 Bool_t AliESDtrack::UpdateTrackParams(AliKalmanTrack *t, ULong_t flags) {
95 // This function updates track's running parameters
102 fITSncls=t->GetNumberOfClusters();
103 fITSchi2=t->GetChi2();
104 for (Int_t i=0;i<fITSncls;i++) fITSindex[i]=t->GetClusterIndex(i);
105 fITSsignal=t->GetPIDsignal();
108 case kTPCin: case kTPCout: case kTPCrefit:
109 fTPCncls=t->GetNumberOfClusters();
110 fTPCchi2=t->GetChi2();
111 for (Int_t i=0;i<fTPCncls;i++) fTPCindex[i]=t->GetClusterIndex(i);
112 fTPCsignal=t->GetPIDsignal();
113 {Double_t mass=t->GetMass(); // preliminary mass setting
114 if (mass>0.5) fR[4]=1.; // used by
115 else if (mass<0.4) fR[2]=1.; // the ITS reconstruction
118 case kTRDin: case kTRDout: case kTRDrefit:
119 fTRDncls=t->GetNumberOfClusters();
120 fTRDchi2=t->GetChi2();
121 fTRDsignal=t->GetPIDsignal();
124 Error("UpdateTrackParams()","Wrong flag !\n");
129 fLabel=t->GetLabel();
131 if (t->IsStartedTimeIntegral()) {
133 Double_t times[10];t->GetIntegratedTimes(times); SetIntegratedTimes(times);
134 SetIntegratedLength(t->GetIntegratedLength());
137 fRalpha=t->GetAlpha();
138 t->GetExternalParameters(fRx,fRp);
139 t->GetExternalCovariance(fRc);
143 AliITStrackV2* itstrack = dynamic_cast<AliITStrackV2*>(t);
146 itstrack->PropagateTo(3.,0.0028,65.19);
147 itstrack->PropagateToVertex();
149 Double_t ralpha=t->GetAlpha();
150 Double_t rx; // X-coordinate of the track reference plane
151 Double_t rp[5]; // external track parameters
152 t->GetExternalParameters(rx,rp);
154 Double_t phi=TMath::ASin(rp[2]) + ralpha;
155 Double_t pt=1./TMath::Abs(rp[4]);
156 Double_t r=TMath::Sqrt(rx*rx + rp[0]*rp[0]);
158 fVertexX=r*TMath::Cos(phi);
159 fVertexY=r*TMath::Sin(phi);
162 fVertexPx = pt*TMath::Cos(phi);
163 fVertexPy = pt*TMath::Sin(phi);
164 fVertexPz = pt*rp[3];
172 //_______________________________________________________________________
173 void AliESDtrack::GetExternalParametersAt(Double_t x, Double_t p[5]) const {
174 //---------------------------------------------------------------------
175 // This function returns external representation of the track parameters
177 //---------------------------------------------------------------------
179 Double_t c=fRp[4]/AliKalmanTrack::GetConvConst();
180 Double_t f1=fRp[2], f2=f1 + c*dx;
181 Double_t r1=sqrt(1.- f1*f1), r2=sqrt(1.- f2*f2);
183 p[0]=fRp[0]+dx*(f1+f2)/(r1+r2);
184 p[1]=fRp[1]+dx*(f1+f2)/(f1*r2 + f2*r1)*fRp[3];
190 //_______________________________________________________________________
191 void AliESDtrack::GetExternalParameters(Double_t &x, Double_t p[5]) const {
192 //---------------------------------------------------------------------
193 // This function returns external representation of the track parameters
194 //---------------------------------------------------------------------
196 for (Int_t i=0; i<5; i++) p[i]=fRp[i];
199 Double_t AliESDtrack::GetP() const {
200 //---------------------------------------------------------------------
201 // This function returns the track momentum
202 //---------------------------------------------------------------------
203 Double_t lam=TMath::ATan(fRp[3]);
204 Double_t pt=1./TMath::Abs(fRp[4]);
205 return pt/TMath::Cos(lam);
208 void AliESDtrack::GetPxPyPz(Double_t *p) const {
209 //---------------------------------------------------------------------
210 // This function returns the global track momentum components
211 //---------------------------------------------------------------------
212 Double_t phi=TMath::ASin(fRp[2]) + fRalpha;
213 Double_t pt=1./TMath::Abs(fRp[4]);
214 p[0]=pt*TMath::Cos(phi); p[1]=pt*TMath::Sin(phi); p[2]=pt*fRp[3];
217 void AliESDtrack::GetXYZ(Double_t *xyz) const {
218 //---------------------------------------------------------------------
219 // This function returns the global track position
220 //---------------------------------------------------------------------
221 Double_t phi=TMath::ASin(fRp[2]) + fRalpha;
222 Double_t r=TMath::Sqrt(fRx*fRx + fRp[0]*fRp[0]);
223 xyz[0]=r*TMath::Cos(phi); xyz[1]=r*TMath::Sin(phi); xyz[2]=fRp[1];
226 //_______________________________________________________________________
227 void AliESDtrack::GetExternalCovariance(Double_t c[15]) const {
228 //---------------------------------------------------------------------
229 // This function returns external representation of the cov. matrix
230 //---------------------------------------------------------------------
231 for (Int_t i=0; i<15; i++) c[i]=fRc[i];
234 //_______________________________________________________________________
235 void AliESDtrack::GetIntegratedTimes(Double_t *times) const {
236 for (Int_t i=0; i<kSPECIES; i++) times[i]=fTrackTime[i];
239 //_______________________________________________________________________
240 void AliESDtrack::SetIntegratedTimes(const Double_t *times) {
241 for (Int_t i=0; i<kSPECIES; i++) fTrackTime[i]=times[i];
244 //_______________________________________________________________________
245 void AliESDtrack::SetITSpid(const Double_t *p) {
246 for (Int_t i=0; i<kSPECIES; i++) fITSr[i]=p[i];
247 SetStatus(AliESDtrack::kITSpid);
250 //_______________________________________________________________________
251 void AliESDtrack::GetITSpid(Double_t *p) const {
252 for (Int_t i=0; i<kSPECIES; i++) p[i]=fITSr[i];
255 //_______________________________________________________________________
256 Int_t AliESDtrack::GetITSclusters(UInt_t *idx) const {
257 //---------------------------------------------------------------------
258 // This function returns indices of the assgined ITS clusters
259 //---------------------------------------------------------------------
260 for (Int_t i=0; i<fITSncls; i++) idx[i]=fITSindex[i];
264 //_______________________________________________________________________
265 Int_t AliESDtrack::GetTPCclusters(Int_t *idx) const {
266 //---------------------------------------------------------------------
267 // This function returns indices of the assgined ITS clusters
268 //---------------------------------------------------------------------
269 for (Int_t i=0; i<180; i++) idx[i]=fTPCindex[i]; // MI I prefer some constant
273 //_______________________________________________________________________
274 void AliESDtrack::SetTPCpid(const Double_t *p) {
275 for (Int_t i=0; i<kSPECIES; i++) fTPCr[i]=p[i];
276 SetStatus(AliESDtrack::kTPCpid);
279 //_______________________________________________________________________
280 void AliESDtrack::GetTPCpid(Double_t *p) const {
281 for (Int_t i=0; i<kSPECIES; i++) p[i]=fTPCr[i];
284 //_______________________________________________________________________
285 void AliESDtrack::SetTRDpid(const Double_t *p) {
286 for (Int_t i=0; i<kSPECIES; i++) fTRDr[i]=p[i];
287 SetStatus(AliESDtrack::kTRDpid);
290 //_______________________________________________________________________
291 void AliESDtrack::GetTRDpid(Double_t *p) const {
292 for (Int_t i=0; i<kSPECIES; i++) p[i]=fTRDr[i];
295 //_______________________________________________________________________
296 void AliESDtrack::SetTRDpid(Int_t iSpecies, Float_t p)
301 Float_t AliESDtrack::GetTRDpid(Int_t iSpecies) const
303 return fTRDr[iSpecies];
306 //_______________________________________________________________________
307 void AliESDtrack::SetTOFpid(const Double_t *p) {
308 for (Int_t i=0; i<kSPECIES; i++) fTOFr[i]=p[i];
309 SetStatus(AliESDtrack::kTOFpid);
312 //_______________________________________________________________________
313 void AliESDtrack::GetTOFpid(Double_t *p) const {
314 for (Int_t i=0; i<kSPECIES; i++) p[i]=fTOFr[i];
317 //_______________________________________________________________________
318 void AliESDtrack::SetESDpid(const Double_t *p) {
319 for (Int_t i=0; i<kSPECIES; i++) fR[i]=p[i];
320 SetStatus(AliESDtrack::kESDpid);
323 //_______________________________________________________________________
324 void AliESDtrack::GetESDpid(Double_t *p) const {
325 for (Int_t i=0; i<kSPECIES; i++) p[i]=fR[i];
328 void AliESDtrack::GetVertexXYZ(Double_t& x,Double_t& y, Double_t&z) const
330 //returns track position in DCA to vertex
335 void AliESDtrack::GetVertexPxPyPz(Double_t& px,Double_t& py, Double_t& pz) const
337 //returns track momentum in DCA to vertex