The Gaudi Framework  v33r1 (b1225454)
AlgTool Class Reference

Base class from which all the concrete tool classes should be derived. More...

#include <GaudiKernel/AlgTool.h>

Inheritance diagram for AlgTool:
Collaboration diagram for AlgTool:

Public Types

using Factory = Gaudi::PluginService::Factory< IAlgTool *(const std::string &, const std::string &, const IInterface *)>
 
- Public Types inherited from extends< PropertyHolder< CommonMessaging< implements< IAlgTool, IDataHandleHolder, IProperty, IStateful > > >, IDataHandleHolder >
using base_class = extends
 Typedef to this class. More...
 
using extend_interfaces_base = extend_interfaces< Interfaces... >
 Typedef to the base of this class. More...
 
- Public Types inherited from PropertyHolder< CommonMessaging< implements< IAlgTool, IDataHandleHolder, IProperty, IStateful > > >
using PropertyHolderImpl = PropertyHolder< CommonMessaging< implements< IAlgTool, IDataHandleHolder, IProperty, IStateful > > >
 Typedef used to refer to this class from derived classes, as in. More...
 
- Public Types inherited from CommonMessaging< implements< IAlgTool, IDataHandleHolder, IProperty, IStateful > >
using base_class = CommonMessaging
 
- Public Types inherited from extend_interfaces< Interfaces... >
using ext_iids = typename Gaudi::interface_list_cat< typename Interfaces::ext_iids... >::type
 take union of the ext_iids of all Interfaces... More...
 

Public Member Functions

StatusCode queryInterface (const InterfaceID &riid, void **ppvUnknown) override
 Query for a given interface. More...
 
const std::stringname () const override
 Retrieve full identifying name of the concrete tool object. More...
 
const std::stringtype () const override
 Retrieve type (concrete class) of the sub-algtool. More...
 
const IInterfaceparent () const override
 Retrieve parent of the sub-algtool. More...
 
StatusCode configure () override
 
StatusCode initialize () override
 
StatusCode start () override
 
StatusCode stop () override
 
StatusCode finalize () override
 
StatusCode terminate () override
 
StatusCode reinitialize () override
 
StatusCode restart () override
 
Gaudi::StateMachine::State FSMState () const override
 
Gaudi::StateMachine::State targetFSMState () const override
 
StatusCode sysInitialize () override
 Initialize AlgTool. More...
 
StatusCode sysStart () override
 Start AlgTool. More...
 
StatusCode sysStop () override
 Stop AlgTool. More...
 
StatusCode sysFinalize () override
 Finalize AlgTool. More...
 
StatusCode sysReinitialize () override
 Initialize AlgTool. More...
 
StatusCode sysRestart () override
 Start AlgTool. More...
 
 AlgTool (std::string type, std::string name, const IInterface *parent)
 Standard Constructor. More...
 
SmartIF< ISvcLocator > & serviceLocator () const override
 Retrieve pointer to service locator. More...
 
ISvcLocatorsvcLoc () const
 shortcut for the method service locator More...
 
IDataProviderSvcevtSvc () const
 accessor to event service service More...
 
IToolSvctoolSvc () const
 The standard ToolSvc service, Return a pointer to the service if present. More...
 
StatusCode setProperties ()
 Method for setting declared properties to the values specified in the jobOptions via the job option service. More...
 
template<class T >
StatusCode service (std::string_view name, T *&svc, bool createIf=true) const
 Access a service by name, creating it if it doesn't already exist. More...
 
template<class T >
StatusCode service (std::string_view type, std::string_view name, T *&svc) const
 Access a service by name, type creating it if it doesn't already exist. More...
 
SmartIF< IServiceservice (std::string_view name, const bool createIf=true, const bool quiet=false) const
 Return a pointer to the service identified by name (or "type/name") More...
 
template<typename T >
SmartIF< T > service (std::string_view name, const bool createIf=true, const bool quiet=false) const
 
template<class T >
Gaudi::Details::PropertyBasedeclareProperty (const std::string &name, ToolHandle< T > &hndl, const std::string &doc="none")
 
template<class T >
StatusCode declareTool (ToolHandle< T > &handle, bool createIf=true)
 
template<class T >
StatusCode declareTool (ToolHandle< T > &handle, std::string toolTypeAndName, bool createIf=true)
 
template<class T >
Gaudi::Details::PropertyBasedeclareProperty (const std::string &name, ToolHandleArray< T > &hndlArr, const std::string &doc="none")
 
template<class T >
void addToolsArray (ToolHandleArray< T > &hndlArr)
 
void acceptDHVisitor (IDataHandleVisitor *) const override
 
void registerTool (IAlgTool *tool) const
 
void deregisterTool (IAlgTool *tool) const
 
const std::vector< IAlgTool * > & tools () const
 
IAuditorSvcauditorSvc () const
 Access the auditor service. More...
 
IMonitorSvcmonitorSvc () const
 Access the monitor service. More...
 
template<class T >
void declareInfo (const std::string &name, const T &var, const std::string &desc) const
 Declare monitoring information. More...
 
void declareInfo (const std::string &name, const std::string &format, const void *var, int size, const std::string &desc) const
 Declare monitoring information (special case) More...
 
 ~AlgTool () override
 
- Public Member Functions inherited from DataHandleHolderBase< PropertyHolder< CommonMessaging< implements< IAlgTool, IDataHandleHolder, IProperty, IStateful > > > >
std::vector< Gaudi::DataHandle * > inputHandles () const override
 
std::vector< Gaudi::DataHandle * > outputHandles () const override
 
virtual const DataObjIDCollextraInputDeps () const override
 
virtual const DataObjIDCollextraOutputDeps () const override
 
void declare (Gaudi::DataHandle &handle) override
 
void renounce (Gaudi::DataHandle &handle) override
 
const DataObjIDCollinputDataObjs () const override
 
const DataObjIDColloutputDataObjs () const override
 
void addDependency (const DataObjID &id, const Gaudi::DataHandle::Mode &mode) override
 
- Public Member Functions inherited from extends< PropertyHolder< CommonMessaging< implements< IAlgTool, IDataHandleHolder, IProperty, IStateful > > >, IDataHandleHolder >
void * i_cast (const InterfaceID &tid) const override
 Implementation of IInterface::i_cast. More...
 
StatusCode queryInterface (const InterfaceID &ti, void **pp) override
 Implementation of IInterface::queryInterface. More...
 
std::vector< std::stringgetInterfaceNames () const override
 Implementation of IInterface::getInterfaceNames. More...
 
- Public Member Functions inherited from PropertyHolder< CommonMessaging< implements< IAlgTool, IDataHandleHolder, IProperty, IStateful > > >
 PropertyHolder ()=default
 
Gaudi::Details::PropertyBasedeclareProperty (Gaudi::Details::PropertyBase &prop)
 Declare a property. More...
 
Gaudi::Details::PropertyBasedeclareProperty (const std::string &name, TYPE &value, const std::string &doc="none")
 Helper to wrap a regular data member and use it as a regular property. More...
 
Gaudi::Details::PropertyBasedeclareProperty (const std::string &name, Gaudi::Property< TYPE, VERIFIER, HANDLERS > &prop, const std::string &doc="none")
 Declare a PropertyBase instance setting name and documentation. More...
 
Gaudi::Details::PropertyBasedeclareRemoteProperty (const std::string &name, IProperty *rsvc, const std::string &rname="")
 Declare a remote property. More...
 
StatusCode setProperty (const Gaudi::Details::PropertyBase &p) override
 set the property form another property More...
 
StatusCode setProperty (const std::string &s) override
 set the property from the formatted string More...
 
StatusCode setProperty (const std::string &n, const std::string &v) override
 set the property from name and the value More...
 
StatusCode setProperty (const std::string &name, const TYPE &value)
 set the property form the value More...
 
StatusCode getProperty (Gaudi::Details::PropertyBase *p) const override
 get the property More...
 
const Gaudi::Details::PropertyBasegetProperty (const std::string &name) const override
 get the property by name More...
 
StatusCode getProperty (const std::string &n, std::string &v) const override
 convert the property to the string More...
 
const std::vector< Gaudi::Details::PropertyBase * > & getProperties () const override
 get all properties More...
 
bool hasProperty (const std::string &name) const override
 Return true if we have a property with the given name. More...
 
 PropertyHolder (const PropertyHolder &)=delete
 
PropertyHolderoperator= (const PropertyHolder &)=delete
 
- Public Member Functions inherited from CommonMessaging< implements< IAlgTool, IDataHandleHolder, IProperty, IStateful > >
MSG::Level msgLevel () const
 get the cached level (originally extracted from the embedded MsgStream) More...
 
bool msgLevel (MSG::Level lvl) const
 get the output level from the embedded MsgStream More...
 
- Public Member Functions inherited from CommonMessagingBase
virtual ~CommonMessagingBase ()=default
 Virtual destructor. More...
 
const SmartIF< IMessageSvc > & msgSvc () const
 The standard message service. More...
 
MsgStreammsgStream () const
 Return an uninitialized MsgStream. More...
 
MsgStreammsgStream (const MSG::Level level) const
 Predefined configurable message stream for the efficient printouts. More...
 
MsgStreamalways () const
 shortcut for the method msgStream(MSG::ALWAYS) More...
 
MsgStreamfatal () const
 shortcut for the method msgStream(MSG::FATAL) More...
 
MsgStreamerr () const
 shortcut for the method msgStream(MSG::ERROR) More...
 
MsgStreamerror () const
 shortcut for the method msgStream(MSG::ERROR) More...
 
MsgStreamwarning () const
 shortcut for the method msgStream(MSG::WARNING) More...
 
MsgStreaminfo () const
 shortcut for the method msgStream(MSG::INFO) More...
 
MsgStreamdebug () const
 shortcut for the method msgStream(MSG::DEBUG) More...
 
MsgStreamverbose () const
 shortcut for the method msgStream(MSG::VERBOSE) More...
 
MsgStreammsg () const
 shortcut for the method msgStream(MSG::INFO) More...
 

Protected Member Functions

template<typename I >
void declareInterface (I *i)
 
std::vector< IAlgTool * > & tools ()
 
- Protected Member Functions inherited from DataHandleHolderBase< PropertyHolder< CommonMessaging< implements< IAlgTool, IDataHandleHolder, IProperty, IStateful > > > >
void initDataHandleHolder ()
 initializes all handles - called by the sysInitialize method of any descendant of this More...
 
- Protected Member Functions inherited from PropertyHolder< CommonMessaging< implements< IAlgTool, IDataHandleHolder, IProperty, IStateful > > >
Gaudi::Details::PropertyBaseproperty (const std::string &name) const
 
- Protected Member Functions inherited from CommonMessaging< implements< IAlgTool, IDataHandleHolder, IProperty, IStateful > >
MSG::Level setUpMessaging () const
 Set up local caches. More...
 
MSG::Level resetMessaging ()
 Reinitialize internal states. More...
 
void updateMsgStreamOutputLevel (int level)
 Update the output level of the cached MsgStream. More...
 

Protected Attributes

std::unique_ptr< IDataHandleVisitorm_updateDataHandles
 Hook for for derived classes to provide a custom visitor for data handles. More...
 
- Protected Attributes inherited from DataHandleHolderBase< PropertyHolder< CommonMessaging< implements< IAlgTool, IDataHandleHolder, IProperty, IStateful > > > >
DataObjIDColl m_inputDataObjs
 
DataObjIDColl m_outputDataObjs
 

Private Types

typedef std::list< std::pair< InterfaceID, void * > > InterfaceList
 

Private Member Functions

void initToolHandles () const
 
StatusCode service_i (std::string_view algName, bool createIf, const InterfaceID &iid, void **ppSvc) const
 flag indicating whether ToolHandle tools have been added to m_tools More...
 
StatusCode service_i (std::string_view svcType, std::string_view svcName, const InterfaceID &iid, void **ppS) const
 

Private Attributes

std::string m_type
 AlgTool type (concrete class name) More...
 
const std::string m_name
 AlgTool full name. More...
 
const IInterfacem_parent = nullptr
 AlgTool parent. More...
 
SmartIF< ISvcLocatorm_svcLocator
 Pointer to Service Locator service. More...
 
SmartIF< IDataProviderSvcm_evtSvc
 Event data service. More...
 
SmartIF< IToolSvcm_ptoolSvc
 Tool service. More...
 
SmartIF< IMonitorSvcm_pMonitorSvc
 Online Monitoring Service. More...
 
SmartIF< IAuditorSvcm_pAuditorSvc
 Auditor Service. More...
 
InterfaceList m_interfaceList
 Interface list. More...
 
Gaudi::Property< int > m_outputLevel
 
Gaudi::Property< std::stringm_monitorSvcName
 
Gaudi::Property< bool > m_auditInit {this, "AuditTools", false, " unused"}
 
Gaudi::Property< bool > m_auditorInitialize {this, "AuditInitialize", false, "trigger auditor on initialize()"}
 
Gaudi::Property< bool > m_auditorStart {this, "AuditStart", false, "trigger auditor on start()"}
 
Gaudi::Property< bool > m_auditorStop {this, "AuditStop", false, "trigger auditor on stop()"}
 
Gaudi::Property< bool > m_auditorFinalize {this, "AuditFinalize", false, "trigger auditor on finalize()"}
 
Gaudi::Property< bool > m_auditorReinitialize {this, "AuditReinitialize", false, "trigger auditor on reinitialize()"}
 
Gaudi::Property< bool > m_auditorRestart {this, "AuditRestart", false, "trigger auditor on restart()"}
 
std::vector< IAlgTool * > m_tools
 
std::vector< BaseToolHandle * > m_toolHandles
 
std::vector< GaudiHandleArrayBase * > m_toolHandleArrays
 
bool m_toolHandlesInit = false
 
Gaudi::StateMachine::State m_state = Gaudi::StateMachine::CONFIGURED
 state of the Tool More...
 
Gaudi::StateMachine::State m_targetState = Gaudi::StateMachine::CONFIGURED
 state of the Tool More...
 

Detailed Description

Base class from which all the concrete tool classes should be derived.

Specific methods for doing something useful should be implemented in the concrete tools. Sub-types of this class could implement an additional interface for behavior common to sets of concrete tools (for example vertexers).

Author
Gloria Corti
Pere Mato

Definition at line 57 of file AlgTool.h.

Member Typedef Documentation

◆ Factory

using AlgTool::Factory = Gaudi::PluginService::Factory<IAlgTool*( const std::string&, const std::string&, const IInterface* )>

Definition at line 61 of file AlgTool.h.

◆ InterfaceList

Definition at line 286 of file AlgTool.h.

Constructor & Destructor Documentation

◆ AlgTool()

AlgTool::AlgTool ( std::string  type,
std::string  name,
const IInterface parent 
)

Standard Constructor.

Parameters
typethe concrete class of the sub-algtool
namethe full name of the concrete sub-algtool
parentthe parent of the concrete sub-algtool

Definition at line 128 of file AlgTool.cpp.

130  : m_type( std::move( type ) ), m_name( std::move( name ) ), m_parent( parent ) {
131  addRef(); // Initial count set to 1
132 
133  IInterface* _p = const_cast<IInterface*>( parent );
134 
135  if ( Gaudi::Algorithm* _alg = dynamic_cast<Gaudi::Algorithm*>( _p ) ) {
136  m_svcLocator = _alg->serviceLocator();
137  } else if ( Service* _svc = dynamic_cast<Service*>( _p ) ) {
138  m_svcLocator = _svc->serviceLocator();
139  } else if ( AlgTool* _too = dynamic_cast<AlgTool*>( _p ) ) {
140  m_svcLocator = _too->serviceLocator();
141  } else if ( Auditor* _aud = dynamic_cast<Auditor*>( _p ) ) {
142  m_svcLocator = _aud->serviceLocator();
143  } else {
144  throw GaudiException( "Failure to create tool '" + m_type + "/" + m_name + "': illegal parent type '" +
145  System::typeinfoName( typeid( *_p ) ) + "'",
146  "AlgTool", StatusCode::FAILURE );
147  }
148 
149  // inherit output level from parent
150  // get the "OutputLevel" property from parent
151  if ( SmartIF<IProperty> pprop( _p ); pprop && pprop->hasProperty( "OutputLevel" ) ) {
152  m_outputLevel.assign( pprop->getProperty( "OutputLevel" ) );
153  }
154 
155  // Auditor monitoring properties
156  // Initialize the default value from ApplicationMgr AuditAlgorithms
157  Gaudi::Property<bool> audit( false );
158  // note that here we need that the service locator is already defined
159  if ( auto appMgr = serviceLocator()->service<IProperty>( "ApplicationMgr" );
160  appMgr && appMgr->hasProperty( "AuditTools" ) ) {
161  audit.assign( appMgr->getProperty( "AuditTools" ) );
162  }
163  m_auditInit = audit;
164  m_auditorInitialize = audit;
165  m_auditorStart = audit;
166  m_auditorStop = audit;
167  m_auditorFinalize = audit;
168  m_auditorReinitialize = audit;
169  m_auditorRestart = audit;
170 }
Define general base for Gaudi exception.
Gaudi::Property< bool > m_auditorStart
Definition: AlgTool.h:312
std::string m_type
AlgTool type (concrete class name)
Definition: AlgTool.h:288
Implementation of property with value of concrete type.
Definition: Property.h:370
GAUDI_API const std::string typeinfoName(const std::type_info &)
Get platform independent information about the class type.
Definition: System.cpp:308
const IInterface * m_parent
AlgTool parent.
Definition: AlgTool.h:290
Gaudi::Property< bool > m_auditorReinitialize
Definition: AlgTool.h:315
SmartIF< ISvcLocator > & serviceLocator() const override
Retrieve pointer to service locator.
Definition: AlgTool.cpp:89
const std::string m_name
AlgTool full name.
Definition: AlgTool.h:289
Gaudi::Property< int > m_outputLevel
Definition: AlgTool.h:302
Definition of the basic interface.
Definition: IInterface.h:254
virtual bool hasProperty(const std::string &name) const =0
Return true if we have a property with the given name.
Gaudi::Property< bool > m_auditorStop
Definition: AlgTool.h:313
T move(T... args)
Gaudi::Property< bool > m_auditorRestart
Definition: AlgTool.h:316
Gaudi::Property< bool > m_auditInit
Definition: AlgTool.h:310
Base class from which all the concrete tool classes should be derived.
Definition: AlgTool.h:57
Base class from which all concrete algorithm classes should be derived.
Definition: Algorithm.h:89
SmartIF< ISvcLocator > m_svcLocator
Pointer to Service Locator service.
Definition: AlgTool.h:292
appMgr
Definition: IOTest.py:103
constexpr static const auto FAILURE
Definition: StatusCode.h:101
const std::string & type() const override
Retrieve type (concrete class) of the sub-algtool.
Definition: AlgTool.cpp:75
Gaudi::Property< bool > m_auditorInitialize
Definition: AlgTool.h:311
Base class for all services.
Definition: Service.h:46
const std::string & name() const override
Retrieve full identifying name of the concrete tool object.
Definition: AlgTool.cpp:68
Gaudi::Property< bool > m_auditorFinalize
Definition: AlgTool.h:314
Base class from which all concrete auditor classes should be derived.
Definition: Auditor.h:44
const IInterface * parent() const override
Retrieve parent of the sub-algtool.
Definition: AlgTool.cpp:82

◆ ~AlgTool()

AlgTool::~AlgTool ( )
override

Definition at line 364 of file AlgTool.cpp.

366 {
367  if ( m_pMonitorSvc ) { m_pMonitorSvc->undeclareAll( this ); }
368 }
SmartIF< IMonitorSvc > m_pMonitorSvc
Online Monitoring Service.
Definition: AlgTool.h:295
virtual void undeclareAll(const IInterface *owner)=0
Undeclare monitoring information.

Member Function Documentation

◆ acceptDHVisitor()

void AlgTool::acceptDHVisitor ( IDataHandleVisitor vis) const
override

Definition at line 453 of file AlgTool.cpp.

453  {
454  //-----------------------------------------------------------------------------
455  vis->visit( this );
456 
457  for ( auto tool : tools() ) vis->visit( dynamic_cast<AlgTool*>( tool ) );
458 }
virtual void visit(const IDataHandleHolder *)=0
const std::vector< IAlgTool * > & tools() const
Definition: AlgTool.cpp:411

◆ addToolsArray()

template<class T >
void AlgTool::addToolsArray ( ToolHandleArray< T > &  hndlArr)
inline

Definition at line 203 of file AlgTool.h.

203  {
204  m_toolHandleArrays.push_back( &hndlArr );
205  }
T push_back(T... args)
std::vector< GaudiHandleArrayBase * > m_toolHandleArrays
Definition: AlgTool.h:321

◆ auditorSvc()

IAuditorSvc * AlgTool::auditorSvc ( ) const

Access the auditor service.

Definition at line 443 of file AlgTool.cpp.

443  {
444  //---------------------------------------------------------------------------
445  if ( !m_pAuditorSvc ) {
446  m_pAuditorSvc = service( "AuditorSvc", true );
447  if ( !m_pAuditorSvc ) { throw GaudiException( "Service [AuditorSvc] not found", name(), StatusCode::FAILURE ); }
448  }
449  return m_pAuditorSvc.get();
450 }
Define general base for Gaudi exception.
TYPE * get() const
Get interface pointer.
Definition: SmartIF.h:86
SmartIF< IAuditorSvc > m_pAuditorSvc
Auditor Service.
Definition: AlgTool.h:296
StatusCode service(std::string_view name, T *&svc, bool createIf=true) const
Access a service by name, creating it if it doesn't already exist.
Definition: AlgTool.h:138
constexpr static const auto FAILURE
Definition: StatusCode.h:101
const std::string & name() const override
Retrieve full identifying name of the concrete tool object.
Definition: AlgTool.cpp:68

◆ configure()

StatusCode AlgTool::configure ( )
inlineoverride

Definition at line 76 of file AlgTool.h.

76 { return StatusCode::SUCCESS; }
constexpr static const auto SUCCESS
Definition: StatusCode.h:100

◆ declareInfo() [1/2]

template<class T >
void AlgTool::declareInfo ( const std::string name,
const T &  var,
const std::string desc 
) const
inline

Declare monitoring information.

Parameters
nameMonitoring information name known to the external system
varMonitoring Listener address (the item to monitor...)
descTextual description of the information being monitored

Definition at line 264 of file AlgTool.h.

264  {
265  IMonitorSvc* mS = monitorSvc();
266  if ( mS ) mS->declareInfo( name, var, desc, this );
267  }
IMonitorSvc * monitorSvc() const
Access the monitor service.
Definition: AlgTool.h:252
Definition of the IMonitorSvc interface, which publishes Gaudi variables to outside monitoring proces...
Definition: IMonitorSvc.h:33
virtual void declareInfo(const std::string &name, const bool &var, const std::string &desc, const IInterface *owner)=0
Declare monitoring information.
const std::string & name() const override
Retrieve full identifying name of the concrete tool object.
Definition: AlgTool.cpp:68

◆ declareInfo() [2/2]

void AlgTool::declareInfo ( const std::string name,
const std::string format,
const void *  var,
int  size,
const std::string desc 
) const
inline

Declare monitoring information (special case)

Parameters
nameMonitoring information name known to the external system
formatFormat information
varMonitoring Listener address
sizeMonitoring Listener address size
descTextual description of the information being monitored

Definition at line 276 of file AlgTool.h.

277  {
278  IMonitorSvc* mS = monitorSvc();
279  if ( mS ) mS->declareInfo( name, format, var, size, desc, this );
280  }
constexpr auto size(const T &, Args &&...) noexcept
GAUDI_API std::string format(const char *,...)
MsgStream format utility "a la sprintf(...)".
Definition: MsgStream.cpp:119
IMonitorSvc * monitorSvc() const
Access the monitor service.
Definition: AlgTool.h:252
Definition of the IMonitorSvc interface, which publishes Gaudi variables to outside monitoring proces...
Definition: IMonitorSvc.h:33
virtual void declareInfo(const std::string &name, const bool &var, const std::string &desc, const IInterface *owner)=0
Declare monitoring information.
const std::string & name() const override
Retrieve full identifying name of the concrete tool object.
Definition: AlgTool.cpp:68

◆ declareInterface()

template<typename I >
void AlgTool::declareInterface ( I *  i)
inlineprotected

Definition at line 159 of file AlgTool.h.

159  {
160  m_interfaceList.emplace_back( I::interfaceID(), i );
161  }
InterfaceList m_interfaceList
Interface list.
Definition: AlgTool.h:298
T emplace_back(T... args)

◆ declareProperty() [1/2]

template<class T >
Gaudi::Details::PropertyBase* AlgTool::declareProperty ( const std::string name,
ToolHandle< T > &  hndl,
const std::string doc = "none" 
)
inline

Definition at line 167 of file AlgTool.h.

168  {
169  this->declareTool( hndl, hndl.typeAndName() ).ignore();
170  return PropertyHolderImpl::declareProperty( name, hndl, doc );
171  }
std::string typeAndName() const override
Definition: ToolHandle.h:270
StatusCode declareTool(ToolHandle< T > &handle, bool createIf=true)
Definition: AlgTool.h:174
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Details::PropertyBase &prop)
Declare a property.
const std::string & name() const override
Retrieve full identifying name of the concrete tool object.
Definition: AlgTool.cpp:68

◆ declareProperty() [2/2]

template<class T >
Gaudi::Details::PropertyBase* AlgTool::declareProperty ( const std::string name,
ToolHandleArray< T > &  hndlArr,
const std::string doc = "none" 
)
inline

Definition at line 196 of file AlgTool.h.

197  {
198  addToolsArray( hndlArr );
199  return PropertyHolderImpl::declareProperty( name, hndlArr, doc );
200  }
void addToolsArray(ToolHandleArray< T > &hndlArr)
Definition: AlgTool.h:203
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Details::PropertyBase &prop)
Declare a property.
const std::string & name() const override
Retrieve full identifying name of the concrete tool object.
Definition: AlgTool.cpp:68

◆ declareTool() [1/2]

template<class T >
StatusCode AlgTool::declareTool ( ToolHandle< T > &  handle,
bool  createIf = true 
)
inline

Definition at line 174 of file AlgTool.h.

174  {
175  return this->declareTool( handle, handle.typeAndName(), createIf );
176  }
std::string typeAndName() const override
Definition: ToolHandle.h:270
StatusCode declareTool(ToolHandle< T > &handle, bool createIf=true)
Definition: AlgTool.h:174

◆ declareTool() [2/2]

template<class T >
StatusCode AlgTool::declareTool ( ToolHandle< T > &  handle,
std::string  toolTypeAndName,
bool  createIf = true 
)
inline

Definition at line 179 of file AlgTool.h.

179  {
180 
181  StatusCode sc = handle.initialize( toolTypeAndName, handle.isPublic() ? nullptr : this, createIf );
182  if ( UNLIKELY( !sc ) ) {
183  throw GaudiException{std::string{"Cannot create handle for "} + ( handle.isPublic() ? "public" : "private" ) +
184  " tool " + toolTypeAndName,
185  name(), sc};
186  }
187 
188  m_toolHandles.push_back( &handle );
189 
190  return sc;
191  }
#define UNLIKELY(x)
Definition: Kernel.h:106
Define general base for Gaudi exception.
STL class.
T push_back(T... args)
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:61
bool isPublic() const noexcept
Definition: ToolHandle.h:50
StatusCode initialize(const std::string &toolTypeAndName, const IInterface *parent=nullptr, bool createIf=true)
Definition: ToolHandle.h:210
std::vector< BaseToolHandle * > m_toolHandles
Definition: AlgTool.h:320
const std::string & name() const override
Retrieve full identifying name of the concrete tool object.
Definition: AlgTool.cpp:68

◆ deregisterTool()

void AlgTool::deregisterTool ( IAlgTool tool) const
inline

Definition at line 216 of file AlgTool.h.

216  {
217  auto it = std::find( m_tools.begin(), m_tools.end(), tool );
218  if ( it != m_tools.end() ) {
219  if ( UNLIKELY( msgLevel( MSG::DEBUG ) ) ) debug() << "De-Registering tool " << tool->name() << endmsg;
220  m_tools.erase( it );
221  } else {
222  if ( UNLIKELY( msgLevel( MSG::DEBUG ) ) ) debug() << "Could not de-register tool " << tool->name() << endmsg;
223  }
224  }
#define UNLIKELY(x)
Definition: Kernel.h:106
T end(T... args)
std::vector< IAlgTool * > m_tools
Definition: AlgTool.h:319
MSG::Level msgLevel() const
get the cached level (originally extracted from the embedded MsgStream)
virtual const std::string & name() const =0
Retrieve the name of the instance.
T erase(T... args)
MsgStream & debug() const
shortcut for the method msgStream(MSG::DEBUG)
T find(T... args)
T begin(T... args)
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:202

◆ evtSvc()

IDataProviderSvc * AlgTool::evtSvc ( ) const

accessor to event service service

Returns
pointer to detector service

Definition at line 98 of file AlgTool.cpp.

98  {
99  if ( !m_evtSvc ) {
100  m_evtSvc = service( "EventDataSvc", true );
101  if ( !m_evtSvc ) { throw GaudiException( "Service [EventDataSvc] not found", name(), StatusCode::FAILURE ); }
102  }
103  return m_evtSvc.get();
104 }
Define general base for Gaudi exception.
TYPE * get() const
Get interface pointer.
Definition: SmartIF.h:86
StatusCode service(std::string_view name, T *&svc, bool createIf=true) const
Access a service by name, creating it if it doesn't already exist.
Definition: AlgTool.h:138
SmartIF< IDataProviderSvc > m_evtSvc
Event data service.
Definition: AlgTool.h:293
constexpr static const auto FAILURE
Definition: StatusCode.h:101
const std::string & name() const override
Retrieve full identifying name of the concrete tool object.
Definition: AlgTool.cpp:68

◆ finalize()

StatusCode AlgTool::finalize ( )
override

Definition at line 278 of file AlgTool.cpp.

280 {
281  // For the time being there is nothing to be done here.
282  return StatusCode::SUCCESS;
283 }
constexpr static const auto SUCCESS
Definition: StatusCode.h:100

◆ FSMState()

Gaudi::StateMachine::State AlgTool::FSMState ( ) const
inlineoverride

Definition at line 84 of file AlgTool.h.

84 { return m_state; }
Gaudi::StateMachine::State m_state
state of the Tool
Definition: AlgTool.h:328

◆ initialize()

StatusCode AlgTool::initialize ( )
override

Definition at line 211 of file AlgTool.cpp.

213 {
214  // For the time being there is nothing to be done here.
215  // Setting the properties is done by the ToolSvc calling setProperties()
216  // explicitly.
217  return StatusCode::SUCCESS;
218 }
constexpr static const auto SUCCESS
Definition: StatusCode.h:100

◆ initToolHandles()

void AlgTool::initToolHandles ( ) const
private

Definition at line 370 of file AlgTool.cpp.

370  {
371  auto init_one = [&]( BaseToolHandle* th ) {
372  if ( !th->isEnabled() ) {
373  if ( UNLIKELY( msgLevel( MSG::DEBUG ) ) && !th->typeAndName().empty() )
374  debug() << "ToolHandle " << th->typeAndName() << " not used" << endmsg;
375  return;
376  }
377  if ( !th->get() ) {
378  auto sc = th->retrieve();
379  if ( UNLIKELY( sc.isFailure() ) ) {
380  throw GaudiException( "Failed to retrieve tool " + th->typeAndName(), this->name(), StatusCode::FAILURE );
381  }
382  }
383  auto* tool = th->get();
384  if ( UNLIKELY( msgLevel( MSG::DEBUG ) ) )
385  debug() << "Adding " << ( th->isPublic() ? "public" : "private" ) << " ToolHandle tool " << tool->name() << " ("
386  << tool->type() << ")" << endmsg;
387  m_tools.push_back( tool );
388  };
389 
390  for ( auto thArr : m_toolHandleArrays ) {
391  if ( UNLIKELY( msgLevel( MSG::DEBUG ) ) )
392  debug() << "Registering all Tools in ToolHandleArray " << thArr->propertyName() << endmsg;
393  // Iterate over its tools:
394  for ( auto toolHandle : thArr->getBaseArray() ) {
395  // Try to cast it into a BaseToolHandle pointer:
396  BaseToolHandle* bth = dynamic_cast<BaseToolHandle*>( toolHandle );
397  if ( bth ) {
398  init_one( bth );
399  } else {
400  error() << "Error retrieving Tool " << toolHandle->typeAndName() << " in ToolHandleArray "
401  << thArr->propertyName() << ". Not registered" << endmsg;
402  }
403  }
404  }
405 
406  for ( BaseToolHandle* th : m_toolHandles ) init_one( th );
407 
408  m_toolHandlesInit = true;
409 }
#define UNLIKELY(x)
Definition: Kernel.h:106
Define general base for Gaudi exception.
bool m_toolHandlesInit
Definition: AlgTool.h:322
Non-templated base class for actual ToolHandle<T>.
Definition: ToolHandle.h:79
std::vector< IAlgTool * > m_tools
Definition: AlgTool.h:319
MSG::Level msgLevel() const
get the cached level (originally extracted from the embedded MsgStream)
T push_back(T... args)
MsgStream & error() const
shortcut for the method msgStream(MSG::ERROR)
MsgStream & debug() const
shortcut for the method msgStream(MSG::DEBUG)
std::vector< BaseToolHandle * > m_toolHandles
Definition: AlgTool.h:320
constexpr static const auto FAILURE
Definition: StatusCode.h:101
const std::string & name() const override
Retrieve full identifying name of the concrete tool object.
Definition: AlgTool.cpp:68
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:202
std::vector< GaudiHandleArrayBase * > m_toolHandleArrays
Definition: AlgTool.h:321

◆ monitorSvc()

IMonitorSvc* AlgTool::monitorSvc ( ) const
inline

Access the monitor service.

Attention
Note that this method will return a NULL pointer if no monitor service is configured to be present. You must take this possibility into account when using the pointer
Returns
Pointer to the Monitor service
Return values
NULLNo monitor service is present
non-NULLA monitor service is present and available to be used

Definition at line 252 of file AlgTool.h.

252  {
253  // If not already located try to locate it without forcing a creation
254  if ( !m_pMonitorSvc ) m_pMonitorSvc = service( m_monitorSvcName, false, true );
255  return m_pMonitorSvc.get();
256  }
SmartIF< IMonitorSvc > m_pMonitorSvc
Online Monitoring Service.
Definition: AlgTool.h:295
TYPE * get() const
Get interface pointer.
Definition: SmartIF.h:86
Gaudi::Property< std::string > m_monitorSvcName
Definition: AlgTool.h:307
StatusCode service(std::string_view name, T *&svc, bool createIf=true) const
Access a service by name, creating it if it doesn't already exist.
Definition: AlgTool.h:138

◆ name()

const std::string & AlgTool::name ( ) const
override

Retrieve full identifying name of the concrete tool object.

Definition at line 68 of file AlgTool.cpp.

70 {
71  return m_name;
72 }
const std::string m_name
AlgTool full name.
Definition: AlgTool.h:289

◆ parent()

const IInterface * AlgTool::parent ( ) const
override

Retrieve parent of the sub-algtool.

Definition at line 82 of file AlgTool.cpp.

84 {
85  return m_parent;
86 }
const IInterface * m_parent
AlgTool parent.
Definition: AlgTool.h:290

◆ queryInterface()

StatusCode AlgTool::queryInterface ( const InterfaceID riid,
void **  ppvUnknown 
)
override

Query for a given interface.

Definition at line 51 of file AlgTool.cpp.

53 {
54  if ( !ppvi ) { return StatusCode::FAILURE; } // RETURN
55  StatusCode sc = base_class::queryInterface( riid, ppvi );
56  if ( sc.isSuccess() ) return sc;
58  [&]( const std::pair<InterfaceID, void*>& item ) { return item.first.versionMatch( riid ); } );
59  if ( i == std::end( m_interfaceList ) ) {
60  *ppvi = nullptr;
61  return Status::NO_INTERFACE; // RETURN
62  }
63  *ppvi = i->second;
64  addRef();
65  return StatusCode::SUCCESS; // RETURN
66 }
constexpr static const auto SUCCESS
Definition: StatusCode.h:100
T end(T... args)
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:61
bool isSuccess() const
Definition: StatusCode.h:365
T find_if(T... args)
T begin(T... args)
constexpr static const auto FAILURE
Definition: StatusCode.h:101
InterfaceList m_interfaceList
Interface list.
Definition: AlgTool.h:298

◆ registerTool()

void AlgTool::registerTool ( IAlgTool tool) const
inline

Definition at line 211 of file AlgTool.h.

211  {
212  if ( UNLIKELY( msgLevel( MSG::DEBUG ) ) ) debug() << "Registering tool " << tool->name() << endmsg;
213  m_tools.push_back( tool );
214  }
#define UNLIKELY(x)
Definition: Kernel.h:106
std::vector< IAlgTool * > m_tools
Definition: AlgTool.h:319
MSG::Level msgLevel() const
get the cached level (originally extracted from the embedded MsgStream)
virtual const std::string & name() const =0
Retrieve the name of the instance.
T push_back(T... args)
MsgStream & debug() const
shortcut for the method msgStream(MSG::DEBUG)
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:202

◆ reinitialize()

StatusCode AlgTool::reinitialize ( )
override

Definition at line 304 of file AlgTool.cpp.

306 {
307  /* @TODO
308  * MCl 2008-10-23: the implementation of reinitialize as finalize+initialize
309  * is causing too many problems
310  *
311  // Default implementation is finalize+initialize
312  StatusCode sc = finalize();
313  if (sc.isFailure()) {
314  error() << "reinitialize(): cannot be finalized" << endmsg;
315  return sc;
316  }
317  sc = initialize();
318  if (sc.isFailure()) {
319  error() << "reinitialize(): cannot be initialized" << endmsg;
320  return sc;
321  }
322  */
323  return StatusCode::SUCCESS;
324 }
constexpr static const auto SUCCESS
Definition: StatusCode.h:100

◆ restart()

StatusCode AlgTool::restart ( )
override

Definition at line 346 of file AlgTool.cpp.

348 {
349  // Default implementation is stop+start
350  StatusCode sc = stop();
351  if ( sc.isFailure() ) {
352  error() << "restart(): cannot be stopped" << endmsg;
353  return sc;
354  }
355  sc = start();
356  if ( sc.isFailure() ) {
357  error() << "restart(): cannot be started" << endmsg;
358  return sc;
359  }
360  return StatusCode::SUCCESS;
361 }
constexpr static const auto SUCCESS
Definition: StatusCode.h:100
MsgStream & error() const
shortcut for the method msgStream(MSG::ERROR)
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:61
bool isFailure() const
Definition: StatusCode.h:145
StatusCode stop() override
Definition: AlgTool.cpp:257
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:202
StatusCode start() override
Definition: AlgTool.cpp:235

◆ service() [1/4]

template<class T >
StatusCode AlgTool::service ( std::string_view  name,
T *&  svc,
bool  createIf = true 
) const
inline

Access a service by name, creating it if it doesn't already exist.

Definition at line 138 of file AlgTool.h.

138  {
139  return service_i( name, createIf, T::interfaceID(), (void**)&svc );
140  }
const std::string & name() const override
Retrieve full identifying name of the concrete tool object.
Definition: AlgTool.cpp:68
StatusCode service_i(std::string_view algName, bool createIf, const InterfaceID &iid, void **ppSvc) const
flag indicating whether ToolHandle tools have been added to m_tools
Definition: AlgTool.cpp:425

◆ service() [2/4]

template<class T >
StatusCode AlgTool::service ( std::string_view  type,
std::string_view  name,
T *&  svc 
) const
inline

Access a service by name, type creating it if it doesn't already exist.

Definition at line 145 of file AlgTool.h.

145  {
146  return service_i( type, name, T::interfaceID(), reinterpret_cast<void**>( &svc ) );
147  }
const std::string & type() const override
Retrieve type (concrete class) of the sub-algtool.
Definition: AlgTool.cpp:75
const std::string & name() const override
Retrieve full identifying name of the concrete tool object.
Definition: AlgTool.cpp:68
StatusCode service_i(std::string_view algName, bool createIf, const InterfaceID &iid, void **ppSvc) const
flag indicating whether ToolHandle tools have been added to m_tools
Definition: AlgTool.cpp:425

◆ service() [3/4]

SmartIF< IService > AlgTool::service ( std::string_view  name,
const bool  createIf = true,
const bool  quiet = false 
) const

Return a pointer to the service identified by name (or "type/name")

Definition at line 437 of file AlgTool.cpp.

437  {
438  const ServiceLocatorHelper helper( *serviceLocator(), *this );
439  return helper.service( name, quiet, createIf );
440 }
an helper to share the implementation of service() among the various kernel base classes
SmartIF< ISvcLocator > & serviceLocator() const override
Retrieve pointer to service locator.
Definition: AlgTool.cpp:89
const std::string & name() const override
Retrieve full identifying name of the concrete tool object.
Definition: AlgTool.cpp:68

◆ service() [4/4]

template<typename T >
SmartIF<T> AlgTool::service ( std::string_view  name,
const bool  createIf = true,
const bool  quiet = false 
) const
inline

Definition at line 153 of file AlgTool.h.

153  {
154  return SmartIF<T>( service( name, createIf, quiet ) );
155  }
Small smart pointer class with automatic reference counting for IInterface.
Definition: IConverter.h:25
StatusCode service(std::string_view name, T *&svc, bool createIf=true) const
Access a service by name, creating it if it doesn't already exist.
Definition: AlgTool.h:138
const std::string & name() const override
Retrieve full identifying name of the concrete tool object.
Definition: AlgTool.cpp:68

◆ service_i() [1/2]

StatusCode AlgTool::service_i ( std::string_view  algName,
bool  createIf,
const InterfaceID iid,
void **  ppSvc 
) const
private

flag indicating whether ToolHandle tools have been added to m_tools

implementation of service method

Definition at line 425 of file AlgTool.cpp.

425  {
426  const ServiceLocatorHelper helper( *serviceLocator(), *this );
427  return helper.getService( svcName, createIf, iid, ppSvc );
428 }
an helper to share the implementation of service() among the various kernel base classes
SmartIF< ISvcLocator > & serviceLocator() const override
Retrieve pointer to service locator.
Definition: AlgTool.cpp:89

◆ service_i() [2/2]

StatusCode AlgTool::service_i ( std::string_view  svcType,
std::string_view  svcName,
const InterfaceID iid,
void **  ppS 
) const
private

Definition at line 431 of file AlgTool.cpp.

432  {
433  const ServiceLocatorHelper helper( *serviceLocator(), *this );
434  return helper.createService( svcType, svcName, iid, ppSvc );
435 }
an helper to share the implementation of service() among the various kernel base classes
SmartIF< ISvcLocator > & serviceLocator() const override
Retrieve pointer to service locator.
Definition: AlgTool.cpp:89

◆ serviceLocator()

SmartIF< ISvcLocator > & AlgTool::serviceLocator ( ) const
override

Retrieve pointer to service locator.

Definition at line 89 of file AlgTool.cpp.

91 {
92  return m_svcLocator;
93 }
SmartIF< ISvcLocator > m_svcLocator
Pointer to Service Locator service.
Definition: AlgTool.h:292

◆ setProperties()

StatusCode AlgTool::setProperties ( )

Method for setting declared properties to the values specified in the jobOptions via the job option service.

This method is called by the ToolSvc after creating the concrete tool, before passing it to the requesting parent and does not need to be called explicitly.

Definition at line 117 of file AlgTool.cpp.

119 {
120  if ( !m_svcLocator ) return StatusCode::FAILURE;
121  auto jos = m_svcLocator->service<IJobOptionsSvc>( "JobOptionsSvc" );
122  if ( !jos ) return StatusCode::FAILURE;
123 
124  return jos->setMyProperties( name(), this );
125 }
StatusCode service(const Gaudi::Utils::TypeNameString &name, T *&svc, bool createIf=true)
Templated method to access a service by name.
Definition: ISvcLocator.h:86
Main interface for the JobOptions service.
SmartIF< ISvcLocator > m_svcLocator
Pointer to Service Locator service.
Definition: AlgTool.h:292
constexpr static const auto FAILURE
Definition: StatusCode.h:101
const std::string & name() const override
Retrieve full identifying name of the concrete tool object.
Definition: AlgTool.cpp:68

◆ start()

StatusCode AlgTool::start ( )
override

Definition at line 235 of file AlgTool.cpp.

237 {
238  // For the time being there is nothing to be done here.
239  return StatusCode::SUCCESS;
240 }
constexpr static const auto SUCCESS
Definition: StatusCode.h:100

◆ stop()

StatusCode AlgTool::stop ( )
override

Definition at line 257 of file AlgTool.cpp.

259 {
260  // For the time being there is nothing to be done here.
261  return StatusCode::SUCCESS;
262 }
constexpr static const auto SUCCESS
Definition: StatusCode.h:100

◆ svcLoc()

ISvcLocator* AlgTool::svcLoc ( ) const
inline

shortcut for the method service locator

Definition at line 117 of file AlgTool.h.

117 { return serviceLocator(); }
SmartIF< ISvcLocator > & serviceLocator() const override
Retrieve pointer to service locator.
Definition: AlgTool.cpp:89

◆ sysFinalize()

StatusCode AlgTool::sysFinalize ( )
override

Finalize AlgTool.

Definition at line 265 of file AlgTool.cpp.

265  {
266  //-----------------------------------------------------------------------------
267  return attempt( *this, "sysFinalize", [&]() {
269  Gaudi::Guards::AuditorGuard guard( this,
270  // check if we want to audit the initialize
272  StatusCode sc = finalize();
273  if ( sc.isSuccess() ) m_state = m_targetState;
274  return sc;
275  } );
276 }
StatusCode finalize() override
Definition: AlgTool.cpp:278
IAuditorSvc * auditorSvc() const
Access the auditor service.
Definition: AlgTool.cpp:443
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:61
bool isSuccess() const
Definition: StatusCode.h:365
Gaudi::StateMachine::State m_state
state of the Tool
Definition: AlgTool.h:328
State GAUDI_API ChangeState(const Transition transition, const State state)
Function to get the new state according to the required transition, checking if the transition is all...
Gaudi::StateMachine::State m_targetState
state of the Tool
Definition: AlgTool.h:329
It is a simple guard, which "locks" the scope for the Auditor Service is am exception-safe way.
Definition: Guards.h:213
Gaudi::Property< bool > m_auditorFinalize
Definition: AlgTool.h:314

◆ sysInitialize()

StatusCode AlgTool::sysInitialize ( )
override

Initialize AlgTool.

Definition at line 173 of file AlgTool.cpp.

173  {
174  //-----------------------------------------------------------------------------
175  return attempt( *this, "sysInitialize", [&]() {
177  Gaudi::Guards::AuditorGuard guard( this,
178  // check if we want to audit the initialize
180  StatusCode sc = initialize();
181  if ( !sc ) return sc;
182 
185 
186  // check for explicit circular data dependencies in declared handles
187  DataObjIDColl out;
188  for ( auto& h : outputHandles() ) {
189  if ( !h->objKey().empty() ) out.emplace( h->fullKey() );
190  }
191  for ( auto& h : inputHandles() ) {
192  if ( !h->objKey().empty() && out.find( h->fullKey() ) != out.end() ) {
193  error() << "Explicit circular data dependency found for id " << h->fullKey() << endmsg;
194  sc = StatusCode::FAILURE;
195  }
196  }
197 
198  if ( !sc ) return sc;
199 
200  // visit all sub-tools, build full set
202  acceptDHVisitor( &avis );
203 
204  // initialize handles
205  initDataHandleHolder(); // this should 'freeze' the handle configuration.
206 
207  return sc;
208  } );
209 }
StatusCode initialize() override
Definition: AlgTool.cpp:211
void initDataHandleHolder()
initializes all handles - called by the sysInitialize method of any descendant of this
MsgStream & error() const
shortcut for the method msgStream(MSG::ERROR)
IAuditorSvc * auditorSvc() const
Access the auditor service.
Definition: AlgTool.cpp:443
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:61
void acceptDHVisitor(IDataHandleVisitor *) const override
Definition: AlgTool.cpp:453
T get(T... args)
Gaudi::StateMachine::State m_state
state of the Tool
Definition: AlgTool.h:328
State GAUDI_API ChangeState(const Transition transition, const State state)
Function to get the new state according to the required transition, checking if the transition is all...
T emplace(T... args)
constexpr static const auto FAILURE
Definition: StatusCode.h:101
Gaudi::Property< bool > m_auditorInitialize
Definition: AlgTool.h:311
Gaudi::StateMachine::State m_targetState
state of the Tool
Definition: AlgTool.h:329
It is a simple guard, which "locks" the scope for the Auditor Service is am exception-safe way.
Definition: Guards.h:213
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:202
std::unique_ptr< IDataHandleVisitor > m_updateDataHandles
Hook for for derived classes to provide a custom visitor for data handles.
Definition: AlgTool.h:232

◆ sysReinitialize()

StatusCode AlgTool::sysReinitialize ( )
override

Initialize AlgTool.

Definition at line 286 of file AlgTool.cpp.

286  {
287  //-----------------------------------------------------------------------------
288 
289  // Check that the current status is the correct one.
291  error() << "sysReinitialize(): cannot reinitialize tool not initialized" << endmsg;
292  return StatusCode::FAILURE;
293  }
294 
295  return attempt( *this, "SysReinitialize()", [&]() {
296  Gaudi::Guards::AuditorGuard guard( this,
297  // check if we want to audit the initialize
299  return reinitialize();
300  } );
301 }
Gaudi::Property< bool > m_auditorReinitialize
Definition: AlgTool.h:315
Gaudi::StateMachine::State FSMState() const override
Definition: AlgTool.h:84
MsgStream & error() const
shortcut for the method msgStream(MSG::ERROR)
IAuditorSvc * auditorSvc() const
Access the auditor service.
Definition: AlgTool.cpp:443
constexpr static const auto FAILURE
Definition: StatusCode.h:101
StatusCode reinitialize() override
Definition: AlgTool.cpp:304
It is a simple guard, which "locks" the scope for the Auditor Service is am exception-safe way.
Definition: Guards.h:213
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:202

◆ sysRestart()

StatusCode AlgTool::sysRestart ( )
override

Start AlgTool.

Definition at line 327 of file AlgTool.cpp.

327  {
328  //-----------------------------------------------------------------------------
329 
330  // Check that the current status is the correct one.
332  error() << "sysRestart(): cannot reinitialize tool not started" << endmsg;
333  return StatusCode::FAILURE;
334  }
335 
336  return attempt( *this, "sysRestart", [&]() {
338  Gaudi::Guards::AuditorGuard guard( this,
339  // check if we want to audit the initialize
341  return restart();
342  } );
343 }
Gaudi::StateMachine::State FSMState() const override
Definition: AlgTool.h:84
MsgStream & error() const
shortcut for the method msgStream(MSG::ERROR)
IAuditorSvc * auditorSvc() const
Access the auditor service.
Definition: AlgTool.cpp:443
StatusCode restart() override
Definition: AlgTool.cpp:346
Gaudi::Property< bool > m_auditorRestart
Definition: AlgTool.h:316
Gaudi::StateMachine::State m_state
state of the Tool
Definition: AlgTool.h:328
State GAUDI_API ChangeState(const Transition transition, const State state)
Function to get the new state according to the required transition, checking if the transition is all...
constexpr static const auto FAILURE
Definition: StatusCode.h:101
Gaudi::StateMachine::State m_targetState
state of the Tool
Definition: AlgTool.h:329
It is a simple guard, which "locks" the scope for the Auditor Service is am exception-safe way.
Definition: Guards.h:213
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:202

◆ sysStart()

StatusCode AlgTool::sysStart ( )
override

Start AlgTool.

Definition at line 221 of file AlgTool.cpp.

221  {
222  //-----------------------------------------------------------------------------
223  return attempt( *this, "sysStart", [&]() {
225  Gaudi::Guards::AuditorGuard guard( this,
226  // check if we want to audit the initialize
227  m_auditorStart ? auditorSvc() : nullptr, IAuditor::Start );
228  StatusCode sc = start();
229  if ( sc.isSuccess() ) m_state = m_targetState;
230  return sc;
231  } );
232 }
Gaudi::Property< bool > m_auditorStart
Definition: AlgTool.h:312
IAuditorSvc * auditorSvc() const
Access the auditor service.
Definition: AlgTool.cpp:443
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:61
bool isSuccess() const
Definition: StatusCode.h:365
Gaudi::StateMachine::State m_state
state of the Tool
Definition: AlgTool.h:328
State GAUDI_API ChangeState(const Transition transition, const State state)
Function to get the new state according to the required transition, checking if the transition is all...
Gaudi::StateMachine::State m_targetState
state of the Tool
Definition: AlgTool.h:329
It is a simple guard, which "locks" the scope for the Auditor Service is am exception-safe way.
Definition: Guards.h:213
StatusCode start() override
Definition: AlgTool.cpp:235

◆ sysStop()

StatusCode AlgTool::sysStop ( )
override

Stop AlgTool.

Definition at line 243 of file AlgTool.cpp.

243  {
244  //-----------------------------------------------------------------------------
245  return attempt( *this, "sysStop", [&]() {
247  Gaudi::Guards::AuditorGuard guard( this,
248  // check if we want to audit the initialize
249  m_auditorStop ? auditorSvc() : nullptr, IAuditor::Stop );
250  StatusCode sc = stop();
251  if ( sc.isSuccess() ) m_state = m_targetState;
252  return sc;
253  } );
254 }
IAuditorSvc * auditorSvc() const
Access the auditor service.
Definition: AlgTool.cpp:443
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:61
Gaudi::Property< bool > m_auditorStop
Definition: AlgTool.h:313
bool isSuccess() const
Definition: StatusCode.h:365
Gaudi::StateMachine::State m_state
state of the Tool
Definition: AlgTool.h:328
State GAUDI_API ChangeState(const Transition transition, const State state)
Function to get the new state according to the required transition, checking if the transition is all...
StatusCode stop() override
Definition: AlgTool.cpp:257
Gaudi::StateMachine::State m_targetState
state of the Tool
Definition: AlgTool.h:329
It is a simple guard, which "locks" the scope for the Auditor Service is am exception-safe way.
Definition: Guards.h:213

◆ targetFSMState()

Gaudi::StateMachine::State AlgTool::targetFSMState ( ) const
inlineoverride

Definition at line 85 of file AlgTool.h.

85 { return m_targetState; }
Gaudi::StateMachine::State m_targetState
state of the Tool
Definition: AlgTool.h:329

◆ terminate()

StatusCode AlgTool::terminate ( )
inlineoverride

Definition at line 81 of file AlgTool.h.

81 { return StatusCode::SUCCESS; }
constexpr static const auto SUCCESS
Definition: StatusCode.h:100

◆ tools() [1/2]

const std::vector< IAlgTool * > & AlgTool::tools ( ) const

Definition at line 411 of file AlgTool.cpp.

411  {
413 
414  return m_tools;
415 }
void initToolHandles() const
Definition: AlgTool.cpp:370
#define UNLIKELY(x)
Definition: Kernel.h:106
bool m_toolHandlesInit
Definition: AlgTool.h:322
std::vector< IAlgTool * > m_tools
Definition: AlgTool.h:319

◆ tools() [2/2]

std::vector< IAlgTool * > & AlgTool::tools ( )
protected

Definition at line 417 of file AlgTool.cpp.

417  {
419 
420  return m_tools;
421 }
void initToolHandles() const
Definition: AlgTool.cpp:370
#define UNLIKELY(x)
Definition: Kernel.h:106
bool m_toolHandlesInit
Definition: AlgTool.h:322
std::vector< IAlgTool * > m_tools
Definition: AlgTool.h:319

◆ toolSvc()

IToolSvc * AlgTool::toolSvc ( ) const

The standard ToolSvc service, Return a pointer to the service if present.

Definition at line 106 of file AlgTool.cpp.

108 {
109  if ( !m_ptoolSvc ) {
110  m_ptoolSvc = service( "ToolSvc", true );
111  if ( !m_ptoolSvc ) { throw GaudiException( "Service [ToolSvc] not found", name(), StatusCode::FAILURE ); }
112  }
113  return m_ptoolSvc.get();
114 }
Define general base for Gaudi exception.
TYPE * get() const
Get interface pointer.
Definition: SmartIF.h:86
SmartIF< IToolSvc > m_ptoolSvc
Tool service.
Definition: AlgTool.h:294
StatusCode service(std::string_view name, T *&svc, bool createIf=true) const
Access a service by name, creating it if it doesn't already exist.
Definition: AlgTool.h:138
constexpr static const auto FAILURE
Definition: StatusCode.h:101
const std::string & name() const override
Retrieve full identifying name of the concrete tool object.
Definition: AlgTool.cpp:68

◆ type()

const std::string & AlgTool::type ( ) const
override

Retrieve type (concrete class) of the sub-algtool.

Definition at line 75 of file AlgTool.cpp.

77 {
78  return m_type;
79 }
std::string m_type
AlgTool type (concrete class name)
Definition: AlgTool.h:288

Member Data Documentation

◆ m_auditInit

Gaudi::Property<bool> AlgTool::m_auditInit {this, "AuditTools", false, " unused"}
private

Definition at line 310 of file AlgTool.h.

◆ m_auditorFinalize

Gaudi::Property<bool> AlgTool::m_auditorFinalize {this, "AuditFinalize", false, "trigger auditor on finalize()"}
private

Definition at line 314 of file AlgTool.h.

◆ m_auditorInitialize

Gaudi::Property<bool> AlgTool::m_auditorInitialize {this, "AuditInitialize", false, "trigger auditor on initialize()"}
private

Definition at line 311 of file AlgTool.h.

◆ m_auditorReinitialize

Gaudi::Property<bool> AlgTool::m_auditorReinitialize {this, "AuditReinitialize", false, "trigger auditor on reinitialize()"}
private

Definition at line 315 of file AlgTool.h.

◆ m_auditorRestart

Gaudi::Property<bool> AlgTool::m_auditorRestart {this, "AuditRestart", false, "trigger auditor on restart()"}
private

Definition at line 316 of file AlgTool.h.

◆ m_auditorStart

Gaudi::Property<bool> AlgTool::m_auditorStart {this, "AuditStart", false, "trigger auditor on start()"}
private

Definition at line 312 of file AlgTool.h.

◆ m_auditorStop

Gaudi::Property<bool> AlgTool::m_auditorStop {this, "AuditStop", false, "trigger auditor on stop()"}
private

Definition at line 313 of file AlgTool.h.

◆ m_evtSvc

SmartIF<IDataProviderSvc> AlgTool::m_evtSvc
mutableprivate

Event data service.

Definition at line 293 of file AlgTool.h.

◆ m_interfaceList

InterfaceList AlgTool::m_interfaceList
private

Interface list.

Definition at line 298 of file AlgTool.h.

◆ m_monitorSvcName

Gaudi::Property<std::string> AlgTool::m_monitorSvcName
private
Initial value:
{this, "MonitorService", "MonitorSvc",
"name to use for Monitor Service"}

Definition at line 307 of file AlgTool.h.

◆ m_name

const std::string AlgTool::m_name
private

AlgTool full name.

Definition at line 289 of file AlgTool.h.

◆ m_outputLevel

Gaudi::Property<int> AlgTool::m_outputLevel
private
Initial value:
{
this, "OutputLevel", setUpMessaging(),
"output level"}

Definition at line 302 of file AlgTool.h.

◆ m_parent

const IInterface* AlgTool::m_parent = nullptr
private

AlgTool parent.

Definition at line 290 of file AlgTool.h.

◆ m_pAuditorSvc

SmartIF<IAuditorSvc> AlgTool::m_pAuditorSvc
mutableprivate

Auditor Service.

Definition at line 296 of file AlgTool.h.

◆ m_pMonitorSvc

SmartIF<IMonitorSvc> AlgTool::m_pMonitorSvc
mutableprivate

Online Monitoring Service.

Definition at line 295 of file AlgTool.h.

◆ m_ptoolSvc

SmartIF<IToolSvc> AlgTool::m_ptoolSvc
mutableprivate

Tool service.

Definition at line 294 of file AlgTool.h.

◆ m_state

state of the Tool

Definition at line 328 of file AlgTool.h.

◆ m_svcLocator

SmartIF<ISvcLocator> AlgTool::m_svcLocator
mutableprivate

Pointer to Service Locator service.

Definition at line 292 of file AlgTool.h.

◆ m_targetState

state of the Tool

Definition at line 329 of file AlgTool.h.

◆ m_toolHandleArrays

std::vector<GaudiHandleArrayBase*> AlgTool::m_toolHandleArrays
mutableprivate

Definition at line 321 of file AlgTool.h.

◆ m_toolHandles

std::vector<BaseToolHandle*> AlgTool::m_toolHandles
mutableprivate

Definition at line 320 of file AlgTool.h.

◆ m_toolHandlesInit

bool AlgTool::m_toolHandlesInit = false
mutableprivate

Definition at line 322 of file AlgTool.h.

◆ m_tools

std::vector<IAlgTool*> AlgTool::m_tools
mutableprivate

Definition at line 319 of file AlgTool.h.

◆ m_type

std::string AlgTool::m_type
private

AlgTool type (concrete class name)

Definition at line 288 of file AlgTool.h.

◆ m_updateDataHandles

std::unique_ptr<IDataHandleVisitor> AlgTool::m_updateDataHandles
protected

Hook for for derived classes to provide a custom visitor for data handles.

Definition at line 232 of file AlgTool.h.


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