ATLAS Offline Software
Loading...
Searching...
No Matches
D3PD::BlockFillerToolImpl Class Reference

Non-template parts of BlockFillerTool. More...

#include <BlockFillerToolImpl.h>

Inherits extends< AthAlgTool, IBlockFillerTool >, and D3PD::AddVariable.

Inherited by D3PD::BlockFillerTool< Types< CaloCluster, xAOD::CaloCluster > >, D3PD::BlockFillerTool< LArRawChannel >, D3PD::BlockFillerTool< TileRawChannelCollection >, D3PD::BlockFillerTool< TileRawChannel >, D3PD::BlockFillerTool< D3PD::Types< Obj1, Obj2 > >, D3PD::BlockFillerTool< Types< xAOD::Electron, xAOD::Photon > >, D3PD::BlockFillerTool< Types< INavigable4Momentum, I4Momentum, CLHEP::HepLorentzVector, xAOD::IParticle > >, D3PD::BlockFillerTool< xAOD::Muon >, D3PD::BlockFillerTool< Types< TrackRecord, xAOD::TruthParticle > >, D3PD::BlockFillerTool< Types< Trk::VxCandidate, xAOD::Vertex > >, D3PD::BlockFillerTool< xAOD::TruthParticle >, D3PD::BlockFillerTool< SG::AuxElement >, D3PD::BlockFillerTool< CaloCalibrationHit >, D3PD::BlockFillerTool< CaloCell >, D3PD::BlockFillerTool< CaloCellContainer >, D3PD::BlockFillerTool< Types< AmgSymMatrix(5), AmgSymMatrix(3), Amg::MatrixX > >, D3PD::BlockFillerTool< xAOD::EventInfo >, D3PD::BlockFillerTool< AmgSymMatrix(5)>, D3PD::BlockFillerTool< LArCollisionTime >, D3PD::BlockFillerTool< LArDigit >, D3PD::BlockFillerTool< LArHit >, D3PD::BlockFillerTool< LArNoisyROSummary >, D3PD::BlockFillerTool< LArHitContainer >, D3PD::BlockFillerTool< TileCell >, D3PD::BlockFillerTool< MDTSimHit >, D3PD::BlockFillerTool< Trk::Perigee >, D3PD::BlockFillerTool< Trk::TrackParameters >, D3PD::BlockFillerTool< SkimDecisionCollection >, D3PD::BlockFillerTool< xAOD::CaloCluster >, D3PD::BlockFillerTool< TileCosmicMuon >, D3PD::BlockFillerTool< TileDigits >, D3PD::BlockFillerTool< TileHit >, D3PD::BlockFillerTool< TileHitVector >, D3PD::BlockFillerTool< TileL2 >, D3PD::BlockFillerTool< TileMu >, D3PD::BlockFillerTool< TileTTL1 >, D3PD::BlockFillerTool< xAOD::TrackParticle >, D3PD::BlockFillerTool< TileTrigger >, D3PD::BlockFillerTool< CaloTower >, D3PD::BlockFillerTool< TrackRecord >, D3PD::BlockFillerTool< xAOD::Photon >, D3PD::BlockFillerTool< xAOD::Egamma >, D3PD::BlockFillerTool< Obj1 >, D3PD::BlockFillerTool< Obj2 >, D3PD::BlockFillerTool< Obj4 >, D3PD::BlockFillerTool< Obj5 >, D3PD::BlockFillerTool< Types< T0 > >, D3PD::BlockFillerTool< void >, D3PD::BlockFillerTool< T >, D3PD::BlockFillerTool< Types< T0 > >, D3PD::BlockFillerTool< void >, D3PD::ContainerFlagFillerTool, and D3PD::IndexFillerTool.

Collaboration diagram for D3PD::BlockFillerToolImpl:

Public Member Functions

 BlockFillerToolImpl (const std::string &type, const std::string &name, const IInterface *parent)
 Standard Gaudi tool constructor.
StatusCode configureD3PD (IAddVariable *tree)
 Configure the parent tree.
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.
template<class T>
StatusCode addVariable (const std::string &name, T *&ptr, const std::string &docstring="")
 Make the template implementation from IAddVariable visible.
template<class T, class U>
StatusCode addVariable (const std::string &name, T *&ptr, const std::string &docstring, const U &defval)
 Make the template implementation from IAddVariable visible.
virtual StatusCode addDimensionedVariable (const std::string &name, const std::type_info &ti, void *&ptr, const std::string &dim, const std::string &docstring="", const void *defval=0)
 Add a variable to the tuple.
template<class T>
StatusCode addDimensionedVariable (const std::string &name, T *&ptr, const std::string &dim, const std::string &docstring="")
 Add a variable to the tuple.
template<class T, class U>
StatusCode addDimensionedVariable (const std::string &name, T *&ptr, const std::string &dim, const std::string &docstring, const U &defval)
 Add a variable to the tuple.

Protected Member Functions

StatusCode configureImpl (IAddVariable *tree, const std::type_info &ti, const std::type_info &fill_ti)
 Configure during initialization: type-check.
StatusCode configureImpl (IAddVariable *tree, const std::type_info &ti, const std::vector< const std::type_info * > &tis, size_t &which)
 Configure during initialization: type-check.
StatusCode convert (void const *&p) const
 Do type conversion.

Protected Attributes

ObjectMetadata m_metadata
 Metadata about the variables created by this object.

Private Attributes

std::string m_prefix
 Property: the variable prefix for this block.
std::string m_suffix
 Property: the variable prefix for this block.
std::string m_blockName
 Property: the name of this block.
TypeConverter m_converter
 Helper to do type conversions.
IAddVariablem_tree
 Reference to the block name.

Static Private Attributes

static const std::string s_emptyString
 Used to provide a default value for blockName.

Detailed Description

Non-template parts of BlockFillerTool.

The class BlockFillerTool provides a type-safe wrapper for the IBlockFillerTool interface; it is templated on the type of object on which it operates. This class serves as a common base class for the BlockFillerTool instantiations, and factors out all the code that doesn't depend on the template argument.

We also derive from AddVariable, so we provide the IAddVariable interface.

Definition at line 42 of file BlockFillerToolImpl.h.

Constructor & Destructor Documentation

◆ BlockFillerToolImpl()

D3PD::BlockFillerToolImpl::BlockFillerToolImpl ( 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 27 of file BlockFillerToolImpl.cxx.

30 : base_class (type, name, parent),
32{
33 declareProperty ("Prefix", m_prefix = "",
34 "Tuple variable prefix for this block.");
35 declareProperty ("Suffix", m_suffix = "",
36 "Tuple variable suffix for this block.");
37 declareProperty ("BlockName", m_blockName = this->name(),
38 "The name of this block.");
39}
AddVariable(const std::string &prefix, const std::string &blockName=s_emptyString)
Constructor.
std::string m_prefix
Property: the variable prefix for this block.
std::string m_suffix
Property: the variable prefix for this block.
std::string m_blockName
Property: the name of this block.

Member Function Documentation

◆ addDimensionedVariable() [1/3]

StatusCode D3PD::AddVariable::addDimensionedVariable ( const std::string & name,
const std::type_info & ti,
void *& ptr,
const std::string & dim,
const std::string & docstring = "",
const void * defval = 0 )
virtualinherited

Add a variable to the tuple.

Parameters
nameThe name of the variable.
typeThe type of the variable.
ptrPointer to the type of the variable. The pointer need not be initialized; the D3PD software will set the pointer prior to calling fill().
dimDimension for the variable. (Presently unimplemented!)
docstringDocumentation string for this variable.
defvalPointer to the default value to use for this variable. Null for no default (generally means to fill with zeros). Of the type given by ti. Only works for basic types.

If called from the constructor, the only effect is to clear ptr.

Implements D3PD::IAddVariable.

Definition at line 123 of file AddVariable.cxx.

129{
130 if (!m_tree) {
131 // Called from constructor --- just initialize pointer.
132 ptr = 0;
133 return StatusCode::SUCCESS;
134 }
135
136 CHECK( m_metadata.addDimensionedVariable( m_prefix + name + m_suffix,
137 ti, ptr, dim,
138 docstring, defval ) );
139 return m_tree->addDimensionedVariable (m_prefix + name + m_suffix,
140 ti, ptr, dim,
141 docstring, defval);
142}
#define CHECK(...)
Evaluate an expression and check for errors.
ObjectMetadata m_metadata
Metadata about the variables created by this object.
const std::string & m_prefix
Reference to the variable prefix.
const std::string & m_suffix
Reference to the variable suffix.
IAddVariable * m_tree
Reference to the block name.
void * ptr(T *p)
Definition SGImplSvc.cxx:74

◆ addDimensionedVariable() [2/3]

template<class T, class U>
StatusCode D3PD::IAddVariable::addDimensionedVariable ( const std::string & name,
T *& ptr,
const std::string & dim,
const std::string & docstring,
const U & defval )
inherited

Add a variable to the tuple.

Parameters
nameThe name of the variable.
ptrPointer to the type of the variable. The pointer need not be initialized; the D3PD software will set the pointer prior to calling fill().
dimDimension for the variable. (Presently unimplemented!)
docstringDocumentation string for this variable.
defvalPointer to the default value to use for this variable. Only works for basic types.

If called from the constructor, the only effect is to clear ptr.

◆ addDimensionedVariable() [3/3]

template<class T>
StatusCode D3PD::IAddVariable::addDimensionedVariable ( const std::string & name,
T *& ptr,
const std::string & dim,
const std::string & docstring = "" )
inherited

Add a variable to the tuple.

Parameters
nameThe name of the variable.
ptrPointer to the type of the variable. The pointer need not be initialized; the D3PD software will set the pointer prior to calling fill().
dimDimension for the variable. (Presently unimplemented!)
docstringDocumentation string for this variable.

If called from the constructor, the only effect is to clear ptr.

◆ addVariable() [1/3]

StatusCode D3PD::AddVariable::addVariable ( const std::string & name,
const std::type_info & ti,
void *& ptr,
const std::string & docstring = "",
const void * defval = 0 )
virtualinherited

Add a variable to the tuple.

Parameters
nameThe name of the variable.
typeThe type of the variable.
ptrPointer to the type of the variable. The pointer need not be initialized; the D3PD software will set the pointer prior to calling fill().
docstringDocumentation string for this variable.
defvalPointer to the default value to use for this variable. Null for no default (generally means to fill with zeros). Of the type given by ti. Only works for basic types.

If called from the constructor, the only effect is to clear ptr.

Implements D3PD::IAddVariable.

Definition at line 85 of file AddVariable.cxx.

90{
91 if (!m_tree) {
92 // Called from constructor --- just initialize pointer.
93 ptr = 0;
94 return StatusCode::SUCCESS;
95 }
96
97 CHECK( m_metadata.addVariable( m_prefix + name + m_suffix,
98 ti, ptr, docstring, defval ) );
99 return m_tree->addVariable (m_prefix + name + m_suffix,
100 ti, ptr, docstring, defval);
101}

◆ addVariable() [2/3]

template<class T, class U>
StatusCode D3PD::IAddVariable::addVariable ( const std::string & name,
T *& ptr,
const std::string & docstring,
const U & defval )
inherited

Make the template implementation from IAddVariable visible.

◆ addVariable() [3/3]

template<class T>
StatusCode D3PD::IAddVariable::addVariable ( const std::string & name,
T *& ptr,
const std::string & docstring = "" )
inherited

Make the template implementation from IAddVariable visible.

◆ configureD3PD()

StatusCode D3PD::AddVariable::configureD3PD ( IAddVariable * tree)
inherited

Configure the parent tree.

Parameters
treeThe parent IAddVariable instance.

Definition at line 61 of file AddVariable.cxx.

62{
63 m_tree = tree;
64 m_metadata.clear();
65 return StatusCode::SUCCESS;
66}
TChain * tree

◆ configureImpl() [1/2]

StatusCode D3PD::BlockFillerToolImpl::configureImpl ( IAddVariable * tree,
const std::type_info & ti,
const std::type_info & fill_ti )
protected

Configure during initialization: type-check.

Parameters
treeOur parent for tuple making.
tiGives the type of the object being passed to fillUntyped.
fill_tiis the type of object that the user code will expect.

This is the common implementation for the configureD3PD method of IBlockFillerTool. It checks that the type of the object coming as input is compatible with what the user code is expecting, and raises an error otherwise.

Definition at line 55 of file BlockFillerToolImpl.cxx.

58{
60 CHECK( m_converter.init (ti, fill_ti) );
61
62 return StatusCode::SUCCESS;
63}
StatusCode configureD3PD(IAddVariable *tree)
Configure the parent tree.
TypeConverter m_converter
Helper to do type conversions.

◆ configureImpl() [2/2]

StatusCode D3PD::BlockFillerToolImpl::configureImpl ( IAddVariable * tree,
const std::type_info & ti,
const std::vector< const std::type_info * > & tis,
size_t & which )
protected

Configure during initialization: type-check.

Parameters
treeOur parent for tuple making.
tiGives the type of the object being passed to fillUntyped.
tisList of possible input types that we can accept.
[out]whichIndex of the accepted type.

This is the common implementation for the configureD3PD method of IBlockFillerTool. It checks that the type of the object coming as input is compatible with what the user code is expecting, and raises an error otherwise.

This version allows for one of a set of types to match. If successful, WHICH is set to the index (0-based) of the matching type.

Definition at line 83 of file BlockFillerToolImpl.cxx.

87{
89 CHECK( m_converter.init (ti, tis, which) );
90 return StatusCode::SUCCESS;
91}

◆ convert()

StatusCode D3PD::BlockFillerToolImpl::convert ( void const *& p) const
protected

Do type conversion.

Parameters
p[in,out]Pointer to convert.

On entry, p is a pointer to an object of the type that was passed into configureImpl as ti. Convert the pointer to point to an object of the type that was given as fill_ti. If the conversion fails, the pointer is set to 0 (and FAILURE is returned).

Definition at line 105 of file BlockFillerToolImpl.cxx.

106{
107 p = m_converter.convertUntyped (p);
108 if (!p) {
109 REPORT_MESSAGE (MSG::ERROR)
110 << "Pointer conversion from " << m_converter.srcName() << " to "
111 << m_converter.dstName() << "failed.";
112 return StatusCode::FAILURE;
113 }
114 return StatusCode::SUCCESS;
115}
#define REPORT_MESSAGE(LVL)
Report a message.

Member Data Documentation

◆ m_blockName

std::string D3PD::BlockFillerToolImpl::m_blockName
private

Property: the name of this block.

Definition at line 118 of file BlockFillerToolImpl.h.

◆ m_converter

TypeConverter D3PD::BlockFillerToolImpl::m_converter
private

Helper to do type conversions.

Definition at line 121 of file BlockFillerToolImpl.h.

◆ m_metadata

ObjectMetadata D3PD::AddVariable::m_metadata
protectedinherited

Metadata about the variables created by this object.

Definition at line 129 of file AddVariable.h.

◆ m_prefix

std::string D3PD::BlockFillerToolImpl::m_prefix
private

Property: the variable prefix for this block.

Definition at line 112 of file BlockFillerToolImpl.h.

◆ m_suffix

std::string D3PD::BlockFillerToolImpl::m_suffix
private

Property: the variable prefix for this block.

Definition at line 115 of file BlockFillerToolImpl.h.

◆ m_tree

IAddVariable* D3PD::AddVariable::m_tree
privateinherited

Reference to the block name.

The parent IAddVariable instance.

Definition at line 143 of file AddVariable.h.

◆ s_emptyString

const std::string D3PD::AddVariable::s_emptyString
staticprivateinherited

Used to provide a default value for blockName.

Definition at line 41 of file AddVariable.h.


The documentation for this class was generated from the following files: