PandaTree
Object.h
1 #ifndef PandaTree_Framework_Object_h
2 #define PandaTree_Framework_Object_h
3 
4 #include "IOUtils.h"
5 #include "TTree.h"
6 #include <iostream>
7 #include <vector>
8 #include <utility>
9 
10 class TTree;
11 
12 namespace panda {
13 
15 
22  class Object {
23  public:
24  Object() {}
25  Object(Object const&) {}
26  virtual ~Object() {}
27  Object& operator=(Object const&) { return *this; }
28 
30 
37  virtual void setStatus(TTree& tree, utils::BranchList const&) {}
38 
40  virtual utils::BranchList getStatus(TTree&) const { return utils::BranchList(); }
41 
43 
47  virtual utils::BranchList getBranchNames(Bool_t fullName = kTRUE, Bool_t direct = kFALSE) const { return utils::BranchList(); }
48 
50 
57  virtual UInt_t setAddress(TTree& tree, utils::BranchList const& = {"*"}, Bool_t setStatus = kTRUE) { return -1; }
58 
60 
64  virtual void book(TTree& tree, utils::BranchList const& = {"*"}) {}
65 
67 
76  virtual Int_t getEntry(TTree& tree, Long64_t entry, Bool_t localEntry = kFALSE) { return 0; }
77 
79 
88  virtual Int_t getEntry(UInt_t treeId, Long64_t entry, Bool_t localEntry = kFALSE) { return 0; }
89 
91 
97  virtual Int_t fill(TTree& tree) { return tree.Fill(); }
98 
100  virtual void init() {}
101 
103  virtual char const* getName() const { return ""; }
104 
106  virtual void setName(char const*) {}
107 
109  virtual void print(std::ostream& out = std::cout, UInt_t level = 1) const { dump(out); }
110 
112  virtual void dump(std::ostream& = std::cout) const {}
113  };
114 
115 }
116 
117 #endif
virtual Int_t fill(TTree &tree)
Fill a tree.
Definition: Object.h:97
virtual void print(std::ostream &out=std::cout, UInt_t level=1) const
Print the object content.
Definition: Object.h:109
virtual UInt_t setAddress(TTree &tree, utils::BranchList const &={"*"}, Bool_t setStatus=kTRUE)
Bind the tree branches to the elements of this object.
Definition: Object.h:57
Object base class.
Definition: Object.h:22
virtual void book(TTree &tree, utils::BranchList const &={"*"})
Book new branches bound to this object on the tree.
Definition: Object.h:64
List of branch names.
Definition: IOUtils.h:64
virtual Int_t getEntry(UInt_t treeId, Long64_t entry, Bool_t localEntry=kFALSE)
Read an entry from an input tree.
Definition: Object.h:88
virtual utils::BranchList getBranchNames(Bool_t fullName=kTRUE, Bool_t direct=kFALSE) const
Get the full list of branch names.
Definition: Object.h:47
virtual utils::BranchList getStatus(TTree &) const
Get status of branches in the tree.
Definition: Object.h:40
virtual void setStatus(TTree &tree, utils::BranchList const &)
Set status of branches to true (matching branch) or false (vetoed branch)
Definition: Object.h:37
virtual void dump(std::ostream &=std::cout) const
Dump the object content.
Definition: Object.h:112
virtual void setName(char const *)
Set object name.
Definition: Object.h:106
virtual Int_t getEntry(TTree &tree, Long64_t entry, Bool_t localEntry=kFALSE)
Read an entry from an input tree.
Definition: Object.h:76
virtual void init()
Reset the object state.
Definition: Object.h:100
Definition: Array.h:11
virtual char const * getName() const
Name of this object.
Definition: Object.h:103