ATLAS Offline Software
Loading...
Searching...
No Matches
ScalarBranch.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3*/
4#ifndef MUONTESTER_MUONSCALARBRANCH_H
5#define MUONTESTER_MUONSCALARBRANCH_H
6
10namespace MuonVal {
11class MuonTesterTree;
12template <class T> class ScalarBranch : public MuonTesterBranch, virtual public IMuonTesterBranch {
13public:
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 const T& operator=(const T& value);
34 const T& 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
44private:
48 bool m_updated{false};
49};
50
51template <typename T> std::ostream& operator<<(std::ostream& out, const ScalarBranch<T>& B);
52}
54#endif
Most basic interface class used by the MuonTester tree.
virtual std::string name() const =0
Returns the name of the branch.
virtual TTree * tree()=0
Returns the pointer to the underlying TTree object.
MuonTesterBranch(MuonTesterTree &tree, const std::string &br_name)
ScalarBranch(MuonTesterTree &tree, const std::string &name, const T &default_value)
bool isUpdated() const
bool mustBeUpdated() const
const T & getVariable() const
bool fill(const EventContext &ctx) override
The fill method checks if enough information is provided such that the branch is cleared from the inf...
const T & operator=(const T &value)
Setter methods.
virtual ~ScalarBranch()=default
const T & setValue(const T &value)
const T & getDefault() const
bool init() override
The init method checks whether the branch name has already registered to the MuonTree and tries then ...
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...
ScalarBranch(TTree *tree, const std::string &name)
Default constructor passing the TTree object and the name of the branch in the tree.
void setDefault(const T &def)
ScalarBranch(MuonTesterTree &tree, const std::string &name)
Class to store array like branches into the n-tuples.
Definition HitValAlg.cxx:19
std::ostream & operator<<(std::ostream &out, const ScalarBranch< T > &B)