restore AliMUONDisplay-trigger-button action (Christian)
[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 **************************************************************************/
ae982df3 15//-----------------------------------------------------------------
16// Implementation of the ESD track class
4427806c 17// ESD = Event Summary Data
ae982df3 18// This is the class to deal with during the phisical analysis of data
4427806c 19// Origin: Iouri Belikov, CERN
20// e-mail: Jouri.Belikov@cern.ch
ae982df3 21//-----------------------------------------------------------------
22
23#include "TMath.h"
24
25#include "AliESDtrack.h"
26#include "AliKalmanTrack.h"
27
28ClassImp(AliESDtrack)
29
30//_______________________________________________________________________
31AliESDtrack::AliESDtrack() :
2bad268c 32fFlags(0),
33fLabel(0),
34fTrackLength(0),
35fStopVertex(0),
36fRalpha(0),
37fRx(0),
a866ac60 38fCalpha(0),
39fCx(0),
67c3dcbe 40fCchi2(1e10),
a866ac60 41fIalpha(0),
42fIx(0),
c4d11b15 43fTalpha(0),
44fTx(0),
a866ac60 45fOalpha(0),
46fOx(0),
2bad268c 47fITSchi2(0),
ae982df3 48fITSncls(0),
2bad268c 49fITSsignal(0),
2bad268c 50fTPCchi2(0),
05e445cd 51fTPCncls(0),
a866ac60 52fTPCClusterMap(159),//number of padrows
2bad268c 53fTPCsignal(0),
54fTRDchi2(0),
55fTRDncls(0),
c4d11b15 56fTRDncls0(0),
2bad268c 57fTRDsignal(0),
58fTOFchi2(0),
59fTOFindex(0),
4a78b8c5 60fTOFsignal(-1),
61fPHOSsignal(-1),
704be597 62fEMCALsignal(-1),
4a78b8c5 63fRICHsignal(-1)
ae982df3 64{
65 //
66 // The default ESD constructor
67 //
2bad268c 68 for (Int_t i=0; i<kSPECIES; i++) {
4a78b8c5 69 fTrackTime[i]=0.;
70 fR[i]=1.;
71 fITSr[i]=1.;
72 fTPCr[i]=1.;
73 fTRDr[i]=1.;
74 fTOFr[i]=1.;
4a78b8c5 75 fRICHr[i]=1.;
2bad268c 76 }
ac2f7574 77
704be597 78 for (Int_t i=0; i<kSPECIESN; i++) {
79 fPHOSr[i] = 1.;
80 fEMCALr[i] = 1.;
81 }
82
ac2f7574 83
4a78b8c5 84 fPHOSpos[0]=fPHOSpos[1]=fPHOSpos[2]=0.;
704be597 85 fEMCALpos[0]=fEMCALpos[1]=fEMCALpos[2]=0.;
bb2ceb1f 86 Int_t i;
c4d11b15 87 for (i=0; i<5; i++) { fRp[i]=0.; fCp[i]=0.; fIp[i]=0.; fOp[i]=0.; fTp[i]=0.;}
88 for (i=0; i<15; i++) { fRc[i]=0.; fCc[i]=0.; fIc[i]=0.; fOc[i]=0.; fTc[i]=0.; }
a866ac60 89 for (i=0; i<6; i++) { fITSindex[i]=0; }
90 for (i=0; i<180; i++){ fTPCindex[i]=0; }
c4d11b15 91 for (i=0; i<130; i++) { fTRDindex[i]=0; }
6e5b1b04 92 fTPCLabel = 0;
93 fTRDLabel = 0;
94 fITSLabel = 0;
c4d11b15 95 fITStrack = 0;
96 fTRDtrack = 0;
97}
98
99//_______________________________________________________________________
100
101AliESDtrack::AliESDtrack(const AliESDtrack& track):TObject(track){
102 //
103 //copy constructor
104 //
105 fFlags = track.fFlags;
106 fLabel =track.fLabel;
107 fTrackLength =track.fTrackLength;
108 for (Int_t i=0;i<kSPECIES;i++) fTrackTime[i] =track.fTrackTime[i];
109 for (Int_t i=0;i<kSPECIES;i++) fR[i] =track.fR[i];
110 fStopVertex =track.fStopVertex;
111 //
112 fRalpha =track.fRalpha;
113 fRx =track.fRx;
114 for (Int_t i=0;i<5;i++) fRp[i] =track.fRp[i];
115 for (Int_t i=0;i<15;i++) fRc[i] =track.fRc[i];
116 //
117 fCalpha =track.fCalpha;
118 fCx =track.fCx;
119 for (Int_t i=0;i<5;i++) fCp[i] =track.fCp[i];
120 for (Int_t i=0;i<15;i++) fCc[i] =track.fCc[i];
121 fCchi2 =track.fCchi2;
122 //
123 fIalpha =track.fIalpha;
124 fIx =track.fIx;
125 for (Int_t i=0;i<5;i++) fIp[i] =track.fIp[i];
126 for (Int_t i=0;i<15;i++) fIc[i] =track.fIc[i];
127 //
128 fTalpha =track.fTalpha;
129 fTx =track.fTx;
130 for (Int_t i=0;i<5;i++) fTp[i] =track.fTp[i];
131 for (Int_t i=0;i<15;i++) fTc[i] =track.fTc[i];
132 //
133 fOalpha =track.fOalpha;
134 fOx =track.fOx;
135 for (Int_t i=0;i<5;i++) fOp[i] =track.fOp[i];
136 for (Int_t i=0;i<15;i++) fOc[i] =track.fOc[i];
137 //
138 fXalpha =track.fXalpha;
139 fXx =track.fXx;
140 for (Int_t i=0;i<5;i++) fXp[i] =track.fXp[i];
141 for (Int_t i=0;i<15;i++) fXc[i] =track.fXc[i];
142 //
143 fITSchi2 =track.fITSchi2;
144 for (Int_t i=0;i<12;i++) fITSchi2MIP[i] =track.fITSchi2MIP[i];
145 fITSncls =track.fITSncls;
146 for (Int_t i=0;i<6;i++) fITSindex[i]=track.fITSindex[i];
147 fITSsignal =track.fITSsignal;
148 for (Int_t i=0;i<kSPECIES;i++) fITSr[i]=track.fITSr[i];
149 fITSLabel =track.fITSLabel;
150 fITSFakeRatio =track.fITSFakeRatio;
151 fITStrack =0; //coping separatelly - in user code
152 //
153 fTPCchi2 =track.fTPCchi2;
154 fTPCncls =track.fTPCncls;
155 for (Int_t i=0;i<180;i++) fTPCindex[i]=track.fTPCindex[i];
156 fTPCClusterMap=track.fTPCClusterMap;
157 fTPCsignal=track.fTPCsignal;
158 for (Int_t i=0;i<kSPECIES;i++) fTPCr[i]=track.fTPCr[i];
159 fTPCLabel=track.fTPCLabel;
160 //
161 fTRDchi2=track.fTRDchi2;
162 fTRDncls=track.fTRDncls;
163 fTRDncls0=track.fTRDncls0;
164 for (Int_t i=0;i<130;i++) fTRDindex[i]=track.fTRDindex[i];
165 fTRDsignal=track.fTRDsignal;
166 for (Int_t i=0;i<kSPECIES;i++) fTRDr[i]=track.fTRDr[i];
167 fTRDLabel=track.fTRDLabel;
168 fTRDtrack=0;
169 //
170 fTOFchi2=track.fTOFchi2;
171 fTOFindex=track.fTOFindex;
172 fTOFsignal=track.fTOFsignal;
173 for (Int_t i=0;i<kSPECIES;i++) fTOFr[i]=track.fTOFr[i];
174 //
175 for (Int_t i=0;i<3;i++) fPHOSpos[i]=track.fPHOSpos[i];
176 fPHOSsignal=track.fPHOSsignal;
4162b1d0 177 for (Int_t i=0;i<kSPECIESN;i++) fPHOSr[i]=track.fPHOSr[i];
c4d11b15 178 //
179 for (Int_t i=0;i<3;i++) fEMCALpos[i]=track.fEMCALpos[i];
180 fEMCALsignal=track.fEMCALsignal;
4162b1d0 181 for (Int_t i=0;i<kSPECIESN;i++) fEMCALr[i]=track.fEMCALr[i];
c4d11b15 182 //
183 fRICHsignal=track.fRICHsignal;
184 for (Int_t i=0;i<kSPECIES;i++) fRICHr[i]=track.fRICHr[i];
185
ac2f7574 186
ae982df3 187}
c4d11b15 188//_______________________________________________________________________
189AliESDtrack::~AliESDtrack(){
190 //
191 // This is destructor according Coding Conventrions
192 //
193 //printf("Delete track\n");
3fd96ae3 194 delete fITStrack;
195 delete fTRDtrack;
c4d11b15 196}
ae982df3 197
198//_______________________________________________________________________
4a78b8c5 199Double_t AliESDtrack::GetMass() const {
4427806c 200 // Returns the mass of the most probable particle type
ae982df3 201 Float_t max=0.;
202 Int_t k=-1;
203 for (Int_t i=0; i<kSPECIES; i++) {
204 if (fR[i]>max) {k=i; max=fR[i];}
205 }
db3989b3 206 if (k==0) { // dE/dx "crossing points" in the TPC
207 Double_t p=GetP();
208 if ((p>0.38)&&(p<0.48))
209 if (fR[0]<fR[3]*10.) return 0.49368;
210 if ((p>0.75)&&(p<0.85))
211 if (fR[0]<fR[4]*10.) return 0.93827;
212 return 0.00051;
213 }
c4d11b15 214 if (k==1) return 0.10566;
ae982df3 215 if (k==2||k==-1) return 0.13957;
216 if (k==3) return 0.49368;
217 if (k==4) return 0.93827;
218 Warning("GetMass()","Undefined mass !");
219 return 0.13957;
220}
221
222//_______________________________________________________________________
ad2f1f2b 223Bool_t AliESDtrack::UpdateTrackParams(AliKalmanTrack *t, ULong_t flags) {
ae982df3 224 //
225 // This function updates track's running parameters
226 //
9b859005 227 SetStatus(flags);
228 fLabel=t->GetLabel();
229
230 if (t->IsStartedTimeIntegral()) {
231 SetStatus(kTIME);
232 Double_t times[10];t->GetIntegratedTimes(times); SetIntegratedTimes(times);
233 SetIntegratedLength(t->GetIntegratedLength());
234 }
235
236 fRalpha=t->GetAlpha();
237 t->GetExternalParameters(fRx,fRp);
238 t->GetExternalCovariance(fRc);
239
ae982df3 240 switch (flags) {
ad2f1f2b 241
9b859005 242 case kITSin: case kITSout: case kITSrefit:
ae982df3 243 fITSncls=t->GetNumberOfClusters();
244 fITSchi2=t->GetChi2();
245 for (Int_t i=0;i<fITSncls;i++) fITSindex[i]=t->GetClusterIndex(i);
246 fITSsignal=t->GetPIDsignal();
6e5b1b04 247 fITSLabel = t->GetLabel();
babd135a 248 fITSFakeRatio = t->GetFakeRatio();
ae982df3 249 break;
ad2f1f2b 250
9b859005 251 case kTPCin: case kTPCrefit:
6e5b1b04 252 fTPCLabel = t->GetLabel();
9b859005 253 fIalpha=fRalpha;
254 fIx=fRx;
255 {
256 Int_t i;
257 for (i=0; i<5; i++) fIp[i]=fRp[i];
258 for (i=0; i<15;i++) fIc[i]=fRc[i];
259 }
260 case kTPCout:
a866ac60 261
ae982df3 262 fTPCncls=t->GetNumberOfClusters();
263 fTPCchi2=t->GetChi2();
a866ac60 264
265 {//prevrow must be declared in separate namespace, otherwise compiler cries:
266 //"jump to case label crosses initialization of `Int_t prevrow'"
267 Int_t prevrow = -1;
6e5b1b04 268 // for (Int_t i=0;i<fTPCncls;i++)
269 for (Int_t i=0;i<160;i++)
a866ac60 270 {
271 fTPCindex[i]=t->GetClusterIndex(i);
272
273 // Piotr's Cluster Map for HBT
274 // ### please change accordingly if cluster array is changing
275 // to "New TPC Tracking" style (with gaps in array)
276 Int_t idx = fTPCindex[i];
277 Int_t sect = (idx&0xff000000)>>24;
278 Int_t row = (idx&0x00ff0000)>>16;
279 if (sect > 18) row +=63; //if it is outer sector, add number of inner sectors
280
281 fTPCClusterMap.SetBitNumber(row,kTRUE);
282
283 //Fill the gap between previous row and this row with 0 bits
284 //In case ### pleas change it as well - just set bit 0 in case there
285 //is no associated clusters for current "i"
286 if (prevrow < 0)
287 {
288 prevrow = row;//if previous bit was not assigned yet == this is the first one
289 }
290 else
291 { //we don't know the order (inner to outer or reverse)
292 //just to be save in case it is going to change
293 Int_t n = 0, m = 0;
294 if (prevrow < row)
295 {
296 n = prevrow;
297 m = row;
298 }
299 else
300 {
301 n = row;
302 m = prevrow;
303 }
304
305 for (Int_t j = n+1; j < m; j++)
306 {
307 fTPCClusterMap.SetBitNumber(j,kFALSE);
308 }
309 prevrow = row;
310 }
311 // End Of Piotr's Cluster Map for HBT
312 }
313 }
ae982df3 314 fTPCsignal=t->GetPIDsignal();
315 {Double_t mass=t->GetMass(); // preliminary mass setting
316 if (mass>0.5) fR[4]=1.; // used by
317 else if (mass<0.4) fR[2]=1.; // the ITS reconstruction
a866ac60 318 else fR[3]=1.;}
319 //
ae982df3 320 break;
9b859005 321
672b5f43 322 case kTRDout:
704be597 323 { //requested by the PHOS/EMCAL ("temporary solution")
db3989b3 324 Int_t i;
325 Double_t x=460.,buf[15];
326 if (t->PropagateTo(x,30.,0.)) {
e964f790 327 fOalpha=t->GetAlpha();
db3989b3 328 t->GetExternalParameters(x,buf); fOx=x;
329 for (i=0; i<5; i++) fOp[i]=buf[i];
330 t->GetExternalCovariance(buf);
331 for (i=0; i<15; i++) fOc[i]=buf[i];
e964f790 332 }
db3989b3 333 x=450.;
334 if (t->PropagateTo(x,30.,0.)) {
704be597 335 fXalpha=t->GetAlpha();
db3989b3 336 t->GetExternalParameters(x,buf); fXx=x;
337 for (i=0; i<5; i++) fXp[i]=buf[i];
338 t->GetExternalCovariance(buf);
339 for (i=0; i<15; i++) fXc[i]=buf[i];
704be597 340 }
672b5f43 341 }
342 case kTRDin: case kTRDrefit:
6e5b1b04 343 fTRDLabel = t->GetLabel();
c4d11b15 344
79e94bf8 345 fTRDncls=t->GetNumberOfClusters();
346 fTRDchi2=t->GetChi2();
bb2ceb1f 347 for (Int_t i=0;i<fTRDncls;i++) fTRDindex[i]=t->GetClusterIndex(i);
79e94bf8 348 fTRDsignal=t->GetPIDsignal();
349 break;
c4d11b15 350 case kTRDbackup:
351 t->GetExternalParameters(fTx,fTp);
352 t->GetExternalCovariance(fTc);
353 fTRDncls0 = t->GetNumberOfClusters();
354 break;
355 case kTOFin:
356 break;
357 case kTOFout:
358 break;
d0862fea 359 case kTRDStop:
360 break;
ae982df3 361 default:
362 Error("UpdateTrackParams()","Wrong flag !\n");
363 return kFALSE;
364 }
365
ae982df3 366 return kTRUE;
367}
368
369//_______________________________________________________________________
67c3dcbe 370void
371AliESDtrack::SetConstrainedTrackParams(AliKalmanTrack *t, Double_t chi2) {
372 //
373 // This function sets the constrained track parameters
374 //
db3989b3 375 Int_t i;
376 Double_t x,buf[15];
67c3dcbe 377 fCalpha=t->GetAlpha();
db3989b3 378 t->GetExternalParameters(x,buf); fCx=x;
379 for (i=0; i<5; i++) fCp[i]=buf[i];
380 t->GetExternalCovariance(buf);
381 for (i=0; i<15; i++) fCc[i]=buf[i];
67c3dcbe 382 fCchi2=chi2;
383}
384
385
386//_______________________________________________________________________
ae982df3 387void AliESDtrack::GetExternalParameters(Double_t &x, Double_t p[5]) const {
388 //---------------------------------------------------------------------
389 // This function returns external representation of the track parameters
390 //---------------------------------------------------------------------
391 x=fRx;
392 for (Int_t i=0; i<5; i++) p[i]=fRp[i];
393}
67c3dcbe 394//_______________________________________________________________________
a866ac60 395void AliESDtrack::GetExternalCovariance(Double_t cov[15]) const {
67c3dcbe 396 //---------------------------------------------------------------------
397 // This function returns external representation of the cov. matrix
398 //---------------------------------------------------------------------
a866ac60 399 for (Int_t i=0; i<15; i++) cov[i]=fRc[i];
67c3dcbe 400}
401
402
403//_______________________________________________________________________
404void
405AliESDtrack::GetConstrainedExternalParameters(Double_t &x, Double_t p[5])const{
406 //---------------------------------------------------------------------
407 // This function returns the constrained external track parameters
408 //---------------------------------------------------------------------
409 x=fCx;
410 for (Int_t i=0; i<5; i++) p[i]=fCp[i];
411}
412//_______________________________________________________________________
413void
414AliESDtrack::GetConstrainedExternalCovariance(Double_t c[15]) const {
415 //---------------------------------------------------------------------
416 // This function returns the constrained external cov. matrix
417 //---------------------------------------------------------------------
418 for (Int_t i=0; i<15; i++) c[i]=fCc[i];
419}
420
ae982df3 421
422Double_t AliESDtrack::GetP() const {
423 //---------------------------------------------------------------------
424 // This function returns the track momentum
425 //---------------------------------------------------------------------
2157f4f2 426 if (TMath::Abs(fRp[4])<=0) return 0;
ae982df3 427 Double_t pt=1./TMath::Abs(fRp[4]);
5bc70ad8 428 return pt*TMath::Sqrt(1.+ fRp[3]*fRp[3]);
ae982df3 429}
430
67c3dcbe 431void AliESDtrack::GetConstrainedPxPyPz(Double_t *p) const {
432 //---------------------------------------------------------------------
433 // This function returns the constrained global track momentum components
434 //---------------------------------------------------------------------
2157f4f2 435 if (TMath::Abs(fCp[4])<=0) {
436 p[0]=p[1]=p[2]=0;
437 return;
438 }
67c3dcbe 439 Double_t phi=TMath::ASin(fCp[2]) + fCalpha;
440 Double_t pt=1./TMath::Abs(fCp[4]);
441 p[0]=pt*TMath::Cos(phi); p[1]=pt*TMath::Sin(phi); p[2]=pt*fCp[3];
442}
443void AliESDtrack::GetConstrainedXYZ(Double_t *xyz) const {
444 //---------------------------------------------------------------------
445 // This function returns the global track position
446 //---------------------------------------------------------------------
447 Double_t phi=TMath::ATan2(fCp[0],fCx) + fCalpha;
448 Double_t r=TMath::Sqrt(fCx*fCx + fCp[0]*fCp[0]);
449 xyz[0]=r*TMath::Cos(phi); xyz[1]=r*TMath::Sin(phi); xyz[2]=fCp[1];
450}
451
ae982df3 452void AliESDtrack::GetPxPyPz(Double_t *p) const {
453 //---------------------------------------------------------------------
454 // This function returns the global track momentum components
455 //---------------------------------------------------------------------
2157f4f2 456 if (TMath::Abs(fRp[4])<=0) {
457 p[0]=p[1]=p[2]=0;
458 return;
459 }
ae982df3 460 Double_t phi=TMath::ASin(fRp[2]) + fRalpha;
461 Double_t pt=1./TMath::Abs(fRp[4]);
462 p[0]=pt*TMath::Cos(phi); p[1]=pt*TMath::Sin(phi); p[2]=pt*fRp[3];
463}
ae982df3 464void AliESDtrack::GetXYZ(Double_t *xyz) const {
465 //---------------------------------------------------------------------
466 // This function returns the global track position
467 //---------------------------------------------------------------------
bb2ceb1f 468 Double_t phi=TMath::ATan2(fRp[0],fRx) + fRalpha;
ae982df3 469 Double_t r=TMath::Sqrt(fRx*fRx + fRp[0]*fRp[0]);
470 xyz[0]=r*TMath::Cos(phi); xyz[1]=r*TMath::Sin(phi); xyz[2]=fRp[1];
471}
472
67c3dcbe 473
9b859005 474void AliESDtrack::GetInnerPxPyPz(Double_t *p) const {
475 //---------------------------------------------------------------------
476 // This function returns the global track momentum components
477 // af the entrance of the TPC
478 //---------------------------------------------------------------------
e964f790 479 if (fIx==0) {p[0]=p[1]=p[2]=0.; return;}
9b859005 480 Double_t phi=TMath::ASin(fIp[2]) + fIalpha;
481 Double_t pt=1./TMath::Abs(fIp[4]);
482 p[0]=pt*TMath::Cos(phi); p[1]=pt*TMath::Sin(phi); p[2]=pt*fIp[3];
483}
484
485void AliESDtrack::GetInnerXYZ(Double_t *xyz) const {
486 //---------------------------------------------------------------------
487 // This function returns the global track position
488 // af the entrance of the TPC
489 //---------------------------------------------------------------------
e964f790 490 if (fIx==0) {xyz[0]=xyz[1]=xyz[2]=0.; return;}
9b859005 491 Double_t phi=TMath::ATan2(fIp[0],fIx) + fIalpha;
492 Double_t r=TMath::Sqrt(fIx*fIx + fIp[0]*fIp[0]);
493 xyz[0]=r*TMath::Cos(phi); xyz[1]=r*TMath::Sin(phi); xyz[2]=fIp[1];
494}
495
a866ac60 496void AliESDtrack::GetInnerExternalParameters(Double_t &x, Double_t p[5]) const
497{
498 //skowron
499 //---------------------------------------------------------------------
500 // This function returns external representation of the track parameters at Inner Layer of TPC
501 //---------------------------------------------------------------------
502 x=fIx;
503 for (Int_t i=0; i<5; i++) p[i]=fIp[i];
504}
505void AliESDtrack::GetInnerExternalCovariance(Double_t cov[15]) const
506{
507 //skowron
508 //---------------------------------------------------------------------
509 // This function returns external representation of the cov. matrix at Inner Layer of TPC
510 //---------------------------------------------------------------------
511 for (Int_t i=0; i<15; i++) cov[i]=fIc[i];
512
513}
514
c4d11b15 515void AliESDtrack::GetTRDExternalParameters(Double_t &x, Double_t p[5], Double_t cov[15]) const
516{
517 //
518 //this function returns TRD parameters
519 //
520 x=fTx;
521 for (Int_t i=0; i<5; i++) p[i]=fTp[i];
522 for (Int_t i=0; i<15; i++) cov[i]=fTc[i];
523}
524
3fd96ae3 525void AliESDtrack::GetOuterPxPyPzPHOS(Double_t *p) const {
672b5f43 526 //---------------------------------------------------------------------
527 // This function returns the global track momentum components
528 // af the radius of the PHOS
529 //---------------------------------------------------------------------
704be597 530 p[0]=p[1]=p[2]=0. ;
3fd96ae3 531 if (fOx==0)
532 return;
533 Double_t phi=TMath::ASin(fOp[2]) + fOalpha;
534 Double_t pt=1./TMath::Abs(fOp[4]);
535 p[0]=pt*TMath::Cos(phi);
536 p[1]=pt*TMath::Sin(phi);
537 p[2]=pt*fOp[3];
538}
539void AliESDtrack::GetOuterPxPyPzEMCAL(Double_t *p) const {
540 //---------------------------------------------------------------------
541 // This function returns the global track momentum components
542 // af the radius of the EMCAL
543 //---------------------------------------------------------------------
544 if (fXx==0)
545 return;
546 Double_t phi=TMath::ASin(fXp[2]) + fXalpha;
547 Double_t pt=1./TMath::Abs(fXp[4]);
548 p[0]=pt*TMath::Cos(phi);
549 p[1]=pt*TMath::Sin(phi);
550 p[2]=pt*fXp[3];
672b5f43 551}
552
3fd96ae3 553void AliESDtrack::GetOuterXYZPHOS(Double_t *xyz) const {
672b5f43 554 //---------------------------------------------------------------------
555 // This function returns the global track position
3fd96ae3 556 // af the radius of the PHOS
704be597 557 //---------------------------------------------------------------------
558 xyz[0]=xyz[1]=xyz[2]=0.;
3fd96ae3 559 if (fOx==0)
560 return;
561 Double_t phi=TMath::ATan2(fOp[0],fOx) + fOalpha;
562 Double_t r=TMath::Sqrt(fOx*fOx + fOp[0]*fOp[0]);
563 xyz[0]=r*TMath::Cos(phi); xyz[1]=r*TMath::Sin(phi); xyz[2]=fOp[1];
564}
565void AliESDtrack::GetOuterXYZEMCAL(Double_t *xyz) const {
566 //---------------------------------------------------------------------
567 // This function returns the global track position
568 // af the radius of the EMCAL
569 //---------------------------------------------------------------------
570 if (fXx==0)
571 return;
572 Double_t phi=TMath::ATan2(fXp[0],fOx) + fXalpha;
573 Double_t r=TMath::Sqrt(fXx*fXx + fXp[0]*fXp[0]);
574 xyz[0]=r*TMath::Cos(phi);
575 xyz[1]=r*TMath::Sin(phi);
576 xyz[2]=fXp[1];
577}
672b5f43 578
ae982df3 579//_______________________________________________________________________
ae982df3 580void AliESDtrack::GetIntegratedTimes(Double_t *times) const {
4427806c 581 // Returns the array with integrated times for each particle hypothesis
ae982df3 582 for (Int_t i=0; i<kSPECIES; i++) times[i]=fTrackTime[i];
583}
584
585//_______________________________________________________________________
586void AliESDtrack::SetIntegratedTimes(const Double_t *times) {
4427806c 587 // Sets the array with integrated times for each particle hypotesis
ae982df3 588 for (Int_t i=0; i<kSPECIES; i++) fTrackTime[i]=times[i];
589}
590
591//_______________________________________________________________________
4427806c 592void AliESDtrack::SetITSpid(const Double_t *p) {
593 // Sets values for the probability of each particle type (in ITS)
c630aafd 594 for (Int_t i=0; i<kSPECIES; i++) fITSr[i]=p[i];
595 SetStatus(AliESDtrack::kITSpid);
596}
597
babd135a 598void AliESDtrack::SetITSChi2MIP(const Float_t *chi2mip){
c4d11b15 599 for (Int_t i=0; i<12; i++) fITSchi2MIP[i]=chi2mip[i];
babd135a 600}
c630aafd 601//_______________________________________________________________________
602void AliESDtrack::GetITSpid(Double_t *p) const {
4427806c 603 // Gets the probability of each particle type (in ITS)
c630aafd 604 for (Int_t i=0; i<kSPECIES; i++) p[i]=fITSr[i];
605}
606
607//_______________________________________________________________________
ae982df3 608Int_t AliESDtrack::GetITSclusters(UInt_t *idx) const {
609 //---------------------------------------------------------------------
610 // This function returns indices of the assgined ITS clusters
611 //---------------------------------------------------------------------
612 for (Int_t i=0; i<fITSncls; i++) idx[i]=fITSindex[i];
613 return fITSncls;
614}
615
616//_______________________________________________________________________
05e445cd 617Int_t AliESDtrack::GetTPCclusters(Int_t *idx) const {
ae982df3 618 //---------------------------------------------------------------------
619 // This function returns indices of the assgined ITS clusters
620 //---------------------------------------------------------------------
d1420ddf 621 if (idx!=0)
622 for (Int_t i=0; i<180; i++) idx[i]=fTPCindex[i]; // MI I prefer some constant
ae982df3 623 return fTPCncls;
624}
8c6a71ab 625
626//_______________________________________________________________________
627void AliESDtrack::SetTPCpid(const Double_t *p) {
4427806c 628 // Sets values for the probability of each particle type (in TPC)
8c6a71ab 629 for (Int_t i=0; i<kSPECIES; i++) fTPCr[i]=p[i];
630 SetStatus(AliESDtrack::kTPCpid);
631}
632
633//_______________________________________________________________________
634void AliESDtrack::GetTPCpid(Double_t *p) const {
4427806c 635 // Gets the probability of each particle type (in TPC)
8c6a71ab 636 for (Int_t i=0; i<kSPECIES; i++) p[i]=fTPCr[i];
637}
638
639//_______________________________________________________________________
bb2ceb1f 640Int_t AliESDtrack::GetTRDclusters(UInt_t *idx) const {
641 //---------------------------------------------------------------------
642 // This function returns indices of the assgined TRD clusters
643 //---------------------------------------------------------------------
d1420ddf 644 if (idx!=0)
c4d11b15 645 for (Int_t i=0; i<130; i++) idx[i]=fTRDindex[i]; // MI I prefer some constant
bb2ceb1f 646 return fTRDncls;
647}
648
649//_______________________________________________________________________
c630aafd 650void AliESDtrack::SetTRDpid(const Double_t *p) {
4427806c 651 // Sets values for the probability of each particle type (in TRD)
c630aafd 652 for (Int_t i=0; i<kSPECIES; i++) fTRDr[i]=p[i];
653 SetStatus(AliESDtrack::kTRDpid);
654}
655
656//_______________________________________________________________________
657void AliESDtrack::GetTRDpid(Double_t *p) const {
4427806c 658 // Gets the probability of each particle type (in TRD)
c630aafd 659 for (Int_t i=0; i<kSPECIES; i++) p[i]=fTRDr[i];
660}
661
662//_______________________________________________________________________
79e94bf8 663void AliESDtrack::SetTRDpid(Int_t iSpecies, Float_t p)
664{
4427806c 665 // Sets the probability of particle type iSpecies to p (in TRD)
79e94bf8 666 fTRDr[iSpecies] = p;
667}
668
669Float_t AliESDtrack::GetTRDpid(Int_t iSpecies) const
670{
4427806c 671 // Returns the probability of particle type iSpecies (in TRD)
79e94bf8 672 return fTRDr[iSpecies];
673}
674
675//_______________________________________________________________________
c630aafd 676void AliESDtrack::SetTOFpid(const Double_t *p) {
4427806c 677 // Sets the probability of each particle type (in TOF)
c630aafd 678 for (Int_t i=0; i<kSPECIES; i++) fTOFr[i]=p[i];
679 SetStatus(AliESDtrack::kTOFpid);
680}
681
682//_______________________________________________________________________
683void AliESDtrack::GetTOFpid(Double_t *p) const {
4427806c 684 // Gets probabilities of each particle type (in TOF)
c630aafd 685 for (Int_t i=0; i<kSPECIES; i++) p[i]=fTOFr[i];
686}
687
4a78b8c5 688
689
690//_______________________________________________________________________
691void AliESDtrack::SetPHOSpid(const Double_t *p) {
692 // Sets the probability of each particle type (in PHOS)
ac2f7574 693 for (Int_t i=0; i<kSPECIESN; i++) fPHOSr[i]=p[i];
4a78b8c5 694 SetStatus(AliESDtrack::kPHOSpid);
695}
696
697//_______________________________________________________________________
698void AliESDtrack::GetPHOSpid(Double_t *p) const {
699 // Gets probabilities of each particle type (in PHOS)
ac2f7574 700 for (Int_t i=0; i<kSPECIESN; i++) p[i]=fPHOSr[i];
4a78b8c5 701}
702
704be597 703//_______________________________________________________________________
704void AliESDtrack::SetEMCALpid(const Double_t *p) {
705 // Sets the probability of each particle type (in EMCAL)
706 for (Int_t i=0; i<kSPECIESN; i++) fEMCALr[i]=p[i];
707 SetStatus(AliESDtrack::kEMCALpid);
708}
709
710//_______________________________________________________________________
711void AliESDtrack::GetEMCALpid(Double_t *p) const {
712 // Gets probabilities of each particle type (in EMCAL)
713 for (Int_t i=0; i<kSPECIESN; i++) p[i]=fEMCALr[i];
714}
4a78b8c5 715
716//_______________________________________________________________________
717void AliESDtrack::SetRICHpid(const Double_t *p) {
718 // Sets the probability of each particle type (in RICH)
719 for (Int_t i=0; i<kSPECIES; i++) fRICHr[i]=p[i];
720 SetStatus(AliESDtrack::kRICHpid);
721}
722
723//_______________________________________________________________________
724void AliESDtrack::GetRICHpid(Double_t *p) const {
725 // Gets probabilities of each particle type (in RICH)
726 for (Int_t i=0; i<kSPECIES; i++) p[i]=fRICHr[i];
727}
728
729
730
c630aafd 731//_______________________________________________________________________
8c6a71ab 732void AliESDtrack::SetESDpid(const Double_t *p) {
4427806c 733 // Sets the probability of each particle type for the ESD track
8c6a71ab 734 for (Int_t i=0; i<kSPECIES; i++) fR[i]=p[i];
735 SetStatus(AliESDtrack::kESDpid);
736}
737
738//_______________________________________________________________________
739void AliESDtrack::GetESDpid(Double_t *p) const {
4427806c 740 // Gets probability of each particle type for the ESD track
8c6a71ab 741 for (Int_t i=0; i<kSPECIES; i++) p[i]=fR[i];
742}
743
ac2f7574 744//_______________________________________________________________________
745void AliESDtrack::Print(Option_t *) const {
746 // Prints info on the track
747
748 Info("Print","Track info") ;
749 Double_t p[kSPECIESN] ;
750 Int_t index = 0 ;
751 if( IsOn(kITSpid) ){
752 printf("From ITS: ") ;
753 GetITSpid(p) ;
754 for(index = 0 ; index < kSPECIES; index++)
755 printf("%f, ", p[index]) ;
756 printf("\n signal = %f\n", GetITSsignal()) ;
757 }
758 if( IsOn(kTPCpid) ){
759 printf("From TPC: ") ;
760 GetTPCpid(p) ;
761 for(index = 0 ; index < kSPECIES; index++)
762 printf("%f, ", p[index]) ;
763 printf("\n signal = %f\n", GetTPCsignal()) ;
764 }
765 if( IsOn(kTRDpid) ){
766 printf("From TRD: ") ;
767 GetTRDpid(p) ;
768 for(index = 0 ; index < kSPECIES; index++)
769 printf("%f, ", p[index]) ;
770 printf("\n signal = %f\n", GetTRDsignal()) ;
771 }
772 if( IsOn(kTOFpid) ){
773 printf("From TOF: ") ;
774 GetTOFpid(p) ;
775 for(index = 0 ; index < kSPECIES; index++)
776 printf("%f, ", p[index]) ;
777 printf("\n signal = %f\n", GetTOFsignal()) ;
778 }
779 if( IsOn(kRICHpid) ){
780 printf("From TOF: ") ;
781 GetRICHpid(p) ;
782 for(index = 0 ; index < kSPECIES; index++)
783 printf("%f, ", p[index]) ;
784 printf("\n signal = %f\n", GetRICHsignal()) ;
785 }
786 if( IsOn(kPHOSpid) ){
787 printf("From PHOS: ") ;
788 GetPHOSpid(p) ;
789 for(index = 0 ; index < kSPECIESN; index++)
790 printf("%f, ", p[index]) ;
791 printf("\n signal = %f\n", GetPHOSsignal()) ;
792 }
704be597 793 if( IsOn(kEMCALpid) ){
794 printf("From EMCAL: ") ;
795 GetEMCALpid(p) ;
796 for(index = 0 ; index < kSPECIESN; index++)
797 printf("%f, ", p[index]) ;
798 printf("\n signal = %f\n", GetEMCALsignal()) ;
799 }
ac2f7574 800}