From 9d0d65bea834087e29dc6e4b7e9748db6e2b0b6d Mon Sep 17 00:00:00 2001 From: hristov Date: Thu, 2 Sep 2004 08:56:21 +0000 Subject: [PATCH 1/1] Improved version of V0 analysis (Yu.Belikov) --- STEER/AliESDv0Analysis.C | 104 ++++++++++++++++++++++++++------------- 1 file changed, 70 insertions(+), 34 deletions(-) diff --git a/STEER/AliESDv0Analysis.C b/STEER/AliESDv0Analysis.C index bf2dd7d2c7e..102b0586b40 100644 --- a/STEER/AliESDv0Analysis.C +++ b/STEER/AliESDv0Analysis.C @@ -9,40 +9,41 @@ #if !defined( __CINT__) || defined(__MAKECINT__) #include #include - #include "TFile.h" - #include "TH1F.h" - #include "TH2F.h" - #include "TCanvas.h" - #include "TStopwatch.h" - #include "TParticle.h" - - #include "AliRun.h" + #include + #include + #include #include "AliESD.h" #endif -extern AliRun *gAlice; - -Int_t AliESDv0Analysis(Int_t nev=1) { - TH1F *hm=new TH1F("hm","Effective Mass",40,1.065,1.165); - hm->SetXTitle("Mass (GeV/c**2)"); +Int_t AliESDv0Analysis(const Char_t *dir=".") { + TH1F *hm=(TH1F*)gROOT->FindObject("hm"); + if (!hm) { + hm=new TH1F("hm","Lambda+LambdaBar Effective Mass",60,1.065,1.165); + hm->SetXTitle("Mass (GeV/c**2)"); + } + Char_t fname[100]; + sprintf(fname,"%s/AliESDs.root",dir); + TFile *ef=TFile::Open(fname); + if (!ef||!ef->IsOpen()) {cerr<<"Can't AliESDs.root !\n"; return 1;} + cerr<<"\n****** "<IsOpen()) {cerr<<"Can't AliESDs.root !\n"; return 1;} AliESD* event = new AliESD; + + TTree* tree = (TTree*) ef->Get("esdTree"); if (!tree) {cerr<<"no ESD tree found\n"; return 1;}; tree->SetBranchAddress("ESD", &event); - TStopwatch timer; Int_t rc=0,n=0; //****** Tentative particle type "concentrations" - Double_t c[5]={0.0, 0.0, 0.1, 0.1, 0.1}; + Double_t c[5]={0.0, 0.0, 1, 0, 1}; //******* The loop over events - while (tree->GetEvent(n)) { + while (tree->GetEvent(n)) + { cerr<<"Processing event number : "<GetV0(nv0); - Int_t pi=v0->GetPindex(); - AliESDtrack *t=event->GetTrack(pi); - Int_t isProton=1; - if ((t->GetStatus()&AliESDtrack::kESDpid)!=0) { - Double_t r[10]; t->GetESDpid(r); + + Int_t protonIdx=v0->GetPindex(); + Int_t pionIdx =v0->GetNindex(); + + v0->ChangeMassHypothesis(3122); + Double_t mass=v0->GetEffMass(); + if (mass>1.17) { //check also a LambdaBar hypothesis + v0->ChangeMassHypothesis(-3122); + mass=v0->GetEffMass(); + if (mass>1.17) continue; + Int_t tmp=protonIdx; protonIdx=pionIdx; pionIdx=tmp; + } + + AliESDtrack *protonTrk=event->GetTrack(protonIdx); + AliESDtrack *pionTrk =event->GetTrack(pionIdx); + + if (protonTrk->GetP()<0.5) continue; + + // Check if the "proton track" is a proton + if ((protonTrk->GetStatus()&AliESDtrack::kESDpid)!=0) { + Double_t r[10]; protonTrk->GetESDpid(r); Double_t rcc=0.; Int_t i; for (i=0; iChangeMassHypothesis(3122); - Double_t mass=v0->GetEffMass(); + + //Check if the "pion track" is a pion + if ((pionTrk->GetStatus()&AliESDtrack::kESDpid)!=0) { + Double_t r[10]; pionTrk->GetESDpid(r); + Double_t rcc=0.; + Int_t i; + for (i=0; iFill(mass); } + } delete event; ef->Close(); - timer.Stop(); timer.Print(); - - hm->Draw(); + TCanvas *c1=(TCanvas*)gROOT->FindObject("c1"); + if (!c1) { + c1=new TCanvas(); + } - ef->Close(); + if (hm->GetEntries()>100) hm->Fit("gaus","","",1.11,1.12); + else hm->Draw(); + c1->Update(); return rc; } -- 2.39.3