PandaTree
Singlet.h
1 #ifndef PandaTree_Framework_Singlet_h
2 #define PandaTree_Framework_Singlet_h
3 
4 #include "ReaderObject.h"
5 
6 #include "TString.h"
7 
8 #include <vector>
9 
10 namespace panda {
11 
13 
16  class Singlet : public ReaderObject {
17  public:
18  Singlet(char const* name = "") : ReaderObject(), name_(name) {}
19  Singlet(Singlet const& src) : ReaderObject(src), name_(src.name_) {}
20  ~Singlet() {}
21  Singlet& operator=(Singlet const& _src) { name_ = _src.name_; return *this; }
22 
23  void setStatus(TTree&, utils::BranchList const& blist) final;
24  utils::BranchList getStatus(TTree&) const final;
25  utils::BranchList getBranchNames(Bool_t fullName = kTRUE, Bool_t = kFALSE) const final;
26  UInt_t setAddress(TTree&, utils::BranchList const& blist = {"*"}, Bool_t setStatus = kTRUE) final;
27  void book(TTree&, utils::BranchList const& blist = {"*"}) final;
28  void init() final { doInit_(); }
29  char const* getName() const final { return name_; }
30  void setName(char const* n) final { name_ = n; }
31 
32  protected:
33  virtual void doSetStatus_(TTree&, utils::BranchList const&) = 0;
34  virtual utils::BranchList doGetStatus_(TTree&) const = 0;
35  virtual utils::BranchList doGetBranchNames_(Bool_t) const = 0;
36  virtual void doSetAddress_(TTree&, utils::BranchList const&, Bool_t setStatus) = 0;
37  virtual void doBook_(TTree&, utils::BranchList const&) = 0;
38  virtual void doInit_() = 0;
39 
40  TString name_{};
41  };
42 
43 }
44 
45 #endif
UInt_t setAddress(TTree &, utils::BranchList const &blist={"*"}, Bool_t setStatus=kTRUE) final
Bind the tree branches to the elements of this object.
Definition: Singlet.cc:22
void init() final
Reset the object state.
Definition: Singlet.h:28
List of branch names.
Definition: IOUtils.h:64
utils::BranchList getStatus(TTree &) const final
Get status of branches in the tree.
Definition: Singlet.cc:10
char const * getName() const final
Name of this object.
Definition: Singlet.h:29
Base class for singlet objects.
Definition: Singlet.h:16
utils::BranchList getBranchNames(Bool_t fullName=kTRUE, Bool_t=kFALSE) const final
Get the full list of branch names.
Definition: Singlet.cc:16
void setStatus(TTree &, utils::BranchList const &blist) final
Set status of branches to true (matching branch) or false (vetoed branch)
Definition: Singlet.cc:4
Definition: Array.h:11
void setName(char const *n) final
Set object name.
Definition: Singlet.h:30
Base class for objects that can be linked to an input tree directly.
Definition: ReaderObject.h:10
void book(TTree &, utils::BranchList const &blist={"*"}) final
Book new branches bound to this object on the tree.
Definition: Singlet.cc:30