#include <TParticle.h>
#include <TCanvas.h>
#include <TBenchmark.h>
- #include <TKey.h>
+ #include <TFile.h>
+ #include <TTree.h>
#include <TROOT.h>
#include <AliStack.h>
delete rl;
return 1;
}
- TKey *key=0;
- TIter next(ef->GetListOfKeys());
+ AliESD* event = new AliESD;
+ TTree* tree = (TTree*) ef->Get("esdTree");
+ if (!tree) {
+ ::Error("AliESDComparison.C", "no ESD tree found");
+ delete rl;
+ return 1;
+ }
+ tree->SetBranchAddress("ESD", &event);
//****** Tentative particle type "concentrations"
Double_t c[5]={0.01, 0.01, 0.85, 0.10, 0.05};
+ //Double_t c[5]={0.2, 0.2, 0.2, 0.2, 0.2};
+ AliPID::SetPriors(c);
+
//******* The loop over events
Int_t e=0;
- while ((key=(TKey*)next())!=0) {
+ while (tree->GetEvent(e)) {
cout<<endl<<endl<<"********* Processing event number: "<<e<<"*******\n";
- rl->GetEvent(e); ef->cd();
+ rl->GetEvent(e);
e++;
- AliESD *event=(AliESD*)key->ReadObj();
-
Int_t ntrk=event->GetNumberOfTracks();
cerr<<"Number of ESD tracks : "<<ntrk<<endl;
UInt_t status=AliESDtrack::kESDpid;
status|=AliESDtrack::kITSpid;
status|=AliESDtrack::kTPCpid;
+ status|=AliESDtrack::kTRDpid;
status|=AliESDtrack::kTOFpid;
if ((t->GetStatus()&status) == status) {
Int_t code=part->GetPdgCode();
Double_t r[10]; t->GetESDpid(r);
+ //t->GetTRDpid(r);
+ //t->GetTPCpid(r);
- Double_t rcc=0.;
- Int_t i;
- for (i=0; i<AliESDtrack::kSPECIES; i++) rcc+=(c[i]*r[i]);
- if (rcc==0.) continue;
+ AliPID pid(r);
- //Here we apply Bayes' formula
Double_t w[10];
- for (i=0; i<AliESDtrack::kSPECIES; i++) w[i]=c[i]*r[i]/rcc;
+ w[0]=pid.GetProbability(AliPID::kElectron);
+ w[1]=pid.GetProbability(AliPID::kMuon);
+ w[2]=pid.GetProbability(AliPID::kPion);
+ w[3]=pid.GetProbability(AliPID::kKaon);
+ w[4]=pid.GetProbability(AliPID::kProton);
+
if (TMath::Abs(code)==2212) prR->Fill(p);
if (w[4]>w[3] && w[4]>w[2] && w[4]>w[1] && w[4]>w[0]) {//proton
}
if (TMath::Abs(code)==211) piR->Fill(p);
- if (w[2]>w[3] && w[2]>w[4] && w[2]>w[1] && w[2]>w[0]) {//pion
+ if (w[2]>w[4] && w[2]>w[3] && w[2]>w[0] && w[2]>w[1]) {//pion
pisel++;
piG->Fill(p);
if (TMath::Abs(code)!=211) piF->Fill(p);
}
}
}
- delete event;
cout<<"Number of selected ESD tracks : "<<nsel<<endl;
cout<<"Number of selected pion ESD tracks : "<<pisel<<endl;
cout<<"Number of selected kaon ESD tracks : "<<kasel<<endl;
} // ***** End of the loop over events
+ delete event;
ef->Close();
TCanvas *c1=(TCanvas*)gROOT->FindObject("c1");