]> git.uio.no Git - u/mrichter/AliRoot.git/blame - STEER/AliESDtrack.cxx
Removing const
[u/mrichter/AliRoot.git] / STEER / AliESDtrack.cxx
CommitLineData
ae982df3 1/**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3 * *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
6 * *
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 **************************************************************************/
15
16//-----------------------------------------------------------------
17// Implementation of the ESD track class
4427806c 18// ESD = Event Summary Data
ae982df3 19// This is the class to deal with during the phisical analysis of data
4427806c 20// Origin: Iouri Belikov, CERN
21// e-mail: Jouri.Belikov@cern.ch
ae982df3 22//-----------------------------------------------------------------
23
24#include "TMath.h"
25
26#include "AliESDtrack.h"
27#include "AliKalmanTrack.h"
28
29ClassImp(AliESDtrack)
30
31//_______________________________________________________________________
32AliESDtrack::AliESDtrack() :
2bad268c 33fFlags(0),
34fLabel(0),
35fTrackLength(0),
36fStopVertex(0),
37fRalpha(0),
38fRx(0),
39fITSchi2(0),
ae982df3 40fITSncls(0),
2bad268c 41fITSsignal(0),
2bad268c 42fTPCchi2(0),
05e445cd 43fTPCncls(0),
2bad268c 44fTPCsignal(0),
45fTRDchi2(0),
46fTRDncls(0),
47fTRDsignal(0),
48fTOFchi2(0),
49fTOFindex(0),
bb2ceb1f 50fTOFsignal(-1)
ae982df3 51{
52 //
53 // The default ESD constructor
54 //
2bad268c 55 for (Int_t i=0; i<kSPECIES; i++) {
56 fTrackTime[i]=0;
57 fR[i]=0;
58 fITSr[i]=0;
59 fTPCr[i]=0;
60 fTRDr[i]=0;
61 fTOFr[i]=0;
62 }
bb2ceb1f 63 Int_t 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;
ae982df3 68}
69
70//_______________________________________________________________________
71Float_t AliESDtrack::GetMass() const {
4427806c 72 // Returns the mass of the most probable particle type
ae982df3 73 Float_t max=0.;
74 Int_t k=-1;
75 for (Int_t i=0; i<kSPECIES; i++) {
76 if (fR[i]>max) {k=i; max=fR[i];}
77 }
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 !");
84 return 0.13957;
85}
86
87//_______________________________________________________________________
ad2f1f2b 88Bool_t AliESDtrack::UpdateTrackParams(AliKalmanTrack *t, ULong_t flags) {
ae982df3 89 //
90 // This function updates track's running parameters
91 //
9b859005 92 SetStatus(flags);
93 fLabel=t->GetLabel();
94
95 if (t->IsStartedTimeIntegral()) {
96 SetStatus(kTIME);
97 Double_t times[10];t->GetIntegratedTimes(times); SetIntegratedTimes(times);
98 SetIntegratedLength(t->GetIntegratedLength());
99 }
100
101 fRalpha=t->GetAlpha();
102 t->GetExternalParameters(fRx,fRp);
103 t->GetExternalCovariance(fRc);
104
ae982df3 105 switch (flags) {
ad2f1f2b 106
9b859005 107 case kITSin: case kITSout: case kITSrefit:
ae982df3 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();
112 break;
ad2f1f2b 113
9b859005 114 case kTPCin: case kTPCrefit:
115 fIalpha=fRalpha;
116 fIx=fRx;
117 {
118 Int_t i;
119 for (i=0; i<5; i++) fIp[i]=fRp[i];
120 for (i=0; i<15;i++) fIc[i]=fRc[i];
121 }
122 case kTPCout:
ae982df3 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
130 else fR[3]=1.;} //
131 break;
9b859005 132
672b5f43 133 case kTRDout:
134 { //requested by the PHOS ("temporary solution")
135 Double_t r=474.;
136 t->PropagateTo(r,30.,0.);
137 fOalpha=fRalpha;
138 fOx=fRx;
139 Int_t i;
140 for (i=0; i<5; i++) fOp[i]=fRp[i];
141 for (i=0; i<15;i++) fOc[i]=fRc[i];
142 }
143 case kTRDin: case kTRDrefit:
79e94bf8 144 fTRDncls=t->GetNumberOfClusters();
145 fTRDchi2=t->GetChi2();
bb2ceb1f 146 for (Int_t i=0;i<fTRDncls;i++) fTRDindex[i]=t->GetClusterIndex(i);
79e94bf8 147 fTRDsignal=t->GetPIDsignal();
148 break;
9b859005 149
ae982df3 150 default:
151 Error("UpdateTrackParams()","Wrong flag !\n");
152 return kFALSE;
153 }
154
ae982df3 155 return kTRUE;
156}
157
158//_______________________________________________________________________
159void AliESDtrack::GetExternalParameters(Double_t &x, Double_t p[5]) const {
160 //---------------------------------------------------------------------
161 // This function returns external representation of the track parameters
162 //---------------------------------------------------------------------
163 x=fRx;
164 for (Int_t i=0; i<5; i++) p[i]=fRp[i];
165}
166
167Double_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);
174}
175
176void 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];
183}
184
185void AliESDtrack::GetXYZ(Double_t *xyz) const {
186 //---------------------------------------------------------------------
187 // This function returns the global track position
188 //---------------------------------------------------------------------
bb2ceb1f 189 Double_t phi=TMath::ATan2(fRp[0],fRx) + fRalpha;
ae982df3 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];
192}
193
9b859005 194void 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];
202}
203
204void 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];
212}
213
672b5f43 214void 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];
222}
223
224void 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];
232}
233
ae982df3 234//_______________________________________________________________________
235void 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];
240}
241
242//_______________________________________________________________________
243void AliESDtrack::GetIntegratedTimes(Double_t *times) const {
4427806c 244 // Returns the array with integrated times for each particle hypothesis
ae982df3 245 for (Int_t i=0; i<kSPECIES; i++) times[i]=fTrackTime[i];
246}
247
248//_______________________________________________________________________
249void AliESDtrack::SetIntegratedTimes(const Double_t *times) {
4427806c 250 // Sets the array with integrated times for each particle hypotesis
ae982df3 251 for (Int_t i=0; i<kSPECIES; i++) fTrackTime[i]=times[i];
252}
253
c630aafd 254//_______________________________________________________________________
4427806c 255void AliESDtrack::SetITSpid(const Double_t *p) {
256 // Sets values for the probability of each particle type (in ITS)
c630aafd 257 for (Int_t i=0; i<kSPECIES; i++) fITSr[i]=p[i];
258 SetStatus(AliESDtrack::kITSpid);
259}
260
261//_______________________________________________________________________
262void AliESDtrack::GetITSpid(Double_t *p) const {
4427806c 263 // Gets the probability of each particle type (in ITS)
c630aafd 264 for (Int_t i=0; i<kSPECIES; i++) p[i]=fITSr[i];
265}
266
ae982df3 267//_______________________________________________________________________
268Int_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];
273 return fITSncls;
274}
275
276//_______________________________________________________________________
05e445cd 277Int_t AliESDtrack::GetTPCclusters(Int_t *idx) const {
ae982df3 278 //---------------------------------------------------------------------
279 // This function returns indices of the assgined ITS clusters
280 //---------------------------------------------------------------------
05e445cd 281 for (Int_t i=0; i<180; i++) idx[i]=fTPCindex[i]; // MI I prefer some constant
ae982df3 282 return fTPCncls;
283}
8c6a71ab 284
285//_______________________________________________________________________
286void AliESDtrack::SetTPCpid(const Double_t *p) {
4427806c 287 // Sets values for the probability of each particle type (in TPC)
8c6a71ab 288 for (Int_t i=0; i<kSPECIES; i++) fTPCr[i]=p[i];
289 SetStatus(AliESDtrack::kTPCpid);
290}
291
292//_______________________________________________________________________
293void AliESDtrack::GetTPCpid(Double_t *p) const {
4427806c 294 // Gets the probability of each particle type (in TPC)
8c6a71ab 295 for (Int_t i=0; i<kSPECIES; i++) p[i]=fTPCr[i];
296}
297
bb2ceb1f 298//_______________________________________________________________________
299Int_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
304 return fTRDncls;
305}
306
c630aafd 307//_______________________________________________________________________
308void AliESDtrack::SetTRDpid(const Double_t *p) {
4427806c 309 // Sets values for the probability of each particle type (in TRD)
c630aafd 310 for (Int_t i=0; i<kSPECIES; i++) fTRDr[i]=p[i];
311 SetStatus(AliESDtrack::kTRDpid);
312}
313
314//_______________________________________________________________________
315void AliESDtrack::GetTRDpid(Double_t *p) const {
4427806c 316 // Gets the probability of each particle type (in TRD)
c630aafd 317 for (Int_t i=0; i<kSPECIES; i++) p[i]=fTRDr[i];
318}
319
79e94bf8 320//_______________________________________________________________________
321void AliESDtrack::SetTRDpid(Int_t iSpecies, Float_t p)
322{
4427806c 323 // Sets the probability of particle type iSpecies to p (in TRD)
79e94bf8 324 fTRDr[iSpecies] = p;
325}
326
327Float_t AliESDtrack::GetTRDpid(Int_t iSpecies) const
328{
4427806c 329 // Returns the probability of particle type iSpecies (in TRD)
79e94bf8 330 return fTRDr[iSpecies];
331}
332
c630aafd 333//_______________________________________________________________________
334void AliESDtrack::SetTOFpid(const Double_t *p) {
4427806c 335 // Sets the probability of each particle type (in TOF)
c630aafd 336 for (Int_t i=0; i<kSPECIES; i++) fTOFr[i]=p[i];
337 SetStatus(AliESDtrack::kTOFpid);
338}
339
340//_______________________________________________________________________
341void AliESDtrack::GetTOFpid(Double_t *p) const {
4427806c 342 // Gets probabilities of each particle type (in TOF)
c630aafd 343 for (Int_t i=0; i<kSPECIES; i++) p[i]=fTOFr[i];
344}
345
8c6a71ab 346//_______________________________________________________________________
347void AliESDtrack::SetESDpid(const Double_t *p) {
4427806c 348 // Sets the probability of each particle type for the ESD track
8c6a71ab 349 for (Int_t i=0; i<kSPECIES; i++) fR[i]=p[i];
350 SetStatus(AliESDtrack::kESDpid);
351}
352
353//_______________________________________________________________________
354void AliESDtrack::GetESDpid(Double_t *p) const {
4427806c 355 // Gets probability of each particle type for the ESD track
8c6a71ab 356 for (Int_t i=0; i<kSPECIES; i++) p[i]=fR[i];
357}
358