1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictly for non-commercial purposes is hereby granted *
9 * without fee, provided that the above copyright notice appears in all *
10 * copies and that both the copyright notice and this permission notice *
11 * appear in the supporting documentation. The authors make no claims *
12 * about the suitability of this software for any purpose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
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 //-----------------------------------------------------------------
25 #include "AliESDtrack.h"
26 #include "AliKalmanTrack.h"
31 //_______________________________________________________________________
32 AliESDtrack::AliESDtrack() :
58 fTPCClusterMap(159),//number of padrows
83 // The default ESD constructor
85 for (Int_t i=0; i<AliPID::kSPECIES; i++) {
95 for (Int_t i=0; i<AliPID::kSPECIESN; i++) {
101 fPHOSpos[0]=fPHOSpos[1]=fPHOSpos[2]=0.;
102 fEMCALpos[0]=fEMCALpos[1]=fEMCALpos[2]=0.;
104 for (i=0; i<5; i++) {
105 fRp[i]=fCp[i]=fIp[i]=fTp[i]=0.;
107 for (i=0; i<15; i++) {
108 fRc[i]=fCc[i]=fIc[i]=fTc[i]=0.;
110 for (i=0; i<6; i++) { fITSindex[i]=0; }
111 for (i=0; i<180; i++){ fTPCindex[i]=0; }
112 for (i=0; i<3;i++) { fKinkIndexes[i]=0;}
113 for (i=0; i<3;i++) { fV0Indexes[i]=-1;}
114 for (i=0; i<130; i++) { fTRDindex[i]=0; }
115 for (i=0;i<kNPlane;i++) {fTRDsignals[i]=0.; fTRDTimBin[i]=-1;}
116 for (Int_t i=0;i<4;i++) {fTPCPoints[i]=-1;}
117 for (Int_t i=0;i<3;i++) {fTOFLabel[i]=-1;}
118 for (Int_t i=0;i<10;i++) {fTOFInfo[i]=-1;}
127 //_______________________________________________________________________
128 AliESDtrack::AliESDtrack(const AliESDtrack& track):
130 fFlags(track.fFlags),
131 fLabel(track.fLabel),
133 fTrackLength(track.fTrackLength),
136 fStopVertex(track.fStopVertex),
137 fRalpha(track.fRalpha),
139 fCalpha(track.fCalpha),
141 fCchi2(track.fCchi2),
142 fIalpha(track.fIalpha),
144 fTalpha(track.fTalpha),
146 fITSchi2(track.fITSchi2),
147 fITSncls(track.fITSncls),
148 fITSsignal(track.fITSsignal),
149 fITSLabel(track.fITSLabel),
150 fITSFakeRatio(track.fITSFakeRatio),
151 fITStrack(0), //coping separatelly - in user code
152 fTPCchi2(track.fTPCchi2),
153 fTPCncls(track.fTPCncls),
154 fTPCClusterMap(track.fTPCClusterMap),
155 fTPCsignal(track.fTPCsignal),
156 fTPCLabel(track.fTPCLabel),
157 fTRDchi2(track.fTRDchi2),
158 fTRDncls(track.fTRDncls),
159 fTRDncls0(track.fTRDncls0),
160 fTRDsignal(track.fTRDsignal),
161 fTRDLabel(track.fTRDLabel),
162 fTRDQuality(track.fTRDQuality),
164 fTOFchi2(track.fTOFchi2),
165 fTOFindex(track.fTOFindex),
166 fTOFsignal(track.fTOFsignal),
167 fPHOSsignal(track.fPHOSsignal),
168 fEMCALsignal(track.fEMCALsignal),
169 fRICHchi2(track.fRICHchi2),
170 fRICHncls(track.fRICHncls),
171 fRICHindex(track.fRICHindex),
172 fRICHsignal(track.fRICHsignal),
173 fRICHtheta(track.fRICHtheta),
174 fRICHphi(track.fRICHphi),
175 fRICHdx(track.fRICHdx),
176 fRICHdy(track.fRICHdy)
181 for (Int_t i=0;i<AliPID::kSPECIES;i++) fTrackTime[i] =track.fTrackTime[i];
182 for (Int_t i=0;i<AliPID::kSPECIES;i++) fR[i] =track.fR[i];
184 for (Int_t i=0;i<5;i++) fRp[i] =track.fRp[i];
185 for (Int_t i=0;i<15;i++) fRc[i] =track.fRc[i];
187 for (Int_t i=0;i<5;i++) fCp[i] =track.fCp[i];
188 for (Int_t i=0;i<15;i++) fCc[i] =track.fCc[i];
190 for (Int_t i=0;i<5;i++) fIp[i] =track.fIp[i];
191 for (Int_t i=0;i<15;i++) fIc[i] =track.fIc[i];
193 for (Int_t i=0;i<5;i++) fTp[i] =track.fTp[i];
194 for (Int_t i=0;i<15;i++) fTc[i] =track.fTc[i];
196 for (Int_t i=0;i<12;i++) fITSchi2MIP[i] =track.fITSchi2MIP[i];
197 for (Int_t i=0;i<6;i++) fITSindex[i]=track.fITSindex[i];
198 for (Int_t i=0;i<AliPID::kSPECIES;i++) fITSr[i]=track.fITSr[i];
200 for (Int_t i=0;i<180;i++) fTPCindex[i]=track.fTPCindex[i];
201 for (Int_t i=0;i<AliPID::kSPECIES;i++) fTPCr[i]=track.fTPCr[i];
202 for (Int_t i=0;i<4;i++) {fTPCPoints[i]=track.fTPCPoints[i];}
203 for (Int_t i=0; i<3;i++) { fKinkIndexes[i]=track.fKinkIndexes[i];}
204 for (Int_t i=0; i<3;i++) { fV0Indexes[i]=track.fV0Indexes[i];}
206 for (Int_t i=0;i<130;i++) fTRDindex[i]=track.fTRDindex[i];
207 for (Int_t i=0;i<kNPlane;i++) {
208 fTRDsignals[i]=track.fTRDsignals[i];
209 fTRDTimBin[i]=track.fTRDTimBin[i];
211 for (Int_t i=0;i<AliPID::kSPECIES;i++) fTRDr[i]=track.fTRDr[i];
213 for (Int_t i=0;i<AliPID::kSPECIES;i++) fTOFr[i]=track.fTOFr[i];
214 for (Int_t i=0;i<3;i++) fTOFLabel[i]=track.fTOFLabel[i];
215 for (Int_t i=0;i<10;i++) fTOFInfo[i]=track.fTOFInfo[i];
217 for (Int_t i=0;i<3;i++) fPHOSpos[i]=track.fPHOSpos[i];
218 for (Int_t i=0;i<AliPID::kSPECIESN;i++) fPHOSr[i]=track.fPHOSr[i];
220 for (Int_t i=0;i<3;i++) fEMCALpos[i]=track.fEMCALpos[i];
221 for (Int_t i=0;i<AliPID::kSPECIESN;i++) fEMCALr[i]=track.fEMCALr[i];
223 for (Int_t i=0;i<AliPID::kSPECIES;i++) fRICHr[i]=track.fRICHr[i];
225 //_______________________________________________________________________
226 AliESDtrack::~AliESDtrack(){
228 // This is destructor according Coding Conventrions
230 //printf("Delete track\n");
235 //_______________________________________________________________________
236 void AliESDtrack::MakeMiniESDtrack(){
237 // Resets everything except
238 // fFlags: Reconstruction status flags
239 // fLabel: Track label
240 // fID: Unique ID of the track
241 // fD: Impact parameter in XY-plane
242 // fZ: Impact parameter in Z
243 // fR[AliPID::kSPECIES]: combined "detector response probability"
244 // Running track parameters
245 // fRalpha: track rotation angle
246 // fRx: X-coordinate of the track reference plane
247 // fRp[5]: external track parameters
248 // fRc[15]: external cov. matrix of the track parameters
251 for (Int_t i=0;i<AliPID::kSPECIES;i++) fTrackTime[i] = 0;
254 // Reset track parameters constrained to the primary vertex
257 for (Int_t i=0;i<5;i++) fCp[i] = 0;
258 for (Int_t i=0;i<15;i++) fCc[i] = 0;
261 // Reset track parameters at the inner wall of TPC
264 for (Int_t i=0;i<5;i++) fIp[i] = 0;
265 for (Int_t i=0;i<15;i++) fIc[i] = 0;
267 // Reset track parameters at the inner wall of the TRD
270 for (Int_t i=0;i<5;i++) fTp[i] = 0;
271 for (Int_t i=0;i<15;i++) fTc[i] = 0;
273 // Reset ITS track related information
275 for (Int_t i=0;i<12;i++) fITSchi2MIP[i] = 0;
277 for (Int_t i=0;i<6;i++) fITSindex[i]= 0;
279 for (Int_t i=0;i<AliPID::kSPECIES;i++) fITSr[i]= 0;
284 // Reset TPC related track information
287 for (Int_t i=0;i<180;i++) fTPCindex[i] = 0;
290 for (Int_t i=0;i<AliPID::kSPECIES;i++) fTPCr[i]=0;
292 for (Int_t i=0;i<4;i++) fTPCPoints[i] = 0;
293 for (Int_t i=0; i<3;i++) fKinkIndexes[i] = 0;
294 for (Int_t i=0; i<3;i++) fV0Indexes[i] = 0;
296 // Reset TRD related track information
300 for (Int_t i=0;i<130;i++) fTRDindex[i] = 0;
302 for (Int_t i=0;i<kNPlane;i++) {
306 for (Int_t i=0;i<AliPID::kSPECIES;i++) fTRDr[i] = 0;
311 // Reset TOF related track information
315 for (Int_t i=0;i<AliPID::kSPECIES;i++) fTOFr[i] = 0;
316 for (Int_t i=0;i<3;i++) fTOFLabel[i] = 0;
317 for (Int_t i=0;i<10;i++) fTOFInfo[i] = 0;
319 // Reset PHOS related track information
320 for (Int_t i=0;i<3;i++) fPHOSpos[i] = 0;
322 for (Int_t i=0;i<AliPID::kSPECIESN;i++) fPHOSr[i] = 0;
324 // Reset EMCAL related track information
325 for (Int_t i=0;i<3;i++) fEMCALpos[i] = 0;
327 for (Int_t i=0;i<AliPID::kSPECIESN;i++) fEMCALr[i] = 0;
329 // Reset RICH related track information
334 for (Int_t i=0;i<AliPID::kSPECIES;i++) fRICHr[i] = 0;
341 //_______________________________________________________________________
342 Double_t AliESDtrack::GetMass() const {
343 // Returns the mass of the most probable particle type
346 for (Int_t i=0; i<AliPID::kSPECIES; i++) {
347 if (fR[i]>max) {k=i; max=fR[i];}
349 if (k==0) { // dE/dx "crossing points" in the TPC
351 if ((p>0.38)&&(p<0.48))
352 if (fR[0]<fR[3]*10.) return AliPID::ParticleMass(AliPID::kKaon);
353 if ((p>0.75)&&(p<0.85))
354 if (fR[0]<fR[4]*10.) return AliPID::ParticleMass(AliPID::kProton);
357 if (k==1) return AliPID::ParticleMass(AliPID::kMuon);
358 if (k==2||k==-1) return AliPID::ParticleMass(AliPID::kPion);
359 if (k==3) return AliPID::ParticleMass(AliPID::kKaon);
360 if (k==4) return AliPID::ParticleMass(AliPID::kProton);
361 AliWarning("Undefined mass !");
362 return AliPID::ParticleMass(AliPID::kPion);
365 //_______________________________________________________________________
366 Bool_t AliESDtrack::UpdateTrackParams(const AliKalmanTrack *t, ULong_t flags) {
368 // This function updates track's running parameters
373 fLabel=t->GetLabel();
375 if (t->IsStartedTimeIntegral()) {
377 Double_t times[10];t->GetIntegratedTimes(times); SetIntegratedTimes(times);
378 SetIntegratedLength(t->GetIntegratedLength());
381 fRalpha=t->GetAlpha();
382 t->GetExternalParameters(fRx,fRp);
383 t->GetExternalCovariance(fRc);
387 case kITSin: case kITSout: case kITSrefit:
388 fITSncls=t->GetNumberOfClusters();
389 fITSchi2=t->GetChi2();
390 for (Int_t i=0;i<fITSncls;i++) fITSindex[i]=t->GetClusterIndex(i);
391 fITSsignal=t->GetPIDsignal();
392 fITSLabel = t->GetLabel();
393 fITSFakeRatio = t->GetFakeRatio();
396 case kTPCin: case kTPCrefit:
397 fTPCLabel = t->GetLabel();
402 for (i=0; i<5; i++) fIp[i]=fRp[i];
403 for (i=0; i<15;i++) fIc[i]=fRc[i];
407 fTPCncls=t->GetNumberOfClusters();
408 fTPCchi2=t->GetChi2();
410 {//prevrow must be declared in separate namespace, otherwise compiler cries:
411 //"jump to case label crosses initialization of `Int_t prevrow'"
413 // for (Int_t i=0;i<fTPCncls;i++)
414 for (Int_t i=0;i<160;i++)
416 fTPCindex[i]=t->GetClusterIndex(i);
418 // Piotr's Cluster Map for HBT
419 // ### please change accordingly if cluster array is changing
420 // to "New TPC Tracking" style (with gaps in array)
421 Int_t idx = fTPCindex[i];
422 Int_t sect = (idx&0xff000000)>>24;
423 Int_t row = (idx&0x00ff0000)>>16;
424 if (sect > 18) row +=63; //if it is outer sector, add number of inner sectors
426 fTPCClusterMap.SetBitNumber(row,kTRUE);
428 //Fill the gap between previous row and this row with 0 bits
429 //In case ### pleas change it as well - just set bit 0 in case there
430 //is no associated clusters for current "i"
433 prevrow = row;//if previous bit was not assigned yet == this is the first one
436 { //we don't know the order (inner to outer or reverse)
437 //just to be save in case it is going to change
450 for (Int_t j = n+1; j < m; j++)
452 fTPCClusterMap.SetBitNumber(j,kFALSE);
456 // End Of Piotr's Cluster Map for HBT
459 fTPCsignal=t->GetPIDsignal();
460 {Double_t mass=t->GetMass(); // preliminary mass setting
461 if (mass>0.5) fR[4]=1.; // used by
462 else if (mass<0.4) fR[2]=1.; // the ITS reconstruction
467 case kTRDout: case kTRDin: case kTRDrefit:
468 fTRDLabel = t->GetLabel();
469 fTRDncls=t->GetNumberOfClusters();
470 fTRDchi2=t->GetChi2();
471 for (Int_t i=0;i<fTRDncls;i++) fTRDindex[i]=t->GetClusterIndex(i);
472 fTRDsignal=t->GetPIDsignal();
475 t->GetExternalParameters(fTx,fTp);
476 t->GetExternalCovariance(fTc);
477 fTalpha = t->GetAlpha();
478 fTRDncls0 = t->GetNumberOfClusters();
487 AliError("Wrong flag !");
494 //_______________________________________________________________________
496 AliESDtrack::SetConstrainedTrackParams(const AliKalmanTrack *t, Double_t chi2) {
498 // This function sets the constrained track parameters
502 fCalpha=t->GetAlpha();
503 t->GetExternalParameters(x,buf); fCx=x;
504 for (i=0; i<5; i++) fCp[i]=buf[i];
505 t->GetExternalCovariance(buf);
506 for (i=0; i<15; i++) fCc[i]=buf[i];
511 //_______________________________________________________________________
512 void AliESDtrack::GetExternalParameters(Double_t &x, Double_t p[5]) const {
513 //---------------------------------------------------------------------
514 // This function returns external representation of the track parameters
515 //---------------------------------------------------------------------
517 for (Int_t i=0; i<5; i++) p[i]=fRp[i];
520 //_______________________________________________________________________
522 GetExternalParametersAt(Double_t x, Double_t b, Double_t p[5]) const {
523 //---------------------------------------------------------------------
524 // This function returns external track parameters extrapolated to
525 // the radial position "x" (cm) in the magnetic field "b" (kG)
526 //---------------------------------------------------------------------
527 Double_t convconst=0.299792458*b/1000.;
529 Double_t f1=fRp[2], f2=f1 + dx*fRp[4]*convconst;
531 if (TMath::Abs(f2) >= 0.9999) return kFALSE;
533 Double_t r1=TMath::Sqrt(1.- f1*f1), r2=TMath::Sqrt(1.- f2*f2);
534 p[0] = fRp[0] + dx*(f1+f2)/(r1+r2);
535 p[1] = fRp[1] + dx*(f1+f2)/(f1*r2 + f2*r1)*fRp[3];
543 //_______________________________________________________________________
544 void AliESDtrack::GetExternalCovariance(Double_t cov[15]) const {
545 //---------------------------------------------------------------------
546 // This function returns external representation of the cov. matrix
547 //---------------------------------------------------------------------
548 for (Int_t i=0; i<15; i++) cov[i]=fRc[i];
552 //_______________________________________________________________________
554 AliESDtrack::GetConstrainedExternalParameters(Double_t &x, Double_t p[5])const{
555 //---------------------------------------------------------------------
556 // This function returns the constrained external track parameters
557 //---------------------------------------------------------------------
559 for (Int_t i=0; i<5; i++) p[i]=fCp[i];
561 //_______________________________________________________________________
563 AliESDtrack::GetConstrainedExternalCovariance(Double_t c[15]) const {
564 //---------------------------------------------------------------------
565 // This function returns the constrained external cov. matrix
566 //---------------------------------------------------------------------
567 for (Int_t i=0; i<15; i++) c[i]=fCc[i];
571 Double_t AliESDtrack::GetP() const {
572 //---------------------------------------------------------------------
573 // This function returns the track momentum
574 // Results for (nearly) straight tracks are meaningless !
575 //---------------------------------------------------------------------
576 if (TMath::Abs(fRp[4])<=0) return 0;
577 Double_t pt=1./TMath::Abs(fRp[4]);
578 return pt*TMath::Sqrt(1.+ fRp[3]*fRp[3]);
581 //_______________________________________________________________________
582 Double_t AliESDtrack::GetD(Double_t b, Double_t x, Double_t y) const {
583 //------------------------------------------------------------------
584 // This function calculates the transverse impact parameter
585 // with respect to a point with global coordinates (x,y)
586 // in the magnetic field "b" (kG)
587 //------------------------------------------------------------------
588 Double_t convconst=0.299792458*b/1000.;
589 Double_t rp4=fRp[4]*convconst;
591 Double_t xt=fRx, yt=fRp[0];
593 Double_t sn=TMath::Sin(fRalpha), cs=TMath::Cos(fRalpha);
594 Double_t a = x*cs + y*sn;
595 y = -x*sn + y*cs; x=a;
598 sn=rp4*xt - fRp[2]; cs=rp4*yt + TMath::Sqrt(1.- fRp[2]*fRp[2]);
599 a=2*(xt*fRp[2] - yt*TMath::Sqrt(1.- fRp[2]*fRp[2]))-rp4*(xt*xt + yt*yt);
601 return a/(1 + TMath::Sqrt(sn*sn + cs*cs));
604 Bool_t Local2GlobalMomentum(Double_t p[3],Double_t alpha) {
605 //----------------------------------------------------------------
606 // This function performs local->global transformation of the
608 // When called, the arguments are:
609 // p[0] = 1/pt of the track;
610 // p[1] = sine of local azim. angle of the track momentum;
611 // p[2] = tangent of the track momentum dip angle;
612 // alpha - rotation angle.
613 // The result is returned as:
617 // Results for (nearly) straight tracks are meaningless !
618 //----------------------------------------------------------------
619 if (TMath::Abs(p[0])<=0) return kFALSE;
620 if (TMath::Abs(p[1])> 0.999999) return kFALSE;
622 Double_t pt=1./TMath::Abs(p[0]);
623 Double_t cs=TMath::Cos(alpha), sn=TMath::Sin(alpha);
624 Double_t r=TMath::Sqrt(1 - p[1]*p[1]);
625 p[0]=pt*(r*cs - p[1]*sn); p[1]=pt*(p[1]*cs + r*sn); p[2]=pt*p[2];
630 Bool_t Local2GlobalPosition(Double_t r[3],Double_t alpha) {
631 //----------------------------------------------------------------
632 // This function performs local->global transformation of the
634 // When called, the arguments are:
638 // alpha - rotation angle.
639 // The result is returned as:
643 //----------------------------------------------------------------
644 Double_t cs=TMath::Cos(alpha), sn=TMath::Sin(alpha), x=r[0];
645 r[0]=x*cs - r[1]*sn; r[1]=x*sn + r[1]*cs;
650 Bool_t AliESDtrack::GetConstrainedPxPyPz(Double_t *p) const {
651 //---------------------------------------------------------------------
652 // This function returns the constrained global track momentum components
653 // Results for (nearly) straight tracks are meaningless !
654 //---------------------------------------------------------------------
655 p[0]=fCp[4]; p[1]=fCp[2]; p[2]=fCp[3];
656 return Local2GlobalMomentum(p,fCalpha);
659 Bool_t AliESDtrack::GetConstrainedXYZ(Double_t *r) const {
660 //---------------------------------------------------------------------
661 // This function returns the constrained global track position
662 //---------------------------------------------------------------------
663 r[0]=fCx; r[1]=fCp[0]; r[2]=fCp[1];
664 return Local2GlobalPosition(r,fCalpha);
667 Bool_t AliESDtrack::GetPxPyPz(Double_t *p) const {
668 //---------------------------------------------------------------------
669 // This function returns the global track momentum components
670 // Results for (nearly) straight tracks are meaningless !
671 //---------------------------------------------------------------------
672 p[0]=fRp[4]; p[1]=fRp[2]; p[2]=fRp[3];
673 return Local2GlobalMomentum(p,fRalpha);
676 Bool_t AliESDtrack::GetXYZ(Double_t *r) const {
677 //---------------------------------------------------------------------
678 // This function returns the global track position
679 //---------------------------------------------------------------------
680 r[0]=fRx; r[1]=fRp[0]; r[2]=fRp[1];
681 return Local2GlobalPosition(r,fRalpha);
684 void AliESDtrack::GetCovariance(Double_t cv[21]) const {
685 //---------------------------------------------------------------------
686 // This function returns the global covariance matrix of the track params
688 // Cov(x,x) ... : cv[0]
689 // Cov(y,x) ... : cv[1] cv[2]
690 // Cov(z,x) ... : cv[3] cv[4] cv[5]
691 // Cov(px,x)... : cv[6] cv[7] cv[8] cv[9]
692 // Cov(py,x)... : cv[10] cv[11] cv[12] cv[13] cv[14]
693 // Cov(pz,x)... : cv[15] cv[16] cv[17] cv[18] cv[19] cv[20]
695 // Results for (nearly) straight tracks are meaningless !
696 //---------------------------------------------------------------------
697 if (TMath::Abs(fRp[4])<=0) {
698 for (Int_t i=0; i<21; i++) cv[i]=0.;
701 if (TMath::Abs(fRp[2]) > 0.999999) {
702 for (Int_t i=0; i<21; i++) cv[i]=0.;
705 Double_t pt=1./TMath::Abs(fRp[4]);
706 Double_t cs=TMath::Cos(fRalpha), sn=TMath::Sin(fRalpha);
707 Double_t r=TMath::Sqrt(1-fRp[2]*fRp[2]);
709 Double_t m00=-sn, m10=cs;
710 Double_t m23=-pt*(sn + fRp[2]*cs/r), m43=-pt*pt*(r*cs - fRp[2]*sn);
711 Double_t m24= pt*(cs - fRp[2]*sn/r), m44=-pt*pt*(r*sn + fRp[2]*cs);
712 Double_t m35=pt, m45=-pt*pt*fRp[3];
714 cv[0]=fRc[0]*m00*m00;
715 cv[1]=fRc[0]*m00*m10;
716 cv[2]=fRc[0]*m10*m10;
720 cv[6]=m00*(fRc[3]*m23+fRc[10]*m43);
721 cv[7]=m10*(fRc[3]*m23+fRc[10]*m43);
722 cv[8]=fRc[4]*m23+fRc[11]*m43;
723 cv[9]=m23*(fRc[5]*m23+fRc[12]*m43)+m43*(fRc[12]*m23+fRc[14]*m43);
724 cv[10]=m00*(fRc[3]*m24+fRc[10]*m44);
725 cv[11]=m10*(fRc[3]*m24+fRc[10]*m44);
726 cv[12]=fRc[4]*m24+fRc[11]*m44;
727 cv[13]=m23*(fRc[5]*m24+fRc[12]*m44)+m43*(fRc[12]*m24+fRc[14]*m44);
728 cv[14]=m24*(fRc[5]*m24+fRc[12]*m44)+m44*(fRc[12]*m24+fRc[14]*m44);
729 cv[15]=m00*(fRc[6]*m35+fRc[10]*m45);
730 cv[16]=m10*(fRc[6]*m35+fRc[10]*m45);
731 cv[17]=fRc[7]*m35+fRc[11]*m45;
732 cv[18]=m23*(fRc[8]*m35+fRc[12]*m45)+m43*(fRc[13]*m35+fRc[14]*m45);
733 cv[19]=m24*(fRc[8]*m35+fRc[12]*m45)+m44*(fRc[13]*m35+fRc[14]*m45);
734 cv[20]=m35*(fRc[9]*m35+fRc[13]*m45)+m45*(fRc[13]*m35+fRc[14]*m45);
737 Bool_t AliESDtrack::GetInnerPxPyPz(Double_t *p) const {
738 //---------------------------------------------------------------------
739 // This function returns the global track momentum components
740 // af the entrance of the TPC
741 //---------------------------------------------------------------------
742 p[0]=fIp[4]; p[1]=fIp[2]; p[2]=fIp[3];
743 return Local2GlobalMomentum(p,fIalpha);
746 Bool_t AliESDtrack::GetInnerXYZ(Double_t *r) const {
747 //---------------------------------------------------------------------
748 // This function returns the global track position
749 // af the entrance of the TPC
750 //---------------------------------------------------------------------
751 if (fIx==0) return kFALSE;
752 r[0]=fIx; r[1]=fIp[0]; r[2]=fIp[1];
753 return Local2GlobalPosition(r,fIalpha);
756 void AliESDtrack::GetInnerExternalParameters(Double_t &x, Double_t p[5]) const
759 //---------------------------------------------------------------------
760 // This function returns external representation of the track parameters at Inner Layer of TPC
761 //---------------------------------------------------------------------
763 for (Int_t i=0; i<5; i++) p[i]=fIp[i];
765 void AliESDtrack::GetInnerExternalCovariance(Double_t cov[15]) const
768 //---------------------------------------------------------------------
769 // This function returns external representation of the cov. matrix at Inner Layer of TPC
770 //---------------------------------------------------------------------
771 for (Int_t i=0; i<15; i++) cov[i]=fIc[i];
775 void AliESDtrack::GetTRDExternalParameters(Double_t &x, Double_t&alpha, Double_t p[5], Double_t cov[15]) const
778 //this function returns TRD parameters
782 for (Int_t i=0; i<5; i++) p[i]=fTp[i];
783 for (Int_t i=0; i<15; i++) cov[i]=fTc[i];
786 Bool_t AliESDtrack::GetPxPyPzAt(Double_t x, Double_t b, Double_t *p) const {
787 //---------------------------------------------------------------------
788 // This function returns the global track momentum extrapolated to
789 // the radial position "x" (cm) in the magnetic field "b" (kG)
790 //---------------------------------------------------------------------
791 Double_t convconst=0.299792458*b/1000.;
793 p[1]=fRp[2]+(x-fRx)*fRp[4]*convconst;
795 return Local2GlobalMomentum(p,fRalpha);
798 Bool_t AliESDtrack::GetXYZAt(Double_t x, Double_t b, Double_t *r) const {
799 //---------------------------------------------------------------------
800 // This function returns the global track position extrapolated to
801 // the radial position "x" (cm) in the magnetic field "b" (kG)
802 //---------------------------------------------------------------------
803 Double_t convconst=0.299792458*b/1000.;
805 Double_t f1=fRp[2], f2=f1 + dx*fRp[4]*convconst;
807 if (TMath::Abs(f2) >= 0.9999) return kFALSE;
809 Double_t r1=TMath::Sqrt(1.- f1*f1), r2=TMath::Sqrt(1.- f2*f2);
811 r[1] = fRp[0] + dx*(f1+f2)/(r1+r2);
812 r[2] = fRp[1] + dx*(f1+f2)/(f1*r2 + f2*r1)*fRp[3];
813 return Local2GlobalPosition(r,fRalpha);
816 //_______________________________________________________________________
817 void AliESDtrack::GetIntegratedTimes(Double_t *times) const {
818 // Returns the array with integrated times for each particle hypothesis
819 for (Int_t i=0; i<AliPID::kSPECIES; i++) times[i]=fTrackTime[i];
822 //_______________________________________________________________________
823 void AliESDtrack::SetIntegratedTimes(const Double_t *times) {
824 // Sets the array with integrated times for each particle hypotesis
825 for (Int_t i=0; i<AliPID::kSPECIES; i++) fTrackTime[i]=times[i];
828 //_______________________________________________________________________
829 void AliESDtrack::SetITSpid(const Double_t *p) {
830 // Sets values for the probability of each particle type (in ITS)
831 for (Int_t i=0; i<AliPID::kSPECIES; i++) fITSr[i]=p[i];
832 SetStatus(AliESDtrack::kITSpid);
835 void AliESDtrack::SetITSChi2MIP(const Float_t *chi2mip){
836 for (Int_t i=0; i<12; i++) fITSchi2MIP[i]=chi2mip[i];
838 //_______________________________________________________________________
839 void AliESDtrack::GetITSpid(Double_t *p) const {
840 // Gets the probability of each particle type (in ITS)
841 for (Int_t i=0; i<AliPID::kSPECIES; i++) p[i]=fITSr[i];
844 //_______________________________________________________________________
845 Int_t AliESDtrack::GetITSclusters(UInt_t *idx) const {
846 //---------------------------------------------------------------------
847 // This function returns indices of the assgined ITS clusters
848 //---------------------------------------------------------------------
849 for (Int_t i=0; i<fITSncls; i++) idx[i]=fITSindex[i];
853 //_______________________________________________________________________
854 Int_t AliESDtrack::GetTPCclusters(Int_t *idx) const {
855 //---------------------------------------------------------------------
856 // This function returns indices of the assgined ITS clusters
857 //---------------------------------------------------------------------
859 for (Int_t i=0; i<180; i++) idx[i]=fTPCindex[i]; // MI I prefer some constant
863 Float_t AliESDtrack::GetTPCdensity(Int_t row0, Int_t row1) const{
865 // GetDensity of the clusters on given region between row0 and row1
866 // Dead zone effect takin into acoount
871 for (Int_t i=row0;i<=row1;i++){
872 Int_t index = fTPCindex[i];
873 if (index!=-1) good++; // track outside of dead zone
874 if (index>0) found++;
877 if (good>(row1-row0)*0.5) density = Float_t(found)/Float_t(good);
881 //_______________________________________________________________________
882 void AliESDtrack::SetTPCpid(const Double_t *p) {
883 // Sets values for the probability of each particle type (in TPC)
884 for (Int_t i=0; i<AliPID::kSPECIES; i++) fTPCr[i]=p[i];
885 SetStatus(AliESDtrack::kTPCpid);
888 //_______________________________________________________________________
889 void AliESDtrack::GetTPCpid(Double_t *p) const {
890 // Gets the probability of each particle type (in TPC)
891 for (Int_t i=0; i<AliPID::kSPECIES; i++) p[i]=fTPCr[i];
894 //_______________________________________________________________________
895 Int_t AliESDtrack::GetTRDclusters(UInt_t *idx) const {
896 //---------------------------------------------------------------------
897 // This function returns indices of the assgined TRD clusters
898 //---------------------------------------------------------------------
900 for (Int_t i=0; i<130; i++) idx[i]=fTRDindex[i]; // MI I prefer some constant
904 //_______________________________________________________________________
905 void AliESDtrack::SetTRDpid(const Double_t *p) {
906 // Sets values for the probability of each particle type (in TRD)
907 for (Int_t i=0; i<AliPID::kSPECIES; i++) fTRDr[i]=p[i];
908 SetStatus(AliESDtrack::kTRDpid);
911 //_______________________________________________________________________
912 void AliESDtrack::GetTRDpid(Double_t *p) const {
913 // Gets the probability of each particle type (in TRD)
914 for (Int_t i=0; i<AliPID::kSPECIES; i++) p[i]=fTRDr[i];
917 //_______________________________________________________________________
918 void AliESDtrack::SetTRDpid(Int_t iSpecies, Float_t p)
920 // Sets the probability of particle type iSpecies to p (in TRD)
924 Float_t AliESDtrack::GetTRDpid(Int_t iSpecies) const
926 // Returns the probability of particle type iSpecies (in TRD)
927 return fTRDr[iSpecies];
930 //_______________________________________________________________________
931 void AliESDtrack::SetTOFpid(const Double_t *p) {
932 // Sets the probability of each particle type (in TOF)
933 for (Int_t i=0; i<AliPID::kSPECIES; i++) fTOFr[i]=p[i];
934 SetStatus(AliESDtrack::kTOFpid);
937 //_______________________________________________________________________
938 void AliESDtrack::SetTOFLabel(const Int_t *p) {
940 for (Int_t i=0; i<3; i++) fTOFLabel[i]=p[i];
943 //_______________________________________________________________________
944 void AliESDtrack::GetTOFpid(Double_t *p) const {
945 // Gets probabilities of each particle type (in TOF)
946 for (Int_t i=0; i<AliPID::kSPECIES; i++) p[i]=fTOFr[i];
949 //_______________________________________________________________________
950 void AliESDtrack::GetTOFLabel(Int_t *p) const {
952 for (Int_t i=0; i<3; i++) p[i]=fTOFLabel[i];
955 //_______________________________________________________________________
956 void AliESDtrack::GetTOFInfo(Float_t *info) const {
958 for (Int_t i=0; i<10; i++) info[i]=fTOFInfo[i];
961 //_______________________________________________________________________
962 void AliESDtrack::SetTOFInfo(Float_t*info) {
964 for (Int_t i=0; i<10; i++) fTOFInfo[i]=info[i];
969 //_______________________________________________________________________
970 void AliESDtrack::SetPHOSpid(const Double_t *p) {
971 // Sets the probability of each particle type (in PHOS)
972 for (Int_t i=0; i<AliPID::kSPECIESN; i++) fPHOSr[i]=p[i];
973 SetStatus(AliESDtrack::kPHOSpid);
976 //_______________________________________________________________________
977 void AliESDtrack::GetPHOSpid(Double_t *p) const {
978 // Gets probabilities of each particle type (in PHOS)
979 for (Int_t i=0; i<AliPID::kSPECIESN; i++) p[i]=fPHOSr[i];
982 //_______________________________________________________________________
983 void AliESDtrack::SetEMCALpid(const Double_t *p) {
984 // Sets the probability of each particle type (in EMCAL)
985 for (Int_t i=0; i<AliPID::kSPECIESN; i++) fEMCALr[i]=p[i];
986 SetStatus(AliESDtrack::kEMCALpid);
989 //_______________________________________________________________________
990 void AliESDtrack::GetEMCALpid(Double_t *p) const {
991 // Gets probabilities of each particle type (in EMCAL)
992 for (Int_t i=0; i<AliPID::kSPECIESN; i++) p[i]=fEMCALr[i];
995 //_______________________________________________________________________
996 void AliESDtrack::SetRICHpid(const Double_t *p) {
997 // Sets the probability of each particle type (in RICH)
998 for (Int_t i=0; i<AliPID::kSPECIES; i++) fRICHr[i]=p[i];
999 SetStatus(AliESDtrack::kRICHpid);
1002 //_______________________________________________________________________
1003 void AliESDtrack::GetRICHpid(Double_t *p) const {
1004 // Gets probabilities of each particle type (in RICH)
1005 for (Int_t i=0; i<AliPID::kSPECIES; i++) p[i]=fRICHr[i];
1010 //_______________________________________________________________________
1011 void AliESDtrack::SetESDpid(const Double_t *p) {
1012 // Sets the probability of each particle type for the ESD track
1013 for (Int_t i=0; i<AliPID::kSPECIES; i++) fR[i]=p[i];
1014 SetStatus(AliESDtrack::kESDpid);
1017 //_______________________________________________________________________
1018 void AliESDtrack::GetESDpid(Double_t *p) const {
1019 // Gets probability of each particle type for the ESD track
1020 for (Int_t i=0; i<AliPID::kSPECIES; i++) p[i]=fR[i];
1023 //_______________________________________________________________________
1024 void AliESDtrack::Print(Option_t *) const {
1025 // Prints info on the track
1027 printf("ESD track info\n") ;
1028 Double_t p[AliPID::kSPECIESN] ;
1030 if( IsOn(kITSpid) ){
1031 printf("From ITS: ") ;
1033 for(index = 0 ; index < AliPID::kSPECIES; index++)
1034 printf("%f, ", p[index]) ;
1035 printf("\n signal = %f\n", GetITSsignal()) ;
1037 if( IsOn(kTPCpid) ){
1038 printf("From TPC: ") ;
1040 for(index = 0 ; index < AliPID::kSPECIES; index++)
1041 printf("%f, ", p[index]) ;
1042 printf("\n signal = %f\n", GetTPCsignal()) ;
1044 if( IsOn(kTRDpid) ){
1045 printf("From TRD: ") ;
1047 for(index = 0 ; index < AliPID::kSPECIES; index++)
1048 printf("%f, ", p[index]) ;
1049 printf("\n signal = %f\n", GetTRDsignal()) ;
1051 if( IsOn(kTOFpid) ){
1052 printf("From TOF: ") ;
1054 for(index = 0 ; index < AliPID::kSPECIES; index++)
1055 printf("%f, ", p[index]) ;
1056 printf("\n signal = %f\n", GetTOFsignal()) ;
1058 if( IsOn(kRICHpid) ){
1059 printf("From RICH: ") ;
1061 for(index = 0 ; index < AliPID::kSPECIES; index++)
1062 printf("%f, ", p[index]) ;
1063 printf("\n signal = %f\n", GetRICHsignal()) ;
1065 if( IsOn(kPHOSpid) ){
1066 printf("From PHOS: ") ;
1068 for(index = 0 ; index < AliPID::kSPECIESN; index++)
1069 printf("%f, ", p[index]) ;
1070 printf("\n signal = %f\n", GetPHOSsignal()) ;
1072 if( IsOn(kEMCALpid) ){
1073 printf("From EMCAL: ") ;
1075 for(index = 0 ; index < AliPID::kSPECIESN; index++)
1076 printf("%f, ", p[index]) ;
1077 printf("\n signal = %f\n", GetEMCALsignal()) ;