ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
MuonSpectrometer
MuonValidation
MuonTesterTree
MuonTesterTree
ArrayBranch.h
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3
*/
4
#ifndef MUONTESTER_ARRAYBRANCH_H
5
#define MUONTESTER_ARRAYBRANCH_H
6
7
#include <
MuonTesterTree/IMuonTesterBranch.h
>
8
#include <
MuonTesterTree/MuonTesterBranch.h
>
9
#include <TTree.h>
11
12
namespace
MuonVal
{
13
class
MuonTesterTree
;
14
template
<
class
T>
class
ArrayBranch
:
public
MuonTesterBranch
,
virtual
public
IMuonTesterBranch
{
15
public
:
17
ArrayBranch
(TTree*
tree
,
const
std::string&
name
,
size_t
size
);
18
ArrayBranch
(
MuonTesterTree
&
tree
,
const
std::string&
name
,
size_t
size
);
19
21
ArrayBranch
(TTree*
tree
,
const
std::string&
name
,
size_t
size
,
const
T& def_val);
22
ArrayBranch
(
MuonTesterTree
&
tree
,
const
std::string&
name
,
size_t
size
,
const
T& def_val);
23
24
virtual
~ArrayBranch
() =
default
;
25
27
bool
fill
(
const
EventContext&)
override
final
;
29
bool
init
() override final;
30
32
bool
initialized
()
const
;
33
35
size_t
size
()
const
;
36
38
void
set
(
size_t
s,
const
T& val);
40
const
T&
get
(
size_t
s)
const
;
41
43
const
T& operator[](
size_t
s)
const
;
45
T& operator[](
size_t
s);
46
48
const
T&
getDefault
()
const
;
49
50
void
setDefault
(
const
T& val);
51
52
private
:
54
std
::
string
tree_data_type
()
const
;
56
void
reset
();
57
size_t
m_size
{0};
58
std::vector<T>
m_data
{};
59
std::vector<bool>
m_updated
{};
60
61
bool
m_init
{
false
};
62
64
T
m_default
{};
65
bool
m_failIfNotUpdated
{
true
};
66
};
67
68
template
<> std::string
ArrayBranch<char*>::tree_data_type
()
const
;
69
template
<> std::string
ArrayBranch<std::string>::tree_data_type
()
const
;
70
template
<> std::string
ArrayBranch<Char_t>::tree_data_type
()
const
;
71
template
<> std::string
ArrayBranch<UChar_t>::tree_data_type
()
const
;
72
template
<> std::string
ArrayBranch<Short_t>::tree_data_type
()
const
;
73
template
<> std::string
ArrayBranch<Int_t>::tree_data_type
()
const
;
74
template
<> std::string
ArrayBranch<Long64_t>::tree_data_type
()
const
;
75
template
<> std::string
ArrayBranch<UShort_t>::tree_data_type
()
const
;
76
template
<> std::string
ArrayBranch<UInt_t>::tree_data_type
()
const
;
77
template
<> std::string
ArrayBranch<ULong64_t>::tree_data_type
()
const
;
78
template
<> std::string
ArrayBranch<Float_t>::tree_data_type
()
const
;
79
template
<> std::string
ArrayBranch<Double_t>::tree_data_type
()
const
;
80
template
<> std::string
ArrayBranch<Bool_t>::tree_data_type
()
const
;
81
}
82
#include <
MuonTesterTree/ArrayBranch.icc
>
83
#endif
ArrayBranch.icc
IMuonTesterBranch.h
MuonTesterBranch.h
MuonVal::ArrayBranch::ArrayBranch
ArrayBranch(MuonTesterTree &tree, const std::string &name, size_t size, const T &def_val)
MuonVal::ArrayBranch::m_failIfNotUpdated
bool m_failIfNotUpdated
Definition
ArrayBranch.h:65
MuonVal::ArrayBranch::ArrayBranch
ArrayBranch(TTree *tree, const std::string &name, size_t size, const T &def_val)
Constructor with default value to be set in case an element is not updated.
MuonVal::ArrayBranch::m_updated
std::vector< bool > m_updated
Definition
ArrayBranch.h:59
MuonVal::ArrayBranch::ArrayBranch
ArrayBranch(TTree *tree, const std::string &name, size_t size)
Constructor.
MuonVal::ArrayBranch::initialized
bool initialized() const
Is the branch initialized.
MuonVal::ArrayBranch::setDefault
void setDefault(const T &val)
MuonVal::ArrayBranch::get
const T & get(size_t s) const
Returns the i-th value.
MuonVal::ArrayBranch::m_init
bool m_init
Definition
ArrayBranch.h:61
MuonVal::ArrayBranch::fill
bool fill(const EventContext &) override final
Returns false if one of the array values is not updated.
MuonVal::ArrayBranch::m_size
size_t m_size
Definition
ArrayBranch.h:57
MuonVal::ArrayBranch::size
size_t size() const
How large is the array.
MuonVal::ArrayBranch::m_data
std::vector< T > m_data
Definition
ArrayBranch.h:58
MuonVal::ArrayBranch::set
void set(size_t s, const T &val)
Set's the i-th entry of the array to val.
MuonVal::ArrayBranch::~ArrayBranch
virtual ~ArrayBranch()=default
MuonVal::ArrayBranch::getDefault
const T & getDefault() const
default value in cases the branch is not updated
MuonVal::ArrayBranch::init
bool init() override final
Connects the branch with the tree.
MuonVal::ArrayBranch::tree_data_type
std::string tree_data_type() const
Data type of the branch in the tree.
MuonVal::ArrayBranch::reset
void reset()
Resets the check mask.
MuonVal::ArrayBranch::ArrayBranch
ArrayBranch(MuonTesterTree &tree, const std::string &name, size_t size)
MuonVal::ArrayBranch::m_default
T m_default
Default value in cases where the part are not updated.
Definition
ArrayBranch.h:64
MuonVal::IMuonTesterBranch
Most basic interface class used by the MuonTester tree.
Definition
IMuonTesterBranch.h:20
MuonVal::IMuonTesterBranch::name
virtual std::string name() const =0
Returns the name of the branch.
MuonVal::IMuonTesterBranch::tree
virtual TTree * tree()=0
Returns the pointer to the underlying TTree object.
MuonVal::MuonTesterBranch::MuonTesterBranch
MuonTesterBranch(MuonTesterTree &tree, const std::string &br_name)
Definition
MuonTesterBranch.cxx:33
MuonVal::MuonTesterTree
Definition
MuonTesterTree.h:38
const
MuonVal
Class to store array like branches into the n-tuples.
Definition
HitValAlg.cxx:19
std
STL namespace.
private
#define private
Definition
testRead.cxx:27
Generated on
for ATLAS Offline Software by
1.17.0