ATLAS Offline Software
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 $
16 
17 
18 namespace D3PD {
19 
20 
28  (const std::string& type,
29  const std::string& name,
30  const IInterface* parent)
31  : base_class (type, name, parent),
32  AddVariable (m_prefix, m_blockName, m_suffix),
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 
58 {
60  CHECK( m_associator.retrieve() );
61  CHECK( m_blockFillers.retrieve() );
62  return StatusCode::SUCCESS;
63 }
64 
65 
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 
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
D3PD::ContainedAssociationFillerTool::ContainedAssociationFillerTool
ContainedAssociationFillerTool(const std::string &type, const std::string &name, const IInterface *parent)
Standard Gaudi tool constructor.
Definition: ContainedAssociationFillerTool.cxx:28
D3PD::ContainedAssociationFillerTool::book
virtual StatusCode book()
Declare tuple variables.
Definition: ContainedAssociationFillerTool.cxx:93
D3PD::ContainedAssociationFillerTool::m_blockFillers
ToolHandleArray< IBlockFillerTool > m_blockFillers
Property: The list of block filler tools.
Definition: ContainedAssociationFillerTool.h:130
D3PD::IAddVariable
Common interface for adding a variable to a tuple.
Definition: IAddVariable.h:70
calibdata.pout
def pout(output, newline=True)
Definition: calibdata.py:130
python.PerfMonSerializer.p
def p
Definition: PerfMonSerializer.py:743
D3PD::ContainedAssociationFillerTool::configureD3PD
virtual StatusCode configureD3PD(IAddVariable *tree, const std::type_info &ti)
Configure during initialization: type-check.
Definition: ContainedAssociationFillerTool.cxx:75
D3PD::ContainedAssociationFillerTool::fillUntyped
virtual StatusCode fillUntyped(const void *p, bool again=false)
Fill one block.
Definition: ContainedAssociationFillerTool.cxx:136
D3PD::AddVariable
Common implementation of IAddVariable.
Definition: AddVariable.h:38
D3PD::AddVariable::configureD3PD
StatusCode configureD3PD(IAddVariable *tree)
Configure the parent tree.
Definition: AddVariable.cxx:61
initialize
void initialize()
Definition: run_EoverP.cxx:894
tree
TChain * tree
Definition: tile_monitor.h:30
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::ContainedAssociationFillerTool::m_prefix
std::string m_prefix
Property: The variable name prefix.
Definition: ContainedAssociationFillerTool.h:133
ContainedAssociationFillerTool.h
Represent a single association by containment.
D3PD
Block filler tool for noisy FEB information.
Definition: InnerDetector/InDetMonitoring/InDetGlobalMonitoring/macros/EnhancedPrimaryVertexMonitoring/TrigD3PD/ChainGroup.h:21
lumiFormat.i
int i
Definition: lumiFormat.py:92
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
test_pyathena.parent
parent
Definition: test_pyathena.py:15
D3PD::ContainedAssociationFillerTool::m_associator
ToolHandle< ISingleAssociationTool > m_associator
Property: The association tool instance.
Definition: ContainedAssociationFillerTool.h:127
CHECK
#define CHECK(...)
Evaluate an expression and check for errors.
Definition: Control/AthenaKernel/AthenaKernel/errorcheck.h:422
D3PD::ContainedAssociationFillerTool::m_blockName
std::string m_blockName
Property: the name of this block.
Definition: ContainedAssociationFillerTool.h:139
D3PD::ContainedAssociationFillerTool::initialize
virtual StatusCode initialize()
Standard Gaudi initialize method.
Definition: ContainedAssociationFillerTool.cxx:57
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:195
errorcheck.h
Helpers for checking error return status codes and reporting errors.
D3PD::ContainedAssociationFillerTool::m_suffix
std::string m_suffix
Property: The variable name suffix.
Definition: ContainedAssociationFillerTool.h:136
D3PD::ContainedAssociationFillerTool::m_matched
bool * m_matched
Variable to flag that the association succeeded.
Definition: ContainedAssociationFillerTool.h:146
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
declareProperty
#define declareProperty(n, p, h)
Definition: BaseFakeBkgTool.cxx:15
D3PD::ContainedAssociationFillerTool::m_matchedName
std::string m_matchedName
Property: The variable name to use for the matched flag.
Definition: ContainedAssociationFillerTool.h:143