ATLAS Offline Software
Loading...
Searching...
No Matches
ContainedAssociationFillerTool.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: ContainedAssociationFillerTool.cxx 618070 2014-09-22 19:05:34Z ssnyder $
12
13
16
17
18namespace D3PD {
19
20
28 (const std::string& type,
29 const std::string& name,
30 const IInterface* parent)
31 : base_class (type, name, parent),
33 m_associator (this),
34 m_blockFillers (this),
35 m_matched (0)
36{
37 declareProperty ("Associator", m_associator,
38 "The ISingleAssociationTool instance.");
39 declareProperty ("BlockFillers", m_blockFillers,
40 "List of contained block filler tools.");
41 declareProperty ("Prefix", m_prefix = "",
42 "Variable name prefix for the contained blocks.");
43 declareProperty ("Suffix", m_suffix = "",
44 "Variable name suffix for the contained blocks.");
45 declareProperty ("BlockName", m_blockName = this->name(),
46 "The name of this block.");
47 declareProperty ("Matched", m_matchedName = "matched",
48 "Variable name to use for the matched flag. "
49 "Omitted if empty.");
50}
51
52
56StatusCode
58{
59 CHECK( AthAlgTool::initialize() );
60 CHECK( m_associator.retrieve() );
61 CHECK( m_blockFillers.retrieve() );
62 return StatusCode::SUCCESS;
63}
64
65
74StatusCode
76 const std::type_info& ti)
77{
79 CHECK( m_associator->configureD3PD (this, ti) );
80 const std::type_info& ati = m_associator->typeinfo();
81 for (size_t i = 0; i < m_blockFillers.size(); i++)
82 CHECK( m_blockFillers[i]->configureD3PD (this, ati ) );
83
84 return StatusCode::SUCCESS;
85}
86
87
94{
95 CHECK( m_associator->book () );
96 for (size_t i = 0; i < m_blockFillers.size(); i++)
97 CHECK( m_blockFillers[i]->book ( ) );
98
99 if (!m_matchedName.empty())
101
102 return StatusCode::SUCCESS;
103}
104
105
135StatusCode
137 bool again /*= false*/)
138{
139 const void* pout = m_associator->getUntyped (p);
140 StatusCode scout (EMPTY);
141 if (pout) {
142 if (!m_matchedName.empty())
143 *m_matched = true;
144 for (size_t i = 0; i < m_blockFillers.size(); i++) {
145 // Set checked flag on scout.
146 // Otherwise, if we get an exception in the child, all we'll see
147 // is an unchecked status code error with no mention of the
148 // actual exception...
149 scout.ignore();
150 CHECK( againok (m_blockFillers[i]->fillUntyped (pout, again), scout) );
151 }
152 }
153 m_associator->releaseObjectUntyped (pout);
154
155 scout = StatusCode(scout.getCode()); // Make sure checked flag is clear again.
156 return againok (scout);
157}
158
159
160
161} // namespace D3PD
Represent a single association by containment.
Helpers for checking error return status codes and reporting errors.
#define CHECK(...)
Evaluate an expression and check for errors.
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.
StatusCode configureD3PD(IAddVariable *tree)
Configure the parent tree.
AddVariable(const std::string &prefix, const std::string &blockName=s_emptyString)
Constructor.
std::string m_blockName
Property: the name of this block.
bool * m_matched
Variable to flag that the association succeeded.
std::string m_suffix
Property: The variable name suffix.
virtual StatusCode book()
Declare tuple variables.
std::string m_matchedName
Property: The variable name to use for the matched flag.
virtual StatusCode fillUntyped(const void *p, bool again=false)
Fill one block.
ToolHandle< ISingleAssociationTool > m_associator
Property: The association tool instance.
std::string m_prefix
Property: The variable name prefix.
virtual StatusCode configureD3PD(IAddVariable *tree, const std::type_info &ti)
Configure during initialization: type-check.
virtual StatusCode initialize()
Standard Gaudi initialize method.
ToolHandleArray< IBlockFillerTool > m_blockFillers
Property: The list of block filler tools.
ContainedAssociationFillerTool(const std::string &type, const std::string &name, const IInterface *parent)
Standard Gaudi tool constructor.
Common interface for adding a variable to a tuple.
Block filler tool for noisy FEB information.
TChain * tree