ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
PhysicsAnalysis
D3PDMaker
D3PDMakerCoreComps
src
ContainerFlagFillerTool.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
// $Id$
12
13
14
#include "
ContainerFlagFillerTool.h
"
15
#include "
AthenaKernel/errorcheck.h
"
16
17
18
namespace
D3PD
{
19
20
21
ContainerFlagFillerTool::ContainerFlagFillerTool
(
const
std::string&
type
,
22
const
std::string& name,
23
const
IInterface* parent)
24
:
BlockFillerToolImpl
(
type
, name, parent),
25
m_getters
(this),
26
m_map
(this,
m_getters
,
m_allowMissing
)
27
{
28
declareProperty (
"FlagNames"
,
m_flagNames
,
29
"Names of the flags added to the D3PD."
30
"May be followed by a string of the form `@TYPE/KEY', in which case the "
31
"corresponding entry in Getters is automatically initialized (only available "
32
"when the Python configuration wrapper is used). May be followed by a "
33
"docstring following a colon."
);
34
declareProperty (
"Getters"
,
m_getters
,
35
"Getter tools for the INav4MomLinkContainer objects."
);
36
declareProperty (
"AllowMissing"
,
m_allowMissing
,
37
"If true, missing containers will not be considered errors."
);
38
}
39
40
44
StatusCode
ContainerFlagFillerTool::initialize
()
45
{
46
// Check that the configuration makes sense:
47
if
(
m_getters
.size() !=
m_flagNames
.size() ) {
48
REPORT_MESSAGE
( MSG::FATAL )
49
<<
"Different number of getter tools and flags specified"
;
50
return
StatusCode::FAILURE;
51
}
52
53
CHECK
( BlockFillerToolImpl::initialize() );
54
55
return
StatusCode::SUCCESS;
56
}
57
58
67
StatusCode
ContainerFlagFillerTool::configureD3PD
(
IAddVariable
*
tree
,
68
const
std::type_info& ti)
69
{
70
CHECK
(
m_map
.configureD3PD (ti) );
71
CHECK
(
AddVariable::configureD3PD
(
tree
) );
72
return
StatusCode::SUCCESS;
73
}
74
75
81
StatusCode
ContainerFlagFillerTool::book
()
82
{
83
// Resize the flag vector to the right size:
84
m_flags
.resize(
m_flagNames
.size(), 0 );
85
86
// Book the flag variable(s):
87
for
(
size_t
i = 0; i <
m_flagNames
.size(); ++i ) {
88
std::string flagname =
m_flagNames
[i];
89
std::string desc =
"Was this object selected according to X criteria?"
;
90
std::string::size_type ipos = flagname.find (
':'
);
91
if
(ipos != std::string::npos) {
92
desc = flagname.substr (ipos+1, std::string::npos);
93
flagname.resize (ipos);
94
}
95
CHECK
(
addVariable
(flagname,
m_flags
[ i ], desc) );
96
}
97
98
return
StatusCode::SUCCESS;
99
}
100
101
112
StatusCode
ContainerFlagFillerTool::fillUntyped
(
const
void
* p,
113
bool
/*again = false*/
)
114
{
115
if
(
m_flags
.empty())
116
return
StatusCode(
EMPTY
);
117
118
CHECK
(
m_map
.reset() );
119
for
(
size_t
i = 0; i <
m_flags
.size(); i++)
120
*
m_flags
[i] = (
m_map
.findIndex (p, i) != -1);
121
return
StatusCode::SUCCESS;
122
}
123
124
125
}
// namespace D3PD
ClusterMessageType::EMPTY
@ EMPTY
Definition
ClusterMessage.h:25
ContainerFlagFillerTool.h
Flag objects that are present in other containers.
errorcheck.h
Helpers for checking error return status codes and reporting errors.
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
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::BlockFillerToolImpl::BlockFillerToolImpl
BlockFillerToolImpl(const std::string &type, const std::string &name, const IInterface *parent)
Standard Gaudi tool constructor.
Definition
BlockFillerToolImpl.cxx:27
D3PD::ContainerFlagFillerTool::initialize
virtual StatusCode initialize()
Function initializing the tool.
Definition
ContainerFlagFillerTool.cxx:44
D3PD::ContainerFlagFillerTool::m_flagNames
std::vector< std::string > m_flagNames
Property: The flag names.
Definition
ContainerFlagFillerTool.h:95
D3PD::ContainerFlagFillerTool::m_allowMissing
bool m_allowMissing
Property: If true, missing containers will not be considered errors.
Definition
ContainerFlagFillerTool.h:101
D3PD::ContainerFlagFillerTool::m_flags
std::vector< bool * > m_flags
Variables: The flags created in the D3PD.
Definition
ContainerFlagFillerTool.h:104
D3PD::ContainerFlagFillerTool::configureD3PD
virtual StatusCode configureD3PD(IAddVariable *tree, const std::type_info &ti)
Configure during initialization: type-check.
Definition
ContainerFlagFillerTool.cxx:67
D3PD::ContainerFlagFillerTool::book
virtual StatusCode book()
Declare tuple variables.
Definition
ContainerFlagFillerTool.cxx:81
D3PD::ContainerFlagFillerTool::m_getters
ToolHandleArray< ICollectionGetterTool > m_getters
Property: The container getters that are used to compute the flags.
Definition
ContainerFlagFillerTool.h:98
D3PD::ContainerFlagFillerTool::m_map
IndexMap m_map
Map to manage index lookups.
Definition
ContainerFlagFillerTool.h:107
D3PD::ContainerFlagFillerTool::ContainerFlagFillerTool
ContainerFlagFillerTool(const std::string &type, const std::string &name, const IInterface *parent)
Standard Gaudi tool constructor.
Definition
ContainerFlagFillerTool.cxx:21
D3PD::ContainerFlagFillerTool::fillUntyped
virtual StatusCode fillUntyped(const void *p, bool again=false)
Fill one block.
Definition
ContainerFlagFillerTool.cxx:112
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
type
tree
TChain * tree
Definition
tile_monitor.h:30
Generated on
for ATLAS Offline Software by
1.17.0