ATLAS Offline Software
Public Member Functions | Private Attributes | List of all members
D3PD::FirstAssociationTool Class Reference

Choose the first result from a multiple association. More...

#include <FirstAssociationTool.h>

Inheritance diagram for D3PD::FirstAssociationTool:
Collaboration diagram for D3PD::FirstAssociationTool:

Public Member Functions

 FirstAssociationTool (const std::string &type, const std::string &name, const IInterface *parent)
 Standard Gaudi tool constructor. More...
 
virtual StatusCode initialize () override
 Standard Gaudi initialize method. More...
 
virtual StatusCode configureD3PD (IAddVariable *tree, const std::type_info &ti) override
 Configure during initialization: type-check. More...
 
virtual StatusCode book () override
 Declare tuple variables. More...
 
virtual const std::type_info & typeinfo () const override
 Return the type of object retrieved by this tool. More...
 
virtual const void * getUntyped (const void *p) override
 Return the target object. More...
 
virtual void releaseObjectUntyped (const void *p) override
 Release an object retrieved from the association. More...
 

Private Attributes

ToolHandle< IMultiAssociationToolm_associator
 The wrapped multiple association tool. More...
 

Detailed Description

Choose the first result from a multiple association.

This wrapper will turn a multiple association tool into a single association tool by only using the first result from the association.

Definition at line 37 of file FirstAssociationTool.h.

Constructor & Destructor Documentation

◆ FirstAssociationTool()

D3PD::FirstAssociationTool::FirstAssociationTool ( const std::string &  type,
const std::string &  name,
const IInterface *  parent 
)

Standard Gaudi tool constructor.

Parameters
typeThe name of the tool type.
nameThe tool name.
parentThe tool's Gaudi parent.

Definition at line 28 of file FirstAssociationTool.cxx.

31  : base_class (type, name, parent),
32  m_associator (this)
33 {
34  declareProperty ("Associator", m_associator,
35  "The IMultiAssociationTool instance to wrap.");
36 }

Member Function Documentation

◆ book()

StatusCode D3PD::FirstAssociationTool::book ( )
overridevirtual

Declare tuple variables.

This is called at the start of the first event.

Definition at line 71 of file FirstAssociationTool.cxx.

72 {
73  CHECK( m_associator->book() );
74  return StatusCode::SUCCESS;
75 }

◆ configureD3PD()

StatusCode D3PD::FirstAssociationTool::configureD3PD ( IAddVariable tree,
const std::type_info &  ti 
)
overridevirtual

Configure during initialization: type-check.

Parameters
treeOur parent for tuple making.
tiGives the type of the object being passed to resetUntyped.

configureD3PD should check that the type of the object coming as input is compatible with what it expects, and raise an error otherwise.

Definition at line 58 of file FirstAssociationTool.cxx.

60 {
61  CHECK( m_associator->configureD3PD (tree, ti) );
62  return StatusCode::SUCCESS;
63 }

◆ getUntyped()

const void * D3PD::FirstAssociationTool::getUntyped ( const void *  p)
overridevirtual

Return the target object.

Parameters
pThe source object for the association.

Return the target of the association, or 0. Should be of the type given by typeinfo.

Definition at line 95 of file FirstAssociationTool.cxx.

96 {
97  StatusCode sc = m_associator->resetUntyped (p);
98  if (sc.isFailure())
99  return 0;
100  return m_associator->nextUntyped();
101 }

◆ initialize()

StatusCode D3PD::FirstAssociationTool::initialize ( )
overridevirtual

Standard Gaudi initialize method.

Definition at line 42 of file FirstAssociationTool.cxx.

43 {
45  CHECK( m_associator.retrieve() );
46  return StatusCode::SUCCESS;
47 }

◆ releaseObjectUntyped()

void D3PD::FirstAssociationTool::releaseObjectUntyped ( const void *  p)
overridevirtual

Release an object retrieved from the association.

Parameters
pThe object to release.

Call this when you are done with the object returned by getUntyped(). The default implementation is a no-op, but if the association dynamically allocated the object which it returned, this gives it a chance to free it.

Definition at line 113 of file FirstAssociationTool.cxx.

114 {
115  m_associator->releaseElementUntyped (p);
116 }

◆ typeinfo()

const std::type_info & D3PD::FirstAssociationTool::typeinfo ( ) const
overridevirtual

Return the type of object retrieved by this tool.

Definition at line 81 of file FirstAssociationTool.cxx.

82 {
83  return m_associator->elementTypeinfo();
84 
85 }

Member Data Documentation

◆ m_associator

ToolHandle<IMultiAssociationTool> D3PD::FirstAssociationTool::m_associator
private

The wrapped multiple association tool.

Definition at line 108 of file FirstAssociationTool.h.


The documentation for this class was generated from the following files:
D3PD::FirstAssociationTool::m_associator
ToolHandle< IMultiAssociationTool > m_associator
The wrapped multiple association tool.
Definition: FirstAssociationTool.h:108
initialize
void initialize()
Definition: run_EoverP.cxx:894
tree
TChain * tree
Definition: tile_monitor.h:30
AthenaPoolTestRead.sc
sc
Definition: AthenaPoolTestRead.py:27
python.utils.AtlRunQueryDQUtils.p
p
Definition: AtlRunQueryDQUtils.py:210
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
CHECK
#define CHECK(...)
Evaluate an expression and check for errors.
Definition: Control/AthenaKernel/AthenaKernel/errorcheck.h:422
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:221
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78