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>
16 #include "TStopwatch.h"
17 #include "TParticle.h"
25 extern AliRun *gAlice;
27 Int_t AliESDv0Analysis(Int_t nev=1) {
28 TH1F *hm=new TH1F("hm","Effective Mass",40,1.065,1.165);
29 hm->SetXTitle("Mass (GeV/c**2)");
31 TFile *ef=TFile::Open("AliESDs.root");
32 if (!ef->IsOpen()) {cerr<<"Can't AliESDs.root !\n"; return 1;}
37 TIter next(ef->GetListOfKeys());
39 //****** Tentative particle type "concentrations"
40 Double_t c[5]={0.0, 0.0, 0.1, 0.1, 0.1};
42 //******* The loop over events
43 while ((key=(TKey*)next())!=0) {
45 cerr<<"Processing event number : "<<n++<<endl;
47 AliESD *event=(AliESD*)key->ReadObj();
49 Int_t nv0=event->GetNumberOfV0s();
50 cerr<<"Number of ESD v0s : "<<nv0<<endl;
53 AliESDv0 *v0=event->GetV0(nv0);
54 Int_t pi=v0->GetPindex();
55 AliESDtrack *t=event->GetTrack(pi);
57 if ((t->GetStatus()&AliESDtrack::kESDpid)!=0) {
58 Double_t r[10]; t->GetESDpid(r);
61 for (i=0; i<AliESDtrack::kSPECIES; i++) rcc+=(c[i]*r[i]);
62 if (rcc==0.) continue;
63 //Here we apply Bayes' formula
65 for (i=0; i<AliESDtrack::kSPECIES; i++) w[i]=c[i]*r[i]/rcc;
67 if (w[4]<w[3]) isProton=0;
68 if (w[4]<w[2]) isProton=0;
69 if (w[4]<w[1]) isProton=0;
70 if (w[4]<w[0]) isProton=0;
72 if (!isProton) continue;
73 v0->ChangeMassHypothesis(3122);
74 Double_t mass=v0->GetEffMass();
80 timer.Stop(); timer.Print();