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() :
53 // The default ESD constructor
55 for (Int_t i=0; i<kSPECIES; i++) {
64 for (i=0; i<5; i++) fRp[i]=0.;
65 for (i=0; i<15; i++) fRc[i]=0.;
66 for (i=0; i<6; i++) fITSindex[i]=0;
67 for (i=0; i<180; i++) fTPCindex[i]=0;
70 //_______________________________________________________________________
71 Float_t AliESDtrack::GetMass() const {
72 // Returns the mass of the most probable particle type
75 for (Int_t i=0; i<kSPECIES; i++) {
76 if (fR[i]>max) {k=i; max=fR[i];}
78 if (k==0) return 0.00051;
79 if (k==1) return 0.10566;
80 if (k==2||k==-1) return 0.13957;
81 if (k==3) return 0.49368;
82 if (k==4) return 0.93827;
83 Warning("GetMass()","Undefined mass !");
87 //_______________________________________________________________________
88 Bool_t AliESDtrack::UpdateTrackParams(AliKalmanTrack *t, ULong_t flags) {
90 // This function updates track's running parameters
95 if (t->IsStartedTimeIntegral()) {
97 Double_t times[10];t->GetIntegratedTimes(times); SetIntegratedTimes(times);
98 SetIntegratedLength(t->GetIntegratedLength());
101 fRalpha=t->GetAlpha();
102 t->GetExternalParameters(fRx,fRp);
103 t->GetExternalCovariance(fRc);
107 case kITSin: case kITSout: case kITSrefit:
108 fITSncls=t->GetNumberOfClusters();
109 fITSchi2=t->GetChi2();
110 for (Int_t i=0;i<fITSncls;i++) fITSindex[i]=t->GetClusterIndex(i);
111 fITSsignal=t->GetPIDsignal();
114 case kTPCin: case kTPCrefit:
119 for (i=0; i<5; i++) fIp[i]=fRp[i];
120 for (i=0; i<15;i++) fIc[i]=fRc[i];
123 fTPCncls=t->GetNumberOfClusters();
124 fTPCchi2=t->GetChi2();
125 for (Int_t i=0;i<fTPCncls;i++) fTPCindex[i]=t->GetClusterIndex(i);
126 fTPCsignal=t->GetPIDsignal();
127 {Double_t mass=t->GetMass(); // preliminary mass setting
128 if (mass>0.5) fR[4]=1.; // used by
129 else if (mass<0.4) fR[2]=1.; // the ITS reconstruction
134 { //requested by the PHOS ("temporary solution")
136 t->PropagateTo(r,30.,0.);
140 for (i=0; i<5; i++) fOp[i]=fRp[i];
141 for (i=0; i<15;i++) fOc[i]=fRc[i];
143 case kTRDin: case kTRDrefit:
144 fTRDncls=t->GetNumberOfClusters();
145 fTRDchi2=t->GetChi2();
146 for (Int_t i=0;i<fTRDncls;i++) fTRDindex[i]=t->GetClusterIndex(i);
147 fTRDsignal=t->GetPIDsignal();
151 Error("UpdateTrackParams()","Wrong flag !\n");
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::ATan2(fRp[0],fRx) + 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 void AliESDtrack::GetInnerPxPyPz(Double_t *p) const {
195 //---------------------------------------------------------------------
196 // This function returns the global track momentum components
197 // af the entrance of the TPC
198 //---------------------------------------------------------------------
199 Double_t phi=TMath::ASin(fIp[2]) + fIalpha;
200 Double_t pt=1./TMath::Abs(fIp[4]);
201 p[0]=pt*TMath::Cos(phi); p[1]=pt*TMath::Sin(phi); p[2]=pt*fIp[3];
204 void AliESDtrack::GetInnerXYZ(Double_t *xyz) const {
205 //---------------------------------------------------------------------
206 // This function returns the global track position
207 // af the entrance of the TPC
208 //---------------------------------------------------------------------
209 Double_t phi=TMath::ATan2(fIp[0],fIx) + fIalpha;
210 Double_t r=TMath::Sqrt(fIx*fIx + fIp[0]*fIp[0]);
211 xyz[0]=r*TMath::Cos(phi); xyz[1]=r*TMath::Sin(phi); xyz[2]=fIp[1];
214 void AliESDtrack::GetOuterPxPyPz(Double_t *p) const {
215 //---------------------------------------------------------------------
216 // This function returns the global track momentum components
217 // af the radius of the PHOS
218 //---------------------------------------------------------------------
219 Double_t phi=TMath::ASin(fOp[2]) + fOalpha;
220 Double_t pt=1./TMath::Abs(fOp[4]);
221 p[0]=pt*TMath::Cos(phi); p[1]=pt*TMath::Sin(phi); p[2]=pt*fOp[3];
224 void AliESDtrack::GetOuterXYZ(Double_t *xyz) const {
225 //---------------------------------------------------------------------
226 // This function returns the global track position
227 // af the radius of the PHOS
228 //---------------------------------------------------------------------
229 Double_t phi=TMath::ATan2(fOp[0],fOx) + fOalpha;
230 Double_t r=TMath::Sqrt(fOx*fOx + fOp[0]*fOp[0]);
231 xyz[0]=r*TMath::Cos(phi); xyz[1]=r*TMath::Sin(phi); xyz[2]=fOp[1];
234 //_______________________________________________________________________
235 void AliESDtrack::GetExternalCovariance(Double_t c[15]) const {
236 //---------------------------------------------------------------------
237 // This function returns external representation of the cov. matrix
238 //---------------------------------------------------------------------
239 for (Int_t i=0; i<15; i++) c[i]=fRc[i];
242 //_______________________________________________________________________
243 void AliESDtrack::GetIntegratedTimes(Double_t *times) const {
244 // Returns the array with integrated times for each particle hypothesis
245 for (Int_t i=0; i<kSPECIES; i++) times[i]=fTrackTime[i];
248 //_______________________________________________________________________
249 void AliESDtrack::SetIntegratedTimes(const Double_t *times) {
250 // Sets the array with integrated times for each particle hypotesis
251 for (Int_t i=0; i<kSPECIES; i++) fTrackTime[i]=times[i];
254 //_______________________________________________________________________
255 void AliESDtrack::SetITSpid(const Double_t *p) {
256 // Sets values for the probability of each particle type (in ITS)
257 for (Int_t i=0; i<kSPECIES; i++) fITSr[i]=p[i];
258 SetStatus(AliESDtrack::kITSpid);
261 //_______________________________________________________________________
262 void AliESDtrack::GetITSpid(Double_t *p) const {
263 // Gets the probability of each particle type (in ITS)
264 for (Int_t i=0; i<kSPECIES; i++) p[i]=fITSr[i];
267 //_______________________________________________________________________
268 Int_t AliESDtrack::GetITSclusters(UInt_t *idx) const {
269 //---------------------------------------------------------------------
270 // This function returns indices of the assgined ITS clusters
271 //---------------------------------------------------------------------
272 for (Int_t i=0; i<fITSncls; i++) idx[i]=fITSindex[i];
276 //_______________________________________________________________________
277 Int_t AliESDtrack::GetTPCclusters(Int_t *idx) const {
278 //---------------------------------------------------------------------
279 // This function returns indices of the assgined ITS clusters
280 //---------------------------------------------------------------------
281 for (Int_t i=0; i<180; i++) idx[i]=fTPCindex[i]; // MI I prefer some constant
285 //_______________________________________________________________________
286 void AliESDtrack::SetTPCpid(const Double_t *p) {
287 // Sets values for the probability of each particle type (in TPC)
288 for (Int_t i=0; i<kSPECIES; i++) fTPCr[i]=p[i];
289 SetStatus(AliESDtrack::kTPCpid);
292 //_______________________________________________________________________
293 void AliESDtrack::GetTPCpid(Double_t *p) const {
294 // Gets the probability of each particle type (in TPC)
295 for (Int_t i=0; i<kSPECIES; i++) p[i]=fTPCr[i];
298 //_______________________________________________________________________
299 Int_t AliESDtrack::GetTRDclusters(UInt_t *idx) const {
300 //---------------------------------------------------------------------
301 // This function returns indices of the assgined TRD clusters
302 //---------------------------------------------------------------------
303 for (Int_t i=0; i<90; i++) idx[i]=fTRDindex[i]; // MI I prefer some constant
307 //_______________________________________________________________________
308 void AliESDtrack::SetTRDpid(const Double_t *p) {
309 // Sets values for the probability of each particle type (in TRD)
310 for (Int_t i=0; i<kSPECIES; i++) fTRDr[i]=p[i];
311 SetStatus(AliESDtrack::kTRDpid);
314 //_______________________________________________________________________
315 void AliESDtrack::GetTRDpid(Double_t *p) const {
316 // Gets the probability of each particle type (in TRD)
317 for (Int_t i=0; i<kSPECIES; i++) p[i]=fTRDr[i];
320 //_______________________________________________________________________
321 void AliESDtrack::SetTRDpid(Int_t iSpecies, Float_t p)
323 // Sets the probability of particle type iSpecies to p (in TRD)
327 Float_t AliESDtrack::GetTRDpid(Int_t iSpecies) const
329 // Returns the probability of particle type iSpecies (in TRD)
330 return fTRDr[iSpecies];
333 //_______________________________________________________________________
334 void AliESDtrack::SetTOFpid(const Double_t *p) {
335 // Sets the probability of each particle type (in TOF)
336 for (Int_t i=0; i<kSPECIES; i++) fTOFr[i]=p[i];
337 SetStatus(AliESDtrack::kTOFpid);
340 //_______________________________________________________________________
341 void AliESDtrack::GetTOFpid(Double_t *p) const {
342 // Gets probabilities of each particle type (in TOF)
343 for (Int_t i=0; i<kSPECIES; i++) p[i]=fTOFr[i];
346 //_______________________________________________________________________
347 void AliESDtrack::SetESDpid(const Double_t *p) {
348 // Sets the probability of each particle type for the ESD track
349 for (Int_t i=0; i<kSPECIES; i++) fR[i]=p[i];
350 SetStatus(AliESDtrack::kESDpid);
353 //_______________________________________________________________________
354 void AliESDtrack::GetESDpid(Double_t *p) const {
355 // Gets probability of each particle type for the ESD track
356 for (Int_t i=0; i<kSPECIES; i++) p[i]=fR[i];