1 //********************************************************************
2 // Example (very naive for the moment) of the data analysis
3 // using the ESD classes
4 // Origin: Iouri Belikov, CERN, Jouri.Belikov@cern.ch
5 //********************************************************************
7 #if !defined( __CINT__) || defined(__MAKECINT__)
14 #include "TStopwatch.h"
19 extern TStyle *gStyle;
21 Int_t AliESDanalysis() {
24 gStyle->SetOptStat(111110);
27 Double_t V0mass=0.497672, V0width=0.020, V0window=0.05;
28 Double_t mmin=V0mass-V0window, mmax=V0mass+V0window;
29 TH1F *hm =new TH1F("hm","K0s",40, mmin, mmax);
30 hm->SetXTitle("Mass (GeV/c**2)"); hm->SetLineColor(2);
31 TH1F *hp =new TH1F("hp","Momentum of the positive daughter",40, 0, 2);
32 hp->SetXTitle("P (GeV/c)"); hp->SetLineColor(4);
34 //****** File with the ESD
35 TFile *ef=TFile::Open("AliESDs.root");
36 if (!ef || !ef->IsOpen()) {cerr<<"Can't AliESDs.root !\n"; return 1;}
37 AliESD* event = new AliESD;
38 TTree* tree = (TTree*) ef->Get("esdTree");
39 if (!tree) {cerr<<"no ESD tree found\n"; return 1;};
40 tree->SetBranchAddress("ESD", &event);
44 //******* The loop over events
45 while (tree->GetEvent(n)) {
46 cout<<endl<<"Processing event number : "<<n++<<endl;
48 Int_t ntrk=event->GetNumberOfTracks();
49 cout<<"Number of ESD tracks : "<<ntrk<<endl;
50 Int_t nv0=event->GetNumberOfV0s();
51 cout<<"Number of ESD V0s : "<<nv0<<endl;
52 Int_t ncas=event->GetNumberOfCascades();
53 cout<<"Number of ESD cascades : "<<ncas<<endl;
55 //****** The loop over tracks
58 AliESDtrack *track=event->GetTrack(ntrk);
59 UInt_t status=track->GetStatus();
61 //select only tracks with the "combined PID"
62 if ((status&AliESDtrack::kESDpid)==0) continue;
64 Double_t w[10]; track->GetESDpid(w);
65 //count only "Kaon-like" tracks
66 if (w[3]>w[4] && w[3]>w[2] && w[3]>w[1] && w[3]>w[0]) nk++;
68 cout<<"Number of \"Kaon-like\" tracks : "<<nk<<endl;
70 //****** The loop over V0s
72 AliESDv0 *v0=event->GetV0(nv0);
73 v0->ChangeMassHypothesis(310); // K0s
74 Double_t mass=v0->GetEffMass();
77 Int_t pidx=v0->GetPindex(); // now let's get an access
78 AliESDtrack *track=event->GetTrack(pidx); // to the positive daughter
79 Double_t p=track->GetP();
83 //****** The loop over cascades
85 AliESDcascade *cas=event->GetCascade(ncas);
86 Double_t q; //"quality" of the associated Lambda
87 cas->ChangeMassHypothesis(q,3312); // Xi-
88 // Here you do something with your Xis
90 // You can get the access to the daughters
98 timer.Stop(); timer.Print();
100 TCanvas *c1=new TCanvas("c1","",0,0,600,1200);
104 hm->Fit("gaus","","",V0mass-V0width,V0mass+V0width);
107 hp->Fit("expo","","",0.3,2);