ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
PhysicsAnalysis
D3PDMaker
D3PDMakerUtils
src
AddVariable.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3
*/
4
11
12
13
#include "
AthenaKernel/errorcheck.h
"
14
#include "
D3PDMakerUtils/AddVariable.h
"
15
16
17
namespace
D3PD
{
18
19
21
const
std::string
AddVariable::s_emptyString
;
22
23
29
AddVariable::AddVariable
(
const
std::string& prefix,
30
const
std::string&
/*blockName*/
/*= s_emptyString*/
)
31
:
m_metadata
(),
32
m_prefix
(prefix),
33
m_suffix
(
s_emptyString
),
34
m_tree
(0)
35
{
36
}
37
38
44
AddVariable::AddVariable
(
const
std::string& prefix,
45
const
std::string&
/*blockName*/
,
46
const
std::string& suffix)
47
:
m_metadata
(),
48
m_prefix
(prefix),
49
m_suffix
(suffix),
50
//m_blockName (blockName),
51
m_tree
(0)
52
{
53
}
54
55
60
StatusCode
AddVariable::configureD3PD
(
IAddVariable
*
tree
)
61
{
62
m_tree
=
tree
;
63
m_metadata
.clear();
64
return
StatusCode::SUCCESS;
65
}
66
67
69
* @brief Add a variable to the tuple.
70
* @param name The name of the variable.
71
* @param type The type of the variable.
72
* @param ptr Pointer to the type of the variable.
73
* The pointer need not be initialized;
74
* the D3PD software will set the pointer
75
* prior to calling @c fill().
76
* @param docstring Documentation string for this variable.
77
* @param defval Pointer to the default value to use for this variable.
78
* Null for no default (generally means to fill with zeros).
79
* Of the type given by @c ti.
80
* Only works for basic types.
81
*
82
* If called from the constructor, the only effect is to clear @c ptr.
83
*/
84
StatusCode
AddVariable::addVariable
(
const
std::string& name,
85
const
std::type_info& ti,
86
void
* & ptr,
87
std::string_view docstring
/*= ""*/
,
88
const
void
* defval
/*= 0*/
)
89
{
90
if
(!
m_tree
) {
91
// Called from constructor --- just initialize pointer.
92
ptr = 0;
93
return
StatusCode::SUCCESS;
94
}
95
96
CHECK
(
m_metadata
.addVariable(
m_prefix
+ name +
m_suffix
,
97
ti, ptr, docstring, defval ) );
98
return
m_tree
->addVariable (
m_prefix
+ name +
m_suffix
,
99
ti, ptr, docstring, defval);
100
}
101
102
119
* If called from the constructor, the only effect is to clear @c ptr.
120
*/
121
StatusCode
122
AddVariable::addDimensionedVariable
(
const
std::string& name,
123
const
std::type_info& ti,
124
void
* & ptr,
125
const
std::string& dim,
126
std::string_view docstring
/*= ""*/
,
127
const
void
* defval
/*= 0*/
)
128
{
129
if
(!
m_tree
) {
130
// Called from constructor --- just initialize pointer.
131
ptr = 0;
132
return
StatusCode::SUCCESS;
133
}
134
135
CHECK
(
m_metadata
.addDimensionedVariable(
m_prefix
+ name +
m_suffix
,
136
ti, ptr, dim,
137
docstring, defval ) );
138
return
m_tree
->addDimensionedVariable (
m_prefix
+ name +
m_suffix
,
139
ti, ptr, dim,
140
docstring, defval);
141
}
142
143
144
}
// namespace D3PD
AddVariable.h
Common implementation of IAddVariable.
errorcheck.h
Helpers for checking error return status codes and reporting errors.
CHECK
#define CHECK(...)
Evaluate an expression and check for errors.
Definition
Control/AthenaKernel/AthenaKernel/errorcheck.h:422
D3PD::AddVariable::s_emptyString
static const std::string s_emptyString
Used to provide a default value for blockName.
Definition
AddVariable.h:41
D3PD::AddVariable::configureD3PD
StatusCode configureD3PD(IAddVariable *tree)
Configure the parent tree.
Definition
AddVariable.cxx:60
D3PD::AddVariable::AddVariable
AddVariable(const std::string &prefix, const std::string &blockName=s_emptyString)
Constructor.
Definition
AddVariable.cxx:29
D3PD::AddVariable::m_metadata
ObjectMetadata m_metadata
Metadata about the variables created by this object.
Definition
AddVariable.h:129
D3PD::AddVariable::m_prefix
const std::string & m_prefix
Reference to the variable prefix.
Definition
AddVariable.h:134
D3PD::AddVariable::m_suffix
const std::string & m_suffix
Reference to the variable suffix.
Definition
AddVariable.h:137
D3PD::AddVariable::m_tree
IAddVariable * m_tree
The parent IAddVariable instance.
Definition
AddVariable.h:141
D3PD::AddVariable::addVariable
virtual StatusCode addVariable(const std::string &name, const std::type_info &ti, void *&ptr, std::string_view docstring="", const void *defval=0)
Add a variable to the tuple.
Definition
AddVariable.cxx:84
D3PD::AddVariable::addDimensionedVariable
virtual StatusCode addDimensionedVariable(const std::string &name, const std::type_info &ti, void *&ptr, const std::string &dim, std::string_view docstring="", const void *defval=0)
Add a variable to the tuple.
Definition
AddVariable.cxx:122
D3PD::IAddVariable
Common interface for adding a variable to a tuple.
Definition
IAddVariable.h:70
D3PD
Block filler tool for noisy FEB information.
Definition
CaloCellDetailsFillerTool.cxx:29
D3PD::m_tree
ID3PD * m_tree
Pointer to the ID3PD object used.
Definition
VectorFillerTool.h:147
D3PD::m_prefix
std::string m_prefix
Property: The variable name prefix.
Definition
IndexAssociationFillerTool.h:139
D3PD::m_metadata
ObjectMetadata m_metadata
Metadata about the variables created by this tool.
Definition
VectorFillerToolBase.h:180
tree
TChain * tree
Definition
tile_monitor.h:30
Generated on
for ATLAS Offline Software by
1.17.0