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