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_blockName (blockName),
35
m_tree
(0)
36
{
37
}
38
39
45
AddVariable::AddVariable
(
const
std::string& prefix,
46
const
std::string&
/*blockName*/
,
47
const
std::string& suffix)
48
:
m_metadata
(),
49
m_prefix
(prefix),
50
m_suffix
(suffix),
51
//m_blockName (blockName),
52
m_tree
(0)
53
{
54
}
55
56
61
StatusCode
AddVariable::configureD3PD
(
IAddVariable
*
tree
)
62
{
63
m_tree
=
tree
;
64
m_metadata
.clear();
65
return
StatusCode::SUCCESS;
66
}
67
68
69
/**
70
* @brief Add a variable to the tuple.
71
* @param name The name of the variable.
72
* @param type The type of the variable.
73
* @param ptr Pointer to the type of the variable.
74
* The pointer need not be initialized;
75
* the D3PD software will set the pointer
76
* prior to calling @c fill().
77
* @param docstring Documentation string for this variable.
78
* @param defval Pointer to the default value to use for this variable.
79
* Null for no default (generally means to fill with zeros).
80
* Of the type given by @c ti.
81
* Only works for basic types.
82
*
83
* If called from the constructor, the only effect is to clear @c ptr.
84
*/
85
StatusCode
AddVariable::addVariable
(
const
std::string& name,
86
const
std::type_info& ti,
87
void
* & ptr,
88
const
std::string& docstring
/*= ""*/
,
89
const
void
* defval
/*= 0*/
)
90
{
91
if
(!
m_tree
) {
92
// Called from constructor --- just initialize pointer.
93
ptr = 0;
94
return
StatusCode::SUCCESS;
95
}
96
97
CHECK
(
m_metadata
.addVariable(
m_prefix
+ name +
m_suffix
,
98
ti, ptr, docstring, defval ) );
99
return
m_tree
->addVariable (
m_prefix
+ name +
m_suffix
,
100
ti, ptr, docstring, defval);
101
}
102
103
119
*
120
* If called from the constructor, the only effect is to clear @c ptr.
121
*/
122
StatusCode
123
AddVariable::addDimensionedVariable
(
const
std::string& name,
124
const
std::type_info& ti,
125
void
* & ptr,
126
const
std::string& dim,
127
const
std::string& docstring
/*= ""*/
,
128
const
void
* defval
/*= 0*/
)
129
{
130
if
(!
m_tree
) {
131
// Called from constructor --- just initialize pointer.
132
ptr = 0;
133
return
StatusCode::SUCCESS;
134
}
135
136
CHECK
(
m_metadata
.addDimensionedVariable(
m_prefix
+ name +
m_suffix
,
137
ti, ptr, dim,
138
docstring, defval ) );
139
return
m_tree
->addDimensionedVariable (
m_prefix
+ name +
m_suffix
,
140
ti, ptr, dim,
141
docstring, defval);
142
}
143
144
145
}
// 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::addVariable
virtual StatusCode addVariable(const std::string &name, const std::type_info &ti, void *&ptr, const std::string &docstring="", const void *defval=0)
Add a variable to the tuple.
Definition
AddVariable.cxx:85
D3PD::AddVariable::configureD3PD
StatusCode configureD3PD(IAddVariable *tree)
Configure the parent tree.
Definition
AddVariable.cxx:61
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
Reference to the block name.
Definition
AddVariable.h:143
D3PD::AddVariable::addDimensionedVariable
virtual StatusCode addDimensionedVariable(const std::string &name, const std::type_info &ti, void *&ptr, const std::string &dim, const std::string &docstring="", const void *defval=0)
Add a variable to the tuple.
Definition
AddVariable.cxx:123
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