From e6e6531b51d4c312a96583042e14221f0e3b44fa Mon Sep 17 00:00:00 2001 From: hristov Date: Thu, 21 Oct 2004 08:39:45 +0000 Subject: [PATCH] Access to the ESD objects stored in a tree. Coding conventions (T.Kuhr) --- ANALYSIS/AliD0toKpiAnalysis.cxx | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/ANALYSIS/AliD0toKpiAnalysis.cxx b/ANALYSIS/AliD0toKpiAnalysis.cxx index 6d7d5bcc3d6..f173a667f42 100644 --- a/ANALYSIS/AliD0toKpiAnalysis.cxx +++ b/ANALYSIS/AliD0toKpiAnalysis.cxx @@ -15,15 +15,11 @@ //---------------------------------------------------------------------------- // Implementation of the D0toKpi reconstruction and analysis class -// // Note: the two decay tracks are labelled: 0 (positive track) // 1 (negative track) -// +// An example of usage can be found in the macro AliD0toKpiTest.C // Origin: A. Dainese andrea.dainese@pd.infn.it //---------------------------------------------------------------------------- -#include -#include -#include #include #include #include @@ -431,14 +427,19 @@ void AliD0toKpiAnalysis::FindCandidatesESD(Int_t evFirst,Int_t evLast, // open file with tracks TFile *esdFile = TFile::Open(esdName.Data()); + AliESD* event = new AliESD; + TTree* tree = (TTree*) esdFile->Get("esdTree"); + if (!tree) { + Error("FindCandidatesESD", "no ESD tree found"); + return; + } + tree->SetBranchAddress("ESD", &event); - TKey *key=0; - TIter next(esdFile->GetListOfKeys()); // loop on events in file - while ((key=(TKey*)next())!=0) { - AliESD *event=(AliESD*)key->ReadObj(); + for (Int_t iEvent = evFirst; iEvent < tree->GetEntries(); iEvent++) { + if (iEvent > evLast) break; + tree->GetEvent(iEvent); Int_t ev = (Int_t)event->GetEventNumber(); - if(evevLast) { delete event; continue; } printf("--- Finding D0 -> Kpi in event %d\n",ev); // retrieve primary vertex from file @@ -591,7 +592,6 @@ void AliD0toKpiAnalysis::FindCandidatesESD(Int_t evFirst,Int_t evLast, delete [] trkEntryP; delete [] trkEntryN; delete trkTree; - delete event; printf(" Number of D0 candidates: %d\n",nD0rec1ev); -- 2.39.3