ATLAS Offline Software
ContainedMultiAssociationFillerTool.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: ContainedMultiAssociationFillerTool.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),
33  m_associator (this),
34  m_blockFillers (this),
35  m_next (0)
36 {
37  declareProperty ("Associator", m_associator,
38  "The IMultiAssociationTool instance.");
39  declareProperty ("BlockFillers", m_blockFillers,
40  "List of contained block filler tools.");
41  declareProperty ("BlockName", m_blockName = this->name(),
42  "The name of this block.");
43  declareProperty ("Prefix", m_prefix = "",
44  "Variable name prefix for the contained blocks.");
45 }
46 
47 
53 {
55  CHECK( m_associator.retrieve() );
56  CHECK( m_blockFillers.retrieve() );
57  return StatusCode::SUCCESS;
58 }
59 
60 
66 {
68  if (m_next) {
69  m_associator->releaseElementUntyped (m_next);
70  m_next = 0;
71  }
72  return StatusCode::SUCCESS;
73 }
74 
75 
86  const std::type_info& ti)
87 {
89  CHECK( m_associator->configureD3PD (this, ti) );
90  const std::type_info& ati = m_associator->elementTypeinfo();
91  for (size_t i = 0; i < m_blockFillers.size(); i++)
92  CHECK( m_blockFillers[i]->configureD3PD (this, ati ) );
93 
94  return StatusCode::SUCCESS;
95 }
96 
97 
104 {
105  CHECK( m_associator->book () );
106  for (size_t i = 0; i < m_blockFillers.size(); i++)
107  CHECK( m_blockFillers[i]->book ( ) );
108 
109  return StatusCode::SUCCESS;
110 }
111 
112 
144  bool again /*= false*/)
145 {
146  // ??? Doesn't handle nested AGAIN.
147 
148  if (!again) {
149  if (m_next) {
150  m_associator->releaseElementUntyped (m_next);
151  m_next = 0;
152  }
153 
154  // Start the association.
155  CHECK( m_associator->resetUntyped (p) );
156 
157  // Get the first result.
158  m_next = m_associator->nextUntyped();
159  }
160 
161  if (!m_next)
162  return StatusCode(EMPTY);
163 
164  for (size_t i = 0; i < m_blockFillers.size(); i++) {
165  StatusCode sc = m_blockFillers[i]->fillUntyped (m_next);
167  if (!sc.isSuccess()) {
168  REPORT_MESSAGE (MSG::WARNING)
169  << "Got AGAIN/EMPTY: "
170  << "Nested ContainedMultiAssociationFillerTool not supported.";
171  }
172  }
173 
174  m_associator->releaseElementUntyped (m_next);
175  m_next = m_associator->nextUntyped();
176 
177  // Always return AGAIN for the first object, even if it's the last one.
178  // We'll return EMPTY on the next call.
179  // If we don't do this, then we can have problems if multiple
180  // ContainedMultiAssociationFillerTools are used; any that return
181  // a list of size 1 will have that object duplicated in all rows.
182  if (m_next || !again)
183  return StatusCode(AGAIN);
184 
185  return StatusCode::SUCCESS;
186 }
187 
188 
189 
190 } // namespace D3PD
D3PD::ContainedMultiAssociationFillerTool::m_prefix
std::string m_prefix
Property: The variable name prefix.
Definition: ContainedMultiAssociationFillerTool.h:141
D3PD::IAddVariable
Common interface for adding a variable to a tuple.
Definition: IAddVariable.h:70
D3PD::ContainedMultiAssociationFillerTool::configureD3PD
virtual StatusCode configureD3PD(IAddVariable *tree, const std::type_info &ti)
Configure during initialization: type-check.
Definition: ContainedMultiAssociationFillerTool.cxx:85
python.tests.PyTestsLib.finalize
def finalize(self)
_info( "content of StoreGate..." ) self.sg.dump()
Definition: PyTestsLib.py:53
python.PerfMonSerializer.p
def p
Definition: PerfMonSerializer.py:743
D3PD::AddVariable
Common implementation of IAddVariable.
Definition: AddVariable.h:38
D3PD::ContainedMultiAssociationFillerTool::book
virtual StatusCode book()
Declare tuple variables.
Definition: ContainedMultiAssociationFillerTool.cxx:103
D3PD::AddVariable::configureD3PD
StatusCode configureD3PD(IAddVariable *tree)
Configure the parent tree.
Definition: AddVariable.cxx:61
D3PD::ContainedMultiAssociationFillerTool::m_blockName
std::string m_blockName
Property: the name of this block.
Definition: ContainedMultiAssociationFillerTool.h:144
initialize
void initialize()
Definition: run_EoverP.cxx:894
tree
TChain * tree
Definition: tile_monitor.h:30
D3PD::ContainedMultiAssociationFillerTool::m_associator
ToolHandle< IMultiAssociationTool > m_associator
Property: The association tool instance.
Definition: ContainedMultiAssociationFillerTool.h:135
D3PD::ContainedMultiAssociationFillerTool::m_blockFillers
ToolHandleArray< IBlockFillerTool > m_blockFillers
Property: The list of block filler tools.
Definition: ContainedMultiAssociationFillerTool.h:138
ContainedMultiAssociationFillerTool.h
Represent a multiple association by containment.
AthenaPoolTestRead.sc
sc
Definition: AthenaPoolTestRead.py:27
D3PD::ContainedMultiAssociationFillerTool::ContainedMultiAssociationFillerTool
ContainedMultiAssociationFillerTool(const std::string &type, const std::string &name, const IInterface *parent)
Standard Gaudi tool constructor.
Definition: ContainedMultiAssociationFillerTool.cxx:28
D3PD
Block filler tool for noisy FEB information.
Definition: InnerDetector/InDetMonitoring/InDetGlobalMonitoring/macros/EnhancedPrimaryVertexMonitoring/TrigD3PD/ChainGroup.h:21
D3PD::IBlockFillerTool::againok
static StatusCode againok(StatusCode sc)
StatusCode check helper: change AGAIN or EMPTY to SUCCESS.
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
D3PD::ContainedMultiAssociationFillerTool::fillUntyped
virtual StatusCode fillUntyped(const void *p, bool again=false)
Fill one block.
Definition: ContainedMultiAssociationFillerTool.cxx:143
test_pyathena.parent
parent
Definition: test_pyathena.py:15
CHECK
#define CHECK(...)
Evaluate an expression and check for errors.
Definition: Control/AthenaKernel/AthenaKernel/errorcheck.h:422
D3PD::ContainedMultiAssociationFillerTool::initialize
virtual StatusCode initialize()
Standard Gaudi initialize method.
Definition: ContainedMultiAssociationFillerTool.cxx:52
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:195
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
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
D3PD::ContainedMultiAssociationFillerTool::finalize
virtual StatusCode finalize()
Standard Gaudi finalize method.
Definition: ContainedMultiAssociationFillerTool.cxx:65
declareProperty
#define declareProperty(n, p, h)
Definition: BaseFakeBkgTool.cxx:15
D3PD::ContainedMultiAssociationFillerTool::m_next
const void * m_next
Next object to process.
Definition: ContainedMultiAssociationFillerTool.h:147