ATLAS Offline Software
Loading...
Searching...
No Matches
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.
virtual StatusCode initialize () override
 Standard Gaudi initialize method.
virtual StatusCode configureD3PD (IAddVariable *tree, const std::type_info &ti) override
 Configure during initialization: type-check.
virtual StatusCode book () override
 Declare tuple variables.
virtual const std::type_info & typeinfo () const override
 Return the type of object retrieved by this tool.
virtual const void * getUntyped (const void *p) override
 Return the target object.
virtual void releaseObjectUntyped (const void *p) override
 Release an object retrieved from the association.

Private Attributes

ToolHandle< IMultiAssociationToolm_associator
 The wrapped multiple association tool.

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}
ToolHandle< IMultiAssociationTool > m_associator
The wrapped multiple association tool.

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}
#define CHECK(...)
Evaluate an expression and check for errors.

◆ 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}
TChain * tree

◆ 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}
static Double_t sc
::StatusCode StatusCode
StatusCode definition for legacy code.

◆ initialize()

StatusCode D3PD::FirstAssociationTool::initialize ( )
overridevirtual

Standard Gaudi initialize method.

Definition at line 42 of file FirstAssociationTool.cxx.

43{
44 CHECK( AthAlgTool::initialize() );
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: