ATLAS Offline Software
ScalarBranch.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_MUONSCALARBRANCH_H
5 #define MUONTESTER_MUONSCALARBRANCH_H
6 
10 namespace MuonVal {
11 class MuonTesterTree;
12 template <class T> class ScalarBranch : public MuonTesterBranch, virtual public IMuonTesterBranch {
13 public:
17  ScalarBranch(TTree* tree, const std::string& name);
18  ScalarBranch(MuonTesterTree& tree, const std::string& name);
19 
22  ScalarBranch(TTree* tree, const std::string& name, const T& default_value);
23  ScalarBranch(MuonTesterTree& tree, const std::string& name, const T& default_value);
24 
25  virtual ~ScalarBranch() = default;
26 
27  bool fill(const EventContext& ctx) override;
28  bool init() override;
29 
33  void operator=(const T& value);
34  void setValue(const T& value);
35 
36  bool isUpdated() const;
37  void setDefault(const T& def);
39 
40  const T& getDefault() const;
41  const T& getVariable() const;
42  bool mustBeUpdated() const;
43 
44 private:
46  T m_default{};
47  bool m_failIfNotUpdated{true};
48  bool m_updated{false};
49 };
50 
51 template <typename T> std::ostream& operator<<(std::ostream& out, const ScalarBranch<T>& B);
52 }
54 #endif
MuonVal::ScalarBranch::m_default
T m_default
Definition: ScalarBranch.h:46
MuonVal::ScalarBranch::ScalarBranch
ScalarBranch(MuonTesterTree &tree, const std::string &name)
MuonVal::IMuonTesterBranch::tree
virtual TTree * tree()=0
Returns the pointer to the underlying TTree object.
MuonVal::ScalarBranch::fill
bool fill(const EventContext &ctx) override
The fill method checks if enough information is provided such that the branch is cleared from the inf...
MuonVal::ScalarBranch::getDefault
const T & getDefault() const
MuonVal::ScalarBranch::setValue
void setValue(const T &value)
MuonVal::MuonTesterBranch
Definition: MuonTesterBranch.h:21
python.AthDsoLogger.out
out
Definition: AthDsoLogger.py:71
athena.value
value
Definition: athena.py:124
MuonVal::ScalarBranch::isUpdated
bool isUpdated() const
MuonVal::ScalarBranch::mustBeUpdated
bool mustBeUpdated() const
MuonVal::ScalarBranch::ScalarBranch
ScalarBranch(MuonTesterTree &tree, const std::string &name, const T &default_value)
MuonVal::MuonTesterTree
Definition: MuonTesterTree.h:30
MuonVal::ScalarBranch::m_variable
T m_variable
Definition: ScalarBranch.h:45
MuonVal::ScalarBranch::ScalarBranch
ScalarBranch(TTree *tree, const std::string &name, const T &default_value)
Constructor providing a default_value which is inserted when the information in the branch is not upd...
MuonVal::ScalarBranch::setDefault
void setDefault(const T &def)
ScalarBranch.icc
MuonVal::ScalarBranch::init
bool init() override
The init method checks whether the branch name has already registered to the MuonTree and tries then ...
MuonVal
Class to store array like branches into the n-tuples.
Definition: MuonTPMetaDataAlg.cxx:25
MuonVal::ScalarBranch
Definition: ScalarBranch.h:12
MuonVal::ScalarBranch::ScalarBranch
ScalarBranch(TTree *tree, const std::string &name)
Default constructor passing the TTree object and the name of the branch in the tree.
MuonVal::ScalarBranch::disableFailing
void disableFailing()
MuonTesterBranch.h
MuonVal::operator<<
std::ostream & operator<<(std::ostream &out, const ScalarBranch< T > &B)
MuonVal::IMuonTesterBranch::name
virtual std::string name() const =0
Returns the name of the branch.
MuonVal::ScalarBranch::m_updated
bool m_updated
Definition: ScalarBranch.h:48
MuonVal::ScalarBranch::getVariable
const T & getVariable() const
MuonVal::ScalarBranch::operator=
void operator=(const T &value)
Setter methods.
MuonVal::IMuonTesterBranch
Most basic interface class used by the MuonTester tree.
Definition: IMuonTesterBranch.h:20
MuonVal::ScalarBranch::m_failIfNotUpdated
bool m_failIfNotUpdated
Definition: ScalarBranch.h:47
MuonVal::ScalarBranch::~ScalarBranch
virtual ~ScalarBranch()=default