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 //-----------------------------------------------------------------
24 #include <TParticle.h>
26 #include "AliESDVertex.h"
27 #include "AliESDtrack.h"
28 #include "AliKalmanTrack.h"
30 #include "AliTrackPointArray.h"
31 #include "TPolyMarker3D.h"
35 void SetPIDValues(Double_t * dest, const Double_t * src, Int_t n) {
36 // This function copies "n" PID weights from "scr" to "dest"
37 // and normalizes their sum to 1 thus producing conditional probabilities.
38 // The negative weights are set to 0.
39 // In case all the weights are non-positive they are replaced by
40 // uniform probabilities
44 Float_t uniform = 1./(Float_t)n;
47 for (Int_t i=0; i<n; i++)
57 for (Int_t i=0; i<n; i++) dest[i] /= sum;
59 for (Int_t i=0; i<n; i++) dest[i] = uniform;
62 //_______________________________________________________________________
63 AliESDtrack::AliESDtrack() :
64 AliExternalTrackParam(),
69 fFriendTrack(new AliESDfriendTrack()),
70 fTPCClusterMap(159),//number of padrows
71 fTPCSharedMap(159),//number of padrows
82 fEMCALindex(kEMCALNoMatch),
88 fCdd(0),fCdz(0),fCzz(0),
119 // The default ESD constructor
122 for (i=0; i<AliPID::kSPECIES; i++) {
132 for (i=0; i<3; i++) { fKinkIndexes[i]=0;}
133 for (i=0; i<3; i++) { fV0Indexes[i]=0;}
134 for (i=0;i<kNPlane;i++) {
135 for (j=0;j<kNSlice;j++) {
136 fTRDsignals[i][j]=0.;
140 for (i=0;i<4;i++) {fTPCPoints[i]=0;}
141 for (i=0;i<3;i++) {fTOFLabel[i]=0;}
142 for (i=0;i<10;i++) {fTOFInfo[i]=0;}
143 for (i=0;i<12;i++) {fITSModule[i]=-1;}
146 //_______________________________________________________________________
147 AliESDtrack::AliESDtrack(const AliESDtrack& track):
148 AliExternalTrackParam(track),
154 fTPCClusterMap(track.fTPCClusterMap),
155 fTPCSharedMap(track.fTPCSharedMap),
156 fFlags(track.fFlags),
158 fLabel(track.fLabel),
159 fITSLabel(track.fITSLabel),
160 fTPCLabel(track.fTPCLabel),
161 fTRDLabel(track.fTRDLabel),
162 fTOFCalChannel(track.fTOFCalChannel),
163 fTOFindex(track.fTOFindex),
164 fHMPIDqn(track.fHMPIDqn),
165 fHMPIDcluIdx(track.fHMPIDcluIdx),
166 fEMCALindex(track.fEMCALindex),
167 fHMPIDtrkTheta(track.fHMPIDtrkTheta),
168 fHMPIDtrkPhi(track.fHMPIDtrkPhi),
169 fHMPIDsignal(track.fHMPIDsignal),
170 fTrackLength(track.fTrackLength),
171 fD(track.fD),fZ(track.fZ),
172 fCdd(track.fCdd),fCdz(track.fCdz),fCzz(track.fCzz),
173 fCchi2(track.fCchi2),
174 fITSchi2(track.fITSchi2),
175 fTPCchi2(track.fTPCchi2),
176 fTRDchi2(track.fTRDchi2),
177 fTOFchi2(track.fTOFchi2),
178 fHMPIDchi2(track.fHMPIDchi2),
179 fITSsignal(track.fITSsignal),
180 fTPCsignal(track.fTPCsignal),
181 fTPCsignalS(track.fTPCsignalS),
182 fTRDsignal(track.fTRDsignal),
183 fTRDQuality(track.fTRDQuality),
184 fTRDBudget(track.fTRDBudget),
185 fTOFsignal(track.fTOFsignal),
186 fTOFsignalToT(track.fTOFsignalToT),
187 fTOFsignalRaw(track.fTOFsignalRaw),
188 fTOFsignalDz(track.fTOFsignalDz),
189 fHMPIDtrkX(track.fHMPIDtrkX),
190 fHMPIDtrkY(track.fHMPIDtrkY),
191 fHMPIDmipX(track.fHMPIDmipX),
192 fHMPIDmipY(track.fHMPIDmipY),
193 fTPCncls(track.fTPCncls),
194 fTPCnclsF(track.fTPCnclsF),
195 fTPCsignalN(track.fTPCsignalN),
196 fITSncls(track.fITSncls),
197 fITSClusterMap(track.fITSClusterMap),
198 fTRDncls(track.fTRDncls),
199 fTRDncls0(track.fTRDncls0),
200 fTRDpidQuality(track.fTRDpidQuality)
205 for (Int_t i=0;i<AliPID::kSPECIES;i++) fTrackTime[i]=track.fTrackTime[i];
206 for (Int_t i=0;i<AliPID::kSPECIES;i++) fR[i]=track.fR[i];
208 for (Int_t i=0;i<AliPID::kSPECIES;i++) fITSr[i]=track.fITSr[i];
210 for (Int_t i=0;i<AliPID::kSPECIES;i++) fTPCr[i]=track.fTPCr[i];
211 for (Int_t i=0;i<4;i++) {fTPCPoints[i]=track.fTPCPoints[i];}
212 for (Int_t i=0; i<3;i++) { fKinkIndexes[i]=track.fKinkIndexes[i];}
213 for (Int_t i=0; i<3;i++) { fV0Indexes[i]=track.fV0Indexes[i];}
215 for (Int_t i=0;i<kNPlane;i++) {
216 for (Int_t j=0;j<kNSlice;j++) {
217 fTRDsignals[i][j]=track.fTRDsignals[i][j];
219 fTRDTimBin[i]=track.fTRDTimBin[i];
221 for (Int_t i=0;i<AliPID::kSPECIES;i++) fTRDr[i]=track.fTRDr[i];
222 for (Int_t i=0;i<AliPID::kSPECIES;i++) fTOFr[i]=track.fTOFr[i];
223 for (Int_t i=0;i<3;i++) fTOFLabel[i]=track.fTOFLabel[i];
224 for (Int_t i=0;i<10;i++) fTOFInfo[i]=track.fTOFInfo[i];
225 for (Int_t i=0;i<12;i++) fITSModule[i]=track.fITSModule[i];
226 for (Int_t i=0;i<AliPID::kSPECIES;i++) fHMPIDr[i]=track.fHMPIDr[i];
228 if (track.fCp) fCp=new AliExternalTrackParam(*track.fCp);
229 if (track.fIp) fIp=new AliExternalTrackParam(*track.fIp);
230 if (track.fTPCInner) fTPCInner=new AliExternalTrackParam(*track.fTPCInner);
231 if (track.fOp) fOp=new AliExternalTrackParam(*track.fOp);
233 if (track.fFriendTrack) fFriendTrack=new AliESDfriendTrack(*(track.fFriendTrack));
236 //_______________________________________________________________________
237 AliESDtrack::AliESDtrack(TParticle * part) :
238 AliExternalTrackParam(),
244 fTPCClusterMap(159),//number of padrows
245 fTPCSharedMap(159),//number of padrows
256 fEMCALindex(kEMCALNoMatch),
262 fCdd(0),fCdz(0),fCzz(0),
293 // ESD track from TParticle
296 // Reset all the arrays
298 for (i=0; i<AliPID::kSPECIES; i++) {
308 for (i=0; i<3; i++) { fKinkIndexes[i]=0;}
309 for (i=0; i<3; i++) { fV0Indexes[i]=-1;}
310 for (i=0;i<kNPlane;i++) {
311 for (j=0;j<kNSlice;j++) {
312 fTRDsignals[i][j]=0.;
316 for (i=0;i<4;i++) {fTPCPoints[i]=0;}
317 for (i=0;i<3;i++) {fTOFLabel[i]=0;}
318 for (i=0;i<10;i++) {fTOFInfo[i]=0;}
319 for (i=0;i<12;i++) {fITSModule[i]=-1;}
321 // Calculate the AliExternalTrackParam content
328 // Calculate alpha: the rotation angle of the corresponding local system (TPC sector)
329 alpha = part->Phi()*180./TMath::Pi();
330 if (alpha<0) alpha+= 360.;
331 if (alpha>360) alpha -= 360.;
333 Int_t sector = (Int_t)(alpha/20.);
334 alpha = 10. + 20.*sector;
336 alpha *= TMath::Pi();
338 // Covariance matrix: no errors, the parameters are exact
339 for (i=0; i<15; i++) covar[i]=0.;
341 // Get the vertex of origin and the momentum
342 TVector3 ver(part->Vx(),part->Vy(),part->Vz());
343 TVector3 mom(part->Px(),part->Py(),part->Pz());
345 // Rotate to the local coordinate system (TPC sector)
349 // X of the referense plane
352 Int_t pdgCode = part->GetPdgCode();
355 TDatabasePDG::Instance()->GetParticle(pdgCode)->Charge();
359 param[2] = TMath::Sin(mom.Phi());
360 param[3] = mom.Pz()/mom.Pt();
361 param[4] = TMath::Sign(1/mom.Pt(),charge);
363 // Set AliExternalTrackParam
364 Set(xref, alpha, param, covar);
369 switch (TMath::Abs(pdgCode)) {
395 // If the particle is not e,mu,pi,K or p the PID probabilities are set to 0
396 if (indexPID < AliPID::kSPECIES) {
402 fHMPIDr[indexPID]=1.;
405 // AliESD track label
406 SetLabel(part->GetUniqueID());
410 //_______________________________________________________________________
411 AliESDtrack::~AliESDtrack(){
413 // This is destructor according Coding Conventrions
415 //printf("Delete track\n");
423 void AliESDtrack::AddCalibObject(TObject * object){
425 // add calib object to the list
427 if (!fFriendTrack) fFriendTrack = new AliESDfriendTrack;
428 fFriendTrack->AddCalibObject(object);
431 TObject * AliESDtrack::GetCalibObject(Int_t index){
433 // return calib objct at given position
435 if (!fFriendTrack) return 0;
436 return fFriendTrack->GetCalibObject(index);
440 //_______________________________________________________________________
441 void AliESDtrack::MakeMiniESDtrack(){
442 // Resets everything except
443 // fFlags: Reconstruction status flags
444 // fLabel: Track label
445 // fID: Unique ID of the track
446 // fD: Impact parameter in XY-plane
447 // fZ: Impact parameter in Z
448 // fR[AliPID::kSPECIES]: combined "detector response probability"
449 // Running track parameters in the base class (AliExternalTrackParam)
453 for (Int_t i=0;i<AliPID::kSPECIES;i++) fTrackTime[i] = 0;
455 // Reset track parameters constrained to the primary vertex
459 // Reset track parameters at the inner wall of TPC
461 delete fTPCInner;fTPCInner=0;
462 // Reset track parameters at the inner wall of the TRD
466 // Reset ITS track related information
471 for (Int_t i=0;i<AliPID::kSPECIES;i++) fITSr[i]=0;
474 // Reset TPC related track information
483 for (Int_t i=0;i<AliPID::kSPECIES;i++) fTPCr[i]=0;
485 for (Int_t i=0;i<4;i++) fTPCPoints[i] = 0;
486 for (Int_t i=0; i<3;i++) fKinkIndexes[i] = 0;
487 for (Int_t i=0; i<3;i++) fV0Indexes[i] = 0;
489 // Reset TRD related track information
494 for (Int_t i=0;i<kNPlane;i++) {
495 for (Int_t j=0;j<kNSlice;j++) {
496 fTRDsignals[i][j] = 0;
500 for (Int_t i=0;i<AliPID::kSPECIES;i++) fTRDr[i] = 0;
506 // Reset TOF related track information
514 for (Int_t i=0;i<AliPID::kSPECIES;i++) fTOFr[i] = 0;
515 for (Int_t i=0;i<3;i++) fTOFLabel[i] = 0;
516 for (Int_t i=0;i<10;i++) fTOFInfo[i] = 0;
518 // Reset HMPID related track information
523 for (Int_t i=0;i<AliPID::kSPECIES;i++) fHMPIDr[i] = 0;
530 fEMCALindex = kEMCALNoMatch;
532 delete fFriendTrack; fFriendTrack = 0;
534 //_______________________________________________________________________
535 Double_t AliESDtrack::GetMass() const {
536 // Returns the mass of the most probable particle type
539 for (Int_t i=0; i<AliPID::kSPECIES; i++) {
540 if (fR[i]>max) {k=i; max=fR[i];}
542 if (k==0) { // dE/dx "crossing points" in the TPC
544 if ((p>0.38)&&(p<0.48))
545 if (fR[0]<fR[3]*10.) return AliPID::ParticleMass(AliPID::kKaon);
546 if ((p>0.75)&&(p<0.85))
547 if (fR[0]<fR[4]*10.) return AliPID::ParticleMass(AliPID::kProton);
550 if (k==1) return AliPID::ParticleMass(AliPID::kMuon);
551 if (k==2||k==-1) return AliPID::ParticleMass(AliPID::kPion);
552 if (k==3) return AliPID::ParticleMass(AliPID::kKaon);
553 if (k==4) return AliPID::ParticleMass(AliPID::kProton);
554 AliWarning("Undefined mass !");
555 return AliPID::ParticleMass(AliPID::kPion);
558 //______________________________________________________________________________
559 Double_t AliESDtrack::E() const
561 // Returns the energy of the particle given its assumed mass.
562 // Assumes the pion mass if the particle can't be identified properly.
566 return TMath::Sqrt(p*p + m*m);
569 //______________________________________________________________________________
570 Double_t AliESDtrack::Y() const
572 // Returns the rapidity of a particle given its assumed mass.
573 // Assumes the pion mass if the particle can't be identified properly.
577 if (e != TMath::Abs(pz)) { // energy was not equal to pz
578 return 0.5*TMath::Log((e+pz)/(e-pz));
579 } else { // energy was equal to pz
584 //_______________________________________________________________________
585 Bool_t AliESDtrack::UpdateTrackParams(const AliKalmanTrack *t, ULong_t flags){
587 // This function updates track's running parameters
593 fLabel=t->GetLabel();
595 if (t->IsStartedTimeIntegral()) {
597 Double_t times[10];t->GetIntegratedTimes(times); SetIntegratedTimes(times);
598 SetIntegratedLength(t->GetIntegratedLength());
601 Set(t->GetX(),t->GetAlpha(),t->GetParameter(),t->GetCovariance());
605 case kITSin: case kITSout: case kITSrefit:
607 fITSncls=t->GetNumberOfClusters();
608 index=fFriendTrack->GetITSindices();
609 for (Int_t i=0;i<AliESDfriendTrack::kMaxITScluster;i++) {
610 index[i]=t->GetClusterIndex(i);
612 Int_t l=(index[i] & 0xf0000000) >> 28;
613 SETBIT(fITSClusterMap,l);
616 fITSchi2=t->GetChi2();
617 fITSsignal=t->GetPIDsignal();
618 fITSLabel = t->GetLabel();
621 case kTPCin: case kTPCrefit:
622 fTPCLabel = t->GetLabel();
623 if (flags==kTPCin) fTPCInner=new AliExternalTrackParam(*t);
624 if (!fIp) fIp=new AliExternalTrackParam(*t);
626 fIp->Set(t->GetX(),t->GetAlpha(),t->GetParameter(),t->GetCovariance());
628 index=fFriendTrack->GetTPCindices();
629 if (flags & kTPCout){
630 if (!fOp) fOp=new AliExternalTrackParam(*t);
632 fOp->Set(t->GetX(),t->GetAlpha(),t->GetParameter(),t->GetCovariance());
634 fTPCncls=t->GetNumberOfClusters();
635 fTPCchi2=t->GetChi2();
637 {//prevrow must be declared in separate namespace, otherwise compiler cries:
638 //"jump to case label crosses initialization of `Int_t prevrow'"
640 // for (Int_t i=0;i<fTPCncls;i++)
641 for (Int_t i=0;i<AliESDfriendTrack::kMaxTPCcluster;i++)
643 index[i]=t->GetClusterIndex(i);
644 Int_t idx = index[i];
648 // Piotr's Cluster Map for HBT
649 // ### please change accordingly if cluster array is changing
650 // to "New TPC Tracking" style (with gaps in array)
651 Int_t sect = (idx&0xff000000)>>24;
652 Int_t row = (idx&0x00ff0000)>>16;
653 if (sect > 18) row +=63; //if it is outer sector, add number of inner sectors
655 fTPCClusterMap.SetBitNumber(row,kTRUE);
657 //Fill the gap between previous row and this row with 0 bits
658 //In case ### pleas change it as well - just set bit 0 in case there
659 //is no associated clusters for current "i"
662 prevrow = row;//if previous bit was not assigned yet == this is the first one
665 { //we don't know the order (inner to outer or reverse)
666 //just to be save in case it is going to change
679 for (Int_t j = n+1; j < m; j++)
681 fTPCClusterMap.SetBitNumber(j,kFALSE);
685 // End Of Piotr's Cluster Map for HBT
688 fTPCsignal=t->GetPIDsignal();
691 case kTRDout: case kTRDin: case kTRDrefit:
692 index = fFriendTrack->GetTRDindices();
693 fTRDLabel = t->GetLabel();
694 fTRDchi2 = t->GetChi2();
695 fTRDncls = t->GetNumberOfClusters();
696 for (Int_t i=0;i<6;i++) index[i]=t->GetTrackletIndex(i);
698 fTRDsignal=t->GetPIDsignal();
701 if (!fOp) fOp=new AliExternalTrackParam(*t);
703 fOp->Set(t->GetX(),t->GetAlpha(),t->GetParameter(),t->GetCovariance());
704 fTRDncls0 = t->GetNumberOfClusters();
713 AliError("Wrong flag !");
720 //_______________________________________________________________________
721 void AliESDtrack::GetExternalParameters(Double_t &x, Double_t p[5]) const {
722 //---------------------------------------------------------------------
723 // This function returns external representation of the track parameters
724 //---------------------------------------------------------------------
726 for (Int_t i=0; i<5; i++) p[i]=GetParameter()[i];
729 //_______________________________________________________________________
730 void AliESDtrack::GetExternalCovariance(Double_t cov[15]) const {
731 //---------------------------------------------------------------------
732 // This function returns external representation of the cov. matrix
733 //---------------------------------------------------------------------
734 for (Int_t i=0; i<15; i++) cov[i]=AliExternalTrackParam::GetCovariance()[i];
737 //_______________________________________________________________________
738 Bool_t AliESDtrack::GetConstrainedExternalParameters
739 (Double_t &alpha, Double_t &x, Double_t p[5]) const {
740 //---------------------------------------------------------------------
741 // This function returns the constrained external track parameters
742 //---------------------------------------------------------------------
743 if (!fCp) return kFALSE;
744 alpha=fCp->GetAlpha();
746 for (Int_t i=0; i<5; i++) p[i]=fCp->GetParameter()[i];
750 //_______________________________________________________________________
752 AliESDtrack::GetConstrainedExternalCovariance(Double_t c[15]) const {
753 //---------------------------------------------------------------------
754 // This function returns the constrained external cov. matrix
755 //---------------------------------------------------------------------
756 if (!fCp) return kFALSE;
757 for (Int_t i=0; i<15; i++) c[i]=fCp->GetCovariance()[i];
762 AliESDtrack::GetInnerExternalParameters
763 (Double_t &alpha, Double_t &x, Double_t p[5]) const {
764 //---------------------------------------------------------------------
765 // This function returns external representation of the track parameters
766 // at the inner layer of TPC
767 //---------------------------------------------------------------------
768 if (!fIp) return kFALSE;
769 alpha=fIp->GetAlpha();
771 for (Int_t i=0; i<5; i++) p[i]=fIp->GetParameter()[i];
776 AliESDtrack::GetInnerExternalCovariance(Double_t cov[15]) const {
777 //---------------------------------------------------------------------
778 // This function returns external representation of the cov. matrix
779 // at the inner layer of TPC
780 //---------------------------------------------------------------------
781 if (!fIp) return kFALSE;
782 for (Int_t i=0; i<15; i++) cov[i]=fIp->GetCovariance()[i];
787 AliESDtrack::GetOuterExternalParameters
788 (Double_t &alpha, Double_t &x, Double_t p[5]) const {
789 //---------------------------------------------------------------------
790 // This function returns external representation of the track parameters
791 // at the inner layer of TRD
792 //---------------------------------------------------------------------
793 if (!fOp) return kFALSE;
794 alpha=fOp->GetAlpha();
796 for (Int_t i=0; i<5; i++) p[i]=fOp->GetParameter()[i];
801 AliESDtrack::GetOuterExternalCovariance(Double_t cov[15]) const {
802 //---------------------------------------------------------------------
803 // This function returns external representation of the cov. matrix
804 // at the inner layer of TRD
805 //---------------------------------------------------------------------
806 if (!fOp) return kFALSE;
807 for (Int_t i=0; i<15; i++) cov[i]=fOp->GetCovariance()[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, Int_t *idx) const
838 // Get cluster index array by subdetector index
843 ncls = GetITSclusters(idx);
846 ncls = GetTPCclusters(idx);
849 ncls = GetTRDclusters(idx);
852 if (fTOFindex != 0) {
853 idx[0] = GetTOFcluster();
863 //_______________________________________________________________________
864 void AliESDtrack::GetIntegratedTimes(Double_t *times) const {
865 // Returns the array with integrated times for each particle hypothesis
866 for (Int_t i=0; i<AliPID::kSPECIES; i++) times[i]=fTrackTime[i];
869 //_______________________________________________________________________
870 void AliESDtrack::SetIntegratedTimes(const Double_t *times) {
871 // Sets the array with integrated times for each particle hypotesis
872 for (Int_t i=0; i<AliPID::kSPECIES; i++) fTrackTime[i]=times[i];
875 //_______________________________________________________________________
876 void AliESDtrack::SetITSpid(const Double_t *p) {
877 // Sets values for the probability of each particle type (in ITS)
878 SetPIDValues(fITSr,p,AliPID::kSPECIES);
879 SetStatus(AliESDtrack::kITSpid);
882 //_______________________________________________________________________
883 void AliESDtrack::GetITSpid(Double_t *p) const {
884 // Gets the probability of each particle type (in ITS)
885 for (Int_t i=0; i<AliPID::kSPECIES; i++) p[i]=fITSr[i];
888 //_______________________________________________________________________
889 Char_t AliESDtrack::GetITSclusters(Int_t *idx) const {
890 //---------------------------------------------------------------------
891 // This function returns indices of the assgined ITS clusters
892 //---------------------------------------------------------------------
894 Int_t *index=fFriendTrack->GetITSindices();
895 for (Int_t i=0; i<AliESDfriendTrack::kMaxITScluster; i++) idx[i]=index[i];
900 //_______________________________________________________________________
901 Bool_t AliESDtrack::GetITSModuleIndexInfo(Int_t ilayer,Int_t &idet,Int_t &status,
902 Float_t &xloc,Float_t &zloc) const {
903 //----------------------------------------------------------------------
904 // This function encodes in the module number also the status of cluster association
905 // "status" can have the following values:
906 // 1 "found" (cluster is associated),
907 // 2 "dead" (module is dead from OCDB),
908 // 3 "skipped" (module or layer forced to be skipped),
909 // 4 "outinz" (track out of z acceptance),
910 // 5 "nocls" (no clusters in the road),
911 // 6 "norefit" (cluster rejected during refit),
912 // 7 "deadzspd" (holes in z in SPD)
913 // Also given are the coordinates of the crossing point of track and module
914 // (in the local module ref. system)
915 // WARNING: THIS METHOD HAS TO BE SYNCHRONIZED WITH AliITStrackV2::GetModuleIndexInfo()!
916 //----------------------------------------------------------------------
918 if(fITSModule[ilayer]==-1) {
919 AliError("fModule was not set !");
922 xloc=-99.; zloc=-99.;
926 Int_t module = fITSModule[ilayer];
928 idet = Int_t(module/1000000);
930 module -= idet*1000000;
932 status = Int_t(module/100000);
934 module -= status*100000;
936 Int_t signs = Int_t(module/10000);
940 Int_t xInt = Int_t(module/100);
945 if(signs==1) { xInt*=1; zInt*=1; }
946 if(signs==2) { xInt*=1; zInt*=-1; }
947 if(signs==3) { xInt*=-1; zInt*=1; }
948 if(signs==4) { xInt*=-1; zInt*=-1; }
950 xloc = 0.1*(Float_t)xInt;
951 zloc = 0.1*(Float_t)zInt;
953 if(status==4) idet = -1;
958 //_______________________________________________________________________
959 UShort_t AliESDtrack::GetTPCclusters(Int_t *idx) const {
960 //---------------------------------------------------------------------
961 // This function returns indices of the assgined ITS clusters
962 //---------------------------------------------------------------------
964 Int_t *index=fFriendTrack->GetTPCindices();
965 for (Int_t i=0; i<AliESDfriendTrack::kMaxTPCcluster; i++) idx[i]=index[i];
970 Double_t AliESDtrack::GetTPCdensity(Int_t row0, Int_t row1) const{
972 // GetDensity of the clusters on given region between row0 and row1
973 // Dead zone effect takin into acoount
978 Int_t *index=fFriendTrack->GetTPCindices();
979 for (Int_t i=row0;i<=row1;i++){
980 Int_t idx = index[i];
981 if (idx!=-1) good++; // track outside of dead zone
985 if (good>(row1-row0)*0.5) density = Float_t(found)/Float_t(good);
989 //_______________________________________________________________________
990 void AliESDtrack::SetTPCpid(const Double_t *p) {
991 // Sets values for the probability of each particle type (in TPC)
992 SetPIDValues(fTPCr,p,AliPID::kSPECIES);
993 SetStatus(AliESDtrack::kTPCpid);
996 //_______________________________________________________________________
997 void AliESDtrack::GetTPCpid(Double_t *p) const {
998 // Gets the probability of each particle type (in TPC)
999 for (Int_t i=0; i<AliPID::kSPECIES; i++) p[i]=fTPCr[i];
1002 //_______________________________________________________________________
1003 UChar_t AliESDtrack::GetTRDclusters(Int_t *idx) const {
1004 //---------------------------------------------------------------------
1005 // This function returns indices of the assgined TRD clusters
1006 //---------------------------------------------------------------------
1008 Int_t *index=fFriendTrack->GetTRDindices();
1009 for (Int_t i=0; i<AliESDfriendTrack::kMaxTRDcluster; i++) idx[i]=index[i];
1014 //_______________________________________________________________________
1015 UChar_t AliESDtrack::GetTRDtracklets(Int_t *idx) const {
1016 //---------------------------------------------------------------------
1017 // This function returns indices of the assigned TRD tracklets
1018 //---------------------------------------------------------------------
1020 Int_t *index=fFriendTrack->GetTRDindices();
1021 for (Int_t i=0; i<6/*AliESDfriendTrack::kMaxTRDcluster*/; i++) idx[i]=index[i];
1026 //_______________________________________________________________________
1027 void AliESDtrack::SetTRDpid(const Double_t *p) {
1028 // Sets values for the probability of each particle type (in TRD)
1029 SetPIDValues(fTRDr,p,AliPID::kSPECIES);
1030 SetStatus(AliESDtrack::kTRDpid);
1033 //_______________________________________________________________________
1034 void AliESDtrack::GetTRDpid(Double_t *p) const {
1035 // Gets the probability of each particle type (in TRD)
1036 for (Int_t i=0; i<AliPID::kSPECIES; i++) p[i]=fTRDr[i];
1039 //_______________________________________________________________________
1040 void AliESDtrack::SetTRDpid(Int_t iSpecies, Float_t p)
1042 // Sets the probability of particle type iSpecies to p (in TRD)
1043 fTRDr[iSpecies] = p;
1046 Double_t AliESDtrack::GetTRDpid(Int_t iSpecies) const
1048 // Returns the probability of particle type iSpecies (in TRD)
1049 return fTRDr[iSpecies];
1052 //_______________________________________________________________________
1053 void AliESDtrack::SetTOFpid(const Double_t *p) {
1054 // Sets the probability of each particle type (in TOF)
1055 SetPIDValues(fTOFr,p,AliPID::kSPECIES);
1056 SetStatus(AliESDtrack::kTOFpid);
1059 //_______________________________________________________________________
1060 void AliESDtrack::SetTOFLabel(const Int_t *p) {
1062 for (Int_t i=0; i<3; i++) fTOFLabel[i]=p[i];
1065 //_______________________________________________________________________
1066 void AliESDtrack::GetTOFpid(Double_t *p) const {
1067 // Gets probabilities of each particle type (in TOF)
1068 for (Int_t i=0; i<AliPID::kSPECIES; i++) p[i]=fTOFr[i];
1071 //_______________________________________________________________________
1072 void AliESDtrack::GetTOFLabel(Int_t *p) const {
1074 for (Int_t i=0; i<3; i++) p[i]=fTOFLabel[i];
1077 //_______________________________________________________________________
1078 void AliESDtrack::GetTOFInfo(Float_t *info) const {
1080 for (Int_t i=0; i<10; i++) info[i]=fTOFInfo[i];
1083 //_______________________________________________________________________
1084 void AliESDtrack::SetTOFInfo(Float_t*info) {
1086 for (Int_t i=0; i<10; i++) fTOFInfo[i]=info[i];
1091 //_______________________________________________________________________
1092 void AliESDtrack::SetHMPIDpid(const Double_t *p) {
1093 // Sets the probability of each particle type (in HMPID)
1094 SetPIDValues(fHMPIDr,p,AliPID::kSPECIES);
1095 SetStatus(AliESDtrack::kHMPIDpid);
1098 //_______________________________________________________________________
1099 void AliESDtrack::GetHMPIDpid(Double_t *p) const {
1100 // Gets probabilities of each particle type (in HMPID)
1101 for (Int_t i=0; i<AliPID::kSPECIES; i++) p[i]=fHMPIDr[i];
1106 //_______________________________________________________________________
1107 void AliESDtrack::SetESDpid(const Double_t *p) {
1108 // Sets the probability of each particle type for the ESD track
1109 SetPIDValues(fR,p,AliPID::kSPECIES);
1110 SetStatus(AliESDtrack::kESDpid);
1113 //_______________________________________________________________________
1114 void AliESDtrack::GetESDpid(Double_t *p) const {
1115 // Gets probability of each particle type for the ESD track
1116 for (Int_t i=0; i<AliPID::kSPECIES; i++) p[i]=fR[i];
1119 //_______________________________________________________________________
1120 Bool_t AliESDtrack::RelateToVertex
1121 (const AliESDVertex *vtx, Double_t b, Double_t maxd) {
1123 // Try to relate this track to the vertex "vtx",
1124 // if the (rough) transverse impact parameter is not bigger then "maxd".
1125 // Magnetic field is "b" (kG).
1127 // a) The track gets extapolated to the DCA to the vertex.
1128 // b) The impact parameters and their covariance matrix are calculated.
1129 // c) An attempt to constrain this track to the vertex is done.
1131 // In the case of success, the returned value is kTRUE
1132 // (otherwise, it's kFALSE)
1135 if (!vtx) return kFALSE;
1137 Double_t dz[2],cov[3];
1138 if (!PropagateToDCA(vtx, b, maxd, dz, cov)) return kFALSE;
1146 Double_t covar[6]; vtx->GetCovMatrix(covar);
1147 Double_t p[2]={GetParameter()[0]-dz[0],GetParameter()[1]-dz[1]};
1148 Double_t c[3]={covar[2],0.,covar[5]};
1150 Double_t chi2=GetPredictedChi2(p,c);
1151 if (chi2>77.) return kFALSE;
1154 fCp=new AliExternalTrackParam(*this);
1156 if (!fCp->Update(p,c)) {delete fCp; fCp=0; return kFALSE;}
1162 //_______________________________________________________________________
1163 void AliESDtrack::Print(Option_t *) const {
1164 // Prints info on the track
1166 printf("ESD track info\n") ;
1167 Double_t p[AliPID::kSPECIESN] ;
1169 if( IsOn(kITSpid) ){
1170 printf("From ITS: ") ;
1172 for(index = 0 ; index < AliPID::kSPECIES; index++)
1173 printf("%f, ", p[index]) ;
1174 printf("\n signal = %f\n", GetITSsignal()) ;
1176 if( IsOn(kTPCpid) ){
1177 printf("From TPC: ") ;
1179 for(index = 0 ; index < AliPID::kSPECIES; index++)
1180 printf("%f, ", p[index]) ;
1181 printf("\n signal = %f\n", GetTPCsignal()) ;
1183 if( IsOn(kTRDpid) ){
1184 printf("From TRD: ") ;
1186 for(index = 0 ; index < AliPID::kSPECIES; index++)
1187 printf("%f, ", p[index]) ;
1188 printf("\n signal = %f\n", GetTRDsignal()) ;
1190 if( IsOn(kTOFpid) ){
1191 printf("From TOF: ") ;
1193 for(index = 0 ; index < AliPID::kSPECIES; index++)
1194 printf("%f, ", p[index]) ;
1195 printf("\n signal = %f\n", GetTOFsignal()) ;
1197 if( IsOn(kHMPIDpid) ){
1198 printf("From HMPID: ") ;
1200 for(index = 0 ; index < AliPID::kSPECIES; index++)
1201 printf("%f, ", p[index]) ;
1202 printf("\n signal = %f\n", GetHMPIDsignal()) ;
1208 // Draw functionality
1209 // Origin: Marian Ivanov, Marian.Ivanov@cern.ch
1211 void AliESDtrack::FillPolymarker(TPolyMarker3D *pol, Float_t magF, Float_t minR, Float_t maxR, Float_t stepR){
1213 // Fill points in the polymarker
1216 arrayRef.AddLast(new AliExternalTrackParam(*this));
1217 if (fIp) arrayRef.AddLast(new AliExternalTrackParam(*fIp));
1218 if (fOp) arrayRef.AddLast(new AliExternalTrackParam(*fOp));
1220 Double_t mpos[3]={0,0,0};
1221 Int_t entries=arrayRef.GetEntries();
1222 for (Int_t i=0;i<entries;i++){
1224 ((AliExternalTrackParam*)arrayRef.At(i))->GetXYZ(pos);
1225 mpos[0]+=pos[0]/entries;
1226 mpos[1]+=pos[1]/entries;
1227 mpos[2]+=pos[2]/entries;
1229 // Rotate to the mean position
1231 Float_t fi= TMath::ATan2(mpos[1],mpos[0]);
1232 for (Int_t i=0;i<entries;i++){
1233 Bool_t res = ((AliExternalTrackParam*)arrayRef.At(i))->Rotate(fi);
1234 if (!res) delete arrayRef.RemoveAt(i);
1237 for (Double_t r=minR; r<maxR; r+=stepR){
1239 Double_t mlpos[3]={0,0,0};
1240 for (Int_t i=0;i<entries;i++){
1241 Double_t point[3]={0,0,0};
1242 AliExternalTrackParam *param = ((AliExternalTrackParam*)arrayRef.At(i));
1243 if (!param) continue;
1244 if (param->GetXYZAt(r,magF,point)){
1245 Double_t weight = 1./(10.+(r-param->GetX())*(r-param->GetX()));
1247 mlpos[0]+=point[0]*weight;
1248 mlpos[1]+=point[1]*weight;
1249 mlpos[2]+=point[2]*weight;
1256 pol->SetPoint(counter,mlpos[0],mlpos[1], mlpos[2]);
1257 printf("xyz\t%f\t%f\t%f\n",mlpos[0], mlpos[1],mlpos[2]);