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

typedef Gaudi::PluginService::Factory< IAlgTool *, const std::string &, const std::string &, const IInterface * > Factory
 
- 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 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 (const std::string &type, const 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 (const std::string &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 (const std::string &type, const std::string &name, T *&svc) const
 Access a service by name, type creating it if it doesn't already exist. More...
 
SmartIF< IServiceservice (const std::string &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 (const std::string &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, std::string toolTypeAndName="", bool createIf=true)
 
template<class T >
Gaudi::Details::PropertyBasedeclareProperty (const std::string &name, ToolHandleArray< T > &hndlArr, const std::string &doc="none")
 
virtual std::vector< Gaudi::DataHandle * > inputHandles () const override
 
virtual std::vector< Gaudi::DataHandle * > outputHandles () const override
 
virtual const DataObjIDCollextraInputDeps () const override
 
virtual const DataObjIDCollextraOutputDeps () const override
 
virtual void acceptDHVisitor (IDataHandleVisitor *) const override
 
const DataObjIDCollinputDataObjs () const override
 
const DataObjIDColloutputDataObjs () const override
 
void commitHandles () override
 
void registerTool (IAlgTool *tool) const
 
void deregisterTool (IAlgTool *tool) const
 
template<class T >
StatusCode declarePublicTool (ToolHandle< T > &handle, std::string toolTypeAndName="", bool createIf=true)
 Declare used public tool. More...
 
template<class T >
StatusCode declarePrivateTool (ToolHandle< T > &handle, std::string toolTypeAndName="", bool createIf=true)
 Declare used private tool. More...
 
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 PropertyHolder< CommonMessaging< implements< IAlgTool, IDataHandleHolder, IProperty, IStateful > > >
 PropertyHolder ()=default
 
 ~PropertyHolder () override=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, TYPE &value, const std::string &doc="none") const
 
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
 
Gaudi::Details::PropertyBasedeclareProperty (const std::string &name, ToolHandle< TYPE > &ref, const std::string &doc="none")
 Specializations for various GaudiHandles. More...
 
Gaudi::Details::PropertyBasedeclareProperty (const std::string &name, ServiceHandle< TYPE > &ref, const std::string &doc="none")
 
Gaudi::Details::PropertyBasedeclareProperty (const std::string &name, ToolHandleArray< TYPE > &ref, const std::string &doc="none")
 
Gaudi::Details::PropertyBasedeclareProperty (const std::string &name, ServiceHandleArray< TYPE > &ref, const std::string &doc="none")
 
Gaudi::Details::PropertyBasedeclareProperty (const std::string &name, DataObjectHandle< TYPE > &ref, const std::string &doc="none")
 
- Public Member Functions inherited from CommonMessagingBase
virtual ~CommonMessagingBase ()=default
 Virtual destructor. More...
 
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...
 
MSG::Level msgLevel () const
 get the output level from the embedded MsgStream More...
 
MSG::Level outputLevel () const __attribute__((deprecated))
 Backward compatibility function for getting the output level. More...
 
bool msgLevel (MSG::Level lvl) const
 get the output level from the embedded MsgStream More...
 

Protected Member Functions

template<typename I >
void declareInterface (I *i)
 
virtual void declareInput (Gaudi::DataHandle *im) override
 
virtual void declareOutput (Gaudi::DataHandle *im) override
 
std::vector< IAlgTool * > & tools ()
 
- 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 > >
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...
 

Private Types

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

Private Member Functions

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

Private Attributes

std::vector< Gaudi::DataHandle * > m_inputHandles
 
std::vector< Gaudi::DataHandle * > m_outputHandles
 
DataObjIDColl m_inputDataObjs
 
DataObjIDColl m_outputDataObjs
 
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 {this, "OutputLevel", MSG::NIL, "output level"}
 
Gaudi::Property< std::stringm_monitorSvcName
 
Gaudi::Property< bool > m_auditInit {this, "AuditTools", false, "[[deprecated]] 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()"}
 
Gaudi::Property< DataObjIDCollm_extInputDataObjs {this, "ExtraInputs", DataObjIDColl{}, "[[deprecated]]"}
 
Gaudi::Property< DataObjIDCollm_extOutputDataObjs {this, "ExtraOutputs", DataObjIDColl{}, "[[deprecated]]"}
 
std::string m_threadID
 Thread Id for Alg Tool. More...
 
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 46 of file AlgTool.h.

Member Typedef Documentation

Definition at line 51 of file AlgTool.h.

Definition at line 339 of file AlgTool.h.

Constructor & Destructor Documentation

AlgTool::AlgTool ( const std::string type,
const 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 139 of file AlgTool.cpp.

141  : m_type( type ),
142  m_name( name ),
143  m_parent( parent )
144 {
145  addRef(); // Initial count set to 1
146 
147  IInterface* _p = const_cast<IInterface*>( parent );
148 
149  // inherit output level from parent
150  { // get the "OutputLevel" property from parent
151  SmartIF<IProperty> pprop( _p );
152  if ( pprop && pprop->hasProperty( "OutputLevel" ) ) {
153  m_outputLevel.assign( pprop->getProperty( "OutputLevel" ) );
154  }
155  }
156  m_outputLevel.declareUpdateHandler(
158 
159  if ( Algorithm* _alg = dynamic_cast<Algorithm*>( _p ) ) {
160  m_svcLocator = _alg->serviceLocator();
161  m_threadID = getGaudiThreadIDfromName( _alg->name() );
162  } else if ( Service* _svc = dynamic_cast<Service*>( _p ) ) {
163  m_svcLocator = _svc->serviceLocator();
164  m_threadID = getGaudiThreadIDfromName( _svc->name() );
165  } else if ( AlgTool* _too = dynamic_cast<AlgTool*>( _p ) ) {
166  m_svcLocator = _too->serviceLocator();
167  m_threadID = getGaudiThreadIDfromName( _too->m_threadID );
168  } else if ( Auditor* _aud = dynamic_cast<Auditor*>( _p ) ) {
169  m_svcLocator = _aud->serviceLocator();
170  m_threadID = getGaudiThreadIDfromName( _aud->name() );
171  } else {
172  throw GaudiException( "Failure to create tool '" + type + "/" + name + "': illegal parent type '" +
173  System::typeinfoName( typeid( *_p ) ) + "'",
174  "AlgTool", 0 );
175  }
176 
177  {
178  // Auditor monitoring properties
179  // Initialize the default value from ApplicationMgr AuditAlgorithms
180  Gaudi::Property<bool> audit( false );
181  // note that here we need that the service locator is already defined
182  auto appMgr = serviceLocator()->service<IProperty>( "ApplicationMgr" );
183  if ( appMgr && appMgr->hasProperty( "AuditTools" ) ) {
184  audit.assign( appMgr->getProperty( "AuditTools" ) );
185  }
186  m_auditInit = audit;
187  m_auditorInitialize = audit;
188  m_auditorStart = audit;
189  m_auditorStop = audit;
190  m_auditorFinalize = audit;
191  m_auditorReinitialize = audit;
192  m_auditorRestart = audit;
193  }
194 
195  // check thread ID and try if tool name indicates thread ID
196  if ( m_threadID.empty() ) {
198  }
199 }
T empty(T...args)
Define general base for Gaudi exception.
SmartIF< ISvcLocator > & serviceLocator() const override
Retrieve pointer to service locator.
Definition: AlgTool.cpp:84
Gaudi::Property< bool > m_auditorStart
Definition: AlgTool.h:361
std::string m_type
AlgTool type (concrete class name)
Definition: AlgTool.h:341
Implementation of property with value of concrete type.
Definition: Property.h:313
GAUDI_API const std::string typeinfoName(const std::type_info &)
Get platform independent information about the class type.
Definition: System.cpp:299
const IInterface * m_parent
AlgTool parent.
Definition: AlgTool.h:343
Gaudi::Property< bool > m_auditorReinitialize
Definition: AlgTool.h:364
const std::string m_name
AlgTool full name.
Definition: AlgTool.h:342
StatusCode service(const Gaudi::Utils::TypeNameString &name, T *&svc, bool createIf=true)
Templated method to access a service by name.
Definition: ISvcLocator.h:78
Gaudi::Property< int > m_outputLevel
Definition: AlgTool.h:354
void updateMsgStreamOutputLevel(int level)
Update the output level of the cached MsgStream.
Definition of the basic interface.
Definition: IInterface.h:234
std::string m_threadID
Thread Id for Alg Tool.
Definition: AlgTool.h:370
Gaudi::Property< bool > m_auditorStop
Definition: AlgTool.h:362
PropertyBase base class allowing PropertyBase* collections to be "homogeneous".
Definition: Property.h:32
Gaudi::Property< bool > m_auditorRestart
Definition: AlgTool.h:365
Base class from which all concrete algorithm classes should be derived.
Definition: Algorithm.h:78
const std::string & name() const override
Retrieve full identifying name of the concrete tool object.
Definition: AlgTool.cpp:63
Gaudi::Property< bool > m_auditInit
Definition: AlgTool.h:359
Base class from which all the concrete tool classes should be derived.
Definition: AlgTool.h:46
const IInterface * parent() const override
Retrieve parent of the sub-algtool.
Definition: AlgTool.cpp:77
SmartIF< ISvcLocator > m_svcLocator
Pointer to Service Locator service.
Definition: AlgTool.h:345
appMgr
Definition: IOTest.py:83
Gaudi::Property< bool > m_auditorInitialize
Definition: AlgTool.h:360
The IProperty is the basic interface for all components which have properties that can be set or get...
Definition: IProperty.h:20
Base class for all services.
Definition: Service.h:36
GAUDI_API std::string getGaudiThreadIDfromName(const std::string &name)
helper function to extract Gaudi Thread ID from thread copy name
Definition: ThreadGaudi.cpp:26
Gaudi::Property< bool > m_auditorFinalize
Definition: AlgTool.h:363
Base class from which all concrete auditor classes should be derived.
Definition: Auditor.h:35
AlgTool::~AlgTool ( )
override

Definition at line 382 of file AlgTool.cpp.

384 {
385  if ( m_pMonitorSvc ) {
386  m_pMonitorSvc->undeclareAll( this );
387  }
388 }
SmartIF< IMonitorSvc > m_pMonitorSvc
Online Monitoring Service.
Definition: AlgTool.h:348
virtual void undeclareAll(const IInterface *owner)=0
Undeclare monitoring information.

Member Function Documentation

void AlgTool::acceptDHVisitor ( IDataHandleVisitor vis) const
overridevirtual

Definition at line 504 of file AlgTool.cpp.

505 {
506  //-----------------------------------------------------------------------------
507  vis->visit( this );
508 
509  for ( auto tool : tools() ) {
510  AlgTool* at = dynamic_cast<AlgTool*>( tool );
511  vis->visit( at );
512  }
513 }
virtual void visit(const IDataHandleHolder *)=0
const std::vector< IAlgTool * > & tools() const
Definition: AlgTool.cpp:454
Base class from which all the concrete tool classes should be derived.
Definition: AlgTool.h:46
IAuditorSvc * AlgTool::auditorSvc ( ) const

Access the auditor service.

Definition at line 491 of file AlgTool.cpp.

492 {
493  //---------------------------------------------------------------------------
494  if ( !m_pAuditorSvc ) {
495  m_pAuditorSvc = service( "AuditorSvc", true );
496  if ( !m_pAuditorSvc ) {
497  throw GaudiException( "Service [AuditorSvc] not found", name(), StatusCode::FAILURE );
498  }
499  }
500  return m_pAuditorSvc.get();
501 }
Define general base for Gaudi exception.
TYPE * get() const
Get interface pointer.
Definition: SmartIF.h:76
StatusCode service(const std::string &name, T *&svc, bool createIf=true) const
Access a service by name, creating it if it doesn&#39;t already exist.
Definition: AlgTool.h:129
SmartIF< IAuditorSvc > m_pAuditorSvc
Auditor Service.
Definition: AlgTool.h:349
const std::string & name() const override
Retrieve full identifying name of the concrete tool object.
Definition: AlgTool.cpp:63
void AlgTool::commitHandles ( )
override

Definition at line 516 of file AlgTool.cpp.

517 {
518  //-----------------------------------------------------------------------------
519 
520  for ( auto h : m_outputHandles ) {
521  h->commit();
522  }
523 
524  for ( auto t : m_tools ) {
525  AlgTool* at = dynamic_cast<AlgTool*>( t );
526  if ( at != 0 ) at->commitHandles();
527  }
528 }
void commitHandles() override
Definition: AlgTool.cpp:516
std::vector< IAlgTool * > m_tools
Definition: AlgTool.h:373
std::vector< Gaudi::DataHandle * > m_outputHandles
Definition: AlgTool.h:209
Base class from which all the concrete tool classes should be derived.
Definition: AlgTool.h:46
StatusCode AlgTool::configure ( )
inlineoverride

Definition at line 67 of file AlgTool.h.

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 315 of file AlgTool.h.

316  {
317  IMonitorSvc* mS = monitorSvc();
318  if ( mS ) mS->declareInfo( name, var, desc, this );
319  }
IMonitorSvc * monitorSvc() const
Access the monitor service.
Definition: AlgTool.h:302
Definition of the IMonitorSvc interface, which publishes Gaudi variables to outside monitoring proces...
Definition: IMonitorSvc.h:21
virtual void declareInfo(const std::string &name, const bool &var, const std::string &desc, const IInterface *owner)=0
Declare monitoring information.
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 328 of file AlgTool.h.

330  {
331  IMonitorSvc* mS = monitorSvc();
332  if ( mS ) mS->declareInfo( name, format, var, size, desc, this );
333  }
IMonitorSvc * monitorSvc() const
Access the monitor service.
Definition: AlgTool.h:302
Definition of the IMonitorSvc interface, which publishes Gaudi variables to outside monitoring proces...
Definition: IMonitorSvc.h:21
virtual void declareInfo(const std::string &name, const bool &var, const std::string &desc, const IInterface *owner)=0
Declare monitoring information.
virtual void AlgTool::declareInput ( Gaudi::DataHandle im)
inlineoverrideprotectedvirtual

Definition at line 191 of file AlgTool.h.

191 { m_inputHandles.push_back( im ); }
T push_back(T...args)
std::vector< Gaudi::DataHandle * > m_inputHandles
Definition: AlgTool.h:209
template<typename I >
void AlgTool::declareInterface ( I *  i)
inlineprotected

Definition at line 153 of file AlgTool.h.

154  {
155  m_interfaceList.emplace_back( I::interfaceID(), i );
156  }
InterfaceList m_interfaceList
Interface list.
Definition: AlgTool.h:351
T emplace_back(T...args)
virtual void AlgTool::declareOutput ( Gaudi::DataHandle im)
inlineoverrideprotectedvirtual

Definition at line 193 of file AlgTool.h.

193 { m_outputHandles.push_back( im ); }
T push_back(T...args)
std::vector< Gaudi::DataHandle * > m_outputHandles
Definition: AlgTool.h:209
template<class T >
StatusCode AlgTool::declarePrivateTool ( ToolHandle< T > &  handle,
std::string  toolTypeAndName = "",
bool  createIf = true 
)
inline

Declare used private tool.

Parameters
handleToolHandle<T>
toolTypeAndName
parent,defaultpublic tool
createif necessary, default true

Definition at line 261 of file AlgTool.h.

262  {
263 
264  if ( toolTypeAndName == "" ) toolTypeAndName = handle.typeAndName();
265 
266  StatusCode sc = handle.initialize( toolTypeAndName, this, createIf );
267  if ( UNLIKELY( !sc ) ) {
268  throw GaudiException{"Cannot create handle for private tool " + toolTypeAndName, name(), sc};
269  }
270 
271  m_toolHandles.push_back( &handle );
272 
273  return sc;
274  }
Define general base for Gaudi exception.
#define UNLIKELY(x)
Definition: Kernel.h:126
T push_back(T...args)
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
std::string typeAndName() const override
Definition: ToolHandle.h:227
StatusCode initialize(const std::string &toolTypeAndName, const IInterface *parent=nullptr, bool createIf=true)
Definition: ToolHandle.h:188
const std::string & name() const override
Retrieve full identifying name of the concrete tool object.
Definition: AlgTool.cpp:63
std::vector< BaseToolHandle * > m_toolHandles
Definition: AlgTool.h:374
template<class T >
Gaudi::Details::PropertyBase* AlgTool::declareProperty ( const std::string name,
ToolHandle< T > &  hndl,
const std::string doc = "none" 
)
inline

Definition at line 163 of file AlgTool.h.

165  {
166  this->declareTool( hndl ).ignore();
167  return PropertyHolderImpl::declareProperty( name, hndl, doc );
168  }
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Details::PropertyBase &prop)
Declare a property.
StatusCode declareTool(ToolHandle< T > &handle, std::string toolTypeAndName="", bool createIf=true)
Definition: AlgTool.h:171
void ignore() const
Definition: StatusCode.h:106
template<class T >
Gaudi::Details::PropertyBase* AlgTool::declareProperty ( const std::string name,
ToolHandleArray< T > &  hndlArr,
const std::string doc = "none" 
)
inline

Definition at line 183 of file AlgTool.h.

185  {
186  m_toolHandleArrays.push_back( &hndlArr );
187  return PropertyHolderImpl::declareProperty( name, hndlArr, doc );
188  }
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Details::PropertyBase &prop)
Declare a property.
T push_back(T...args)
std::vector< GaudiHandleArrayBase * > m_toolHandleArrays
Definition: AlgTool.h:375
template<class T >
StatusCode AlgTool::declarePublicTool ( ToolHandle< T > &  handle,
std::string  toolTypeAndName = "",
bool  createIf = true 
)
inline

Declare used public tool.

Parameters
handleToolHandle<T>
toolTypeAndName
parent,defaultpublic tool
createif necessary, default true

Definition at line 238 of file AlgTool.h.

239  {
240 
241  if ( toolTypeAndName == "" ) toolTypeAndName = handle.typeAndName();
242 
243  StatusCode sc = handle.initialize( toolTypeAndName, 0, createIf );
244  if ( UNLIKELY( !sc ) ) {
245  throw GaudiException{"Cannot create handle for public tool " + toolTypeAndName, name(), sc};
246  }
247 
248  m_toolHandles.push_back( &handle );
249 
250  return sc;
251  }
Define general base for Gaudi exception.
#define UNLIKELY(x)
Definition: Kernel.h:126
T push_back(T...args)
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
std::string typeAndName() const override
Definition: ToolHandle.h:227
StatusCode initialize(const std::string &toolTypeAndName, const IInterface *parent=nullptr, bool createIf=true)
Definition: ToolHandle.h:188
const std::string & name() const override
Retrieve full identifying name of the concrete tool object.
Definition: AlgTool.cpp:63
std::vector< BaseToolHandle * > m_toolHandles
Definition: AlgTool.h:374
template<class T >
StatusCode AlgTool::declareTool ( ToolHandle< T > &  handle,
std::string  toolTypeAndName = "",
bool  createIf = true 
)
inline

Definition at line 171 of file AlgTool.h.

172  {
173  if ( handle.isPublic() ) {
174  return declarePublicTool( handle, toolTypeAndName, createIf );
175  } else {
176  return declarePrivateTool( handle, toolTypeAndName, createIf );
177  }
178  }
StatusCode declarePrivateTool(ToolHandle< T > &handle, std::string toolTypeAndName="", bool createIf=true)
Declare used private tool.
Definition: AlgTool.h:261
bool isPublic() const noexcept
Definition: ToolHandle.h:38
StatusCode declarePublicTool(ToolHandle< T > &handle, std::string toolTypeAndName="", bool createIf=true)
Declare used public tool.
Definition: AlgTool.h:238
void AlgTool::deregisterTool ( IAlgTool tool) const
inline

Definition at line 219 of file AlgTool.h.

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

accessor to event service service

Returns
pointer to detector service

Definition at line 93 of file AlgTool.cpp.

94 {
95  if ( !m_evtSvc ) {
96  m_evtSvc = service( "EventDataSvc", true );
97  if ( !m_evtSvc ) {
98  throw GaudiException( "Service [EventDataSvc] not found", name(), StatusCode::FAILURE );
99  }
100  }
101  return m_evtSvc.get();
102 }
Define general base for Gaudi exception.
TYPE * get() const
Get interface pointer.
Definition: SmartIF.h:76
StatusCode service(const std::string &name, T *&svc, bool createIf=true) const
Access a service by name, creating it if it doesn&#39;t already exist.
Definition: AlgTool.h:129
const std::string & name() const override
Retrieve full identifying name of the concrete tool object.
Definition: AlgTool.cpp:63
SmartIF< IDataProviderSvc > m_evtSvc
Event data service.
Definition: AlgTool.h:346
virtual const DataObjIDColl& AlgTool::extraInputDeps ( ) const
inlineoverridevirtual

Definition at line 198 of file AlgTool.h.

198 { return m_extInputDataObjs; }
Gaudi::Property< DataObjIDColl > m_extInputDataObjs
Definition: AlgTool.h:367
virtual const DataObjIDColl& AlgTool::extraOutputDeps ( ) const
inlineoverridevirtual

Definition at line 199 of file AlgTool.h.

199 { return m_extOutputDataObjs; }
Gaudi::Property< DataObjIDColl > m_extOutputDataObjs
Definition: AlgTool.h:368
StatusCode AlgTool::finalize ( )
override

Definition at line 294 of file AlgTool.cpp.

296 {
297  // For the time being there is nothing to be done here.
298  return StatusCode::SUCCESS;
299 }
Gaudi::StateMachine::State AlgTool::FSMState ( ) const
inlineoverride

Definition at line 75 of file AlgTool.h.

75 { return m_state; }
Gaudi::StateMachine::State m_state
state of the Tool
Definition: AlgTool.h:383
StatusCode AlgTool::initialize ( )
override

Definition at line 224 of file AlgTool.cpp.

226 {
227  // For the time being there is nothing to be done here.
228  // Setting the properties is done by the ToolSvc calling setProperties()
229  // explicitly.
230  return StatusCode::SUCCESS;
231 }
void AlgTool::initToolHandles ( ) const
private

Definition at line 390 of file AlgTool.cpp.

391 {
392 
393  IAlgTool* tool( 0 );
394  for ( auto thArr : m_toolHandleArrays ) {
395  if ( !thArr->retrieved() ) {
396  if ( UNLIKELY( msgLevel( MSG::DEBUG ) ) )
397  debug() << "ToolHandleArray " << thArr->propertyName() << " not used: not registering any of its Tools"
398  << endmsg;
399  } else {
400  if ( UNLIKELY( msgLevel( MSG::DEBUG ) ) )
401  debug() << "Registering all Tools in ToolHandleArray " << thArr->propertyName() << endmsg;
402  // Iterate over its tools:
403  for ( auto toolHandle : thArr->getBaseArray() ) {
404  // Try to cast it into a BaseToolHandle pointer:
405  BaseToolHandle* bth = dynamic_cast<BaseToolHandle*>( toolHandle );
406  if ( bth ) {
407  // If the cast was successful, the code is pretty simple:
408  tool = bth->get();
409  if ( UNLIKELY( msgLevel( MSG::DEBUG ) ) ) {
410  debug() << "Adding " << ( bth->isPublic() ? "public" : "private" ) << " ToolHandle tool " << tool->name()
411  << " (" << tool->type() << ") from ToolHandleArray " << thArr->propertyName() << endmsg;
412  }
413  m_tools.push_back( tool );
414  } else {
415  // If it wasn't for some strange reason, then fall back on the
416  // logic implemented previously:
417  if ( toolSvc()->retrieveTool( toolHandle->typeAndName(), tool, this, false ).isSuccess() ) {
418  if ( UNLIKELY( msgLevel( MSG::DEBUG ) ) ) {
419  debug() << "Adding private"
420  << " ToolHandle tool " << tool->name() << " (" << tool->type() << ") from ToolHandleArray "
421  << thArr->propertyName() << endmsg;
422  }
423  m_tools.push_back( tool );
424  } else if ( toolSvc()->retrieveTool( toolHandle->typeAndName(), tool, 0, false ).isSuccess() ) {
425  if ( UNLIKELY( msgLevel( MSG::DEBUG ) ) ) {
426  debug() << "Adding public"
427  << " ToolHandle tool " << tool->name() << " (" << tool->type() << ") from ToolHandleArray "
428  << thArr->propertyName() << endmsg;
429  }
430  m_tools.push_back( tool );
431  } else {
432  warning() << "Error retrieving Tool " << toolHandle->typeAndName() << " in ToolHandleArray "
433  << thArr->propertyName() << ". Not registered" << endmsg;
434  }
435  }
436  }
437  }
438  }
439 
440  for ( auto th : m_toolHandles ) {
441  tool = th->get();
442  if ( tool ) {
443  m_tools.push_back( tool );
444  if ( UNLIKELY( msgLevel( MSG::DEBUG ) ) )
445  debug() << "Adding " << ( th->isPublic() ? "Public" : "Private" ) << " ToolHandle tool " << tool->name() << " ("
446  << tool->type() << ")" << endmsg;
447  } else {
448  if ( UNLIKELY( msgLevel( MSG::DEBUG ) ) ) debug() << "ToolHandle " << th->typeAndName() << " not used" << endmsg;
449  }
450  }
451  m_toolHandlesInit = true;
452 }
bool m_toolHandlesInit
Definition: AlgTool.h:376
bool isPublic() const noexcept
Definition: ToolHandle.h:38
IToolSvc * toolSvc() const
The standard ToolSvc service, Return a pointer to the service if present.
Definition: AlgTool.cpp:104
#define UNLIKELY(x)
Definition: Kernel.h:126
Non-templated base class for actual ToolHandle<T>.
Definition: ToolHandle.h:73
std::vector< IAlgTool * > m_tools
Definition: AlgTool.h:373
T push_back(T...args)
MsgStream & warning() const
shortcut for the method msgStream(MSG::WARNING)
std::vector< BaseToolHandle * > m_toolHandles
Definition: AlgTool.h:374
MsgStream & debug() const
shortcut for the method msgStream(MSG::DEBUG)
The interface implemented by the AlgTool base class.
Definition: IAlgTool.h:23
const IAlgTool * get() const
Definition: ToolHandle.h:90
MSG::Level msgLevel() const
get the output level from the embedded MsgStream
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
std::vector< GaudiHandleArrayBase * > m_toolHandleArrays
Definition: AlgTool.h:375
const DataObjIDColl& AlgTool::inputDataObjs ( ) const
inlineoverride

Definition at line 203 of file AlgTool.h.

203 { return m_inputDataObjs; }
DataObjIDColl m_inputDataObjs
Definition: AlgTool.h:210
virtual std::vector<Gaudi::DataHandle*> AlgTool::inputHandles ( ) const
inlineoverridevirtual

Definition at line 195 of file AlgTool.h.

195 { return m_inputHandles; }
std::vector< Gaudi::DataHandle * > m_inputHandles
Definition: AlgTool.h:209
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 302 of file AlgTool.h.

303  {
304  // If not already located try to locate it without forcing a creation
305  if ( !m_pMonitorSvc ) m_pMonitorSvc = service( m_monitorSvcName, false, true );
306  return m_pMonitorSvc.get();
307  }
SmartIF< IMonitorSvc > m_pMonitorSvc
Online Monitoring Service.
Definition: AlgTool.h:348
TYPE * get() const
Get interface pointer.
Definition: SmartIF.h:76
StatusCode service(const std::string &name, T *&svc, bool createIf=true) const
Access a service by name, creating it if it doesn&#39;t already exist.
Definition: AlgTool.h:129
Gaudi::Property< std::string > m_monitorSvcName
Definition: AlgTool.h:356
const std::string & AlgTool::name ( ) const
override

Retrieve full identifying name of the concrete tool object.

Definition at line 63 of file AlgTool.cpp.

65 {
66  return m_name;
67 }
const std::string m_name
AlgTool full name.
Definition: AlgTool.h:342
const DataObjIDColl& AlgTool::outputDataObjs ( ) const
inlineoverride

Definition at line 204 of file AlgTool.h.

204 { return m_outputDataObjs; }
DataObjIDColl m_outputDataObjs
Definition: AlgTool.h:210
virtual std::vector<Gaudi::DataHandle*> AlgTool::outputHandles ( ) const
inlineoverridevirtual

Definition at line 196 of file AlgTool.h.

196 { return m_outputHandles; }
std::vector< Gaudi::DataHandle * > m_outputHandles
Definition: AlgTool.h:209
const IInterface * AlgTool::parent ( ) const
override

Retrieve parent of the sub-algtool.

Definition at line 77 of file AlgTool.cpp.

79 {
80  return m_parent;
81 }
const IInterface * m_parent
AlgTool parent.
Definition: AlgTool.h:343
StatusCode AlgTool::queryInterface ( const InterfaceID riid,
void **  ppvUnknown 
)
override

Query for a given interface.

Definition at line 44 of file AlgTool.cpp.

46 {
47  if ( !ppvi ) {
48  return StatusCode::FAILURE;
49  } // RETURN
50  StatusCode sc = base_class::queryInterface( riid, ppvi );
51  if ( sc.isSuccess() ) return sc;
53  [&]( const std::pair<InterfaceID, void*>& item ) { return item.first.versionMatch( riid ); } );
54  if ( i == std::end( m_interfaceList ) ) {
55  *ppvi = nullptr;
56  return NO_INTERFACE; // RETURN
57  }
58  *ppvi = i->second;
59  addRef();
60  return SUCCESS; // RETURN
61 }
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:74
T end(T...args)
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
T find_if(T...args)
T begin(T...args)
InterfaceList m_interfaceList
Interface list.
Definition: AlgTool.h:351
StatusCode queryInterface(const InterfaceID &iid, void **pinterface) override
void AlgTool::registerTool ( IAlgTool tool) const
inline

Definition at line 213 of file AlgTool.h.

214  {
215  if ( UNLIKELY( msgLevel( MSG::DEBUG ) ) ) debug() << "Registering tool " << tool->name() << endmsg;
216  m_tools.push_back( tool );
217  }
#define UNLIKELY(x)
Definition: Kernel.h:126
std::vector< IAlgTool * > m_tools
Definition: AlgTool.h:373
T push_back(T...args)
MsgStream & debug() const
shortcut for the method msgStream(MSG::DEBUG)
MSG::Level msgLevel() const
get the output level from the embedded MsgStream
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
virtual const std::string & name() const =0
Retrieve the name of the instance.
StatusCode AlgTool::reinitialize ( )
override

Definition at line 321 of file AlgTool.cpp.

323 {
324  /* @TODO
325  * MCl 2008-10-23: the implementation of reinitialize as finalize+initialize
326  * is causing too many problems
327  *
328  // Default implementation is finalize+initialize
329  StatusCode sc = finalize();
330  if (sc.isFailure()) {
331  error() << "reinitialize(): cannot be finalized" << endmsg;
332  return sc;
333  }
334  sc = initialize();
335  if (sc.isFailure()) {
336  error() << "reinitialize(): cannot be initialized" << endmsg;
337  return sc;
338  }
339  */
340  return StatusCode::SUCCESS;
341 }
StatusCode AlgTool::restart ( )
override

Definition at line 364 of file AlgTool.cpp.

366 {
367  // Default implementation is stop+start
368  StatusCode sc = stop();
369  if ( sc.isFailure() ) {
370  error() << "restart(): cannot be stopped" << endmsg;
371  return sc;
372  }
373  sc = start();
374  if ( sc.isFailure() ) {
375  error() << "restart(): cannot be started" << endmsg;
376  return sc;
377  }
378  return StatusCode::SUCCESS;
379 }
bool isFailure() const
Test for a status code of FAILURE.
Definition: StatusCode.h:84
MsgStream & error() const
shortcut for the method msgStream(MSG::ERROR)
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
StatusCode stop() override
Definition: AlgTool.cpp:272
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
StatusCode start() override
Definition: AlgTool.cpp:249
template<class T >
StatusCode AlgTool::service ( const std::string name,
T *&  svc,
bool  createIf = true 
) const
inline

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

Definition at line 129 of file AlgTool.h.

130  {
131  return service_i( name, createIf, T::interfaceID(), (void**)&svc );
132  }
StatusCode service_i(const std::string &algName, bool createIf, const InterfaceID &iid, void **ppSvc) const
flag indicating whether ToolHandle tools have been added to m_tools
Definition: AlgTool.cpp:470
template<class T >
StatusCode AlgTool::service ( const std::string type,
const std::string name,
T *&  svc 
) const
inline

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

Definition at line 137 of file AlgTool.h.

138  {
139  return service_i( type, name, T::interfaceID(), (void**)&svc );
140  }
StatusCode service_i(const std::string &algName, bool createIf, const InterfaceID &iid, void **ppSvc) const
flag indicating whether ToolHandle tools have been added to m_tools
Definition: AlgTool.cpp:470
SmartIF< IService > AlgTool::service ( const std::string 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 484 of file AlgTool.cpp.

485 {
486  const ServiceLocatorHelper helper( *serviceLocator(), *this );
487  return helper.service( name, quiet, createIf );
488 }
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:84
template<typename T >
SmartIF<T> AlgTool::service ( const std::string name,
const bool  createIf = true,
const bool  quiet = false 
) const
inline

Definition at line 146 of file AlgTool.h.

147  {
148  return SmartIF<T>( service( name, createIf, quiet ) );
149  }
Small smart pointer class with automatic reference counting for IInterface.
Definition: IConverter.h:14
StatusCode service(const std::string &name, T *&svc, bool createIf=true) const
Access a service by name, creating it if it doesn&#39;t already exist.
Definition: AlgTool.h:129
StatusCode AlgTool::service_i ( const std::string 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 470 of file AlgTool.cpp.

471 {
472  const ServiceLocatorHelper helper( *serviceLocator(), *this );
473  return helper.getService( svcName, createIf, iid, ppSvc );
474 }
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:84
StatusCode AlgTool::service_i ( const std::string svcType,
const std::string svcName,
const InterfaceID iid,
void **  ppS 
) const
private

Definition at line 477 of file AlgTool.cpp.

479 {
480  const ServiceLocatorHelper helper( *serviceLocator(), *this );
481  return helper.createService( svcType, svcName, iid, ppSvc );
482 }
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:84
SmartIF< ISvcLocator > & AlgTool::serviceLocator ( ) const
override

Retrieve pointer to service locator.

Definition at line 84 of file AlgTool.cpp.

86 {
87  return m_svcLocator;
88 }
SmartIF< ISvcLocator > m_svcLocator
Pointer to Service Locator service.
Definition: AlgTool.h:345
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  // set first generic Properties
125  StatusCode sc = jos->setMyProperties( getGaudiThreadGenericName( name() ), this );
126  if ( sc.isFailure() ) return StatusCode::FAILURE;
127 
128  // set specific Properties
129  if ( isGaudiThreaded( name() ) ) {
130  if ( jos->setMyProperties( name(), this ).isFailure() ) {
131  return StatusCode::FAILURE;
132  }
133  }
135  return StatusCode::SUCCESS;
136 }
bool isFailure() const
Test for a status code of FAILURE.
Definition: StatusCode.h:84
GAUDI_API bool isGaudiThreaded(const std::string &name)
test if current Gaudi object is running /will run in a thread
Definition: ThreadGaudi.cpp:73
StatusCode service(const Gaudi::Utils::TypeNameString &name, T *&svc, bool createIf=true)
Templated method to access a service by name.
Definition: ISvcLocator.h:78
Main interface for the JobOptions service.
Gaudi::Property< int > m_outputLevel
Definition: AlgTool.h:354
void updateMsgStreamOutputLevel(int level)
Update the output level of the cached MsgStream.
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
const std::string & name() const override
Retrieve full identifying name of the concrete tool object.
Definition: AlgTool.cpp:63
SmartIF< ISvcLocator > m_svcLocator
Pointer to Service Locator service.
Definition: AlgTool.h:345
GAUDI_API std::string getGaudiThreadGenericName(const std::string &name)
helper function to extract Gaudi instance name from thread copy name
Definition: ThreadGaudi.cpp:50
StatusCode AlgTool::start ( )
override

Definition at line 249 of file AlgTool.cpp.

251 {
252  // For the time being there is nothing to be done here.
253  return StatusCode::SUCCESS;
254 }
StatusCode AlgTool::stop ( )
override

Definition at line 272 of file AlgTool.cpp.

274 {
275  // For the time being there is nothing to be done here.
276  return StatusCode::SUCCESS;
277 }
ISvcLocator* AlgTool::svcLoc ( ) const
inline

shortcut for the method service locator

Definition at line 108 of file AlgTool.h.

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

Finalize AlgTool.

Definition at line 280 of file AlgTool.cpp.

281 {
282  //-----------------------------------------------------------------------------
283  return attempt( *this, "sysFinalize", [&]() {
285  Gaudi::Guards::AuditorGuard guard( this,
286  // check if we want to audit the initialize
288  StatusCode sc = finalize();
289  if ( sc.isSuccess() ) m_state = m_targetState;
290  return sc;
291  } );
292 }
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:74
StatusCode finalize() override
Definition: AlgTool.cpp:294
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
Gaudi::StateMachine::State m_state
state of the Tool
Definition: AlgTool.h:383
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...
Definition: StateMachine.cpp:8
Gaudi::StateMachine::State m_targetState
state of the Tool
Definition: AlgTool.h:384
It is a simple guard, which "locks" the scope for the Auditor Service is am exception-safe way...
Definition: Guards.h:214
IAuditorSvc * auditorSvc() const
Access the auditor service.
Definition: AlgTool.cpp:491
Gaudi::Property< bool > m_auditorFinalize
Definition: AlgTool.h:363
StatusCode AlgTool::sysInitialize ( )
override

Initialize AlgTool.

Definition at line 202 of file AlgTool.cpp.

203 {
204  //-----------------------------------------------------------------------------
205  return attempt( *this, "sysInitialize", [&]() {
207  Gaudi::Guards::AuditorGuard guard( this,
208  // check if we want to audit the initialize
210  StatusCode sc = initialize();
211  if ( !sc ) return sc;
212 
215 
216  // visit all sub-tools, build full set
218  acceptDHVisitor(&avis);
219 
220  return sc;
221  } );
222 }
virtual void acceptDHVisitor(IDataHandleVisitor *) const override
Definition: AlgTool.cpp:504
StatusCode initialize() override
Definition: AlgTool.cpp:224
DataObjIDColl m_inputDataObjs
Definition: AlgTool.h:210
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
T get(T...args)
Gaudi::StateMachine::State m_state
state of the Tool
Definition: AlgTool.h:383
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...
Definition: StateMachine.cpp:8
DataObjIDColl m_outputDataObjs
Definition: AlgTool.h:210
Gaudi::Property< bool > m_auditorInitialize
Definition: AlgTool.h:360
Gaudi::StateMachine::State m_targetState
state of the Tool
Definition: AlgTool.h:384
It is a simple guard, which "locks" the scope for the Auditor Service is am exception-safe way...
Definition: Guards.h:214
IAuditorSvc * auditorSvc() const
Access the auditor service.
Definition: AlgTool.cpp:491
std::unique_ptr< IDataHandleVisitor > m_updateDataHandles
Hook for for derived classes to provide a custom visitor for data handles.
Definition: AlgTool.h:282
StatusCode AlgTool::sysReinitialize ( )
override

Initialize AlgTool.

Definition at line 302 of file AlgTool.cpp.

303 {
304  //-----------------------------------------------------------------------------
305 
306  // Check that the current status is the correct one.
308  error() << "sysReinitialize(): cannot reinitialize tool not initialized" << endmsg;
309  return StatusCode::FAILURE;
310  }
311 
312  return attempt( *this, "SysReinitialize()", [&]() {
313  Gaudi::Guards::AuditorGuard guard( this,
314  // check if we want to audit the initialize
316  return reinitialize();
317  } );
318 }
Gaudi::Property< bool > m_auditorReinitialize
Definition: AlgTool.h:364
Gaudi::StateMachine::State FSMState() const override
Definition: AlgTool.h:75
MsgStream & error() const
shortcut for the method msgStream(MSG::ERROR)
StatusCode reinitialize() override
Definition: AlgTool.cpp:321
It is a simple guard, which "locks" the scope for the Auditor Service is am exception-safe way...
Definition: Guards.h:214
IAuditorSvc * auditorSvc() const
Access the auditor service.
Definition: AlgTool.cpp:491
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
StatusCode AlgTool::sysRestart ( )
override

Start AlgTool.

Definition at line 344 of file AlgTool.cpp.

345 {
346  //-----------------------------------------------------------------------------
347 
348  // Check that the current status is the correct one.
350  error() << "sysRestart(): cannot reinitialize tool not started" << endmsg;
351  return StatusCode::FAILURE;
352  }
353 
354  return attempt( *this, "sysRestart", [&]() {
356  Gaudi::Guards::AuditorGuard guard( this,
357  // check if we want to audit the initialize
359  return restart();
360  } );
361 }
Gaudi::StateMachine::State FSMState() const override
Definition: AlgTool.h:75
MsgStream & error() const
shortcut for the method msgStream(MSG::ERROR)
StatusCode restart() override
Definition: AlgTool.cpp:364
Gaudi::Property< bool > m_auditorRestart
Definition: AlgTool.h:365
Gaudi::StateMachine::State m_state
state of the Tool
Definition: AlgTool.h:383
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...
Definition: StateMachine.cpp:8
Gaudi::StateMachine::State m_targetState
state of the Tool
Definition: AlgTool.h:384
It is a simple guard, which "locks" the scope for the Auditor Service is am exception-safe way...
Definition: Guards.h:214
IAuditorSvc * auditorSvc() const
Access the auditor service.
Definition: AlgTool.cpp:491
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
StatusCode AlgTool::sysStart ( )
override

Start AlgTool.

Definition at line 234 of file AlgTool.cpp.

235 {
236  //-----------------------------------------------------------------------------
237  return attempt( *this, "sysStart", [&]() {
239  Gaudi::Guards::AuditorGuard guard( this,
240  // check if we want to audit the initialize
241  m_auditorStart ? auditorSvc() : nullptr, IAuditor::Start );
242  StatusCode sc = start();
243  if ( sc.isSuccess() ) m_state = m_targetState;
244  return sc;
245  } );
246 }
Gaudi::Property< bool > m_auditorStart
Definition: AlgTool.h:361
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:74
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
Gaudi::StateMachine::State m_state
state of the Tool
Definition: AlgTool.h:383
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...
Definition: StateMachine.cpp:8
Gaudi::StateMachine::State m_targetState
state of the Tool
Definition: AlgTool.h:384
It is a simple guard, which "locks" the scope for the Auditor Service is am exception-safe way...
Definition: Guards.h:214
IAuditorSvc * auditorSvc() const
Access the auditor service.
Definition: AlgTool.cpp:491
StatusCode start() override
Definition: AlgTool.cpp:249
StatusCode AlgTool::sysStop ( )
override

Stop AlgTool.

Definition at line 257 of file AlgTool.cpp.

258 {
259  //-----------------------------------------------------------------------------
260  return attempt( *this, "sysStop", [&]() {
262  Gaudi::Guards::AuditorGuard guard( this,
263  // check if we want to audit the initialize
264  m_auditorStop ? auditorSvc() : nullptr, IAuditor::Stop );
265  StatusCode sc = stop();
266  if ( sc.isSuccess() ) m_state = m_targetState;
267  return sc;
268  } );
269 }
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:74
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
Gaudi::Property< bool > m_auditorStop
Definition: AlgTool.h:362
Gaudi::StateMachine::State m_state
state of the Tool
Definition: AlgTool.h:383
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...
Definition: StateMachine.cpp:8
StatusCode stop() override
Definition: AlgTool.cpp:272
Gaudi::StateMachine::State m_targetState
state of the Tool
Definition: AlgTool.h:384
It is a simple guard, which "locks" the scope for the Auditor Service is am exception-safe way...
Definition: Guards.h:214
IAuditorSvc * auditorSvc() const
Access the auditor service.
Definition: AlgTool.cpp:491
Gaudi::StateMachine::State AlgTool::targetFSMState ( ) const
inlineoverride

Definition at line 76 of file AlgTool.h.

76 { return m_targetState; }
Gaudi::StateMachine::State m_targetState
state of the Tool
Definition: AlgTool.h:384
StatusCode AlgTool::terminate ( )
inlineoverride

Definition at line 72 of file AlgTool.h.

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

Definition at line 454 of file AlgTool.cpp.

455 {
457 
458  return m_tools;
459 }
bool m_toolHandlesInit
Definition: AlgTool.h:376
#define UNLIKELY(x)
Definition: Kernel.h:126
std::vector< IAlgTool * > m_tools
Definition: AlgTool.h:373
void initToolHandles() const
Definition: AlgTool.cpp:390
std::vector< IAlgTool * > & AlgTool::tools ( )
protected

Definition at line 461 of file AlgTool.cpp.

462 {
464 
465  return m_tools;
466 }
bool m_toolHandlesInit
Definition: AlgTool.h:376
#define UNLIKELY(x)
Definition: Kernel.h:126
std::vector< IAlgTool * > m_tools
Definition: AlgTool.h:373
void initToolHandles() const
Definition: AlgTool.cpp:390
IToolSvc * AlgTool::toolSvc ( ) const

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

Definition at line 104 of file AlgTool.cpp.

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

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

Definition at line 70 of file AlgTool.cpp.

72 {
73  return m_type;
74 }
std::string m_type
AlgTool type (concrete class name)
Definition: AlgTool.h:341

Member Data Documentation

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

Definition at line 359 of file AlgTool.h.

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

Definition at line 363 of file AlgTool.h.

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

Definition at line 360 of file AlgTool.h.

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

Definition at line 364 of file AlgTool.h.

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

Definition at line 365 of file AlgTool.h.

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

Definition at line 361 of file AlgTool.h.

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

Definition at line 362 of file AlgTool.h.

SmartIF<IDataProviderSvc> AlgTool::m_evtSvc
mutableprivate

Event data service.

Definition at line 346 of file AlgTool.h.

Gaudi::Property<DataObjIDColl> AlgTool::m_extInputDataObjs {this, "ExtraInputs", DataObjIDColl{}, "[[deprecated]]"}
private

Definition at line 367 of file AlgTool.h.

Gaudi::Property<DataObjIDColl> AlgTool::m_extOutputDataObjs {this, "ExtraOutputs", DataObjIDColl{}, "[[deprecated]]"}
private

Definition at line 368 of file AlgTool.h.

DataObjIDColl AlgTool::m_inputDataObjs
private

Definition at line 210 of file AlgTool.h.

std::vector<Gaudi::DataHandle *> AlgTool::m_inputHandles
private

Definition at line 209 of file AlgTool.h.

InterfaceList AlgTool::m_interfaceList
private

Interface list.

Definition at line 351 of file AlgTool.h.

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

Definition at line 356 of file AlgTool.h.

const std::string AlgTool::m_name
private

AlgTool full name.

Definition at line 342 of file AlgTool.h.

DataObjIDColl AlgTool::m_outputDataObjs
private

Definition at line 210 of file AlgTool.h.

std::vector<Gaudi::DataHandle *> AlgTool::m_outputHandles
private

Definition at line 209 of file AlgTool.h.

Gaudi::Property<int> AlgTool::m_outputLevel {this, "OutputLevel", MSG::NIL, "output level"}
private

Definition at line 354 of file AlgTool.h.

const IInterface* AlgTool::m_parent = nullptr
private

AlgTool parent.

Definition at line 343 of file AlgTool.h.

SmartIF<IAuditorSvc> AlgTool::m_pAuditorSvc
mutableprivate

Auditor Service.

Definition at line 349 of file AlgTool.h.

SmartIF<IMonitorSvc> AlgTool::m_pMonitorSvc
mutableprivate

Online Monitoring Service.

Definition at line 348 of file AlgTool.h.

SmartIF<IToolSvc> AlgTool::m_ptoolSvc
mutableprivate

Tool service.

Definition at line 347 of file AlgTool.h.

state of the Tool

Definition at line 383 of file AlgTool.h.

SmartIF<ISvcLocator> AlgTool::m_svcLocator
mutableprivate

Pointer to Service Locator service.

Definition at line 345 of file AlgTool.h.

state of the Tool

Definition at line 384 of file AlgTool.h.

std::string AlgTool::m_threadID
private

Thread Id for Alg Tool.

Definition at line 370 of file AlgTool.h.

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

Definition at line 375 of file AlgTool.h.

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

Definition at line 374 of file AlgTool.h.

bool AlgTool::m_toolHandlesInit = false
mutableprivate

Definition at line 376 of file AlgTool.h.

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

Definition at line 373 of file AlgTool.h.

std::string AlgTool::m_type
private

AlgTool type (concrete class name)

Definition at line 341 of file AlgTool.h.

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

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

Definition at line 282 of file AlgTool.h.


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