1 //********************************************************************
2 // Example (very naive for the moment) of the data analysis
3 // using the ESD classes.
4 // It demonstrates the idea of the "combined PID"
5 // applied to the Lambda0 reconstruction.
6 // Origin: Iouri Belikov, CERN, Jouri.Belikov@cern.ch
7 //********************************************************************
9 #if !defined( __CINT__) || defined(__MAKECINT__)
10 #include <Riostream.h>
20 Int_t AliESDv0Analysis(const Char_t *dir=".") {
21 TH1F *hm=(TH1F*)gROOT->FindObject("hm");
23 hm=new TH1F("hm","Lambda+LambdaBar Effective Mass",60,1.065,1.165);
24 hm->SetXTitle("Mass (GeV/c**2)");
27 sprintf(fname,"%s/AliESDs.root",dir);
28 TFile *ef=TFile::Open(fname);
29 if (!ef||!ef->IsOpen()) {cerr<<"Can't AliESDs.root !\n"; return 1;}
30 cerr<<"\n****** "<<fname<<" ******\n";
32 AliESD* event = new AliESD;
35 TTree* tree = (TTree*) ef->Get("esdTree");
36 if (!tree) {cerr<<"no ESD tree found\n"; return 1;};
37 tree->SetBranchAddress("ESD", &event);
41 //****** Tentative particle type "concentrations"
42 Double_t c[5]={0.0, 0.0, 1, 0, 1};
44 //******* The loop over events
45 while (tree->GetEvent(n))
48 cerr<<"Processing event number : "<<n++<<endl;
50 Int_t nv0=event->GetNumberOfV0s();
51 cerr<<"Number of ESD v0s : "<<nv0<<endl;
54 AliESDv0 *v0=event->GetV0(nv0);
56 Int_t protonIdx=v0->GetPindex();
57 Int_t pionIdx =v0->GetNindex();
59 v0->ChangeMassHypothesis(3122);
60 Double_t mass=v0->GetEffMass();
61 if (mass>1.17) { //check also a LambdaBar hypothesis
62 v0->ChangeMassHypothesis(-3122);
63 mass=v0->GetEffMass();
64 if (mass>1.17) continue;
65 Int_t tmp=protonIdx; protonIdx=pionIdx; pionIdx=tmp;
68 AliESDtrack *protonTrk=event->GetTrack(protonIdx);
69 AliESDtrack *pionTrk =event->GetTrack(pionIdx);
71 if (protonTrk->GetP()<0.5) continue;
73 // Check if the "proton track" is a proton
74 if ((protonTrk->GetStatus()&AliESDtrack::kESDpid)!=0) {
75 Double_t r[10]; protonTrk->GetESDpid(r);
78 for (i=0; i<AliESDtrack::kSPECIES; i++) rcc+=(c[i]*r[i]);
79 if (rcc==0.) continue;
80 //Here we apply Bayes' formula
82 for (i=0; i<AliESDtrack::kSPECIES; i++) w[i]=c[i]*r[i]/rcc;
84 if (w[4]<w[3]) continue;
85 if (w[4]<w[2]) continue;
86 if (w[4]<w[1]) continue;
87 if (w[4]<w[0]) continue;
90 //Check if the "pion track" is a pion
91 if ((pionTrk->GetStatus()&AliESDtrack::kESDpid)!=0) {
92 Double_t r[10]; pionTrk->GetESDpid(r);
95 for (i=0; i<AliESDtrack::kSPECIES; i++) rcc+=(c[i]*r[i]);
96 if (rcc==0.) continue;
97 //Here we apply Bayes' formula
99 for (i=0; i<AliESDtrack::kSPECIES; i++) w[i]=c[i]*r[i]/rcc;
101 if (w[2]<w[4]) continue;
102 if (w[2]<w[3]) continue;
103 if (w[2]<w[1]) continue;
104 if (w[2]<w[0]) continue;
115 TCanvas *c1=(TCanvas*)gROOT->FindObject("c1");
120 if (hm->GetEntries()>100) hm->Fit("gaus","","",1.11,1.12);