//-----------------------------------------------------------------
// Implementation of the TRD PID class
// Assigns the electron and pion liklihoods for each ESD track.
-// The AliTRDprobdist class is instantiated here.
// The function MakePID(AliESD *event) calculates the probability
// of having dedx and the probability of having timbin at a given
// momentum (mom) and particle type k (0 for e) and (2 for pi)
#include "AliTRDpidESD.h"
#include "AliESD.h"
#include "AliESDtrack.h"
-#include "AliTRDprobdist.h"
+#include "AliTRDcalibDB.h"
+#include "Cal/AliTRDCalPIDLQ.h"
ClassImp(AliTRDpidESD)
//
// This function calculates the "detector response" PID probabilities
//
- // The class AliTRDprobdist contains precalculated prob dis.
- AliTRDprobdist *pd = new AliTRDprobdist();
- // Double_t ebin[200], ppi[200], pel[200];
- // pd->GetData(2,ebin,ppi,pel);
- // for(Int_t ie=0; ie<10; ie++)
- // printf(" %f %f %f \n", ebin[ie], ppi[ie], pel[ie]);
+
+ AliTRDcalibDB* calibration = AliTRDcalibDB::Instance();
+ if (!calibration)
+ return -1;
+
+ // The class AliTRDCalPIDLQ contains precalculated prob dis.
+ const AliTRDCalPIDLQ *pd = calibration->GetPIDLQObject();
+ if (!pd) return -1;
+
+ // Example to get mean for particle 2 (pi) and momentum number 4 (2 GeV)
+ // printf("%.2f \n", pd->GetMean(2, 4));
+ // Example of use of Copy Constructor
+ // AliTRDCalPIDLQ *pd1 = new AliTRDCalPIDLQ(*pd);
Int_t ntrk=event->GetNumberOfTracks();
for (Int_t i=0; i<ntrk; i++) {
Int_t ns=AliPID::kSPECIES;
Double_t p[10];
Double_t mom=t->GetP();
+ Double_t probTotal=0.0;
for (Int_t j=0; j<ns; j++) {
p[j]=1.;
for (Int_t ilayer=0; ilayer <6; ilayer++) {
- Double_t dedx=t->GetTRDsignals(ilayer);
+ Double_t dedx=t->GetTRDsignals(ilayer,1);
Int_t timbin=t->GetTRDTimBin(ilayer);
- if (j==0 || j==2){
- p[j]*= pd->GetProbability(j,mom,dedx);
- p[j]*= pd->GetProbabilityT(j,mom,timbin);
- p[j]*= 100;
- }
+ p[j]*= pd->GetProbability(j,mom,dedx);
+ p[j]*= pd->GetProbabilityT(j,mom,timbin);
+ p[j]*= 100;
} // loop over layers
+ probTotal+=p[j];
} //loop over particle species
- // printf(" %f %d %f %f %f \n", mom, timbin, p[0], p[1], p[2]);
- if(p[0]) p[0]= p[0]/(p[0]+p[2]);
- if(p[2]) p[2]= 1.-p[0];
- t->SetTRDpid(p);
- } //loop over track
- delete pd;
- return 0;
-}
-
-
-/*
-//_________________________________________________________________________
-MakePID(AliESD *event)
-{
- //
- // This function calculates the "detector response" PID probabilities
- //
- 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];
+ // printf(" %f %d %f %f %f \n", mom, timbin, p[0], p[1], p[2]);
for (Int_t j=0; j<ns; j++) {
- Double_t mass=AliPID::ParticleMass(j);
- Double_t mass=masses[j];
- Double_t mom=t->GetP();
- Double_t dedx=t->GetTRDsignal()/fMIP;
- Double_t bethe= AliTRDpidESD::Bethe(mom/mass);
- Double_t sigma=fRes*bethe;
- if (TMath::Abs(dedx-bethe) > fRange*sigma) {
- p[j]=TMath::Exp(-0.5*fRange*fRange)/sigma;
- continue;
- }
- p[j]=TMath::Exp(-0.5*(dedx-bethe)*(dedx-bethe)/(sigma*sigma))/sigma;
- }
+ if(probTotal) p[j]/= probTotal;
+ else p[j]=1.0;
+ // p[j]=1.;
+ } //loop over particle species
t->SetTRDpid(p);
- // if(i==50) printf("%f %f %f \n", p[0], p[1], p[2]);
- }
+ } //loop over tracks
return 0;
}
-
-*/
-
-
-