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 // ESD = Event Summary Data
19 // This is the class to deal with during the phisical analysis of data
20 // Origin: Iouri Belikov, CERN
21 // e-mail: Jouri.Belikov@cern.ch
22 //-----------------------------------------------------------------
26 #include "AliESDtrack.h"
27 #include "AliKalmanTrack.h"
31 //_______________________________________________________________________
32 AliESDtrack::AliESDtrack() :
60 // The default ESD constructor
62 for (Int_t i=0; i<kSPECIES; i++) {
71 for (i=0; i<5; i++) fRp[i]=0.;
72 for (i=0; i<15; i++) fRc[i]=0.;
73 for (i=0; i<6; i++) fITSindex[i]=0;
74 for (i=0; i<180; i++) fTPCindex[i]=0;
77 //_______________________________________________________________________
78 Float_t AliESDtrack::GetMass() const {
79 // Returns the mass of the most probable particle type
82 for (Int_t i=0; i<kSPECIES; i++) {
83 if (fR[i]>max) {k=i; max=fR[i];}
85 if (k==0) return 0.00051;
86 if (k==1) return 0.10566;
87 if (k==2||k==-1) return 0.13957;
88 if (k==3) return 0.49368;
89 if (k==4) return 0.93827;
90 Warning("GetMass()","Undefined mass !");
94 //_______________________________________________________________________
95 Bool_t AliESDtrack::UpdateTrackParams(AliKalmanTrack *t, ULong_t flags) {
97 // This function updates track's running parameters
104 fITSncls=t->GetNumberOfClusters();
105 fITSchi2=t->GetChi2();
106 for (Int_t i=0;i<fITSncls;i++) fITSindex[i]=t->GetClusterIndex(i);
107 fITSsignal=t->GetPIDsignal();
110 case kTPCin: case kTPCout: case kTPCrefit:
111 fTPCncls=t->GetNumberOfClusters();
112 fTPCchi2=t->GetChi2();
113 for (Int_t i=0;i<fTPCncls;i++) fTPCindex[i]=t->GetClusterIndex(i);
114 fTPCsignal=t->GetPIDsignal();
115 {Double_t mass=t->GetMass(); // preliminary mass setting
116 if (mass>0.5) fR[4]=1.; // used by
117 else if (mass<0.4) fR[2]=1.; // the ITS reconstruction
120 case kTRDin: case kTRDout: case kTRDrefit:
121 fTRDncls=t->GetNumberOfClusters();
122 fTRDchi2=t->GetChi2();
123 for (Int_t i=0;i<fTRDncls;i++) fTRDindex[i]=t->GetClusterIndex(i);
124 fTRDsignal=t->GetPIDsignal();
127 Error("UpdateTrackParams()","Wrong flag !\n");
132 fLabel=t->GetLabel();
134 if (t->IsStartedTimeIntegral()) {
136 Double_t times[10];t->GetIntegratedTimes(times); SetIntegratedTimes(times);
137 SetIntegratedLength(t->GetIntegratedLength());
140 fRalpha=t->GetAlpha();
141 t->GetExternalParameters(fRx,fRp);
142 t->GetExternalCovariance(fRc);
146 AliKalmanTrack *itstrack = t;
149 itstrack->PropagateTo(3.,0.0028,65.19);
150 itstrack->PropagateToVertex();
152 Double_t ralpha=t->GetAlpha();
153 Double_t rx; // X-coordinate of the track reference plane
154 Double_t rp[5]; // external track parameters
155 t->GetExternalParameters(rx,rp);
157 Double_t phi=TMath::ASin(rp[2]) + ralpha;
158 Double_t pt=1./TMath::Abs(rp[4]);
159 Double_t r=TMath::Sqrt(rx*rx + rp[0]*rp[0]);
161 fVertexX=r*TMath::Cos(phi);
162 fVertexY=r*TMath::Sin(phi);
165 fVertexPx = pt*TMath::Cos(phi);
166 fVertexPy = pt*TMath::Sin(phi);
167 fVertexPz = pt*rp[3];
175 //_______________________________________________________________________
176 void AliESDtrack::GetExternalParameters(Double_t &x, Double_t p[5]) const {
177 //---------------------------------------------------------------------
178 // This function returns external representation of the track parameters
179 //---------------------------------------------------------------------
181 for (Int_t i=0; i<5; i++) p[i]=fRp[i];
184 Double_t AliESDtrack::GetP() const {
185 //---------------------------------------------------------------------
186 // This function returns the track momentum
187 //---------------------------------------------------------------------
188 Double_t lam=TMath::ATan(fRp[3]);
189 Double_t pt=1./TMath::Abs(fRp[4]);
190 return pt/TMath::Cos(lam);
193 void AliESDtrack::GetPxPyPz(Double_t *p) const {
194 //---------------------------------------------------------------------
195 // This function returns the global track momentum components
196 //---------------------------------------------------------------------
197 Double_t phi=TMath::ASin(fRp[2]) + fRalpha;
198 Double_t pt=1./TMath::Abs(fRp[4]);
199 p[0]=pt*TMath::Cos(phi); p[1]=pt*TMath::Sin(phi); p[2]=pt*fRp[3];
202 void AliESDtrack::GetXYZ(Double_t *xyz) const {
203 //---------------------------------------------------------------------
204 // This function returns the global track position
205 //---------------------------------------------------------------------
206 Double_t phi=TMath::ATan2(fRp[0],fRx) + fRalpha;
207 Double_t r=TMath::Sqrt(fRx*fRx + fRp[0]*fRp[0]);
208 xyz[0]=r*TMath::Cos(phi); xyz[1]=r*TMath::Sin(phi); xyz[2]=fRp[1];
211 //_______________________________________________________________________
212 void AliESDtrack::GetExternalCovariance(Double_t c[15]) const {
213 //---------------------------------------------------------------------
214 // This function returns external representation of the cov. matrix
215 //---------------------------------------------------------------------
216 for (Int_t i=0; i<15; i++) c[i]=fRc[i];
219 //_______________________________________________________________________
220 void AliESDtrack::GetIntegratedTimes(Double_t *times) const {
221 // Returns the array with integrated times for each particle hypothesis
222 for (Int_t i=0; i<kSPECIES; i++) times[i]=fTrackTime[i];
225 //_______________________________________________________________________
226 void AliESDtrack::SetIntegratedTimes(const Double_t *times) {
227 // Sets the array with integrated times for each particle hypotesis
228 for (Int_t i=0; i<kSPECIES; i++) fTrackTime[i]=times[i];
231 //_______________________________________________________________________
232 void AliESDtrack::SetITSpid(const Double_t *p) {
233 // Sets values for the probability of each particle type (in ITS)
234 for (Int_t i=0; i<kSPECIES; i++) fITSr[i]=p[i];
235 SetStatus(AliESDtrack::kITSpid);
238 //_______________________________________________________________________
239 void AliESDtrack::GetITSpid(Double_t *p) const {
240 // Gets the probability of each particle type (in ITS)
241 for (Int_t i=0; i<kSPECIES; i++) p[i]=fITSr[i];
244 //_______________________________________________________________________
245 Int_t AliESDtrack::GetITSclusters(UInt_t *idx) const {
246 //---------------------------------------------------------------------
247 // This function returns indices of the assgined ITS clusters
248 //---------------------------------------------------------------------
249 for (Int_t i=0; i<fITSncls; i++) idx[i]=fITSindex[i];
253 //_______________________________________________________________________
254 Int_t AliESDtrack::GetTPCclusters(Int_t *idx) const {
255 //---------------------------------------------------------------------
256 // This function returns indices of the assgined ITS clusters
257 //---------------------------------------------------------------------
258 for (Int_t i=0; i<180; i++) idx[i]=fTPCindex[i]; // MI I prefer some constant
262 //_______________________________________________________________________
263 void AliESDtrack::SetTPCpid(const Double_t *p) {
264 // Sets values for the probability of each particle type (in TPC)
265 for (Int_t i=0; i<kSPECIES; i++) fTPCr[i]=p[i];
266 SetStatus(AliESDtrack::kTPCpid);
269 //_______________________________________________________________________
270 void AliESDtrack::GetTPCpid(Double_t *p) const {
271 // Gets the probability of each particle type (in TPC)
272 for (Int_t i=0; i<kSPECIES; i++) p[i]=fTPCr[i];
275 //_______________________________________________________________________
276 Int_t AliESDtrack::GetTRDclusters(UInt_t *idx) const {
277 //---------------------------------------------------------------------
278 // This function returns indices of the assgined TRD clusters
279 //---------------------------------------------------------------------
280 for (Int_t i=0; i<90; i++) idx[i]=fTRDindex[i]; // MI I prefer some constant
284 //_______________________________________________________________________
285 void AliESDtrack::SetTRDpid(const Double_t *p) {
286 // Sets values for the probability of each particle type (in TRD)
287 for (Int_t i=0; i<kSPECIES; i++) fTRDr[i]=p[i];
288 SetStatus(AliESDtrack::kTRDpid);
291 //_______________________________________________________________________
292 void AliESDtrack::GetTRDpid(Double_t *p) const {
293 // Gets the probability of each particle type (in TRD)
294 for (Int_t i=0; i<kSPECIES; i++) p[i]=fTRDr[i];
297 //_______________________________________________________________________
298 void AliESDtrack::SetTRDpid(Int_t iSpecies, Float_t p)
300 // Sets the probability of particle type iSpecies to p (in TRD)
304 Float_t AliESDtrack::GetTRDpid(Int_t iSpecies) const
306 // Returns the probability of particle type iSpecies (in TRD)
307 return fTRDr[iSpecies];
310 //_______________________________________________________________________
311 void AliESDtrack::SetTOFpid(const Double_t *p) {
312 // Sets the probability of each particle type (in TOF)
313 for (Int_t i=0; i<kSPECIES; i++) fTOFr[i]=p[i];
314 SetStatus(AliESDtrack::kTOFpid);
317 //_______________________________________________________________________
318 void AliESDtrack::GetTOFpid(Double_t *p) const {
319 // Gets probabilities of each particle type (in TOF)
320 for (Int_t i=0; i<kSPECIES; i++) p[i]=fTOFr[i];
323 //_______________________________________________________________________
324 void AliESDtrack::SetESDpid(const Double_t *p) {
325 // Sets the probability of each particle type for the ESD track
326 for (Int_t i=0; i<kSPECIES; i++) fR[i]=p[i];
327 SetStatus(AliESDtrack::kESDpid);
330 //_______________________________________________________________________
331 void AliESDtrack::GetESDpid(Double_t *p) const {
332 // Gets probability of each particle type for the ESD track
333 for (Int_t i=0; i<kSPECIES; i++) p[i]=fR[i];
336 void AliESDtrack::GetVertexXYZ(Double_t& x,Double_t& y, Double_t&z) const
338 //returns track position in DCA to vertex
343 void AliESDtrack::GetVertexPxPyPz(Double_t& px,Double_t& py, Double_t& pz) const
345 //returns track momentum in DCA to vertex