ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
PhysicsAnalysis
D3PDMaker
D3PDMakerCoreComps
src
VoidObjFillerTool.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 "
VoidObjFillerTool.h
"
14
#include "
CxxUtils/checker_macros.h
"
15
#include "
D3PDMakerInterfaces/ID3PD.h
"
16
#include "GaudiKernel/Incident.h"
17
#include "GaudiKernel/IIncidentSvc.h"
18
19
20
namespace
D3PD
{
21
22
29
VoidObjFillerTool::VoidObjFillerTool
(
const
std::string&
type
,
30
const
std::string& name,
31
const
IInterface* parent
32
)
33
: base_class (
type
, name, parent),
34
AddVariable
(
m_prefix
,
m_blockName
),
35
m_blockFillers
(this),
36
m_tree
(0)
37
{
38
declareProperty (
"BlockFillers"
,
m_blockFillers
,
39
"List of contained block filler tools."
);
40
declareProperty (
"Prefix"
,
m_prefix
=
""
,
41
"Variable name prefix for the contained blocks."
);
42
declareProperty (
"BlockName"
,
m_blockName
= this->name(),
43
"The name of this block."
);
44
declareProperty (
"ObjectName"
,
m_objectName
=
""
,
45
"Name of the D3PDObject that created this filler."
);
46
declareProperty (
"SaveMetadata"
,
m_saveMetadata
=
false
,
47
"Set to true to get metadata into the output D3PD "
48
"about the variables created by this tool"
);
49
}
50
51
55
StatusCode
56
VoidObjFillerTool::initialize
()
57
{
58
CHECK
( AthAlgTool::initialize() );
59
CHECK
(
m_blockFillers
.retrieve() );
60
61
// Listen to EndEvent and EndRun incidents:
62
ServiceHandle< IIncidentSvc >
p_incSvc(
"IncidentSvc"
, name() );
63
CHECK
( p_incSvc.retrieve() );
64
p_incSvc->addListener(
this
,
"EndEvtLoop"
);
65
66
return
StatusCode::SUCCESS;
67
}
68
69
76
StatusCode
77
VoidObjFillerTool::configureD3PD
(
IAddVariable
*
tree
)
78
{
79
CHECK
(
AddVariable::configureD3PD
(
tree
) );
80
for
(
size_t
i = 0; i <
m_blockFillers
.size(); i++)
81
CHECK
(
m_blockFillers
[i]->
configureD3PD
(
this
,
typeid
(
void
)) );
82
83
// Try to cast the received object into an ID3PD one:
84
m_tree
=
dynamic_cast<
ID3PD
*
>
(
tree
);
85
86
return
StatusCode::SUCCESS;
87
}
88
89
95
StatusCode
VoidObjFillerTool::book
()
96
{
97
// Configure the metadata object correctly:
98
m_metadata
.setName(
m_objectName
);
99
m_metadata
.setPrefix(
m_prefix
);
100
m_metadata
.setContainer(
isContainerFiller
() );
101
102
for
(
size_t
i = 0; i <
m_blockFillers
.size(); i++)
103
CHECK
(
m_blockFillers
[i]->
book
() );
104
105
return
StatusCode::SUCCESS;
106
}
107
108
115
StatusCode
116
VoidObjFillerTool::fill
()
117
{
118
for
(
size_t
i = 0; i <
m_blockFillers
.size(); i++)
119
CHECK
(
m_blockFillers
[i]->fillUntyped (0) );
120
121
return
StatusCode::SUCCESS;
122
}
123
124
131
bool
VoidObjFillerTool::isContainerFiller
()
const
132
{
133
return
false
;
134
}
135
136
145
void
VoidObjFillerTool::handle
(
const
Incident& inc )
146
{
147
if
( inc.type() ==
"EndEvtLoop"
) {
148
if
(
m_tree
&&
m_metadata
.variables().size() &&
m_saveMetadata
) {
149
const
std::string metadata =
m_metadata
.toString();
150
// safe because this incident handler is only called serially
151
const
std::string metadataName
ATLAS_THREAD_SAFE
=
m_metadata
.metadataName();
152
if
(
m_tree
->addMetadata( metadataName,
153
&metadata ).isFailure() ) {
154
REPORT_MESSAGE
( MSG::ERROR )
155
<<
"Couldn't add object metadata information to the output!"
;
156
return
;
157
}
158
}
159
}
160
161
return
;
162
}
163
164
165
}
// namespace D3PD
REPORT_MESSAGE
#define REPORT_MESSAGE(LVL)
Report a message.
Definition
Control/AthenaKernel/AthenaKernel/errorcheck.h:365
CHECK
#define CHECK(...)
Evaluate an expression and check for errors.
Definition
Control/AthenaKernel/AthenaKernel/errorcheck.h:422
ID3PD.h
Abstract interface for a D3PD tree.
VoidObjFillerTool.h
Object filler tool for tools taking no input.
checker_macros.h
Define macros for attributes used to control the static checker.
ATLAS_THREAD_SAFE
#define ATLAS_THREAD_SAFE
Definition
checker_macros.h:211
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::IAddVariable
Common interface for adding a variable to a tuple.
Definition
IAddVariable.h:70
D3PD::ID3PD
Define an abstract interface for building a D3PD tree.
Definition
ID3PD.h:37
D3PD::VoidObjFillerTool::initialize
virtual StatusCode initialize()
Standard Gaudi initialize method.
Definition
VoidObjFillerTool.cxx:56
D3PD::VoidObjFillerTool::m_saveMetadata
bool m_saveMetadata
Property: If true, the metadata about the variables is saved.
Definition
VoidObjFillerTool.h:123
D3PD::VoidObjFillerTool::m_objectName
std::string m_objectName
Property: the name of the D3PDObject that created this tool.
Definition
VoidObjFillerTool.h:120
D3PD::VoidObjFillerTool::fill
virtual StatusCode fill()
Fill one object.
Definition
VoidObjFillerTool.cxx:116
D3PD::VoidObjFillerTool::m_tree
ID3PD * m_tree
Pointer to the ID3PD object used.
Definition
VoidObjFillerTool.h:126
D3PD::VoidObjFillerTool::isContainerFiller
virtual bool isContainerFiller() const
Find out if the filler handles containers or single objects.
Definition
VoidObjFillerTool.cxx:131
D3PD::VoidObjFillerTool::handle
virtual void handle(const Incident &inc)
Handle end of run incidents to save the metadata at that point.
Definition
VoidObjFillerTool.cxx:145
D3PD::VoidObjFillerTool::configureD3PD
virtual StatusCode configureD3PD(IAddVariable *tree)
Configure the tool.
Definition
VoidObjFillerTool.cxx:77
D3PD::VoidObjFillerTool::book
virtual StatusCode book()
Declare tuple variables.
Definition
VoidObjFillerTool.cxx:95
D3PD::VoidObjFillerTool::m_blockName
std::string m_blockName
Property: the name of this block.
Definition
VoidObjFillerTool.h:117
D3PD::VoidObjFillerTool::m_blockFillers
ToolHandleArray< IBlockFillerTool > m_blockFillers
Property: The list of block filler tools.
Definition
VoidObjFillerTool.h:111
D3PD::VoidObjFillerTool::m_prefix
std::string m_prefix
Property: Variable prefix for this block.
Definition
VoidObjFillerTool.h:114
D3PD::VoidObjFillerTool::VoidObjFillerTool
VoidObjFillerTool(const std::string &type, const std::string &name, const IInterface *parent)
Standard Gaudi tool constructor.
Definition
VoidObjFillerTool.cxx:29
ServiceHandle< IIncidentSvc >
D3PD
Block filler tool for noisy FEB information.
Definition
CaloCellDetailsFillerTool.cxx:29
type
tree
TChain * tree
Definition
tile_monitor.h:30
Generated on
for ATLAS Offline Software by
1.17.0