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"
27 #include "AliTrackPointArray.h"
32 void SetPIDValues(Float_t * dest, const Double_t * src, Int_t n) {
33 // This function copies "n" PID weights from "scr" to "dest"
34 // and normalizes their sum to 1 thus producing conditional probabilities.
35 // The negative weights are set to 0.
36 // In case all the weights are non-positive they are replaced by
37 // uniform probabilities
41 Float_t uniform = 1./(Float_t)n;
44 for (Int_t i=0; i<n; i++)
54 for (Int_t i=0; i<n; i++) dest[i] /= sum;
56 for (Int_t i=0; i<n; i++) dest[i] = uniform;
59 //_______________________________________________________________________
60 AliESDtrack::AliESDtrack() :
86 fTPCClusterMap(159),//number of padrows
113 // The default ESD constructor
115 for (Int_t i=0; i<AliPID::kSPECIES; i++) {
125 for (Int_t i=0; i<AliPID::kSPECIESN; i++) {
131 fPHOSpos[0]=fPHOSpos[1]=fPHOSpos[2]=0.;
132 fEMCALpos[0]=fEMCALpos[1]=fEMCALpos[2]=0.;
134 for (i=0; i<5; i++) {
135 fRp[i]=fCp[i]=fIp[i]=fTp[i]=0.;
137 for (i=0; i<15; i++) {
138 fRc[i]=fCc[i]=fIc[i]=fTc[i]=0.;
140 for (i=0; i<6; i++) { fITSindex[i]=0; }
141 for (i=0; i<180; i++){ fTPCindex[i]=0; }
142 for (i=0; i<3;i++) { fKinkIndexes[i]=0;}
143 for (i=0; i<3;i++) { fV0Indexes[i]=-1;}
144 for (i=0; i<130; i++) { fTRDindex[i]=0; }
145 for (i=0;i<kNPlane;i++) {fTRDsignals[i]=0.; fTRDTimBin[i]=-1;}
146 for (Int_t i=0;i<4;i++) {fTPCPoints[i]=-1;}
147 for (Int_t i=0;i<3;i++) {fTOFLabel[i]=-1;}
148 for (Int_t i=0;i<10;i++) {fTOFInfo[i]=-1;}
158 //_______________________________________________________________________
159 AliESDtrack::AliESDtrack(const AliESDtrack& track):
161 fFlags(track.fFlags),
162 fLabel(track.fLabel),
164 fTrackLength(track.fTrackLength),
167 fStopVertex(track.fStopVertex),
168 fRalpha(track.fRalpha),
170 fCalpha(track.fCalpha),
172 fCchi2(track.fCchi2),
173 fIalpha(track.fIalpha),
175 fTalpha(track.fTalpha),
177 fITSchi2(track.fITSchi2),
178 fITSncls(track.fITSncls),
179 fITSsignal(track.fITSsignal),
180 fITSLabel(track.fITSLabel),
181 fITSFakeRatio(track.fITSFakeRatio),
182 fITStrack(0), //coping separatelly - in user code
183 fTPCchi2(track.fTPCchi2),
184 fTPCncls(track.fTPCncls),
185 fTPCClusterMap(track.fTPCClusterMap),
186 fTPCsignal(track.fTPCsignal),
187 fTPCLabel(track.fTPCLabel),
188 fTRDchi2(track.fTRDchi2),
189 fTRDncls(track.fTRDncls),
190 fTRDncls0(track.fTRDncls0),
191 fTRDsignal(track.fTRDsignal),
192 fTRDLabel(track.fTRDLabel),
193 fTRDQuality(track.fTRDQuality),
194 fTRDBudget(track.fTRDBudget),
196 fTOFchi2(track.fTOFchi2),
197 fTOFindex(track.fTOFindex),
198 fTOFsignal(track.fTOFsignal),
199 fPHOSsignal(track.fPHOSsignal),
200 fEMCALsignal(track.fEMCALsignal),
201 fRICHchi2(track.fRICHchi2),
202 fRICHncls(track.fRICHncls),
203 fRICHindex(track.fRICHindex),
204 fRICHsignal(track.fRICHsignal),
205 fRICHtheta(track.fRICHtheta),
206 fRICHphi(track.fRICHphi),
207 fRICHdx(track.fRICHdx),
208 fRICHdy(track.fRICHdy),
209 fPoints(track.fPoints)
214 for (Int_t i=0;i<AliPID::kSPECIES;i++) fTrackTime[i] =track.fTrackTime[i];
215 for (Int_t i=0;i<AliPID::kSPECIES;i++) fR[i] =track.fR[i];
217 for (Int_t i=0;i<5;i++) fRp[i] =track.fRp[i];
218 for (Int_t i=0;i<15;i++) fRc[i] =track.fRc[i];
220 for (Int_t i=0;i<5;i++) fCp[i] =track.fCp[i];
221 for (Int_t i=0;i<15;i++) fCc[i] =track.fCc[i];
223 for (Int_t i=0;i<5;i++) fIp[i] =track.fIp[i];
224 for (Int_t i=0;i<15;i++) fIc[i] =track.fIc[i];
226 for (Int_t i=0;i<5;i++) fTp[i] =track.fTp[i];
227 for (Int_t i=0;i<15;i++) fTc[i] =track.fTc[i];
229 for (Int_t i=0;i<12;i++) fITSchi2MIP[i] =track.fITSchi2MIP[i];
230 for (Int_t i=0;i<6;i++) fITSindex[i]=track.fITSindex[i];
231 for (Int_t i=0;i<AliPID::kSPECIES;i++) fITSr[i]=track.fITSr[i];
233 for (Int_t i=0;i<180;i++) fTPCindex[i]=track.fTPCindex[i];
234 for (Int_t i=0;i<AliPID::kSPECIES;i++) fTPCr[i]=track.fTPCr[i];
235 for (Int_t i=0;i<4;i++) {fTPCPoints[i]=track.fTPCPoints[i];}
236 for (Int_t i=0; i<3;i++) { fKinkIndexes[i]=track.fKinkIndexes[i];}
237 for (Int_t i=0; i<3;i++) { fV0Indexes[i]=track.fV0Indexes[i];}
239 for (Int_t i=0;i<130;i++) fTRDindex[i]=track.fTRDindex[i];
240 for (Int_t i=0;i<kNPlane;i++) {
241 fTRDsignals[i]=track.fTRDsignals[i];
242 fTRDTimBin[i]=track.fTRDTimBin[i];
244 for (Int_t i=0;i<AliPID::kSPECIES;i++) fTRDr[i]=track.fTRDr[i];
246 for (Int_t i=0;i<AliPID::kSPECIES;i++) fTOFr[i]=track.fTOFr[i];
247 for (Int_t i=0;i<3;i++) fTOFLabel[i]=track.fTOFLabel[i];
248 for (Int_t i=0;i<10;i++) fTOFInfo[i]=track.fTOFInfo[i];
250 for (Int_t i=0;i<3;i++) fPHOSpos[i]=track.fPHOSpos[i];
251 for (Int_t i=0;i<AliPID::kSPECIESN;i++) fPHOSr[i]=track.fPHOSr[i];
253 for (Int_t i=0;i<3;i++) fEMCALpos[i]=track.fEMCALpos[i];
254 for (Int_t i=0;i<AliPID::kSPECIESN;i++) fEMCALr[i]=track.fEMCALr[i];
256 for (Int_t i=0;i<AliPID::kSPECIES;i++) fRICHr[i]=track.fRICHr[i];
258 //_______________________________________________________________________
259 AliESDtrack::~AliESDtrack(){
261 // This is destructor according Coding Conventrions
263 //printf("Delete track\n");
269 //_______________________________________________________________________
270 void AliESDtrack::MakeMiniESDtrack(){
271 // Resets everything except
272 // fFlags: Reconstruction status flags
273 // fLabel: Track label
274 // fID: Unique ID of the track
275 // fD: Impact parameter in XY-plane
276 // fZ: Impact parameter in Z
277 // fR[AliPID::kSPECIES]: combined "detector response probability"
278 // Running track parameters
279 // fRalpha: track rotation angle
280 // fRx: X-coordinate of the track reference plane
281 // fRp[5]: external track parameters
282 // fRc[15]: external cov. matrix of the track parameters
285 for (Int_t i=0;i<AliPID::kSPECIES;i++) fTrackTime[i] = 0;
288 // Reset track parameters constrained to the primary vertex
291 for (Int_t i=0;i<5;i++) fCp[i] = 0;
292 for (Int_t i=0;i<15;i++) fCc[i] = 0;
295 // Reset track parameters at the inner wall of TPC
298 for (Int_t i=0;i<5;i++) fIp[i] = 0;
299 for (Int_t i=0;i<15;i++) fIc[i] = 0;
301 // Reset track parameters at the inner wall of the TRD
304 for (Int_t i=0;i<5;i++) fTp[i] = 0;
305 for (Int_t i=0;i<15;i++) fTc[i] = 0;
307 // Reset ITS track related information
309 for (Int_t i=0;i<12;i++) fITSchi2MIP[i] = 0;
311 for (Int_t i=0;i<6;i++) fITSindex[i]= 0;
313 for (Int_t i=0;i<AliPID::kSPECIES;i++) fITSr[i]= 0;
318 // Reset TPC related track information
321 for (Int_t i=0;i<180;i++) fTPCindex[i] = 0;
324 for (Int_t i=0;i<AliPID::kSPECIES;i++) fTPCr[i]=0;
326 for (Int_t i=0;i<4;i++) fTPCPoints[i] = 0;
327 for (Int_t i=0; i<3;i++) fKinkIndexes[i] = 0;
328 for (Int_t i=0; i<3;i++) fV0Indexes[i] = 0;
330 // Reset TRD related track information
334 for (Int_t i=0;i<130;i++) fTRDindex[i] = 0;
336 for (Int_t i=0;i<kNPlane;i++) {
340 for (Int_t i=0;i<AliPID::kSPECIES;i++) fTRDr[i] = 0;
346 // Reset TOF related track information
350 for (Int_t i=0;i<AliPID::kSPECIES;i++) fTOFr[i] = 0;
351 for (Int_t i=0;i<3;i++) fTOFLabel[i] = 0;
352 for (Int_t i=0;i<10;i++) fTOFInfo[i] = 0;
354 // Reset PHOS related track information
355 for (Int_t i=0;i<3;i++) fPHOSpos[i] = 0;
357 for (Int_t i=0;i<AliPID::kSPECIESN;i++) fPHOSr[i] = 0;
359 // Reset EMCAL related track information
360 for (Int_t i=0;i<3;i++) fEMCALpos[i] = 0;
362 for (Int_t i=0;i<AliPID::kSPECIESN;i++) fEMCALr[i] = 0;
364 // Reset RICH related track information
369 for (Int_t i=0;i<AliPID::kSPECIES;i++) fRICHr[i] = 0;
377 //_______________________________________________________________________
378 Double_t AliESDtrack::GetMass() const {
379 // Returns the mass of the most probable particle type
382 for (Int_t i=0; i<AliPID::kSPECIES; i++) {
383 if (fR[i]>max) {k=i; max=fR[i];}
385 if (k==0) { // dE/dx "crossing points" in the TPC
387 if ((p>0.38)&&(p<0.48))
388 if (fR[0]<fR[3]*10.) return AliPID::ParticleMass(AliPID::kKaon);
389 if ((p>0.75)&&(p<0.85))
390 if (fR[0]<fR[4]*10.) return AliPID::ParticleMass(AliPID::kProton);
393 if (k==1) return AliPID::ParticleMass(AliPID::kMuon);
394 if (k==2||k==-1) return AliPID::ParticleMass(AliPID::kPion);
395 if (k==3) return AliPID::ParticleMass(AliPID::kKaon);
396 if (k==4) return AliPID::ParticleMass(AliPID::kProton);
397 AliWarning("Undefined mass !");
398 return AliPID::ParticleMass(AliPID::kPion);
401 //_______________________________________________________________________
402 Bool_t AliESDtrack::UpdateTrackParams(const AliKalmanTrack *t, ULong_t flags) {
404 // This function updates track's running parameters
409 fLabel=t->GetLabel();
411 if (t->IsStartedTimeIntegral()) {
413 Double_t times[10];t->GetIntegratedTimes(times); SetIntegratedTimes(times);
414 SetIntegratedLength(t->GetIntegratedLength());
417 fRalpha=t->GetAlpha();
418 t->GetExternalParameters(fRx,fRp);
419 t->GetExternalCovariance(fRc);
423 case kITSin: case kITSout: case kITSrefit:
424 fITSncls=t->GetNumberOfClusters();
425 fITSchi2=t->GetChi2();
426 for (Int_t i=0;i<fITSncls;i++) fITSindex[i]=t->GetClusterIndex(i);
427 fITSsignal=t->GetPIDsignal();
428 fITSLabel = t->GetLabel();
429 fITSFakeRatio = t->GetFakeRatio();
432 case kTPCin: case kTPCrefit:
433 fTPCLabel = t->GetLabel();
438 for (i=0; i<5; i++) fIp[i]=fRp[i];
439 for (i=0; i<15;i++) fIc[i]=fRc[i];
443 fTPCncls=t->GetNumberOfClusters();
444 fTPCchi2=t->GetChi2();
446 {//prevrow must be declared in separate namespace, otherwise compiler cries:
447 //"jump to case label crosses initialization of `Int_t prevrow'"
449 // for (Int_t i=0;i<fTPCncls;i++)
450 for (Int_t i=0;i<160;i++)
452 fTPCindex[i]=t->GetClusterIndex(i);
454 // Piotr's Cluster Map for HBT
455 // ### please change accordingly if cluster array is changing
456 // to "New TPC Tracking" style (with gaps in array)
457 Int_t idx = fTPCindex[i];
458 Int_t sect = (idx&0xff000000)>>24;
459 Int_t row = (idx&0x00ff0000)>>16;
460 if (sect > 18) row +=63; //if it is outer sector, add number of inner sectors
462 fTPCClusterMap.SetBitNumber(row,kTRUE);
464 //Fill the gap between previous row and this row with 0 bits
465 //In case ### pleas change it as well - just set bit 0 in case there
466 //is no associated clusters for current "i"
469 prevrow = row;//if previous bit was not assigned yet == this is the first one
472 { //we don't know the order (inner to outer or reverse)
473 //just to be save in case it is going to change
486 for (Int_t j = n+1; j < m; j++)
488 fTPCClusterMap.SetBitNumber(j,kFALSE);
492 // End Of Piotr's Cluster Map for HBT
495 fTPCsignal=t->GetPIDsignal();
496 {Double_t mass=t->GetMass(); // preliminary mass setting
497 if (mass>0.5) fR[4]=1.; // used by
498 else if (mass<0.4) fR[2]=1.; // the ITS reconstruction
503 case kTRDout: case kTRDin: case kTRDrefit:
504 fTRDLabel = t->GetLabel();
505 fTRDncls=t->GetNumberOfClusters();
506 fTRDchi2=t->GetChi2();
507 for (Int_t i=0;i<fTRDncls;i++) fTRDindex[i]=t->GetClusterIndex(i);
508 fTRDsignal=t->GetPIDsignal();
511 t->GetExternalParameters(fTx,fTp);
512 t->GetExternalCovariance(fTc);
513 fTalpha = t->GetAlpha();
514 fTRDncls0 = t->GetNumberOfClusters();
523 AliError("Wrong flag !");
530 //_______________________________________________________________________
532 AliESDtrack::SetConstrainedTrackParams(const AliKalmanTrack *t, Double_t chi2) {
534 // This function sets the constrained track parameters
538 fCalpha=t->GetAlpha();
539 t->GetExternalParameters(x,buf); fCx=x;
540 for (i=0; i<5; i++) fCp[i]=buf[i];
541 t->GetExternalCovariance(buf);
542 for (i=0; i<15; i++) fCc[i]=buf[i];
547 //_______________________________________________________________________
548 void AliESDtrack::GetExternalParameters(Double_t &x, Double_t p[5]) const {
549 //---------------------------------------------------------------------
550 // This function returns external representation of the track parameters
551 //---------------------------------------------------------------------
553 for (Int_t i=0; i<5; i++) p[i]=fRp[i];
556 //_______________________________________________________________________
558 GetExternalParametersAt(Double_t x, Double_t b, Double_t p[5]) const {
559 //---------------------------------------------------------------------
560 // This function returns external track parameters extrapolated to
561 // the radial position "x" (cm) in the magnetic field "b" (kG)
562 //---------------------------------------------------------------------
563 Double_t convconst=0.299792458*b/1000.;
565 Double_t f1=fRp[2], f2=f1 + dx*fRp[4]*convconst;
567 if (TMath::Abs(f2) >= 0.9999) return kFALSE;
569 Double_t r1=TMath::Sqrt(1.- f1*f1), r2=TMath::Sqrt(1.- f2*f2);
570 p[0] = fRp[0] + dx*(f1+f2)/(r1+r2);
571 p[1] = fRp[1] + dx*(f1+f2)/(f1*r2 + f2*r1)*fRp[3];
579 //_______________________________________________________________________
580 void AliESDtrack::GetExternalCovariance(Double_t cov[15]) const {
581 //---------------------------------------------------------------------
582 // This function returns external representation of the cov. matrix
583 //---------------------------------------------------------------------
584 for (Int_t i=0; i<15; i++) cov[i]=fRc[i];
588 //_______________________________________________________________________
590 AliESDtrack::GetConstrainedExternalParameters(Double_t &x, Double_t p[5])const{
591 //---------------------------------------------------------------------
592 // This function returns the constrained external track parameters
593 //---------------------------------------------------------------------
595 for (Int_t i=0; i<5; i++) p[i]=fCp[i];
597 //_______________________________________________________________________
599 AliESDtrack::GetConstrainedExternalCovariance(Double_t c[15]) const {
600 //---------------------------------------------------------------------
601 // This function returns the constrained external cov. matrix
602 //---------------------------------------------------------------------
603 for (Int_t i=0; i<15; i++) c[i]=fCc[i];
607 Double_t AliESDtrack::GetP() const {
608 //---------------------------------------------------------------------
609 // This function returns the track momentum
610 // Results for (nearly) straight tracks are meaningless !
611 //---------------------------------------------------------------------
612 if (TMath::Abs(fRp[4])<=0) return 0;
613 Double_t pt=1./TMath::Abs(fRp[4]);
614 return pt*TMath::Sqrt(1.+ fRp[3]*fRp[3]);
617 //_______________________________________________________________________
618 Double_t AliESDtrack::GetD(Double_t b, Double_t x, Double_t y) const {
619 //------------------------------------------------------------------
620 // This function calculates the transverse impact parameter
621 // with respect to a point with global coordinates (x,y)
622 // in the magnetic field "b" (kG)
623 //------------------------------------------------------------------
624 Double_t convconst=0.299792458*b/1000.;
625 Double_t rp4=fRp[4]*convconst;
627 Double_t xt=fRx, yt=fRp[0];
629 Double_t sn=TMath::Sin(fRalpha), cs=TMath::Cos(fRalpha);
630 Double_t a = x*cs + y*sn;
631 y = -x*sn + y*cs; x=a;
634 sn=rp4*xt - fRp[2]; cs=rp4*yt + TMath::Sqrt(1.- fRp[2]*fRp[2]);
635 a=2*(xt*fRp[2] - yt*TMath::Sqrt(1.- fRp[2]*fRp[2]))-rp4*(xt*xt + yt*yt);
637 return a/(1 + TMath::Sqrt(sn*sn + cs*cs));
640 Bool_t Local2GlobalMomentum(Double_t p[3],Double_t alpha) {
641 //----------------------------------------------------------------
642 // This function performs local->global transformation of the
644 // When called, the arguments are:
645 // p[0] = 1/pt of the track;
646 // p[1] = sine of local azim. angle of the track momentum;
647 // p[2] = tangent of the track momentum dip angle;
648 // alpha - rotation angle.
649 // The result is returned as:
653 // Results for (nearly) straight tracks are meaningless !
654 //----------------------------------------------------------------
655 if (TMath::Abs(p[0])<=0) return kFALSE;
656 if (TMath::Abs(p[1])> 0.999999) return kFALSE;
658 Double_t pt=1./TMath::Abs(p[0]);
659 Double_t cs=TMath::Cos(alpha), sn=TMath::Sin(alpha);
660 Double_t r=TMath::Sqrt(1 - p[1]*p[1]);
661 p[0]=pt*(r*cs - p[1]*sn); p[1]=pt*(p[1]*cs + r*sn); p[2]=pt*p[2];
666 Bool_t Local2GlobalPosition(Double_t r[3],Double_t alpha) {
667 //----------------------------------------------------------------
668 // This function performs local->global transformation of the
670 // When called, the arguments are:
674 // alpha - rotation angle.
675 // The result is returned as:
679 //----------------------------------------------------------------
680 Double_t cs=TMath::Cos(alpha), sn=TMath::Sin(alpha), x=r[0];
681 r[0]=x*cs - r[1]*sn; r[1]=x*sn + r[1]*cs;
686 Bool_t AliESDtrack::GetConstrainedPxPyPz(Double_t *p) const {
687 //---------------------------------------------------------------------
688 // This function returns the constrained global track momentum components
689 // Results for (nearly) straight tracks are meaningless !
690 //---------------------------------------------------------------------
691 p[0]=fCp[4]; p[1]=fCp[2]; p[2]=fCp[3];
692 return Local2GlobalMomentum(p,fCalpha);
695 Bool_t AliESDtrack::GetConstrainedXYZ(Double_t *r) const {
696 //---------------------------------------------------------------------
697 // This function returns the constrained global track position
698 //---------------------------------------------------------------------
699 r[0]=fCx; r[1]=fCp[0]; r[2]=fCp[1];
700 return Local2GlobalPosition(r,fCalpha);
703 Bool_t AliESDtrack::GetPxPyPz(Double_t *p) const {
704 //---------------------------------------------------------------------
705 // This function returns the global track momentum components
706 // Results for (nearly) straight tracks are meaningless !
707 //---------------------------------------------------------------------
708 p[0]=fRp[4]; p[1]=fRp[2]; p[2]=fRp[3];
709 return Local2GlobalMomentum(p,fRalpha);
712 Bool_t AliESDtrack::GetXYZ(Double_t *r) const {
713 //---------------------------------------------------------------------
714 // This function returns the global track position
715 //---------------------------------------------------------------------
716 r[0]=fRx; r[1]=fRp[0]; r[2]=fRp[1];
717 return Local2GlobalPosition(r,fRalpha);
720 void AliESDtrack::GetCovariance(Double_t cv[21]) const {
721 //---------------------------------------------------------------------
722 // This function returns the global covariance matrix of the track params
724 // Cov(x,x) ... : cv[0]
725 // Cov(y,x) ... : cv[1] cv[2]
726 // Cov(z,x) ... : cv[3] cv[4] cv[5]
727 // Cov(px,x)... : cv[6] cv[7] cv[8] cv[9]
728 // Cov(py,x)... : cv[10] cv[11] cv[12] cv[13] cv[14]
729 // Cov(pz,x)... : cv[15] cv[16] cv[17] cv[18] cv[19] cv[20]
731 // Results for (nearly) straight tracks are meaningless !
732 //---------------------------------------------------------------------
733 if (TMath::Abs(fRp[4])<=0) {
734 for (Int_t i=0; i<21; i++) cv[i]=0.;
737 if (TMath::Abs(fRp[2]) > 0.999999) {
738 for (Int_t i=0; i<21; i++) cv[i]=0.;
741 Double_t pt=1./TMath::Abs(fRp[4]);
742 Double_t cs=TMath::Cos(fRalpha), sn=TMath::Sin(fRalpha);
743 Double_t r=TMath::Sqrt(1-fRp[2]*fRp[2]);
745 Double_t m00=-sn, m10=cs;
746 Double_t m23=-pt*(sn + fRp[2]*cs/r), m43=-pt*pt*(r*cs - fRp[2]*sn);
747 Double_t m24= pt*(cs - fRp[2]*sn/r), m44=-pt*pt*(r*sn + fRp[2]*cs);
748 Double_t m35=pt, m45=-pt*pt*fRp[3];
750 cv[0]=fRc[0]*m00*m00;
751 cv[1]=fRc[0]*m00*m10;
752 cv[2]=fRc[0]*m10*m10;
756 cv[6]=m00*(fRc[3]*m23+fRc[10]*m43);
757 cv[7]=m10*(fRc[3]*m23+fRc[10]*m43);
758 cv[8]=fRc[4]*m23+fRc[11]*m43;
759 cv[9]=m23*(fRc[5]*m23+fRc[12]*m43)+m43*(fRc[12]*m23+fRc[14]*m43);
760 cv[10]=m00*(fRc[3]*m24+fRc[10]*m44);
761 cv[11]=m10*(fRc[3]*m24+fRc[10]*m44);
762 cv[12]=fRc[4]*m24+fRc[11]*m44;
763 cv[13]=m23*(fRc[5]*m24+fRc[12]*m44)+m43*(fRc[12]*m24+fRc[14]*m44);
764 cv[14]=m24*(fRc[5]*m24+fRc[12]*m44)+m44*(fRc[12]*m24+fRc[14]*m44);
765 cv[15]=m00*(fRc[6]*m35+fRc[10]*m45);
766 cv[16]=m10*(fRc[6]*m35+fRc[10]*m45);
767 cv[17]=fRc[7]*m35+fRc[11]*m45;
768 cv[18]=m23*(fRc[8]*m35+fRc[12]*m45)+m43*(fRc[13]*m35+fRc[14]*m45);
769 cv[19]=m24*(fRc[8]*m35+fRc[12]*m45)+m44*(fRc[13]*m35+fRc[14]*m45);
770 cv[20]=m35*(fRc[9]*m35+fRc[13]*m45)+m45*(fRc[13]*m35+fRc[14]*m45);
773 Bool_t AliESDtrack::GetInnerPxPyPz(Double_t *p) const {
774 //---------------------------------------------------------------------
775 // This function returns the global track momentum components
776 // af the entrance of the TPC
777 //---------------------------------------------------------------------
778 p[0]=fIp[4]; p[1]=fIp[2]; p[2]=fIp[3];
779 return Local2GlobalMomentum(p,fIalpha);
782 Bool_t AliESDtrack::GetInnerXYZ(Double_t *r) const {
783 //---------------------------------------------------------------------
784 // This function returns the global track position
785 // af the entrance of the TPC
786 //---------------------------------------------------------------------
787 if (fIx==0) return kFALSE;
788 r[0]=fIx; r[1]=fIp[0]; r[2]=fIp[1];
789 return Local2GlobalPosition(r,fIalpha);
792 void AliESDtrack::GetInnerExternalParameters(Double_t &x, Double_t p[5]) const
795 //---------------------------------------------------------------------
796 // This function returns external representation of the track parameters at Inner Layer of TPC
797 //---------------------------------------------------------------------
799 for (Int_t i=0; i<5; i++) p[i]=fIp[i];
801 void AliESDtrack::GetInnerExternalCovariance(Double_t cov[15]) const
804 //---------------------------------------------------------------------
805 // This function returns external representation of the cov. matrix at Inner Layer of TPC
806 //---------------------------------------------------------------------
807 for (Int_t i=0; i<15; i++) cov[i]=fIc[i];
811 Int_t AliESDtrack::GetNcls(Int_t idet) const
813 // Get number of clusters by subdetector index
836 Int_t AliESDtrack::GetClusters(Int_t idet, UInt_t *idx) const
838 // Get cluster index array by subdetector index
843 ncls = GetITSclusters(idx);
846 ncls = GetTPCclusters((Int_t *)idx);
849 ncls = GetTRDclusters(idx);
852 if (fTOFindex != 0) {
853 idx[0] = GetTOFcluster();
863 void AliESDtrack::GetTRDExternalParameters(Double_t &x, Double_t&alpha, Double_t p[5], Double_t cov[15]) const
866 //this function returns TRD parameters
870 for (Int_t i=0; i<5; i++) p[i]=fTp[i];
871 for (Int_t i=0; i<15; i++) cov[i]=fTc[i];
874 Bool_t AliESDtrack::GetPxPyPzAt(Double_t x, Double_t b, Double_t *p) const {
875 //---------------------------------------------------------------------
876 // This function returns the global track momentum extrapolated to
877 // the radial position "x" (cm) in the magnetic field "b" (kG)
878 //---------------------------------------------------------------------
879 Double_t convconst=0.299792458*b/1000.;
881 p[1]=fRp[2]+(x-fRx)*fRp[4]*convconst;
883 return Local2GlobalMomentum(p,fRalpha);
886 Bool_t AliESDtrack::GetXYZAt(Double_t x, Double_t b, Double_t *r) const {
887 //---------------------------------------------------------------------
888 // This function returns the global track position extrapolated to
889 // the radial position "x" (cm) in the magnetic field "b" (kG)
890 //---------------------------------------------------------------------
891 Double_t convconst=0.299792458*b/1000.;
893 Double_t f1=fRp[2], f2=f1 + dx*fRp[4]*convconst;
895 if (TMath::Abs(f2) >= 0.9999) return kFALSE;
897 Double_t r1=TMath::Sqrt(1.- f1*f1), r2=TMath::Sqrt(1.- f2*f2);
899 r[1] = fRp[0] + dx*(f1+f2)/(r1+r2);
900 r[2] = fRp[1] + dx*(f1+f2)/(f1*r2 + f2*r1)*fRp[3];
901 return Local2GlobalPosition(r,fRalpha);
904 //_______________________________________________________________________
905 void AliESDtrack::GetIntegratedTimes(Double_t *times) const {
906 // Returns the array with integrated times for each particle hypothesis
907 for (Int_t i=0; i<AliPID::kSPECIES; i++) times[i]=fTrackTime[i];
910 //_______________________________________________________________________
911 void AliESDtrack::SetIntegratedTimes(const Double_t *times) {
912 // Sets the array with integrated times for each particle hypotesis
913 for (Int_t i=0; i<AliPID::kSPECIES; i++) fTrackTime[i]=times[i];
916 //_______________________________________________________________________
917 void AliESDtrack::SetITSpid(const Double_t *p) {
918 // Sets values for the probability of each particle type (in ITS)
919 SetPIDValues(fITSr,p,AliPID::kSPECIES);
920 SetStatus(AliESDtrack::kITSpid);
923 void AliESDtrack::SetITSChi2MIP(const Float_t *chi2mip){
924 for (Int_t i=0; i<12; i++) fITSchi2MIP[i]=chi2mip[i];
926 //_______________________________________________________________________
927 void AliESDtrack::GetITSpid(Double_t *p) const {
928 // Gets the probability of each particle type (in ITS)
929 for (Int_t i=0; i<AliPID::kSPECIES; i++) p[i]=fITSr[i];
932 //_______________________________________________________________________
933 Int_t AliESDtrack::GetITSclusters(UInt_t *idx) const {
934 //---------------------------------------------------------------------
935 // This function returns indices of the assgined ITS clusters
936 //---------------------------------------------------------------------
937 for (Int_t i=0; i<fITSncls; i++) idx[i]=fITSindex[i];
941 //_______________________________________________________________________
942 Int_t AliESDtrack::GetTPCclusters(Int_t *idx) const {
943 //---------------------------------------------------------------------
944 // This function returns indices of the assgined ITS clusters
945 //---------------------------------------------------------------------
947 for (Int_t i=0; i<180; i++) idx[i]=fTPCindex[i]; // MI I prefer some constant
951 Float_t AliESDtrack::GetTPCdensity(Int_t row0, Int_t row1) const{
953 // GetDensity of the clusters on given region between row0 and row1
954 // Dead zone effect takin into acoount
959 for (Int_t i=row0;i<=row1;i++){
960 Int_t index = fTPCindex[i];
961 if (index!=-1) good++; // track outside of dead zone
962 if (index>0) found++;
965 if (good>(row1-row0)*0.5) density = Float_t(found)/Float_t(good);
969 //_______________________________________________________________________
970 void AliESDtrack::SetTPCpid(const Double_t *p) {
971 // Sets values for the probability of each particle type (in TPC)
972 SetPIDValues(fTPCr,p,AliPID::kSPECIES);
973 SetStatus(AliESDtrack::kTPCpid);
976 //_______________________________________________________________________
977 void AliESDtrack::GetTPCpid(Double_t *p) const {
978 // Gets the probability of each particle type (in TPC)
979 for (Int_t i=0; i<AliPID::kSPECIES; i++) p[i]=fTPCr[i];
982 //_______________________________________________________________________
983 Int_t AliESDtrack::GetTRDclusters(UInt_t *idx) const {
984 //---------------------------------------------------------------------
985 // This function returns indices of the assgined TRD clusters
986 //---------------------------------------------------------------------
988 for (Int_t i=0; i<130; i++) idx[i]=fTRDindex[i]; // MI I prefer some constant
992 //_______________________________________________________________________
993 void AliESDtrack::SetTRDpid(const Double_t *p) {
994 // Sets values for the probability of each particle type (in TRD)
995 SetPIDValues(fTRDr,p,AliPID::kSPECIES);
996 SetStatus(AliESDtrack::kTRDpid);
999 //_______________________________________________________________________
1000 void AliESDtrack::GetTRDpid(Double_t *p) const {
1001 // Gets the probability of each particle type (in TRD)
1002 for (Int_t i=0; i<AliPID::kSPECIES; i++) p[i]=fTRDr[i];
1005 //_______________________________________________________________________
1006 void AliESDtrack::SetTRDpid(Int_t iSpecies, Float_t p)
1008 // Sets the probability of particle type iSpecies to p (in TRD)
1009 fTRDr[iSpecies] = p;
1012 Float_t AliESDtrack::GetTRDpid(Int_t iSpecies) const
1014 // Returns the probability of particle type iSpecies (in TRD)
1015 return fTRDr[iSpecies];
1018 //_______________________________________________________________________
1019 void AliESDtrack::SetTOFpid(const Double_t *p) {
1020 // Sets the probability of each particle type (in TOF)
1021 SetPIDValues(fTOFr,p,AliPID::kSPECIES);
1022 SetStatus(AliESDtrack::kTOFpid);
1025 //_______________________________________________________________________
1026 void AliESDtrack::SetTOFLabel(const Int_t *p) {
1028 for (Int_t i=0; i<3; i++) fTOFLabel[i]=p[i];
1031 //_______________________________________________________________________
1032 void AliESDtrack::GetTOFpid(Double_t *p) const {
1033 // Gets probabilities of each particle type (in TOF)
1034 for (Int_t i=0; i<AliPID::kSPECIES; i++) p[i]=fTOFr[i];
1037 //_______________________________________________________________________
1038 void AliESDtrack::GetTOFLabel(Int_t *p) const {
1040 for (Int_t i=0; i<3; i++) p[i]=fTOFLabel[i];
1043 //_______________________________________________________________________
1044 void AliESDtrack::GetTOFInfo(Float_t *info) const {
1046 for (Int_t i=0; i<10; i++) info[i]=fTOFInfo[i];
1049 //_______________________________________________________________________
1050 void AliESDtrack::SetTOFInfo(Float_t*info) {
1052 for (Int_t i=0; i<10; i++) fTOFInfo[i]=info[i];
1057 //_______________________________________________________________________
1058 void AliESDtrack::SetPHOSpid(const Double_t *p) {
1059 // Sets the probability of each particle type (in PHOS)
1060 SetPIDValues(fPHOSr,p,AliPID::kSPECIESN);
1061 SetStatus(AliESDtrack::kPHOSpid);
1064 //_______________________________________________________________________
1065 void AliESDtrack::GetPHOSpid(Double_t *p) const {
1066 // Gets probabilities of each particle type (in PHOS)
1067 for (Int_t i=0; i<AliPID::kSPECIESN; i++) p[i]=fPHOSr[i];
1070 //_______________________________________________________________________
1071 void AliESDtrack::SetEMCALpid(const Double_t *p) {
1072 // Sets the probability of each particle type (in EMCAL)
1073 SetPIDValues(fEMCALr,p,AliPID::kSPECIESN);
1074 SetStatus(AliESDtrack::kEMCALpid);
1077 //_______________________________________________________________________
1078 void AliESDtrack::GetEMCALpid(Double_t *p) const {
1079 // Gets probabilities of each particle type (in EMCAL)
1080 for (Int_t i=0; i<AliPID::kSPECIESN; i++) p[i]=fEMCALr[i];
1083 //_______________________________________________________________________
1084 void AliESDtrack::SetRICHpid(const Double_t *p) {
1085 // Sets the probability of each particle type (in RICH)
1086 SetPIDValues(fRICHr,p,AliPID::kSPECIES);
1087 SetStatus(AliESDtrack::kRICHpid);
1090 //_______________________________________________________________________
1091 void AliESDtrack::GetRICHpid(Double_t *p) const {
1092 // Gets probabilities of each particle type (in RICH)
1093 for (Int_t i=0; i<AliPID::kSPECIES; i++) p[i]=fRICHr[i];
1098 //_______________________________________________________________________
1099 void AliESDtrack::SetESDpid(const Double_t *p) {
1100 // Sets the probability of each particle type for the ESD track
1101 SetPIDValues(fR,p,AliPID::kSPECIES);
1102 SetStatus(AliESDtrack::kESDpid);
1105 //_______________________________________________________________________
1106 void AliESDtrack::GetESDpid(Double_t *p) const {
1107 // Gets probability of each particle type for the ESD track
1108 for (Int_t i=0; i<AliPID::kSPECIES; i++) p[i]=fR[i];
1111 //_______________________________________________________________________
1112 void AliESDtrack::Print(Option_t *) const {
1113 // Prints info on the track
1115 printf("ESD track info\n") ;
1116 Double_t p[AliPID::kSPECIESN] ;
1118 if( IsOn(kITSpid) ){
1119 printf("From ITS: ") ;
1121 for(index = 0 ; index < AliPID::kSPECIES; index++)
1122 printf("%f, ", p[index]) ;
1123 printf("\n signal = %f\n", GetITSsignal()) ;
1125 if( IsOn(kTPCpid) ){
1126 printf("From TPC: ") ;
1128 for(index = 0 ; index < AliPID::kSPECIES; index++)
1129 printf("%f, ", p[index]) ;
1130 printf("\n signal = %f\n", GetTPCsignal()) ;
1132 if( IsOn(kTRDpid) ){
1133 printf("From TRD: ") ;
1135 for(index = 0 ; index < AliPID::kSPECIES; index++)
1136 printf("%f, ", p[index]) ;
1137 printf("\n signal = %f\n", GetTRDsignal()) ;
1139 if( IsOn(kTOFpid) ){
1140 printf("From TOF: ") ;
1142 for(index = 0 ; index < AliPID::kSPECIES; index++)
1143 printf("%f, ", p[index]) ;
1144 printf("\n signal = %f\n", GetTOFsignal()) ;
1146 if( IsOn(kRICHpid) ){
1147 printf("From RICH: ") ;
1149 for(index = 0 ; index < AliPID::kSPECIES; index++)
1150 printf("%f, ", p[index]) ;
1151 printf("\n signal = %f\n", GetRICHsignal()) ;
1153 if( IsOn(kPHOSpid) ){
1154 printf("From PHOS: ") ;
1156 for(index = 0 ; index < AliPID::kSPECIESN; index++)
1157 printf("%f, ", p[index]) ;
1158 printf("\n signal = %f\n", GetPHOSsignal()) ;
1160 if( IsOn(kEMCALpid) ){
1161 printf("From EMCAL: ") ;
1163 for(index = 0 ; index < AliPID::kSPECIESN; index++)
1164 printf("%f, ", p[index]) ;
1165 printf("\n signal = %f\n", GetEMCALsignal()) ;