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

Algorithm to create a D3PD tree. More...

#include <MakerAlg.h>

Inheritance diagram for D3PD::MakerAlg:
Collaboration diagram for D3PD::MakerAlg:

Public Member Functions

 MakerAlg (const std::string &name, ISvcLocator *svcloc)
 Standard Gaudi algorithm constructor.
virtual StatusCode initialize ()
 Standard Gaudi initialize method.
virtual StatusCode finalize ()
 Standard Gaudi finalize method.
virtual StatusCode execute ()
 Standard Gaudi execute method.
virtual StatusCode sysInitialize () override
 Override sysInitialize.
virtual const DataObjIDColl & extraOutputDeps () const override
 Return the list of extra output dependencies.
ServiceHandle< StoreGateSvc > & evtStore ()
 The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.
const ServiceHandle< StoreGateSvc > & detStore () const
 The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.
virtual StatusCode sysStart () override
 Handle START transition.
virtual std::vector< Gaudi::DataHandle * > inputHandles () const override
 Return this algorithm's input handles.
virtual std::vector< Gaudi::DataHandle * > outputHandles () const override
 Return this algorithm's output handles.
Gaudi::Details::PropertyBase & declareProperty (Gaudi::Property< T, V, H > &t)
void updateVHKA (Gaudi::Details::PropertyBase &)
MsgStream & msg () const
bool msgLvl (const MSG::Level lvl) const
implement IAlgorithm
bool isEventAccepted () const
 Test whether this event should be output.

Protected Member Functions

void renounceArray (SG::VarHandleKeyArray &handlesArray)
 remove all handles from I/O resolution
std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > renounce (T &h)
void extraDeps_update_handler (Gaudi::Details::PropertyBase &ExtraDeps)
 Add StoreName to extra input/output deps as needed.

Protected Attributes

StringArrayProperty m_acceptNames
 Vector of names of Algorithms that this stream accepts.
StringArrayProperty m_requireNames
 Vector of names of Algorithms that this stream requires.
StringArrayProperty m_vetoNames
 Vector of names of Algorithms that this stream is vetoed by.
ServiceHandle< IDecisionSvcm_decSvc

Private Types

typedef ServiceHandle< StoreGateSvcStoreGateSvc_t

Private Member Functions

StatusCode fillToolWithAuditor (IObjFillerTool &tool)
 Call fill() on a tool with an auditor.
StatusCode fillToolWithoutAuditor (IObjFillerTool &tool)
 Cakk fill on a tool without an auditor.
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
 specialization for handling Gaudi::Property<SG::VarHandleKey>

Private Attributes

ServiceHandle< ID3PDSvcm_d3pdSvc
 Property: The D3PD creation service.
ToolHandleArray< IObjFillerToolm_tools
 Property: List of object filler tools to run.
ToolHandleArray< IMetadataToolm_metadataTools
 Property: List of metadata tools to run.
bool m_audit
 Property: Audit the tools with PerfMon or not?
std::string m_tuplePath
 Property: The tuple name.
ID3PDm_d3pd
 The created tuple. Note: we don't take ownership.
bool m_booked
 Flag that we've called book().
StatusCode(D3PD::MakerAlg::* m_fillFunction )(IObjFillerTool &)
 Pointer to the fill function to be used.
DataObjIDColl m_extendedExtraObjects
StoreGateSvc_t m_evtStore
 Pointer to StoreGate (event store by default)
StoreGateSvc_t m_detStore
 Pointer to StoreGate (detector store by default)
std::vector< SG::VarHandleKeyArray * > m_vhka
bool m_varHandleArraysDeclared

Detailed Description

Algorithm to create a D3PD tree.

This algorithm creates one D3PD tree. It's given a list of IObjFillerTool instances to then run on each event. Most of the actual work is done by the separate D3PDSvc.

Properties: D3PDSvc - The D3PD creation service. Tools - List of IObjFillerTool instances to run. TuplePath - The name of the tuple. The interpretation of this depends on the D3PDSvc.

Definition at line 44 of file MakerAlg.h.

Member Typedef Documentation

◆ StoreGateSvc_t

typedef ServiceHandle<StoreGateSvc> AthCommonDataStore< AthCommonMsg< Algorithm > >::StoreGateSvc_t
privateinherited

Definition at line 388 of file AthCommonDataStore.h.

Constructor & Destructor Documentation

◆ MakerAlg()

D3PD::MakerAlg::MakerAlg ( const std::string & name,
ISvcLocator * svcloc )

Standard Gaudi algorithm constructor.

Parameters
nameThe algorithm name.
svclocThe service locator.

Definition at line 26 of file MakerAlg.cxx.

28 : FilteredAlgorithm (name, svcloc),
29 m_d3pdSvc ("D3PD::RootD3PDSvc", name),
30 m_tools (this),
31 m_metadataTools (this),
32 m_audit (false),
33 m_d3pd (0),
34 m_booked (false),
36{
37 declareProperty ("D3PDSvc", m_d3pdSvc,
38 "The D3PD creation service.");
39 declareProperty ("Tools", m_tools,
40 "List of IObjFillerTool instances to run.");
41 declareProperty ("MetadataTools", m_metadataTools,
42 "List of IMetadataTool instances to run.");
43 declareProperty ("TuplePath", m_tuplePath,
44 "The name of the tuple. The interpretation of this "
45 "depends on the D3PDSvc.");
46 declareProperty ("Audit", m_audit,
47 "Audit the tools using PerfMon?");
48}
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
ID3PD * m_d3pd
The created tuple. Note: we don't take ownership.
Definition MakerAlg.h:93
StatusCode(D3PD::MakerAlg::* m_fillFunction)(IObjFillerTool &)
Pointer to the fill function to be used.
Definition MakerAlg.h:99
ServiceHandle< ID3PDSvc > m_d3pdSvc
Property: The D3PD creation service.
Definition MakerAlg.h:78
bool m_audit
Property: Audit the tools with PerfMon or not?
Definition MakerAlg.h:87
bool m_booked
Flag that we've called book().
Definition MakerAlg.h:96
ToolHandleArray< IObjFillerTool > m_tools
Property: List of object filler tools to run.
Definition MakerAlg.h:81
std::string m_tuplePath
Property: The tuple name.
Definition MakerAlg.h:90
ToolHandleArray< IMetadataTool > m_metadataTools
Property: List of metadata tools to run.
Definition MakerAlg.h:84

Member Function Documentation

◆ declareGaudiProperty()

Gaudi::Details::PropertyBase & AthCommonDataStore< AthCommonMsg< Algorithm > >::declareGaudiProperty ( Gaudi::Property< T, V, H > & hndl,
const SG::VarHandleKeyType &  )
inlineprivateinherited

specialization for handling Gaudi::Property<SG::VarHandleKey>

Definition at line 156 of file AthCommonDataStore.h.

158 {
160 hndl.value(),
161 hndl.documentation());
162
163 }

◆ declareProperty()

Gaudi::Details::PropertyBase & AthCommonDataStore< AthCommonMsg< Algorithm > >::declareProperty ( Gaudi::Property< T, V, H > & t)
inlineinherited

Definition at line 145 of file AthCommonDataStore.h.

145 {
146 typedef typename SG::HandleClassifier<T>::type htype;
148 }
Gaudi::Details::PropertyBase & declareGaudiProperty(Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
specialization for handling Gaudi::Property<SG::VarHandleKey>

◆ detStore()

const ServiceHandle< StoreGateSvc > & AthCommonDataStore< AthCommonMsg< Algorithm > >::detStore ( ) const
inlineinherited

The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 95 of file AthCommonDataStore.h.

◆ evtStore()

ServiceHandle< StoreGateSvc > & AthCommonDataStore< AthCommonMsg< Algorithm > >::evtStore ( )
inlineinherited

The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 85 of file AthCommonDataStore.h.

◆ execute()

StatusCode D3PD::MakerAlg::execute ( )
virtual

Standard Gaudi execute method.

Reimplemented from FilteredAlgorithm.

Definition at line 108 of file MakerAlg.cxx.

109{
110 if (!m_booked) {
111 m_booked = true;
112 // This check also only has to be done once. So no reason to do it
113 // in a more complicated way.
114 if (m_audit) {
115 for (size_t i = 0; i < m_tools.size(); i++) {
116 Gaudi::Guards::AuditorGuard auditor( m_tools[ i ]->name() +
117 ":book", auditorSvc(), "evt" );
118 CHECK( m_tools[i]->book() );
119 }
120 } else {
121 for (size_t i = 0; i < m_tools.size(); i++) {
122 CHECK( m_tools[i]->book() );
123 }
124 }
125 }
126
127 // Only write out "accepted" events:
128 if( ! isEventAccepted() ) return StatusCode::SUCCESS;
129
130 CHECK( m_d3pd->clear() );
131
132 // Call fill() on the tools with the pre-configured function. Notice that
133 // no if statements are put into the code here...
134 for (size_t i = 0; i < m_tools.size(); i++) {
135 CHECK( ( this->*m_fillFunction )( *m_tools[i] ) );
136 }
137
138 CHECK( m_d3pd->capture() );
139
140 return StatusCode::SUCCESS;
141}
#define CHECK(...)
Evaluate an expression and check for errors.
bool isEventAccepted() const
Test whether this event should be output.

◆ extraDeps_update_handler()

void AthCommonDataStore< AthCommonMsg< Algorithm > >::extraDeps_update_handler ( Gaudi::Details::PropertyBase & ExtraDeps)
protectedinherited

Add StoreName to extra input/output deps as needed.

use the logic of the VarHandleKey to parse the DataObjID keys supplied via the ExtraInputs and ExtraOuputs Properties to add the StoreName if it's not explicitly given

◆ extraOutputDeps()

const DataObjIDColl & AthAlgorithm::extraOutputDeps ( ) const
overridevirtualinherited

Return the list of extra output dependencies.

This list is extended to include symlinks implied by inheritance relations.

Definition at line 50 of file AthAlgorithm.cxx.

51{
52 // If we didn't find any symlinks to add, just return the collection
53 // from the base class. Otherwise, return the extended collection.
54 if (!m_extendedExtraObjects.empty()) {
56 }
57 return Algorithm::extraOutputDeps();
58}
DataObjIDColl m_extendedExtraObjects

◆ fillToolWithAuditor()

StatusCode D3PD::MakerAlg::fillToolWithAuditor ( IObjFillerTool & tool)
private

Call fill() on a tool with an auditor.

This function is used to call fill() on the object filler tools when PerfMon auditing is turned on.

Parameters
toolThe tool to call the fill() function on
Returns
The result of calling the fill() function

Definition at line 151 of file MakerAlg.cxx.

152{
153 Gaudi::Guards::AuditorGuard auditor( tool.name() +
154 ":fill", auditorSvc(), "evt" );
155 return tool.fill();
156}

◆ fillToolWithoutAuditor()

StatusCode D3PD::MakerAlg::fillToolWithoutAuditor ( IObjFillerTool & tool)
private

Cakk fill on a tool without an auditor.

This function is used to call fill() on the object filler tools when PerfMon auditing is turned off.

Parameters
toolThe tool to call the fill() function on
Returns
The result of calling the fill() function

Definition at line 166 of file MakerAlg.cxx.

167{
168 return tool.fill();
169}

◆ finalize()

StatusCode D3PD::MakerAlg::finalize ( )
virtual

Standard Gaudi finalize method.

Reimplemented from FilteredAlgorithm.

Definition at line 94 of file MakerAlg.cxx.

95{
96 // Run metadata tools.
97 for (size_t i = 0; i < m_metadataTools.size(); i++)
98 CHECK( m_metadataTools[i]->writeMetadata (m_d3pd) );
99
101 return StatusCode::SUCCESS;
102}
virtual StatusCode finalize()

◆ initialize()

StatusCode D3PD::MakerAlg::initialize ( )
virtual

Standard Gaudi initialize method.

Reimplemented from FilteredAlgorithm.

Definition at line 54 of file MakerAlg.cxx.

55{
57 CHECK( m_d3pdSvc.retrieve() );
58 CHECK( m_tools.retrieve() );
59 CHECK( m_metadataTools.retrieve() );
60
61 // Create the tuple.
63
64 // Configure each tool. Since the check on m_audit only has to be
65 // done once in the job, it's enough to implement it like this.
66 if (m_audit) {
67 for (size_t i = 0; i < m_tools.size(); i++) {
68 Gaudi::Guards::AuditorGuard auditor( m_tools[ i ]->name() +
69 ":cfg", auditorSvc(), "ini" );
70 CHECK( m_tools[i]->configureD3PD (m_d3pd) );
71 }
72 } else {
73 for (size_t i = 0; i < m_tools.size(); i++) {
74 CHECK( m_tools[i]->configureD3PD (m_d3pd) );
75 }
76 }
77
78 // Decide which fill function is to be used later on. This way the
79 // if statement is only executed once, and not in every execute()
80 // function.
81 if (m_audit) {
83 } else {
85 }
86
87 return StatusCode::SUCCESS;
88}
StatusCode fillToolWithoutAuditor(IObjFillerTool &tool)
Cakk fill on a tool without an auditor.
Definition MakerAlg.cxx:166
StatusCode fillToolWithAuditor(IObjFillerTool &tool)
Call fill() on a tool with an auditor.
Definition MakerAlg.cxx:151
virtual StatusCode initialize()

◆ inputHandles()

virtual std::vector< Gaudi::DataHandle * > AthCommonDataStore< AthCommonMsg< Algorithm > >::inputHandles ( ) const
overridevirtualinherited

Return this algorithm's input handles.

We override this to include handle instances from key arrays if they have not yet been declared. See comments on updateVHKA.

◆ isEventAccepted()

bool FilteredAlgorithm::isEventAccepted ( ) const
inherited

Test whether this event should be output.

Definition at line 113 of file FilteredAlgorithm.cxx.

114{
115 bool result = true;
116 const EventContext& ctx = this->getContext();
117 if (ctx.valid()) {
118 result = m_decSvc->isEventAccepted(this->name(),ctx);
119 //ATH_MSG_DEBUG("res=" << result << " n=" << this->name() << " sl=" << ctx.slot() << " evt=" << ctx.eventID().event_number());
120 } else {
121 ATH_MSG_DEBUG("Not a threaded app");
122 result = m_decSvc->isEventAccepted(this->name());
123 }
124
125 return result;
126}
#define ATH_MSG_DEBUG(x)
ServiceHandle< IDecisionSvc > m_decSvc

◆ msg()

MsgStream & AthCommonMsg< Algorithm >::msg ( ) const
inlineinherited

Definition at line 24 of file AthCommonMsg.h.

24 {
25 return this->msgStream();
26 }

◆ msgLvl()

bool AthCommonMsg< Algorithm >::msgLvl ( const MSG::Level lvl) const
inlineinherited

Definition at line 30 of file AthCommonMsg.h.

30 {
31 return this->msgLevel(lvl);
32 }

◆ outputHandles()

virtual std::vector< Gaudi::DataHandle * > AthCommonDataStore< AthCommonMsg< Algorithm > >::outputHandles ( ) const
overridevirtualinherited

Return this algorithm's output handles.

We override this to include handle instances from key arrays if they have not yet been declared. See comments on updateVHKA.

◆ renounce()

std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > AthCommonDataStore< AthCommonMsg< Algorithm > >::renounce ( T & h)
inlineprotectedinherited

Definition at line 380 of file AthCommonDataStore.h.

381 {
382 h.renounce();
384 }
std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > renounce(T &h)

◆ renounceArray()

void AthCommonDataStore< AthCommonMsg< Algorithm > >::renounceArray ( SG::VarHandleKeyArray & handlesArray)
inlineprotectedinherited

remove all handles from I/O resolution

Definition at line 364 of file AthCommonDataStore.h.

364 {
366 }

◆ sysInitialize()

StatusCode AthAlgorithm::sysInitialize ( )
overridevirtualinherited

Override sysInitialize.

Override sysInitialize from the base class.

Loop through all output handles, and if they're WriteCondHandles, automatically register them and this Algorithm with the CondSvc

Scan through all outputHandles, and if they're WriteCondHandles, register them with the CondSvc

Reimplemented from AthCommonDataStore< AthCommonMsg< Algorithm > >.

Reimplemented in AthAnalysisAlgorithm, AthFilterAlgorithm, AthHistogramAlgorithm, and PyAthena::Alg.

Definition at line 66 of file AthAlgorithm.cxx.

66 {
68
69 if (sc.isFailure()) {
70 return sc;
71 }
72 ServiceHandle<ICondSvc> cs("CondSvc",name());
73 for (auto h : outputHandles()) {
74 if (h->isCondition() && h->mode() == Gaudi::DataHandle::Writer) {
75 // do this inside the loop so we don't create the CondSvc until needed
76 if ( cs.retrieve().isFailure() ) {
77 ATH_MSG_WARNING("no CondSvc found: won't autoreg WriteCondHandles");
78 return StatusCode::SUCCESS;
79 }
80 if (cs->regHandle(this,*h).isFailure()) {
81 sc = StatusCode::FAILURE;
82 ATH_MSG_ERROR("unable to register WriteCondHandle " << h->fullKey()
83 << " with CondSvc");
84 }
85 }
86 }
87 return sc;
88}
#define ATH_MSG_ERROR(x)
#define ATH_MSG_WARNING(x)
static Double_t sc
virtual StatusCode sysInitialize() override
Override sysInitialize.
AthCommonDataStore(const std::string &name, T... args)
virtual std::vector< Gaudi::DataHandle * > outputHandles() const override
::StatusCode StatusCode
StatusCode definition for legacy code.

◆ sysStart()

virtual StatusCode AthCommonDataStore< AthCommonMsg< Algorithm > >::sysStart ( )
overridevirtualinherited

Handle START transition.

We override this in order to make sure that conditions handle keys can cache a pointer to the conditions container.

◆ updateVHKA()

void AthCommonDataStore< AthCommonMsg< Algorithm > >::updateVHKA ( Gaudi::Details::PropertyBase & )
inlineinherited

Definition at line 308 of file AthCommonDataStore.h.

308 {
309 // debug() << "updateVHKA for property " << p.name() << " " << p.toString()
310 // << " size: " << m_vhka.size() << endmsg;
311 for (auto &a : m_vhka) {
313 for (auto k : keys) {
314 k->setOwner(this);
315 }
316 }
317 }
std::vector< SG::VarHandleKeyArray * > m_vhka

Member Data Documentation

◆ m_acceptNames

StringArrayProperty FilteredAlgorithm::m_acceptNames
protectedinherited
Initial value:
{this, "AcceptAlgs", {},
"Filters which if any are passed enable output"}

Vector of names of Algorithms that this stream accepts.

Definition at line 33 of file FilteredAlgorithm.h.

33 {this, "AcceptAlgs", {},
34 "Filters which if any are passed enable output"};

◆ m_audit

bool D3PD::MakerAlg::m_audit
private

Property: Audit the tools with PerfMon or not?

Definition at line 87 of file MakerAlg.h.

◆ m_booked

bool D3PD::MakerAlg::m_booked
private

Flag that we've called book().

Definition at line 96 of file MakerAlg.h.

◆ m_d3pd

ID3PD* D3PD::MakerAlg::m_d3pd
private

The created tuple. Note: we don't take ownership.

Definition at line 93 of file MakerAlg.h.

◆ m_d3pdSvc

ServiceHandle<ID3PDSvc> D3PD::MakerAlg::m_d3pdSvc
private

Property: The D3PD creation service.

Definition at line 78 of file MakerAlg.h.

◆ m_decSvc

ServiceHandle<IDecisionSvc> FilteredAlgorithm::m_decSvc
protectedinherited
Initial value:
{this, "decSvc", "DecisionSvc/DecisionSvc",
"Handle to DecisionSvc"}

Definition at line 42 of file FilteredAlgorithm.h.

42 {this, "decSvc", "DecisionSvc/DecisionSvc",
43 "Handle to DecisionSvc"};

◆ m_detStore

StoreGateSvc_t AthCommonDataStore< AthCommonMsg< Algorithm > >::m_detStore
privateinherited

Pointer to StoreGate (detector store by default)

Definition at line 393 of file AthCommonDataStore.h.

◆ m_evtStore

StoreGateSvc_t AthCommonDataStore< AthCommonMsg< Algorithm > >::m_evtStore
privateinherited

Pointer to StoreGate (event store by default)

Definition at line 390 of file AthCommonDataStore.h.

◆ m_extendedExtraObjects

DataObjIDColl AthAlgorithm::m_extendedExtraObjects
privateinherited

Definition at line 79 of file AthAlgorithm.h.

◆ m_fillFunction

StatusCode(D3PD::MakerAlg::* D3PD::MakerAlg::m_fillFunction) (IObjFillerTool &)
private

Pointer to the fill function to be used.

Definition at line 99 of file MakerAlg.h.

◆ m_metadataTools

ToolHandleArray<IMetadataTool> D3PD::MakerAlg::m_metadataTools
private

Property: List of metadata tools to run.

Definition at line 84 of file MakerAlg.h.

◆ m_requireNames

StringArrayProperty FilteredAlgorithm::m_requireNames
protectedinherited
Initial value:
{this, "RequireAlgs", {},
"Filters which must all be passed to enable output"}

Vector of names of Algorithms that this stream requires.

Definition at line 36 of file FilteredAlgorithm.h.

36 {this, "RequireAlgs", {},
37 "Filters which must all be passed to enable output"};

◆ m_tools

ToolHandleArray<IObjFillerTool> D3PD::MakerAlg::m_tools
private

Property: List of object filler tools to run.

Definition at line 81 of file MakerAlg.h.

◆ m_tuplePath

std::string D3PD::MakerAlg::m_tuplePath
private

Property: The tuple name.

Definition at line 90 of file MakerAlg.h.

◆ m_varHandleArraysDeclared

bool AthCommonDataStore< AthCommonMsg< Algorithm > >::m_varHandleArraysDeclared
privateinherited

Definition at line 399 of file AthCommonDataStore.h.

◆ m_vetoNames

StringArrayProperty FilteredAlgorithm::m_vetoNames
protectedinherited
Initial value:
{this, "VetoAlgs", {},
"Filters which if any are passed disable output"}

Vector of names of Algorithms that this stream is vetoed by.

Definition at line 39 of file FilteredAlgorithm.h.

39 {this, "VetoAlgs", {},
40 "Filters which if any are passed disable output"};

◆ m_vhka

std::vector<SG::VarHandleKeyArray*> AthCommonDataStore< AthCommonMsg< Algorithm > >::m_vhka
privateinherited

Definition at line 398 of file AthCommonDataStore.h.


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