TreeReader.h
Go to the documentation of this file.
1 #ifndef GARANA_TREEREADER_H_
2 #define GARANA_TREEREADER_H_
3 
4 // ROOT includes
5 #include <TFile.h>
6 #include <TTree.h>
7 #include <TLorentzVector.h>
8 #include <TVector3.h>
9 
10 // C++ includes
11 #include <iostream>
12 #include <vector>
13 #include <string>
14 #include <map>
15 #include <climits>
16 #include <limits.h>
17 
18 using std::cout;
19 using std::cerr;
20 using std::endl;
21 using std::vector;
22 using std::string;
23 using std::map;
24 
25 namespace garana {
26  class TreeReader {
27 
28  public:
29 
30  virtual ~TreeReader() {};
31 
32  void SetupRead(TTree* tree);
33  TTree* GetInputTree();
34  size_t NEntries() const;
35  virtual void GetEntry(const UInt_t& ientry);
36  Int_t Event() const;
37  const TObjArray* GetBranchList() const;
38  void Fill();
39  void Write();
40  void CheckOpt(char opt);
41  bool BlockWrite() const;
42 
43  virtual bool SetBranchAddresses() = 0;
44 
45  protected:
46 
47  //static const std::string treename; problem when using shared libs?
49 
50  char fOpt = 'r';
51  TTree* fTreeIn = nullptr; ///< pointer to the analyzed TTree or TChain
52  UInt_t fCurrentEntry = UINT_MAX;
53 
54  TBranch* b_Event = nullptr;
55  Int_t fEvent = -1; ///< event number for tree entry
56 
57 
58 
59  };//class
60 }//namespace
61 
62 #endif /* GARANA_TREEREADER_H_ */
UInt_t fCurrentEntry
Definition: TreeReader.h:52
virtual ~TreeReader()
Definition: TreeReader.h:30
std::string string
Definition: nybbler.cc:12
opt
Definition: train.py:196
const std::string treename
Definition: TreeReader.h:48
struct vector vector
TTree * GetInputTree()
Definition: TreeReader.cxx:26
TTree * fTreeIn
pointer to the analyzed TTree or TChain
Definition: TreeReader.h:51
void CheckOpt(char opt)
Definition: TreeReader.cxx:67
bool BlockWrite() const
Definition: TreeReader.cxx:93
Int_t Event() const
Definition: TreeReader.cxx:30
TBranch * b_Event
Definition: TreeReader.h:54
void SetupRead(TTree *tree)
Definition: TreeReader.cxx:6
const TObjArray * GetBranchList() const
Definition: TreeReader.cxx:47
virtual bool SetBranchAddresses()=0
virtual void GetEntry(const UInt_t &ientry)
Definition: TreeReader.cxx:39
Int_t fEvent
event number for tree entry
Definition: TreeReader.h:55
size_t NEntries() const
Definition: TreeReader.cxx:35
QTextStream & endl(QTextStream &s)