ATLAS Offline Software
Loading...
Searching...
No Matches
DerivationFramework::CfAthAlgTool Class Reference

#include <CfAthAlgTool.h>

Inheritance diagram for DerivationFramework::CfAthAlgTool:
Collaboration diagram for DerivationFramework::CfAthAlgTool:

Public Member Functions

 CfAthAlgTool (const std::string &t, const std::string &n, const IInterface *p)
virtual ~CfAthAlgTool ()
virtual StatusCode sysInitialize () override
 Perform system initialization for an algorithm.
virtual bool addEvent (const std::string &name, double weight=1.) const
virtual bool addToCounter (const std::string &name, uint64_t counts=1, double weight=1.) const
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

Protected Member Functions

CutIdentifier getCounter (const std::string &name) const
std::string getCounterNameById (CutIdentifier id) const
CutIdentifier getCounterIdByName (const std::string &name) const
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.

Private Types

typedef std::map< std::string, CutIdentifierNameIdMap_t
typedef ServiceHandle< StoreGateSvcStoreGateSvc_t

Private Member Functions

Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
 specialization for handling Gaudi::Property<SG::VarHandleKey>

Private Attributes

ServiceHandle< ICutFlowSvcm_cutFlowSvc
std::string m_ctbasename
NameIdMap_t m_mctn
CutIdentifier m_bid
bool m_bidisset
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

Definition at line 35 of file CfAthAlgTool.h.

Member Typedef Documentation

◆ NameIdMap_t

typedef std::map<std::string, CutIdentifier> DerivationFramework::CfAthAlgTool::NameIdMap_t
private

Definition at line 72 of file CfAthAlgTool.h.

◆ StoreGateSvc_t

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

Definition at line 388 of file AthCommonDataStore.h.

Constructor & Destructor Documentation

◆ CfAthAlgTool()

DerivationFramework::CfAthAlgTool::CfAthAlgTool ( const std::string & t,
const std::string & n,
const IInterface * p )

Definition at line 67 of file CfAthAlgTool.cxx.

69 :
70 AthAlgTool(t,n,p),
71 m_cutFlowSvc("CutFlowSvc/CutFlowSvc", n),
72 m_ctbasename(n),
73 m_bid(0), m_bidisset(false) {
74
75 ATH_MSG_DEBUG("Calling constructor with parameters");
76
77 // Declare counters base name
78 declareProperty("CountersBaseName", m_ctbasename);
79
80 // clean-up counter base name
81 std::string fstr("ToolSvc.");
82 std::string::size_type ind = m_ctbasename.find(fstr);
83 if (ind != std::string::npos) m_ctbasename.erase(ind, fstr.length());
84
85 }
#define ATH_MSG_DEBUG(x)
AthAlgTool()
Default constructor:
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
ServiceHandle< ICutFlowSvc > m_cutFlowSvc

◆ ~CfAthAlgTool()

DerivationFramework::CfAthAlgTool::~CfAthAlgTool ( )
virtual

Definition at line 88 of file CfAthAlgTool.cxx.

88 {
89
90 ATH_MSG_DEBUG("Calling destructor");
91 }

Member Function Documentation

◆ addEvent()

bool DerivationFramework::CfAthAlgTool::addEvent ( const std::string & name,
double weight = 1. ) const
virtual

Definition at line 104 of file CfAthAlgTool.cxx.

104 {
105
106 CutIdentifier id = getCounter(name);
107 if ( id > 0 ) {
108 m_cutFlowSvc->addEvent(id, weight);
109 }
110 return (id > 0);
111 }
uint32_t CutIdentifier
InstanceIdentifier is a unique identifer used for every AthFilterAlgorithm instance.
Definition ICutFlowSvc.h:26
CutIdentifier getCounter(const std::string &name) const

◆ addToCounter()

bool DerivationFramework::CfAthAlgTool::addToCounter ( const std::string & name,
uint64_t counts = 1,
double weight = 1. ) const
virtual

Definition at line 115 of file CfAthAlgTool.cxx.

116 {
117
118 CutIdentifier id = getCounter(name);
119 if ( id > 0 ) {
120 for (uint64_t i=0; i<counts; ++i) {
121 m_cutFlowSvc->addEvent(id, weight);
122 }
123 }
124 return (id > 0);
125 }

◆ declareGaudiProperty()

Gaudi::Details::PropertyBase & AthCommonDataStore< AthCommonMsg< AlgTool > >::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< AlgTool > >::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< AlgTool > >::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< AlgTool > >::evtStore ( )
inlineinherited

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

Definition at line 85 of file AthCommonDataStore.h.

◆ extraDeps_update_handler()

void AthCommonDataStore< AthCommonMsg< AlgTool > >::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

◆ getCounter()

CutIdentifier DerivationFramework::CfAthAlgTool::getCounter ( const std::string & name) const
protected

Definition at line 128 of file CfAthAlgTool.cxx.

128 {
129
131 if ( id < 1 ) {
132 std::string fullname = m_ctbasename + "_" + name;
133 if ( ! m_bidisset ) {
134 throw std::runtime_error("cutFlowSvc()->registerFilter is no longer supported. code an alternative here");
135 //id = cutFlowSvc()->registerFilter(fullname, "N/A");
136 m_bid = id;
137 } else {
138 throw std::runtime_error("cutFlowSvc()->registerCut is no longer supported. code an alternative here");
139 //id = cutFlowSvc()->registerCut(fullname, "N/A", m_bid);
140 }
141 m_mctn[name] = id;
142 }
143 return id;
144 }
CutIdentifier getCounterIdByName(const std::string &name) const

◆ getCounterIdByName()

CutIdentifier DerivationFramework::CfAthAlgTool::getCounterIdByName ( const std::string & name) const
protected

Definition at line 161 of file CfAthAlgTool.cxx.

161 {
162
163 CutIdentifier id = 0;
164
165 NameIdMap_t::const_iterator it = m_mctn.find(name);
166 if ( it != m_mctn.end() ) {
167 id = it->second;
168 }
169 return id;
170 }

◆ getCounterNameById()

std::string DerivationFramework::CfAthAlgTool::getCounterNameById ( CutIdentifier id) const
protected

Definition at line 147 of file CfAthAlgTool.cxx.

147 {
148
149 std::string res = "__NOT_FOUND__";
150
151 for (NameIdMap_t::iterator it = m_mctn.begin(); it != m_mctn.end(); ++it) {
152 if ( it->second == id ) {
153 res = it->first;
154 break;
155 }
156 }
157 return res;
158 }
std::pair< std::vector< unsigned int >, bool > res

◆ inputHandles()

virtual std::vector< Gaudi::DataHandle * > AthCommonDataStore< AthCommonMsg< AlgTool > >::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.

◆ msg()

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

Definition at line 24 of file AthCommonMsg.h.

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

◆ msgLvl()

bool AthCommonMsg< AlgTool >::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< AlgTool > >::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< AlgTool > >::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< AlgTool > >::renounceArray ( SG::VarHandleKeyArray & handlesArray)
inlineprotectedinherited

remove all handles from I/O resolution

Definition at line 364 of file AthCommonDataStore.h.

364 {
366 }

◆ sysInitialize()

StatusCode DerivationFramework::CfAthAlgTool::sysInitialize ( )
overridevirtual

Perform system initialization for an algorithm.

We override this to declare all the elements of handle key arrays at the end of initialization. See comments on updateVHKA.

Reimplemented from AthCommonDataStore< AthCommonMsg< AlgTool > >.

Definition at line 94 of file CfAthAlgTool.cxx.

94 {
95
96 // retrieve CutFlowSvc instance
97 CHECK( m_cutFlowSvc.retrieve() );
98
99 // re-direct to base class...
101 }
#define CHECK(...)
Evaluate an expression and check for errors.
virtual StatusCode sysInitialize() override

◆ sysStart()

virtual StatusCode AthCommonDataStore< AthCommonMsg< AlgTool > >::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< AlgTool > >::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_bid

CutIdentifier DerivationFramework::CfAthAlgTool::m_bid
mutableprivate

Definition at line 76 of file CfAthAlgTool.h.

◆ m_bidisset

bool DerivationFramework::CfAthAlgTool::m_bidisset
mutableprivate

Definition at line 77 of file CfAthAlgTool.h.

◆ m_ctbasename

std::string DerivationFramework::CfAthAlgTool::m_ctbasename
private

Definition at line 69 of file CfAthAlgTool.h.

◆ m_cutFlowSvc

ServiceHandle<ICutFlowSvc> DerivationFramework::CfAthAlgTool::m_cutFlowSvc
private

Definition at line 66 of file CfAthAlgTool.h.

◆ m_detStore

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

Pointer to StoreGate (detector store by default)

Definition at line 393 of file AthCommonDataStore.h.

◆ m_evtStore

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

Pointer to StoreGate (event store by default)

Definition at line 390 of file AthCommonDataStore.h.

◆ m_mctn

NameIdMap_t DerivationFramework::CfAthAlgTool::m_mctn
mutableprivate

Definition at line 73 of file CfAthAlgTool.h.

◆ m_varHandleArraysDeclared

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

Definition at line 399 of file AthCommonDataStore.h.

◆ m_vhka

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

Definition at line 398 of file AthCommonDataStore.h.


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