#ifndef ExRootTreeReader_h #define ExRootTreeReader_h /** \class ExRootTreeReader * * Class simplifying access to ROOT tree branches * * $Date: 2008-11-04 10:32:26 $ * $Revision: 1.1 $ * * * \author S. Ovyn - UCL, Louvain-la-Neuve * */ #include "TROOT.h" #include "TChain.h" #include "TFile.h" #include class ExRootTreeReader { public : ExRootTreeReader(TTree *tree); ~ExRootTreeReader(); Long64_t GetEntries() const { return fChain ? static_cast(fChain->GetEntries()) : 0; } Bool_t ReadEntry(Long64_t entry); TClonesArray *UseBranch(const TString &branchName); private: void Init(); void Notify(); TTree *fChain; // pointer to the analyzed TTree or TChain Int_t fCurrentTree; // current Tree number in a TChain Bool_t fIsInitDone; typedef std::map > TBranchMap; TBranchMap fBranchMap; }; #endif // ExRootTreeReader_h