ATLAS Offline Software
SetBranch.h
Go to the documentation of this file.
1 /*
2 Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3 */
4 #ifndef MUONTESTER_MUONSetBranch_H
5 #define MUONTESTER_MUONSetBranch_H
6 
8 
9 // Implementation to store vector like variables
10 namespace MuonVal {
11 class MuonTesterTree;
12 template <class T> class SetBranch : public MuonTesterBranch, virtual public IMuonTesterBranch {
13 public:
15  SetBranch(TTree* tree, const std::string& name);
16  SetBranch(MuonTesterTree& tree, const std::string& name);
17 
18  virtual ~SetBranch() = default;
21  bool fill(const EventContext& ctx) override;
23  bool init() override;
24 
26  inline size_t size() const;
27 
29  inline void insert(const T& value);
30  inline void operator+=(const T& value);
31 
33  std::set<T>& operator->();
34  std::set<T>& get();
35  const std::set<T>& operator->() const;
36  const std::set<T>& get() const;
38  void operator=(const std::set<T>& other);
39 
40 
41  inline bool isUpdated() const;
42 
43 private:
44  std::set<T> m_variable{};
45  bool m_updated{false};
46 };
47 }
49 #endif
MuonVal::SetBranch::operator+=
void operator+=(const T &value)
MuonVal::IMuonTesterBranch::tree
virtual TTree * tree()=0
Returns the pointer to the underlying TTree object.
MuonVal::SetBranch::operator->
std::set< T > & operator->()
Getter methods.
MuonVal::MuonTesterBranch
Definition: MuonTesterBranch.h:21
MuonVal::SetBranch::isUpdated
bool isUpdated() const
athena.value
value
Definition: athena.py:122
MuonVal::SetBranch::insert
void insert(const T &value)
Adds a new element at the end of the vector.
MuonVal::SetBranch::init
bool init() override
Initialized the Branch.
MuonVal::SetBranch::get
const std::set< T > & get() const
MuonVal::SetBranch::operator->
const std::set< T > & operator->() const
MuonVal::SetBranch::SetBranch
SetBranch(MuonTesterTree &tree, const std::string &name)
MuonVal::SetBranch::operator=
void operator=(const std::set< T > &other)
Assignment operator.
MuonVal::MuonTesterTree
Definition: MuonTesterTree.h:30
MuonVal::SetBranch
Definition: SetBranch.h:12
MuonVal::SetBranch::m_variable
std::set< T > m_variable
Definition: SetBranch.h:44
MuonVal
Class to store array like branches into the n-tuples.
Definition: MuonTPMetaDataAlg.cxx:25
MuonVal::SetBranch::size
size_t size() const
Returns the number of actual saved elements.
MuonVal::SetBranch::m_updated
bool m_updated
Definition: SetBranch.h:45
MuonTesterBranch.h
MuonVal::IMuonTesterBranch::name
virtual std::string name() const =0
Returns the name of the branch.
SetBranch.icc
InDetDD::other
@ other
Definition: InDetDD_Defs.h:16
MuonVal::SetBranch::~SetBranch
virtual ~SetBranch()=default
MuonVal::SetBranch::get
std::set< T > & get()
MuonVal::SetBranch::fill
bool fill(const EventContext &ctx) override
Clears vector in cases that it has not been updated in this event Retursn falls if the vector has not...
MuonVal::SetBranch::SetBranch
SetBranch(TTree *tree, const std::string &name)
Standard constructor.
MuonVal::IMuonTesterBranch
Most basic interface class used by the MuonTester tree.
Definition: IMuonTesterBranch.h:20