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