{
//cosntructor
- if ( ((Int_t)kNSpecies) != ((Int_t)AliESDtrack::kSPECIES))
+ if ( ((Int_t)kNSpecies) != ((Int_t)AliPID::kSPECIES))
Fatal("AliReaderESD","ESD defintions probobly changed. Ask Youra.");
}
/********************************************************************/
fTPCC44Max(10e5)
{
//cosntructor
- if ( ((Int_t)kNSpecies) != ((Int_t)AliESDtrack::kSPECIES))
+ if ( ((Int_t)kNSpecies) != ((Int_t)AliPID::kSPECIES))
Fatal("AliReaderESD","ESD defintions probobly changed. Ask Youra.");
}
/********************************************************************/
//Here we apply Bayes' formula
Double_t rc=0.;
- for (Int_t s=0; s<AliESDtrack::kSPECIES; s++) rc+=concentr[s]*pidtable[s];
+ for (Int_t s=0; s<AliPID::kSPECIES; s++) rc+=concentr[s]*pidtable[s];
if (rc==0.0)
{
if (AliVAODParticle::GetDebug() > 2)
continue;
}
- for (Int_t s=0; s<AliESDtrack::kSPECIES; s++) w[s]=concentr[s]*pidtable[s]/rc;
+ for (Int_t s=0; s<AliPID::kSPECIES; s++) w[s]=concentr[s]*pidtable[s]/rc;
if (AliVAODParticle::GetDebug() > 4)
{
//find the most probable PID
Int_t spec = 0;
Float_t maxprob = w[0];
- for (Int_t s=1; s<AliESDtrack::kSPECIES; s++)
+ for (Int_t s=1; s<AliPID::kSPECIES; s++)
{
if (w[s]>maxprob)
{
AliEMCALRecParticle::AliEMCALRecParticle(): fEMCALRecPoint(0), fDebug(kFALSE)
{
// ctor
- const Int_t nSPECIES = AliESDtrack::kSPECIESN;
+ const Int_t nSPECIES = AliPID::kSPECIESN;
for(Int_t i = 0; i<nSPECIES ; i++)
fPID[i]=0.;
}
fPolarTheta = rp.fPolarTheta;
fPolarPhi = rp.fPolarPhi;
fParticlePDG = rp.fParticlePDG;
- const Int_t nSPECIES = AliESDtrack::kSPECIESN;
+ const Int_t nSPECIES = AliPID::kSPECIESN;
for(Int_t i = 0; i<nSPECIES ; i++)
fPID[i]=rp.fPID[i];
}
Int_t fEMCALRecPoint ; // pointer to the associated track segment in EMCAL
Bool_t fDebug ; // to steer debug output
TVector3 fPos ; // position in the global alice coordinate system
- Double_t fPID[AliESDtrack::kSPECIESN] ; // PID probability densities
+ Double_t fPID[AliPID::kSPECIESN] ; // PID probability densities
ClassDef(AliEMCALRecParticle,3) // Reconstructed Particle
};
//
// This function calculates the "detector response" PID probabilities
//
- static const Double_t masses[]={
- 0.000511, 0.105658, 0.139570, 0.493677, 0.938272, 1.875613
- };
Int_t ntrk=event->GetNumberOfTracks();
for (Int_t i=0; i<ntrk; i++) {
AliESDtrack *t=event->GetTrack(i);
if ((t->GetStatus()&AliESDtrack::kITSout)==0) continue;
Double_t mom=t->GetP();
Double_t dedx=t->GetITSsignal()/fMIP;
- Int_t ns=AliESDtrack::kSPECIES;
+ Int_t ns=AliPID::kSPECIES;
Double_t p[10];
for (Int_t j=0; j<ns; j++) {
- Double_t mass=masses[j];
+ Double_t mass=AliPID::ParticleMass(j);
Double_t bethe=Bethe(mom/mass);
Double_t sigma=fRes*bethe;
if (TMath::Abs(dedx-bethe) > fRange*sigma) {
t->fD[0] = t->GetD(GetX(),GetY());
t->fD[1] = t->GetZat(GetX())-GetZ();
Double_t vdist = TMath::Sqrt(t->fD[0]*t->fD[0]+t->fD[1]*t->fD[1]);
- if (t->GetMass()<0.13) t->SetMass(0.13957); // MI look to the esd - mass hypothesys !!!!!!!!!!!
+ if (t->GetMass()<0.13) t->SetMass(AliPID::ParticleMass(AliPID::kPion)); // MI look to the esd - mass hypothesys !!!!!!!!!!!
// write expected q
t->fExpQ = TMath::Max(0.8*t->fESDtrack->GetTPCsignal(),30.);
Pz() ) ;
printf(" TOF = %.3e ns\n", ToF() ) ;
printf(" PID weight: \n" ) ;
- printf(" photon -> %f\n", fPID[AliESDtrack::kPhoton] ) ;
- printf(" electron -> %f\n", fPID[AliESDtrack::kElectron] ) ;
- printf(" Conversion electron -> %f\n", fPID[AliESDtrack::kEleCon] ) ;
- printf(" muon -> %f\n", fPID[AliESDtrack::kMuon] ) ;
- printf(" neutral pion -> %f\n", fPID[AliESDtrack::kPi0] ) ;
- printf(" charged pion -> %f\n", fPID[AliESDtrack::kPion] ) ;
- printf(" charged kaon -> %f\n", fPID[AliESDtrack::kKaon] ) ;
- printf(" neutral kaon -> %f\n", fPID[AliESDtrack::kKaon0] ) ;
- printf(" proton -> %f\n", fPID[AliESDtrack::kProton] ) ;
- printf(" neutron -> %f\n", fPID[AliESDtrack::kNeutron] ) ;
+ printf(" photon -> %f\n", fPID[AliPID::kPhoton] ) ;
+ printf(" electron -> %f\n", fPID[AliPID::kElectron] ) ;
+ printf(" Conversion electron -> %f\n", fPID[AliPID::kEleCon] ) ;
+ printf(" muon -> %f\n", fPID[AliPID::kMuon] ) ;
+ printf(" neutral pion -> %f\n", fPID[AliPID::kPi0] ) ;
+ printf(" charged pion -> %f\n", fPID[AliPID::kPion] ) ;
+ printf(" charged kaon -> %f\n", fPID[AliPID::kKaon] ) ;
+ printf(" neutral kaon -> %f\n", fPID[AliPID::kKaon0] ) ;
+ printf(" proton -> %f\n", fPID[AliPID::kProton] ) ;
+ printf(" neutron -> %f\n", fPID[AliPID::kNeutron] ) ;
}
Int_t fIndexInList ; // the index of this RecParticle in the list stored in TreeR (to be set by analysis)
Float_t fTof ; // time of fliht
Int_t fType ; // particle type obtained by "virtual" reconstruction
- Double_t fPID[AliESDtrack::kSPECIESN] ; // PID probability densities
+ Double_t fPID[AliPID::kSPECIESN] ; // PID probability densities
private:
fZcharged[3] =-4.68e-2 ; fZcharged[4] =-9.21e-3 ; fZcharged[5] = 4.91e-2 ;//mean
fZcharged[6] = 1.425 ; fZcharged[7] =-5.90e-2 ; fZcharged[8] = 5.07e-2 ;//sigma
- for (Int_t i =0; i< AliESDtrack::kSPECIESN ; i++)
+ for (Int_t i =0; i< AliPID::kSPECIESN ; i++)
fInitPID[i] = 1.;
}
// construct the PID weight from a Bayesian Method
Int_t index ;
- const Int_t kSPECIES = AliESDtrack::kSPECIESN ;
+ const Int_t kSPECIES = AliPID::kSPECIESN ;
Int_t nparticles = AliPHOSGetter::Instance()->RecParticles()->GetEntriesFast() ;
// const Int_t kMAXPARTICLES = 2000 ;
Double_t time = recpar->ToF() ;
//cout<<">>>>>>>Energy "<<en<<"Time "<<time<<endl;
//Electrons initial population to be removed
- fInitPID[AliESDtrack::kEleCon] = 0. ;
+ fInitPID[AliPID::kEleCon] = 0. ;
// now get the signals probability
// s(pid) in the Bayesian formulation
- stof[AliESDtrack::kPhoton][index] = 1.;
- stof[AliESDtrack::kElectron][index] = 1.;
- stof[AliESDtrack::kPion][index] = 1.;
- stof[AliESDtrack::kKaon][index] = 1.;
- stof[AliESDtrack::kProton][index] = 1.;
- stof[AliESDtrack::kNeutron][index] = 1.;
- stof[AliESDtrack::kEleCon][index] = 1.;
- stof[AliESDtrack::kKaon0][index] = 1.;
- stof[AliESDtrack::kMuon][index] = 1.;
+ stof[AliPID::kPhoton][index] = 1.;
+ stof[AliPID::kElectron][index] = 1.;
+ stof[AliPID::kPion][index] = 1.;
+ stof[AliPID::kKaon][index] = 1.;
+ stof[AliPID::kProton][index] = 1.;
+ stof[AliPID::kNeutron][index] = 1.;
+ stof[AliPID::kEleCon][index] = 1.;
+ stof[AliPID::kKaon0][index] = 1.;
+ stof[AliPID::kMuon][index] = 1.;
if(en < 2.) {
- stof[AliESDtrack::kPhoton][index] = fTFphoton ->Eval(time) ; //gaus distribution
- stof[AliESDtrack::kPion][index] = fTFpiong ->Eval(time) ; //gaus distribution
- stof[AliESDtrack::kElectron][index] = stof[AliESDtrack::kPion][index] ;
+ stof[AliPID::kPhoton][index] = fTFphoton ->Eval(time) ; //gaus distribution
+ stof[AliPID::kPion][index] = fTFpiong ->Eval(time) ; //gaus distribution
+ stof[AliPID::kElectron][index] = stof[AliPID::kPion][index] ;
if(time < fTkaonl[1])
- stof[AliESDtrack::kKaon][index] = fTFkaong ->Eval(time) ; //gaus distribution
+ stof[AliPID::kKaon][index] = fTFkaong ->Eval(time) ; //gaus distribution
else
- stof[AliESDtrack::kKaon][index] = fTFkaonl ->Eval(time) ; //landau distribution
+ stof[AliPID::kKaon][index] = fTFkaonl ->Eval(time) ; //landau distribution
if(time < fThhadronl[1])
- stof[AliESDtrack::kProton][index] = fTFhhadrong ->Eval(time) ; //gaus distribution
+ stof[AliPID::kProton][index] = fTFhhadrong ->Eval(time) ; //gaus distribution
else
- stof[AliESDtrack::kProton][index] = fTFhhadronl ->Eval(time) ; //landau distribution
+ stof[AliPID::kProton][index] = fTFhhadronl ->Eval(time) ; //landau distribution
- stof[AliESDtrack::kNeutron][index] = stof[AliESDtrack::kProton][index] ;
- stof[AliESDtrack::kEleCon][index] = stof[AliESDtrack::kPhoton][index] ;
+ stof[AliPID::kNeutron][index] = stof[AliPID::kProton][index] ;
+ stof[AliPID::kEleCon][index] = stof[AliPID::kPhoton][index] ;
// a conversion electron has the photon ToF
- stof[AliESDtrack::kKaon0][index] = stof[AliESDtrack::kKaon][index] ;
- stof[AliESDtrack::kMuon][index] = stof[AliESDtrack::kPhoton][index] ;
+ stof[AliPID::kKaon0][index] = stof[AliPID::kKaon][index] ;
+ stof[AliPID::kMuon][index] = stof[AliPID::kPhoton][index] ;
}
// Info("MakePID", "Dispersion");
Float_t dispersion = emc->GetDispersion();
//dispersion is not well defined if the cluster is only in few crystals
- sdp[AliESDtrack::kPhoton][index] = 1. ;
- sdp[AliESDtrack::kElectron][index] = 1. ;
- sdp[AliESDtrack::kPion][index] = 1. ;
- sdp[AliESDtrack::kKaon][index] = 1. ;
- sdp[AliESDtrack::kProton][index] = 1. ;
- sdp[AliESDtrack::kNeutron][index] = 1. ;
- sdp[AliESDtrack::kEleCon][index] = 1. ;
- sdp[AliESDtrack::kKaon0][index] = 1. ;
- sdp[AliESDtrack::kMuon][index] = 1. ;
+ sdp[AliPID::kPhoton][index] = 1. ;
+ sdp[AliPID::kElectron][index] = 1. ;
+ sdp[AliPID::kPion][index] = 1. ;
+ sdp[AliPID::kKaon][index] = 1. ;
+ sdp[AliPID::kProton][index] = 1. ;
+ sdp[AliPID::kNeutron][index] = 1. ;
+ sdp[AliPID::kEleCon][index] = 1. ;
+ sdp[AliPID::kKaon0][index] = 1. ;
+ sdp[AliPID::kMuon][index] = 1. ;
if(en > 0.5 && emc->GetMultiplicity() > 3){
- sdp[AliESDtrack::kPhoton][index] = GausF (en , dispersion, fDphoton) ;
- sdp[AliESDtrack::kElectron][index] = sdp[AliESDtrack::kPhoton][index] ;
- sdp[AliESDtrack::kPion][index] = LandauF(en , dispersion, fDhadron ) ;
- sdp[AliESDtrack::kKaon][index] = sdp[AliESDtrack::kPion][index] ;
- sdp[AliESDtrack::kProton][index] = sdp[AliESDtrack::kPion][index] ;
- sdp[AliESDtrack::kNeutron][index] = sdp[AliESDtrack::kPion][index] ;
- sdp[AliESDtrack::kEleCon][index] = sdp[AliESDtrack::kPhoton][index];
- sdp[AliESDtrack::kKaon0][index] = sdp[AliESDtrack::kPion][index] ;
- sdp[AliESDtrack::kMuon][index] = fDFmuon ->Eval(dispersion) ; //landau distribution
+ sdp[AliPID::kPhoton][index] = GausF (en , dispersion, fDphoton) ;
+ sdp[AliPID::kElectron][index] = sdp[AliPID::kPhoton][index] ;
+ sdp[AliPID::kPion][index] = LandauF(en , dispersion, fDhadron ) ;
+ sdp[AliPID::kKaon][index] = sdp[AliPID::kPion][index] ;
+ sdp[AliPID::kProton][index] = sdp[AliPID::kPion][index] ;
+ sdp[AliPID::kNeutron][index] = sdp[AliPID::kPion][index] ;
+ sdp[AliPID::kEleCon][index] = sdp[AliPID::kPhoton][index];
+ sdp[AliPID::kKaon0][index] = sdp[AliPID::kPion][index] ;
+ sdp[AliPID::kMuon][index] = fDFmuon ->Eval(dispersion) ; //landau distribution
}
// Info("MakePID","multiplicity %d, dispersion %f", emc->GetMultiplicity(), dispersion);
-// Info("MakePID","ss: photon %f, hadron %f ", sdp[AliESDtrack::kPhoton][index], sdp[AliESDtrack::kPion][index]);
+// Info("MakePID","ss: photon %f, hadron %f ", sdp[AliPID::kPhoton][index], sdp[AliPID::kPion][index]);
// cout<<">>>>>multiplicity "<<emc->GetMultiplicity()<<", dispersion "<< dispersion<<endl ;
-// cout<<"<<<<<ss: photon "<<sdp[AliESDtrack::kPhoton][index]<<", hadron "<<sdp[AliESDtrack::kPion][index]<<endl;
+// cout<<"<<<<<ss: photon "<<sdp[AliPID::kPhoton][index]<<", hadron "<<sdp[AliPID::kPion][index]<<endl;
// CPV-EMC Distance
// Info("MakePID", "Distance");
// else
// cout<<">>>>>>>>>>>CHARGED>>>>>>>>>>>"<<endl;
- scpv[AliESDtrack::kPion][index] = pcpvcharged ;
- scpv[AliESDtrack::kKaon][index] = pcpvcharged ;
- scpv[AliESDtrack::kProton][index] = pcpvcharged ;
- scpv[AliESDtrack::kPhoton][index] = pcpvneutral ;
- scpv[AliESDtrack::kElectron][index] = pcpvelectron ;
- scpv[AliESDtrack::kNeutron][index] = pcpvneutral ;
- scpv[AliESDtrack::kEleCon][index] = pcpvelectron ;
- scpv[AliESDtrack::kKaon0][index] = pcpvneutral ;
- scpv[AliESDtrack::kMuon][index] = pcpvelectron ;
+ scpv[AliPID::kPion][index] = pcpvcharged ;
+ scpv[AliPID::kKaon][index] = pcpvcharged ;
+ scpv[AliPID::kProton][index] = pcpvcharged ;
+ scpv[AliPID::kPhoton][index] = pcpvneutral ;
+ scpv[AliPID::kElectron][index] = pcpvelectron ;
+ scpv[AliPID::kNeutron][index] = pcpvneutral ;
+ scpv[AliPID::kEleCon][index] = pcpvelectron ;
+ scpv[AliPID::kKaon0][index] = pcpvneutral ;
+ scpv[AliPID::kMuon][index] = pcpvelectron ;
// Info("MakePID", "CPV passed");
//Pi0
- stof[AliESDtrack::kPi0][index] = 0. ;
- scpv[AliESDtrack::kPi0][index] = 0. ;
- sdp [AliESDtrack::kPi0][index] = 0. ;
- fInitPID[AliESDtrack::kPi0] = 0. ;
+ stof[AliPID::kPi0][index] = 0. ;
+ scpv[AliPID::kPi0][index] = 0. ;
+ sdp [AliPID::kPi0][index] = 0. ;
+ fInitPID[AliPID::kPi0] = 0. ;
if(en > 30.){
// pi0 are detected via decay photon
- stof[AliESDtrack::kPi0][index] = fTFphoton ->Eval(time) ;
- scpv[AliESDtrack::kPi0][index] = pcpvneutral ;
- sdp [AliESDtrack::kPi0][index] = 1. ;
+ stof[AliPID::kPi0][index] = fTFphoton ->Eval(time) ;
+ scpv[AliPID::kPi0][index] = pcpvneutral ;
+ sdp [AliPID::kPi0][index] = 1. ;
if(emc->GetMultiplicity() > 3)
- sdp [AliESDtrack::kPi0][index] = GausPol2(en , dispersion, fDpi0) ;
+ sdp [AliPID::kPi0][index] = GausPol2(en , dispersion, fDpi0) ;
}
if(en > 0.5){
//Muons deposit few energy
- scpv[AliESDtrack::kMuon][index] = 0 ;
- stof[AliESDtrack::kMuon][index] = 0 ;
- sdp [AliESDtrack::kMuon][index] = 0 ;
+ scpv[AliPID::kMuon][index] = 0 ;
+ stof[AliPID::kMuon][index] = 0 ;
+ sdp [AliPID::kMuon][index] = 0 ;
}
if(en > 0.5){
cout<<">>>>electron : px*pz "<<pcpvelectron <<" hadron: px*pz "<<pcpvcharged<<endl;
- cout<<"Photon , pid "<< fInitPID[AliESDtrack::kPhoton]<<" tof "<<stof[AliESDtrack::kPhoton][index]
- <<", cpv "<<scpv[AliESDtrack::kPhoton][index]<<", ss "<<sdp[AliESDtrack::kPhoton][index]<<endl;
- cout<<"EleCon , pid "<< fInitPID[AliESDtrack::kEleCon]<<", tof "<<stof[AliESDtrack::kEleCon][index]
- <<", cpv "<<scpv[AliESDtrack::kEleCon][index]<<" ss "<<sdp[AliESDtrack::kEleCon][index]<<endl;
- cout<<"Electron , pid "<< fInitPID[AliESDtrack::kElectron]<<", tof "<<stof[AliESDtrack::kElectron][index]
- <<", cpv "<<scpv[AliESDtrack::kElectron][index]<<" ss "<<sdp[AliESDtrack::kElectron][index]<<endl;
- cout<<"Muon , pid "<< fInitPID[AliESDtrack::kMuon]<<", tof "<<stof[AliESDtrack::kMuon][index]
- <<", cpv "<<scpv[AliESDtrack::kMuon][index]<<" ss "<<sdp[AliESDtrack::kMuon][index]<<endl;
- cout<<"Pi0 , pid "<< fInitPID[AliESDtrack::kPi0]<<", tof "<<stof[AliESDtrack::kPi0][index]
- <<", cpv "<<scpv[AliESDtrack::kPi0][index]<<" ss "<<sdp[AliESDtrack::kPi0][index]<<endl;
- cout<<"Pion , pid "<< fInitPID[AliESDtrack::kPion]<<", tof "<<stof[AliESDtrack::kPion][index]
- <<", cpv "<<scpv[AliESDtrack::kPion][index]<<" ss "<<sdp[AliESDtrack::kPion][index]<<endl;
- cout<<"Kaon0 , pid "<< fInitPID[AliESDtrack::kKaon0]<<", tof "<<stof[AliESDtrack::kKaon0][index]
- <<", cpv "<<scpv[AliESDtrack::kKaon0][index]<<" ss "<<sdp[AliESDtrack::kKaon0][index]<<endl;
- cout<<"Kaon , pid "<< fInitPID[AliESDtrack::kKaon]<<", tof "<<stof[AliESDtrack::kKaon][index]
- <<", cpv "<<scpv[AliESDtrack::kKaon][index]<<" ss "<<sdp[AliESDtrack::kKaon][index]<<endl;
- cout<<"Neutron , pid "<< fInitPID[AliESDtrack::kNeutron]<<", tof "<<stof[AliESDtrack::kNeutron][index]
- <<", cpv "<<scpv[AliESDtrack::kNeutron][index]<<" ss "<<sdp[AliESDtrack::kNeutron][index]<<endl;
- cout<<"Proton , pid "<< fInitPID[AliESDtrack::kProton]<<", tof "<<stof[AliESDtrack::kProton][index]
- <<", cpv "<<scpv[AliESDtrack::kProton][index]<<" ss "<<sdp[AliESDtrack::kProton][index]<<endl;
+ cout<<"Photon , pid "<< fInitPID[AliPID::kPhoton]<<" tof "<<stof[AliPID::kPhoton][index]
+ <<", cpv "<<scpv[AliPID::kPhoton][index]<<", ss "<<sdp[AliPID::kPhoton][index]<<endl;
+ cout<<"EleCon , pid "<< fInitPID[AliPID::kEleCon]<<", tof "<<stof[AliPID::kEleCon][index]
+ <<", cpv "<<scpv[AliPID::kEleCon][index]<<" ss "<<sdp[AliPID::kEleCon][index]<<endl;
+ cout<<"Electron , pid "<< fInitPID[AliPID::kElectron]<<", tof "<<stof[AliPID::kElectron][index]
+ <<", cpv "<<scpv[AliPID::kElectron][index]<<" ss "<<sdp[AliPID::kElectron][index]<<endl;
+ cout<<"Muon , pid "<< fInitPID[AliPID::kMuon]<<", tof "<<stof[AliPID::kMuon][index]
+ <<", cpv "<<scpv[AliPID::kMuon][index]<<" ss "<<sdp[AliPID::kMuon][index]<<endl;
+ cout<<"Pi0 , pid "<< fInitPID[AliPID::kPi0]<<", tof "<<stof[AliPID::kPi0][index]
+ <<", cpv "<<scpv[AliPID::kPi0][index]<<" ss "<<sdp[AliPID::kPi0][index]<<endl;
+ cout<<"Pion , pid "<< fInitPID[AliPID::kPion]<<", tof "<<stof[AliPID::kPion][index]
+ <<", cpv "<<scpv[AliPID::kPion][index]<<" ss "<<sdp[AliPID::kPion][index]<<endl;
+ cout<<"Kaon0 , pid "<< fInitPID[AliPID::kKaon0]<<", tof "<<stof[AliPID::kKaon0][index]
+ <<", cpv "<<scpv[AliPID::kKaon0][index]<<" ss "<<sdp[AliPID::kKaon0][index]<<endl;
+ cout<<"Kaon , pid "<< fInitPID[AliPID::kKaon]<<", tof "<<stof[AliPID::kKaon][index]
+ <<", cpv "<<scpv[AliPID::kKaon][index]<<" ss "<<sdp[AliPID::kKaon][index]<<endl;
+ cout<<"Neutron , pid "<< fInitPID[AliPID::kNeutron]<<", tof "<<stof[AliPID::kNeutron][index]
+ <<", cpv "<<scpv[AliPID::kNeutron][index]<<" ss "<<sdp[AliPID::kNeutron][index]<<endl;
+ cout<<"Proton , pid "<< fInitPID[AliPID::kProton]<<", tof "<<stof[AliPID::kProton][index]
+ <<", cpv "<<scpv[AliPID::kProton][index]<<" ss "<<sdp[AliPID::kProton][index]<<endl;
cout<<"######################################################"<<endl;
}
}
//_______________________________________________________________________
void AliPHOSPIDv1::SetInitPID(const Double_t *p) {
// Sets values for the initial population of each particle type
- for (Int_t i=0; i<AliESDtrack::kSPECIESN; i++) fInitPID[i] = p[i];
+ for (Int_t i=0; i<AliPID::kSPECIESN; i++) fInitPID[i] = p[i];
}
//_______________________________________________________________________
void AliPHOSPIDv1::GetInitPID(Double_t *p) const {
// Gets values for the initial population of each particle type
- for (Int_t i=0; i<AliESDtrack::kSPECIESN; i++) p[i] = fInitPID[i];
+ for (Int_t i=0; i<AliPID::kSPECIESN; i++) p[i] = fInitPID[i];
}
TMatrix *fParameters; //! Matrix of identification Parameters
//Initial pid population
- Double_t fInitPID[AliESDtrack::kSPECIESN] ; // Initial population to do bayesian PID
+ Double_t fInitPID[AliPID::kSPECIESN] ; // Initial population to do bayesian PID
// pid probability function parameters
// ToF
Double_t fTphoton[3] ; // gaussian tof response for photon
AliPHOSRecParticle::AliPHOSRecParticle(): fPHOSTrackSegment(0) , fDebug( kFALSE )
{
// ctor
- const Int_t nSPECIES = AliESDtrack::kSPECIESN;
+ const Int_t nSPECIES = AliPID::kSPECIESN;
for(Int_t i = 0; i<nSPECIES ; i++)
fPID[i]=0.;
}
fPolarTheta = rp.fPolarTheta;
fPolarPhi = rp.fPolarPhi;
fParticlePDG = rp.fParticlePDG;
- const Int_t nSPECIES = AliESDtrack::kSPECIESN;
+ const Int_t nSPECIES = AliPID::kSPECIESN;
for(Int_t i = 0; i<nSPECIES ; i++)
fPID[i]=rp.fPID[i];
}
#include "AliRICHRecon.h"
#include <AliStack.h>
#include <TParticle.h>
-#include <TDatabasePDG.h>
#include <TMath.h>
ClassImp(AliRICHTracker)
//__________________________________________________________________________________________________
void AliRICHTracker::CalcProb(Double_t thetaCer,Double_t pmod, Double_t *richPID)
{
//
- Double_t height[5];Double_t totalHeight=0;
- Int_t code[5]={kElectron,kMuonPlus,kPiPlus,kKPlus,kProton};
- TDatabasePDG *db = new TDatabasePDG();
- for(Int_t iPart=0;iPart<4;iPart++){
- Double_t mass = db->GetParticle(code[iPart])->Mass();
+ Double_t height[AliPID::kSPECIES];Double_t totalHeight=0;
+ for(Int_t iPart=0;iPart<AliPID::kSPECIES;iPart++){
+ Double_t mass = AliPID::ParticleMass(iPart);
Double_t refIndex=AliRICHParam::IndOfRefC6F14(6.755);
Double_t cosThetaTh = TMath::Sqrt(mass*mass+pmod*pmod)/(refIndex*pmod);
if(cosThetaTh>=1) {break;}
height[iPart] = TMath::Gaus(thetaCer,thetaTh,sigmaThetaTh);
totalHeight +=height[iPart];
}
- for(Int_t iPart=0;iPart<5;iPart++) richPID[iPart] = height[iPart]/totalHeight;
+ for(Int_t iPart=0;iPart<AliPID::kSPECIES;iPart++) richPID[iPart] = height[iPart]/totalHeight;
}//CalcProb
//
Int_t ntrk=event->GetNumberOfTracks();
for (Int_t i=0; i<ntrk; i++) {
- Int_t ns=AliESDtrack::kSPECIES;
+ Int_t ns=AliPID::kSPECIES;
Double_t p[10]={1.,1.,1.,1.,1.,1.,1.,1.,1.,1.};
const Double_t keps=1e-13;
// The default ESD constructor
//
fID =0;
- for (Int_t i=0; i<kSPECIES; i++) {
+ for (Int_t i=0; i<AliPID::kSPECIES; i++) {
fTrackTime[i]=0.;
fR[i]=1.;
fITSr[i]=1.;
fRICHr[i]=1.;
}
- for (Int_t i=0; i<kSPECIESN; i++) {
+ for (Int_t i=0; i<AliPID::kSPECIESN; i++) {
fPHOSr[i] = 1.;
fEMCALr[i] = 1.;
}
fLabel =track.fLabel;
fTrackLength =track.fTrackLength;
fD=track.fD; fZ=track.fZ;
- for (Int_t i=0;i<kSPECIES;i++) fTrackTime[i] =track.fTrackTime[i];
- for (Int_t i=0;i<kSPECIES;i++) fR[i] =track.fR[i];
+ for (Int_t i=0;i<AliPID::kSPECIES;i++) fTrackTime[i] =track.fTrackTime[i];
+ for (Int_t i=0;i<AliPID::kSPECIES;i++) fR[i] =track.fR[i];
fStopVertex =track.fStopVertex;
//
fRalpha =track.fRalpha;
fITSncls =track.fITSncls;
for (Int_t i=0;i<6;i++) fITSindex[i]=track.fITSindex[i];
fITSsignal =track.fITSsignal;
- for (Int_t i=0;i<kSPECIES;i++) fITSr[i]=track.fITSr[i];
+ for (Int_t i=0;i<AliPID::kSPECIES;i++) fITSr[i]=track.fITSr[i];
fITSLabel =track.fITSLabel;
fITSFakeRatio =track.fITSFakeRatio;
fITStrack =0; //coping separatelly - in user code
for (Int_t i=0;i<180;i++) fTPCindex[i]=track.fTPCindex[i];
fTPCClusterMap=track.fTPCClusterMap;
fTPCsignal=track.fTPCsignal;
- for (Int_t i=0;i<kSPECIES;i++) fTPCr[i]=track.fTPCr[i];
+ for (Int_t i=0;i<AliPID::kSPECIES;i++) fTPCr[i]=track.fTPCr[i];
fTPCLabel=track.fTPCLabel;
for (Int_t i=0;i<4;i++) {fTPCPoints[i]=track.fTPCPoints[i];}
for (Int_t i=0; i<3;i++) { fKinkIndexes[i]=track.fKinkIndexes[i];}
fTRDsignals[i]=track.fTRDsignals[i];
fTRDTimBin[i]=track.fTRDTimBin[i];
}
- for (Int_t i=0;i<kSPECIES;i++) fTRDr[i]=track.fTRDr[i];
+ for (Int_t i=0;i<AliPID::kSPECIES;i++) fTRDr[i]=track.fTRDr[i];
fTRDLabel=track.fTRDLabel;
fTRDtrack=0;
//
fTOFchi2=track.fTOFchi2;
fTOFindex=track.fTOFindex;
fTOFsignal=track.fTOFsignal;
- for (Int_t i=0;i<kSPECIES;i++) fTOFr[i]=track.fTOFr[i];
+ for (Int_t i=0;i<AliPID::kSPECIES;i++) fTOFr[i]=track.fTOFr[i];
for (Int_t i=0;i<3;i++) fTOFLabel[i]=track.fTOFLabel[i];
for (Int_t i=0;i<10;i++) fTOFInfo[i]=track.fTOFInfo[i];
//
for (Int_t i=0;i<3;i++) fPHOSpos[i]=track.fPHOSpos[i];
fPHOSsignal=track.fPHOSsignal;
- for (Int_t i=0;i<kSPECIESN;i++) fPHOSr[i]=track.fPHOSr[i];
+ for (Int_t i=0;i<AliPID::kSPECIESN;i++) fPHOSr[i]=track.fPHOSr[i];
//
for (Int_t i=0;i<3;i++) fEMCALpos[i]=track.fEMCALpos[i];
fEMCALsignal=track.fEMCALsignal;
- for (Int_t i=0;i<kSPECIESN;i++) fEMCALr[i]=track.fEMCALr[i];
+ for (Int_t i=0;i<AliPID::kSPECIESN;i++) fEMCALr[i]=track.fEMCALr[i];
//
fRICHsignal=track.fRICHsignal;
- for (Int_t i=0;i<kSPECIES;i++) fRICHr[i]=track.fRICHr[i];
+ for (Int_t i=0;i<AliPID::kSPECIES;i++) fRICHr[i]=track.fRICHr[i];
}
// Returns the mass of the most probable particle type
Float_t max=0.;
Int_t k=-1;
- for (Int_t i=0; i<kSPECIES; i++) {
+ for (Int_t i=0; i<AliPID::kSPECIES; i++) {
if (fR[i]>max) {k=i; max=fR[i];}
}
if (k==0) { // dE/dx "crossing points" in the TPC
Double_t p=GetP();
if ((p>0.38)&&(p<0.48))
- if (fR[0]<fR[3]*10.) return 0.49368;
+ if (fR[0]<fR[3]*10.) return AliPID::ParticleMass(AliPID::kKaon);
if ((p>0.75)&&(p<0.85))
- if (fR[0]<fR[4]*10.) return 0.93827;
+ if (fR[0]<fR[4]*10.) return AliPID::ParticleMass(AliPID::kProton);
return 0.00051;
}
- if (k==1) return 0.10566;
- if (k==2||k==-1) return 0.13957;
- if (k==3) return 0.49368;
- if (k==4) return 0.93827;
+ if (k==1) return AliPID::ParticleMass(AliPID::kMuon);
+ if (k==2||k==-1) return AliPID::ParticleMass(AliPID::kPion);
+ if (k==3) return AliPID::ParticleMass(AliPID::kKaon);
+ if (k==4) return AliPID::ParticleMass(AliPID::kProton);
AliWarning("Undefined mass !");
- return 0.13957;
+ return AliPID::ParticleMass(AliPID::kPion);
}
//_______________________________________________________________________
//_______________________________________________________________________
void AliESDtrack::GetIntegratedTimes(Double_t *times) const {
// Returns the array with integrated times for each particle hypothesis
- for (Int_t i=0; i<kSPECIES; i++) times[i]=fTrackTime[i];
+ for (Int_t i=0; i<AliPID::kSPECIES; i++) times[i]=fTrackTime[i];
}
//_______________________________________________________________________
void AliESDtrack::SetIntegratedTimes(const Double_t *times) {
// Sets the array with integrated times for each particle hypotesis
- for (Int_t i=0; i<kSPECIES; i++) fTrackTime[i]=times[i];
+ for (Int_t i=0; i<AliPID::kSPECIES; i++) fTrackTime[i]=times[i];
}
//_______________________________________________________________________
void AliESDtrack::SetITSpid(const Double_t *p) {
// Sets values for the probability of each particle type (in ITS)
- for (Int_t i=0; i<kSPECIES; i++) fITSr[i]=p[i];
+ for (Int_t i=0; i<AliPID::kSPECIES; i++) fITSr[i]=p[i];
SetStatus(AliESDtrack::kITSpid);
}
//_______________________________________________________________________
void AliESDtrack::GetITSpid(Double_t *p) const {
// Gets the probability of each particle type (in ITS)
- for (Int_t i=0; i<kSPECIES; i++) p[i]=fITSr[i];
+ for (Int_t i=0; i<AliPID::kSPECIES; i++) p[i]=fITSr[i];
}
//_______________________________________________________________________
//_______________________________________________________________________
void AliESDtrack::SetTPCpid(const Double_t *p) {
// Sets values for the probability of each particle type (in TPC)
- for (Int_t i=0; i<kSPECIES; i++) fTPCr[i]=p[i];
+ for (Int_t i=0; i<AliPID::kSPECIES; i++) fTPCr[i]=p[i];
SetStatus(AliESDtrack::kTPCpid);
}
//_______________________________________________________________________
void AliESDtrack::GetTPCpid(Double_t *p) const {
// Gets the probability of each particle type (in TPC)
- for (Int_t i=0; i<kSPECIES; i++) p[i]=fTPCr[i];
+ for (Int_t i=0; i<AliPID::kSPECIES; i++) p[i]=fTPCr[i];
}
//_______________________________________________________________________
//_______________________________________________________________________
void AliESDtrack::SetTRDpid(const Double_t *p) {
// Sets values for the probability of each particle type (in TRD)
- for (Int_t i=0; i<kSPECIES; i++) fTRDr[i]=p[i];
+ for (Int_t i=0; i<AliPID::kSPECIES; i++) fTRDr[i]=p[i];
SetStatus(AliESDtrack::kTRDpid);
}
//_______________________________________________________________________
void AliESDtrack::GetTRDpid(Double_t *p) const {
// Gets the probability of each particle type (in TRD)
- for (Int_t i=0; i<kSPECIES; i++) p[i]=fTRDr[i];
+ for (Int_t i=0; i<AliPID::kSPECIES; i++) p[i]=fTRDr[i];
}
//_______________________________________________________________________
//_______________________________________________________________________
void AliESDtrack::SetTOFpid(const Double_t *p) {
// Sets the probability of each particle type (in TOF)
- for (Int_t i=0; i<kSPECIES; i++) fTOFr[i]=p[i];
+ for (Int_t i=0; i<AliPID::kSPECIES; i++) fTOFr[i]=p[i];
SetStatus(AliESDtrack::kTOFpid);
}
//_______________________________________________________________________
void AliESDtrack::GetTOFpid(Double_t *p) const {
// Gets probabilities of each particle type (in TOF)
- for (Int_t i=0; i<kSPECIES; i++) p[i]=fTOFr[i];
+ for (Int_t i=0; i<AliPID::kSPECIES; i++) p[i]=fTOFr[i];
}
//_______________________________________________________________________
//_______________________________________________________________________
void AliESDtrack::SetPHOSpid(const Double_t *p) {
// Sets the probability of each particle type (in PHOS)
- for (Int_t i=0; i<kSPECIESN; i++) fPHOSr[i]=p[i];
+ for (Int_t i=0; i<AliPID::kSPECIESN; i++) fPHOSr[i]=p[i];
SetStatus(AliESDtrack::kPHOSpid);
}
//_______________________________________________________________________
void AliESDtrack::GetPHOSpid(Double_t *p) const {
// Gets probabilities of each particle type (in PHOS)
- for (Int_t i=0; i<kSPECIESN; i++) p[i]=fPHOSr[i];
+ for (Int_t i=0; i<AliPID::kSPECIESN; i++) p[i]=fPHOSr[i];
}
//_______________________________________________________________________
void AliESDtrack::SetEMCALpid(const Double_t *p) {
// Sets the probability of each particle type (in EMCAL)
- for (Int_t i=0; i<kSPECIESN; i++) fEMCALr[i]=p[i];
+ for (Int_t i=0; i<AliPID::kSPECIESN; i++) fEMCALr[i]=p[i];
SetStatus(AliESDtrack::kEMCALpid);
}
//_______________________________________________________________________
void AliESDtrack::GetEMCALpid(Double_t *p) const {
// Gets probabilities of each particle type (in EMCAL)
- for (Int_t i=0; i<kSPECIESN; i++) p[i]=fEMCALr[i];
+ for (Int_t i=0; i<AliPID::kSPECIESN; i++) p[i]=fEMCALr[i];
}
//_______________________________________________________________________
void AliESDtrack::SetRICHpid(const Double_t *p) {
// Sets the probability of each particle type (in RICH)
- for (Int_t i=0; i<kSPECIES; i++) fRICHr[i]=p[i];
+ for (Int_t i=0; i<AliPID::kSPECIES; i++) fRICHr[i]=p[i];
SetStatus(AliESDtrack::kRICHpid);
}
//_______________________________________________________________________
void AliESDtrack::GetRICHpid(Double_t *p) const {
// Gets probabilities of each particle type (in RICH)
- for (Int_t i=0; i<kSPECIES; i++) p[i]=fRICHr[i];
+ for (Int_t i=0; i<AliPID::kSPECIES; i++) p[i]=fRICHr[i];
}
//_______________________________________________________________________
void AliESDtrack::SetESDpid(const Double_t *p) {
// Sets the probability of each particle type for the ESD track
- for (Int_t i=0; i<kSPECIES; i++) fR[i]=p[i];
+ for (Int_t i=0; i<AliPID::kSPECIES; i++) fR[i]=p[i];
SetStatus(AliESDtrack::kESDpid);
}
//_______________________________________________________________________
void AliESDtrack::GetESDpid(Double_t *p) const {
// Gets probability of each particle type for the ESD track
- for (Int_t i=0; i<kSPECIES; i++) p[i]=fR[i];
+ for (Int_t i=0; i<AliPID::kSPECIES; i++) p[i]=fR[i];
}
//_______________________________________________________________________
// Prints info on the track
printf("ESD track info\n") ;
- Double_t p[kSPECIESN] ;
+ Double_t p[AliPID::kSPECIESN] ;
Int_t index = 0 ;
if( IsOn(kITSpid) ){
printf("From ITS: ") ;
GetITSpid(p) ;
- for(index = 0 ; index < kSPECIES; index++)
+ for(index = 0 ; index < AliPID::kSPECIES; index++)
printf("%f, ", p[index]) ;
printf("\n signal = %f\n", GetITSsignal()) ;
}
if( IsOn(kTPCpid) ){
printf("From TPC: ") ;
GetTPCpid(p) ;
- for(index = 0 ; index < kSPECIES; index++)
+ for(index = 0 ; index < AliPID::kSPECIES; index++)
printf("%f, ", p[index]) ;
printf("\n signal = %f\n", GetTPCsignal()) ;
}
if( IsOn(kTRDpid) ){
printf("From TRD: ") ;
GetTRDpid(p) ;
- for(index = 0 ; index < kSPECIES; index++)
+ for(index = 0 ; index < AliPID::kSPECIES; index++)
printf("%f, ", p[index]) ;
printf("\n signal = %f\n", GetTRDsignal()) ;
}
if( IsOn(kTOFpid) ){
printf("From TOF: ") ;
GetTOFpid(p) ;
- for(index = 0 ; index < kSPECIES; index++)
+ for(index = 0 ; index < AliPID::kSPECIES; index++)
printf("%f, ", p[index]) ;
printf("\n signal = %f\n", GetTOFsignal()) ;
}
if( IsOn(kRICHpid) ){
printf("From TOF: ") ;
GetRICHpid(p) ;
- for(index = 0 ; index < kSPECIES; index++)
+ for(index = 0 ; index < AliPID::kSPECIES; index++)
printf("%f, ", p[index]) ;
printf("\n signal = %f\n", GetRICHsignal()) ;
}
if( IsOn(kPHOSpid) ){
printf("From PHOS: ") ;
GetPHOSpid(p) ;
- for(index = 0 ; index < kSPECIESN; index++)
+ for(index = 0 ; index < AliPID::kSPECIESN; index++)
printf("%f, ", p[index]) ;
printf("\n signal = %f\n", GetPHOSsignal()) ;
}
if( IsOn(kEMCALpid) ){
printf("From EMCAL: ") ;
GetEMCALpid(p) ;
- for(index = 0 ; index < kSPECIESN; index++)
+ for(index = 0 ; index < AliPID::kSPECIESN; index++)
printf("%f, ", p[index]) ;
printf("\n signal = %f\n", GetEMCALsignal()) ;
}
#include <TBits.h>
#include <TObject.h>
+#include "AliPID.h"
class AliKalmanTrack;
const Int_t kNPlane = 6;
kESDpid=0x40000000,
kTIME=0x80000000
};
- enum {
- kSPECIES=5, // Number of particle species recognized by the PID
- kSPECIESN=10, // Number of charged+neutral particle species recognized by the PHOS/EMCAL PID
- kElectron=0, kMuon=1, kPion=2, kKaon=3, kProton=4, kPhoton=5,
- kPi0=6, kNeutron=7, kKaon0=8, kEleCon=9 // PHOS/EMCAL definition
- };
protected:
ULong_t fFlags; // Reconstruction status flags
Int_t fLabel; // Track label
Float_t fTrackLength; // Track length
Float_t fD; // Impact parameter in XY-plane
Float_t fZ; // Impact parameter in Z
- Float_t fTrackTime[kSPECIES]; // TOFs estimated by the tracking
- Float_t fR[kSPECIES]; // combined "detector response probability"
+ Float_t fTrackTime[AliPID::kSPECIES]; // TOFs estimated by the tracking
+ Float_t fR[AliPID::kSPECIES]; // combined "detector response probability"
Int_t fStopVertex; // Index of stop vertex
Int_t fITSncls; // number of clusters assigned in the ITS
UInt_t fITSindex[6]; //! indices of the assigned ITS clusters
Float_t fITSsignal; // detector's PID signal
- Float_t fITSr[kSPECIES]; // "detector response probabilities" (for the PID)
+ Float_t fITSr[AliPID::kSPECIES]; // "detector response probabilities" (for the PID)
Int_t fITSLabel; // label according TPC
Float_t fITSFakeRatio; // ration of fake tracks
AliKalmanTrack * fITStrack; //! OWNER: pointer to the ITS track -- currently for debug purpose
Int_t fTPCindex[180]; //! indices of the assigned TPC clusters
TBits fTPCClusterMap; // Map of clusters, one bit per padrow; 1 if has a cluster on given padrow
Float_t fTPCsignal; // detector's PID signal
- Float_t fTPCr[kSPECIES]; // "detector response probabilities" (for the PID)
+ Float_t fTPCr[AliPID::kSPECIES]; // "detector response probabilities" (for the PID)
Int_t fTPCLabel; // label according TPC
Float_t fTPCPoints[4]; // TPC points -first, max. dens, last and max density
Int_t fKinkIndexes[3]; // array of indexes of posible kink candidates
Float_t fTRDsignal; // detector's PID signal
Float_t fTRDsignals[kNPlane]; // TRD signals from all six planes
Int_t fTRDTimBin[kNPlane]; // Time bin of Max cluster from all six planes
- Float_t fTRDr[kSPECIES]; // "detector response probabilities" (for the PID)
+ Float_t fTRDr[AliPID::kSPECIES]; // "detector response probabilities" (for the PID)
Int_t fTRDLabel; // label according TRD
AliKalmanTrack * fTRDtrack; //! OWNER: pointer to the TRD track -- currently for debug purpose
Float_t fTOFchi2; // chi2 in the TOF
UInt_t fTOFindex; // index of the assigned TOF cluster
Float_t fTOFsignal; // detector's PID signal
- Float_t fTOFr[kSPECIES]; // "detector response probabilities" (for the PID)
+ Float_t fTOFr[AliPID::kSPECIES]; // "detector response probabilities" (for the PID)
Int_t fTOFLabel[3]; // TOF label
Float_t fTOFInfo[10]; //! TOF informations
// PHOS related track information
Float_t fPHOSpos[3]; // position localised by PHOS in global coordinate system
Float_t fPHOSsignal; // energy measured by PHOS
- Float_t fPHOSr[kSPECIESN]; // PID information from PHOS
+ Float_t fPHOSr[AliPID::kSPECIESN]; // PID information from PHOS
// EMCAL related track information
Float_t fEMCALpos[3]; //position localised by EMCAL in global coordinate system
Float_t fEMCALsignal; // energy measured by EMCAL
- Float_t fEMCALr[kSPECIESN]; // PID information from EMCAL
+ Float_t fEMCALr[AliPID::kSPECIESN]; // PID information from EMCAL
// HMPID related track information
Float_t fRICHsignal; // detector's PID signal (beta for RICH)
- Float_t fRICHr[kSPECIES];// "detector response probabilities" (for the PID)
+ Float_t fRICHr[AliPID::kSPECIES];// "detector response probabilities" (for the PID)
ClassDef(AliESDtrack,11) //ESDtrack
};
#include "AliKalmanTrack.h"
#include "AliLog.h"
-#include "AliPDG.h"
-#include "TPDGCode.h"
-#include "TDatabasePDG.h"
ClassImp(AliKalmanTrack)
AliKalmanTrack::AliKalmanTrack():
fLab(-3141593),
fChi2(0),
- fMass(0.13957),
+ fMass(AliPID::ParticleMass(AliPID::kPion)),
fN(0)
{
//
// AliWarning("Reseting Recorded Time.");
fStartTimeIntegral = kTRUE;
- for(Int_t i=0; i<fgkTypes; i++) fIntegratedTime[i] = 0;
+ for(Int_t i=0; i<AliPID::kSPECIES; i++) fIntegratedTime[i] = 0;
fIntegratedLength = 0;
}
//_______________________________________________________________________
fIntegratedLength += length;
- static Int_t pdgCode[fgkTypes] = {kElectron, kMuonMinus, kPiPlus, kKPlus, kProton};
- TDatabasePDG *db = TDatabasePDG::Instance();
-
Double_t xr, param[5];
Double_t pt, tgl;
if (length > 100) return;
- for (Int_t i=0; i<fgkTypes; i++) {
+ for (Int_t i=0; i<AliPID::kSPECIES; i++) {
- Double_t mass = db->GetParticle(pdgCode[i])->Mass();
+ Double_t mass = AliPID::ParticleMass(i);
Double_t correction = TMath::Sqrt( pt*pt * (1 + tgl*tgl) + mass * mass ) / p;
Double_t time = length * correction / kcc;
return 0.;
}
- static Int_t pdgCode[fgkTypes] = {kElectron, kMuonMinus, kPiPlus, kKPlus, kProton};
-
- for (Int_t i=0; i<fgkTypes; i++)
- if (pdgCode[i] == TMath::Abs(pdg)) return fIntegratedTime[i];
+ for (Int_t i=0; i<AliPID::kSPECIES; i++)
+ if (AliPID::ParticleCode(i) == TMath::Abs(pdg)) return fIntegratedTime[i];
AliWarning(Form("Particle type [%d] not found", pdg));
return 0;
}
void AliKalmanTrack::GetIntegratedTimes(Double_t *times) const {
- for (Int_t i=0; i<fgkTypes; i++) times[i]=fIntegratedTime[i];
+ for (Int_t i=0; i<AliPID::kSPECIES; i++) times[i]=fIntegratedTime[i];
}
void AliKalmanTrack::SetIntegratedTimes(const Double_t *times) {
- for (Int_t i=0; i<fgkTypes; i++) fIntegratedTime[i]=times[i];
+ for (Int_t i=0; i<AliPID::kSPECIES; i++) fIntegratedTime[i]=times[i];
}
//_______________________________________________________________________
// Prints time for all hypothesis
//
- static Int_t pdgCode[fgkTypes] = {kElectron, kMuonMinus, kPiPlus, kKPlus, kProton};
-
- for (Int_t i=0; i<fgkTypes; i++)
- printf("%d: %.2f ", pdgCode[i], fIntegratedTime[i]);
+ for (Int_t i=0; i<AliPID::kSPECIES; i++)
+ printf("%d: %.2f ", AliPID::ParticleCode(i), fIntegratedTime[i]);
printf("\n");
}
//-------------------------------------------------------------------------
#include <TObject.h>
-#include "AliESDtrack.h"
+#include "AliPID.h"
class AliCluster;
static Double_t fgConvConst; //conversion constant cm -> GeV/c
// variables for time integration (S.Radomski@gsi.de)
- static const Int_t fgkTypes = AliESDtrack::kSPECIES; // Number of track types (e,mu,pi,k,p)
Bool_t fStartTimeIntegral; // indicator wether integrate time
- Double_t fIntegratedTime[5]; // integrated time
+ Double_t fIntegratedTime[AliPID::kSPECIES]; // integrated time
Double_t fIntegratedLength; // integrated length
ClassDef(AliKalmanTrack,3) // Reconstructed track
--- /dev/null
+/**************************************************************************
+ * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * *
+ * Author: The ALICE Off-line Project. *
+ * Contributors are mentioned in the code where appropriate. *
+ * *
+ * Permission to use, copy, modify and distribute this software and its *
+ * documentation strictly for non-commercial purposes is hereby granted *
+ * without fee, provided that the above copyright notice appears in all *
+ * copies and that both the copyright notice and this permission notice *
+ * appear in the supporting documentation. The authors make no claims *
+ * about the suitability of this software for any purpose. It is *
+ * provided "as is" without express or implied warranty. *
+ **************************************************************************/
+
+/* $Id$ */
+
+///////////////////////////////////////////////////////////////////////////////
+// //
+// particle id probability densities //
+// //
+// The AliPID class stores the probability densities for the different //
+// particle type hypotheses electron, muon, pion, kaon, proton, photon, //
+// pi0, neutron, K0 and electron conversion. These probability densities //
+// are determined from the detector response functions. //
+// The * and *= operators are overloaded for AliPID to combine the PIDs //
+// from different detectors. //
+// //
+// The Bayesian probability to be a particle of a given type can be //
+// calculated from the probability densities, if the a priori probabilities //
+// (or abundences, concentrations) of particle species are known. These //
+// priors can be given as argument to the GetProbability or GetMostProbable //
+// method or they can be set globally by calling the static method //
+// SetPriors(). //
+// //
+// The implementation of this class is based on the note ... //
+// by Iouri Belikov and Karel Safarik. //
+// //
+///////////////////////////////////////////////////////////////////////////////
+
+
+#include "AliPID.h"
+#include "AliLog.h"
+#include <TPDGCode.h>
+#include <TDatabasePDG.h>
+#include <TClass.h>
+
+
+ClassImp(AliPID)
+
+
+Float_t AliPID::fgkParticleMass[AliPID::kSPECIESN+1] = {
+ 0.00051, // electron
+ 0.10566, // muon
+ 0.13957, // pion
+ 0.49360, // kaon
+ 0.93827, // proton
+ 0.00000, // photon
+ 0.13498, // pi0
+ 0.93957, // neutron
+ 0.49767, // kaon0
+ 0.00000, // electron conversion
+ 0.00000 // unknown
+};
+
+const char* AliPID::fgkParticleName[AliPID::kSPECIESN+1] = {
+ "electron",
+ "muon",
+ "pion",
+ "kaon",
+ "proton",
+ "photon",
+ "pi0",
+ "neutron",
+ "kaon0",
+ "eleCon",
+ "unknown"
+};
+
+const Int_t AliPID::fgkParticleCode[AliPID::kSPECIESN+1] = {
+ ::kElectron,
+ ::kMuonMinus,
+ ::kPiPlus,
+ ::kKPlus,
+ ::kProton,
+ ::kGamma,
+ ::kPi0,
+ ::kNeutron,
+ ::kK0,
+ ::kGamma,
+ 0
+};
+
+
+Double_t AliPID::fgPrior[kSPECIESN] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
+
+
+//_______________________________________________________________________
+AliPID::AliPID()
+{
+// set default values (= equal probabilities)
+
+ for (Int_t i = 0; i < kSPECIESN; i++) {
+ fProbDensity[i] = 1./kSPECIESN;
+ }
+}
+
+//_______________________________________________________________________
+AliPID::AliPID(const Double_t* probDensity, Bool_t charged)
+{
+// set given probability densities
+
+ fCharged = charged;
+ for (Int_t i = 0; i < kSPECIES; i++) {
+ fProbDensity[i] = probDensity[i];
+ }
+ for (Int_t i = kSPECIES; i < kSPECIESN; i++) {
+ fProbDensity[i] = ((charged) ? 0 : probDensity[i]);
+ }
+}
+
+//_______________________________________________________________________
+AliPID::AliPID(const Float_t* probDensity, Bool_t charged)
+{
+// set given probability densities
+
+ fCharged = charged;
+ for (Int_t i = 0; i < kSPECIES; i++) {
+ fProbDensity[i] = probDensity[i];
+ }
+ for (Int_t i = kSPECIES; i < kSPECIESN; i++) {
+ fProbDensity[i] = ((charged) ? 0 : probDensity[i]);
+ }
+}
+
+//_______________________________________________________________________
+AliPID::AliPID(const AliPID& pid) :
+ TObject(pid),
+ fCharged(pid.fCharged)
+{
+// copy constructor
+
+ for (Int_t i = 0; i < kSPECIESN; i++) {
+ fProbDensity[i] = pid.fProbDensity[i];
+ }
+}
+
+//_______________________________________________________________________
+AliPID& AliPID::operator = (const AliPID& pid)
+{
+// assignment operator
+
+ fCharged = pid.fCharged;
+ for (Int_t i = 0; i < kSPECIESN; i++) {
+ fProbDensity[i] = pid.fProbDensity[i];
+ }
+ return *this;
+}
+
+
+//_____________________________________________________________________________
+Double_t AliPID::GetProbability(EParticleType iType,
+ const Double_t* prior) const
+{
+// get the probability to be a particle of type "iType"
+// assuming the a priori probabilities "prior"
+
+ Double_t sum = 0.;
+ Int_t nSpecies = ((fCharged) ? kSPECIES : kSPECIESN);
+ for (Int_t i = 0; i < nSpecies; i++) {
+ sum += fProbDensity[i] * prior[i];
+ }
+ if (sum <= 0) {
+ AliError("Invalid probability densities or priors");
+ return -1;
+ }
+ return fProbDensity[iType] * prior[iType] / sum;
+}
+
+//_____________________________________________________________________________
+Double_t AliPID::GetProbability(EParticleType iType) const
+{
+// get the probability to be a particle of type "iType"
+// assuming the globaly set a priori probabilities
+
+ return GetProbability(iType, fgPrior);
+}
+
+//_____________________________________________________________________________
+void AliPID::GetProbabilities(Double_t* probabilities,
+ const Double_t* prior) const
+{
+// get the probabilities to be a particle of given type
+// assuming the a priori probabilities "prior"
+
+ Double_t sum = 0.;
+ Int_t nSpecies = ((fCharged) ? kSPECIES : kSPECIESN);
+ for (Int_t i = 0; i < nSpecies; i++) {
+ sum += fProbDensity[i] * prior[i];
+ }
+ if (sum <= 0) {
+ AliError("Invalid probability densities or priors");
+ for (Int_t i = 0; i < nSpecies; i++) probabilities[i] = -1;
+ return;
+ }
+ for (Int_t i = 0; i < nSpecies; i++) {
+ probabilities[i] = fProbDensity[i] * prior[i] / sum;
+ }
+}
+
+//_____________________________________________________________________________
+void AliPID::GetProbabilities(Double_t* probabilities) const
+{
+// get the probabilities to be a particle of given type
+// assuming the globaly set a priori probabilities
+
+ GetProbabilities(probabilities, fgPrior);
+}
+
+//_____________________________________________________________________________
+AliPID::EParticleType AliPID::GetMostProbable(const Double_t* prior) const
+{
+// get the most probable particle id hypothesis
+// assuming the a priori probabilities "prior"
+
+ Double_t max = 0.;
+ EParticleType id = kPion;
+ Int_t nSpecies = ((fCharged) ? kSPECIES : kSPECIESN);
+ for (Int_t i = 0; i < nSpecies; i++) {
+ Double_t prob = fProbDensity[i] * prior[i];
+ if (prob > max) {
+ max = prob;
+ id = EParticleType(i);
+ }
+ }
+ if (max == 0) {
+ AliError("Invalid probability densities or priors");
+ }
+ return id;
+}
+
+//_____________________________________________________________________________
+AliPID::EParticleType AliPID::GetMostProbable() const
+{
+// get the most probable particle id hypothesis
+// assuming the globaly set a priori probabilities
+
+ return GetMostProbable(fgPrior);
+}
+
+
+//_____________________________________________________________________________
+void AliPID::SetPriors(const Double_t* prior, Bool_t charged)
+{
+// use the given priors as global a priori probabilities
+
+ Double_t sum = 0;
+ for (Int_t i = 0; i < kSPECIESN; i++) {
+ if (charged && (i >= kSPECIES)) {
+ fgPrior[i] = 0;
+ } else {
+ if (prior[i] < 0) {
+ AliWarningClass(Form("negative prior (%g) for %ss. "
+ "Using 0 instead.", prior[i],
+ fgkParticleName[i]));
+ fgPrior[i] = 0;
+ } else {
+ fgPrior[i] = prior[i];
+ }
+ }
+ sum += prior[i];
+ }
+ if (sum == 0) {
+ AliWarningClass("all priors are zero.");
+ }
+}
+
+//_____________________________________________________________________________
+void AliPID::SetPrior(EParticleType iType, Double_t prior)
+{
+// use the given prior as global a priori probability for particles
+// of type "iType"
+
+ if (prior < 0) {
+ AliWarningClass(Form("negative prior (%g) for %ss. Using 0 instead.",
+ prior, fgkParticleName[iType]));
+ prior = 0;
+ }
+ fgPrior[iType] = prior;
+}
+
+
+//_____________________________________________________________________________
+void AliPID::Init()
+{
+// initialize the mass values from the PDG database
+
+ for (Int_t i = 0; i < kSPECIESN; i++) {
+ fgkParticleMass[i] =
+ TDatabasePDG::Instance()->GetParticle(fgkParticleCode[i])->Mass();
+ }
+}
+
+
+//_____________________________________________________________________________
+AliPID& AliPID::operator *= (const AliPID& pid)
+{
+// combine this probability densities with the one of "pid"
+
+ for (Int_t i = 0; i < kSPECIESN; i++) {
+ fProbDensity[i] *= pid.fProbDensity[i];
+ }
+ return *this;
+}
+
+//_____________________________________________________________________________
+AliPID operator * (const AliPID& pid1, const AliPID& pid2)
+{
+// combine the two probability densities
+
+ AliPID result;
+ result *= pid1;
+ result *= pid2;
+ return result;
+}
--- /dev/null
+#ifndef ALIPID_H
+#define ALIPID_H
+
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice */
+
+///////////////////////////////////////////////////////////////////////////////
+/// //
+/// particle id probability densities //
+/// //
+///////////////////////////////////////////////////////////////////////////////
+
+/* $Id$ */
+
+
+#include <TObject.h>
+
+
+class AliPID : public TObject {
+ public:
+ enum {
+ kSPECIES = 5, // Number of particle species recognized by the PID
+ kSPECIESN = 10 // Number of charged+neutral particle species recognized by the PHOS/EMCAL PID
+ };
+ enum EParticleType {
+ kElectron = 0,
+ kMuon = 1,
+ kPion = 2,
+ kKaon = 3,
+ kProton = 4,
+ kPhoton = 5,
+ kPi0 = 6,
+ kNeutron = 7,
+ kKaon0 = 8,
+ kEleCon = 9,
+ kUnknown = 10
+ };
+ static Float_t ParticleMass(Int_t iType)
+ {return fgkParticleMass[iType];};
+ static const char* ParticleName(Int_t iType)
+ {return fgkParticleName[iType];};
+ static Int_t ParticleCode(Int_t iType)
+ {return fgkParticleCode[iType];};
+
+ AliPID();
+ AliPID(const Double_t* probDensity, Bool_t charged = kTRUE);
+ AliPID(const Float_t* probDensity, Bool_t charged = kTRUE);
+ AliPID(const AliPID& pid);
+ AliPID& operator = (const AliPID& pid);
+
+ Double_t GetProbability(EParticleType iType,
+ const Double_t* prior) const;
+ Double_t GetProbability(EParticleType iType) const;
+ void GetProbabilities(Double_t* probabilities,
+ const Double_t* prior) const;
+ void GetProbabilities(Double_t* probabilities) const;
+ EParticleType GetMostProbable(const Double_t* prior) const;
+ EParticleType GetMostProbable() const;
+
+ static void SetPriors(const Double_t* prior,
+ Bool_t charged = kTRUE);
+ static void SetPrior(EParticleType iType, Double_t prior);
+
+ static void Init();
+
+ AliPID& operator *= (const AliPID& pid);
+
+ private:
+ Bool_t fCharged; // flag for charged/neutral
+ Double_t fProbDensity[kSPECIESN]; // probability densities
+ static Double_t fgPrior[kSPECIESN]; // a priori probabilities
+
+ static Float_t fgkParticleMass[kSPECIESN+1]; // particle masses
+ static const char* fgkParticleName[kSPECIESN+1]; // particle names
+ static const Int_t fgkParticleCode[kSPECIESN+1]; // particle codes
+
+ ClassDef(AliPID, 1) // particle id probability densities
+};
+
+
+AliPID operator * (const AliPID& pid1, const AliPID& pid2);
+
+
+#endif
#pragma link C++ class AliExternalTrackParam+;
#pragma link C++ class AliTrackParam+;
#pragma link C++ class AliLog+;
+#pragma link C++ class AliPID+;
#endif
AliESDv0.cxx AliESDcascade.cxx AliESDVertex.cxx \
AliESDpid.cxx AliESDkink.cxx AliESDV0MI.cxx \
AliKalmanTrack.cxx AliHelix.cxx AliExternalTrackParam.cxx \
- AliTrackParam.cxx AliLog.cxx
+ AliTrackParam.cxx AliLog.cxx AliPID.cxx
HDRS:= $(SRCS:.cxx=.h)
// This function calculates the "detector response" PID probabilities
// Just for a bare hint...
- static const Double_t kMasses[]={
- 0.000511, 0.105658, 0.139570, 0.493677, 0.938272, 1.875613
- };
-
Int_t ntrk=event->GetNumberOfTracks();
AliESDtrack **tracks=new AliESDtrack*[ntrk];
Double_t time[10]; t->GetIntegratedTimes(time);
Double_t p[10];
Double_t mom=t->GetP();
- for (Int_t j=0; j<AliESDtrack::kSPECIES; j++) {
- Double_t mass=kMasses[j];
+ for (Int_t j=0; j<AliPID::kSPECIES; j++) {
+ Double_t mass=AliPID::ParticleMass(j);
Double_t dpp=0.01; //mean relative pt resolution;
if (mom>0.5) dpp=0.01*mom;
Double_t sigma=dpp*time[j]/(1.+ mom*mom/(mass*mass));
//Match ESD tracks to clusters in TOF
- static const Double_t kMasses[]={
- 0.000511, 0.105658, 0.139570, 0.493677, 0.938272, 1.875613
- };
-
Int_t nSteps=(Int_t)(fTOFHeigth/0.1);
//PH Arrays (moved outside of the loop)
t->SetTOFcluster(c->GetIndex());
Double_t time[10]; t->GetIntegratedTimes(time);
Double_t mom=t->GetP();
- for(Int_t j=0;j<=5;j++){
- Double_t mass=kMasses[j];
+ for(Int_t j=0;j<=AliPID::kSPECIES;j++){
+ Double_t mass=AliPID::ParticleMass(j);
time[j]+=(recL-trackPos[3][0])/3e-2*TMath::Sqrt(mom*mom+mass*mass)/mom;
}
//
// This function calculates the "detector response" PID probabilities
//
- static const Double_t masses[]={
- 0.000511, 0.105658, 0.139570, 0.493677, 0.938272, 1.875613
- };
Int_t ntrk=event->GetNumberOfTracks();
for (Int_t i=0; i<ntrk; i++) {
AliESDtrack *t=event->GetTrack(i);
if ((t->GetStatus()&AliESDtrack::kTPCin )==0)
if ((t->GetStatus()&AliESDtrack::kTPCout)==0) continue;
- Int_t ns=AliESDtrack::kSPECIES;
+ Int_t ns=AliPID::kSPECIES;
Double_t p[10];
for (Int_t j=0; j<ns; j++) {
- Double_t mass=masses[j];
+ Double_t mass=AliPID::ParticleMass(j);
Double_t mom=t->GetP();
Double_t dedx=t->GetTPCsignal()/fMIP;
Double_t bethe=Bethe(mom/mass);
Double_t p=TMath::Sqrt((1.+ GetTgl()*GetTgl())/(Get1Pt()*Get1Pt()));
if (p<0.6) {
- if (dedx < 39.+ 12./(p+0.25)/(p+0.25)) { SetMass(0.13957); return;}
- if (dedx < 39.+ 12./p/p) { SetMass(0.49368); return;}
- SetMass(0.93827); return;
+ if (dedx < 39.+ 12./(p+0.25)/(p+0.25)) { SetMass(AliPID::ParticleMass(AliPID::kPion)); return;}
+ if (dedx < 39.+ 12./p/p) { SetMass(AliPID::ParticleMass(AliPID::kKaon)); return;}
+ SetMass(AliPID::ParticleMass(AliPID::kProton)); return;
}
if (p<1.2) {
- if (dedx < 39.+ 12./(p+0.25)/(p+0.25)) { SetMass(0.13957); return;}
- SetMass(0.93827); return;
+ if (dedx < 39.+ 12./(p+0.25)/(p+0.25)) { SetMass(AliPID::ParticleMass(AliPID::kPion)); return;}
+ SetMass(AliPID::ParticleMass(AliPID::kProton)); return;
}
- SetMass(0.13957); return;
+ SetMass(AliPID::ParticleMass(AliPID::kPion)); return;
}
if (p<0.6) {
if (dEdx < 39.+ 12./(p+0.25)/(p+0.25)) {
- t.AssignMass(0.13957); new(&fTrack) AliTPCtrack(t); return;
+ t.AssignMass(AliPID::ParticleMass(AliPID::kPion)); new(&fTrack) AliTPCtrack(t); return;
}
if (dEdx < 39.+ 12./p/p) {
- t.AssignMass(0.49368); new(&fTrack) AliTPCtrack(t); return;
+ t.AssignMass(AliPID::ParticleMass(AliPID::kKaon)); new(&fTrack) AliTPCtrack(t); return;
}
- t.AssignMass(0.93827); new(&fTrack) AliTPCtrack(t); return;
+ t.AssignMass(AliPID::ParticleMass(AliPID::kProton)); new(&fTrack) AliTPCtrack(t); return;
}
if (p<1.2) {
if (dEdx < 39.+ 12./(p+0.25)/(p+0.25)) {
- t.AssignMass(0.13957); new(&fTrack) AliTPCtrack(t); return;
+ t.AssignMass(AliPID::ParticleMass(AliPID::kPion)); new(&fTrack) AliTPCtrack(t); return;
}
- t.AssignMass(0.93827); new(&fTrack) AliTPCtrack(t); return;
+ t.AssignMass(AliPID::ParticleMass(AliPID::kProton)); new(&fTrack) AliTPCtrack(t); return;
}
- t.AssignMass(0.13957); new(&fTrack) AliTPCtrack(t); return;
+ t.AssignMass(AliPID::ParticleMass(AliPID::kPion)); new(&fTrack) AliTPCtrack(t); return;
}
//-----------------------------------------------------------------------------
void AliTPCtrackerParam::CookTrack(Double_t pt,Double_t eta) {
{
// This function calculates the "detector response" PID probabilities
- static const Double_t masses[AliESDtrack::kSPECIES] =
- {0.000511, 0.105658, 0.139570, 0.493677, 0.938272};
-
if (((track->GetStatus()&AliESDtrack::kTRDin) == 0) &&
((track->GetStatus()&AliESDtrack::kTRDout) == 0)) return kFALSE;
Double_t momentum = track->GetP();
// get the probability densities
Double_t pSum = 0;
- for (Int_t iSpecies = 0; iSpecies < AliESDtrack::kSPECIES; iSpecies++) {
- Double_t expectedSignal = fBetheBloch->Eval(momentum/masses[iSpecies]);
+ for (Int_t iSpecies = 0; iSpecies < AliPID::kSPECIES; iSpecies++) {
+ Double_t expectedSignal = fBetheBloch->Eval(momentum/AliPID::ParticleMass(iSpecies));
Double_t expectedError = fRes * expectedSignal;
Double_t measuredSignal = track->GetTRDsignal();
if (TMath::Abs(measuredSignal - expectedSignal) > fRange * expectedError) {
// "normalize" the probability densities
if (pSum <= 0) return kFALSE;
- for (Int_t iSpecies = 0; iSpecies < AliESDtrack::kSPECIES; iSpecies++) {
+ for (Int_t iSpecies = 0; iSpecies < AliPID::kSPECIES; iSpecies++) {
track->SetTRDpid(iSpecies, track->GetTRDpid(iSpecies) / pSum);
}
//
// This function calculates the "detector response" PID probabilities
//
- static const Double_t masses[]={
- 0.000511, 0.105658, 0.139570, 0.493677, 0.938272, 1.875613
- };
Int_t ntrk=event->GetNumberOfTracks();
for (Int_t i=0; i<ntrk; i++) {
AliESDtrack *t=event->GetTrack(i);
if ((t->GetStatus()&AliESDtrack::kTRDin)==0)
if ((t->GetStatus()&AliESDtrack::kTRDout)==0)
if ((t->GetStatus()&AliESDtrack::kTRDrefit)==0) continue;
- Int_t ns=AliESDtrack::kSPECIES;
+ Int_t ns=AliPID::kSPECIES;
Double_t p[10];
for (Int_t j=0; j<ns; j++) {
- Double_t mass=masses[j];
+ Double_t mass=AliPID::ParticleMass(j);
Double_t mom=t->GetP();
Double_t dedx=t->GetTRDsignal()/fMIP;
Double_t bethe=Bethe(mom/mass);
#include <TMath.h>
#include "AliTRDgeometry.h"
+#include "AliESDtrack.h"
#include "TVector2.h"
class AliTRDcluster;