| The Gaudi Framework v32r1 (f65d50dc)

AlgTool.cpp
Go to the documentation of this file.
1 // Include files
2 #include "GaudiKernel/AlgTool.h"
3 #include "GaudiKernel/IDataManagerSvc.h"
4 #include "GaudiKernel/IJobOptionsSvc.h"
5 #include "GaudiKernel/IMessageSvc.h"
6 #include "GaudiKernel/ISvcLocator.h"
7
8 #include "GaudiKernel/Auditor.h"
9 #include "GaudiKernel/DataHandleHolderVisitor.h"
10 #include "GaudiKernel/GaudiException.h"
11 #include "GaudiKernel/Guards.h"
12 #include "GaudiKernel/Service.h"
13 #include "GaudiKernel/ServiceLocatorHelper.h"
14 #include "GaudiKernel/System.h"
15 #include "GaudiKernel/ToolHandle.h"
16 #include <Gaudi/Algorithm.h>
17
18 //------------------------------------------------------------------------------
19 namespace {
20 template <typename FUN>
21 StatusCode attempt( AlgTool& tool, const char* label, FUN&& fun ) {
22 try {
23 return fun();
24 } catch ( const GaudiException& Exception ) {
25 MsgStream log( tool.msgSvc(), tool.name() + "." + label );
26 log << MSG::FATAL << " Exception with tag=" << Exception.tag() << " is caught" << endmsg;
27 log << MSG::ERROR << Exception << endmsg;
28 } catch ( const std::exception& Exception ) {
29 MsgStream log( tool.msgSvc(), tool.name() + "." + label );
30 log << MSG::FATAL << " Standard std::exception is caught" << endmsg;
31 log << MSG::ERROR << Exception.what() << endmsg;
32 } catch ( ... ) {
33 MsgStream log( tool.msgSvc(), tool.name() + "." + label );
34 log << MSG::FATAL << "UNKNOWN Exception is caught" << endmsg;
35 }
36 return StatusCode::FAILURE;
37 }
38 } // namespace
39
40 //------------------------------------------------------------------------------
41 StatusCode AlgTool::queryInterface( const InterfaceID& riid, void** ppvi )
42 //------------------------------------------------------------------------------
43 {
44 if ( !ppvi ) { return StatusCode::FAILURE; } // RETURN
45 StatusCode sc = base_class::queryInterface( riid, ppvi );
46 if ( sc.isSuccess() ) return sc;
47 auto i = std::find_if( std::begin( m_interfaceList ), std::end( m_interfaceList ),
48 [&]( const std::pair<InterfaceID, void*>& item ) { return item.first.versionMatch( riid ); } );
49 if ( i == std::end( m_interfaceList ) ) {
50 *ppvi = nullptr;
51 return Status::NO_INTERFACE; // RETURN
52 }
53 *ppvi = i->second;
54 addRef();
55 return StatusCode::SUCCESS; // RETURN
56 }
57 //------------------------------------------------------------------------------
58 const std::string& AlgTool::name() const
59 //------------------------------------------------------------------------------
60 {
61 return m_name;
62 }
63
64 //------------------------------------------------------------------------------
65 const std::string& AlgTool::type() const
66 //------------------------------------------------------------------------------
67 {
68 return m_type;
69 }
70
71 //------------------------------------------------------------------------------
72 const IInterface* AlgTool::parent() const
73 //------------------------------------------------------------------------------
74 {
75 return m_parent;
76 }
77
78 //------------------------------------------------------------------------------
79 SmartIF<ISvcLocator>& AlgTool::serviceLocator() const
80 //------------------------------------------------------------------------------
81 {
82 return m_svcLocator;
83 }
84
85 // ============================================================================
86 // accessor to event service service
87 // ============================================================================
88 IDataProviderSvc* AlgTool::evtSvc() const {
89 if ( !m_evtSvc ) {
90 m_evtSvc = service( "EventDataSvc", true );
91 if ( !m_evtSvc ) { throw GaudiException( "Service [EventDataSvc] not found", name(), StatusCode::FAILURE ); }
92 }
93 return m_evtSvc.get();
94 }
95 //------------------------------------------------------------------------------
96 IToolSvc* AlgTool::toolSvc() const
97 //------------------------------------------------------------------------------
98 {
99 if ( !m_ptoolSvc ) {
100 m_ptoolSvc = service( "ToolSvc", true );
101 if ( !m_ptoolSvc ) { throw GaudiException( "Service [ToolSvc] not found", name(), StatusCode::FAILURE ); }
102 }
103 return m_ptoolSvc.get();
104 }
105
106 //------------------------------------------------------------------------------
107 StatusCode AlgTool::setProperties()
108 //------------------------------------------------------------------------------
109 {
110 if ( !m_svcLocator ) return StatusCode::FAILURE;
111 auto jos = m_svcLocator->service<IJobOptionsSvc>( "JobOptionsSvc" );
112 if ( !jos ) return StatusCode::FAILURE;
113
114 return jos->setMyProperties( name(), this );
115 }
116
117 //------------------------------------------------------------------------------
118 AlgTool::AlgTool( const std::string& type, const std::string& name, const IInterface* parent )
119 //------------------------------------------------------------------------------
120 : m_type( type ), m_name( name ), m_parent( parent ) {
121 addRef(); // Initial count set to 1
122
123 IInterface* _p = const_cast<IInterface*>( parent );
124
125 if ( Gaudi::Algorithm* _alg = dynamic_cast<Gaudi::Algorithm*>( _p ) ) {
126 m_svcLocator = _alg->serviceLocator();
127 } else if ( Service* _svc = dynamic_cast<Service*>( _p ) ) {
128 m_svcLocator = _svc->serviceLocator();
129 } else if ( AlgTool* _too = dynamic_cast<AlgTool*>( _p ) ) {
130 m_svcLocator = _too->serviceLocator();
131 } else if ( Auditor* _aud = dynamic_cast<Auditor*>( _p ) ) {
132 m_svcLocator = _aud->serviceLocator();
133 } else {
134 throw GaudiException( "Failure to create tool '" + type + "/" + name + "': illegal parent type '" +
135 System::typeinfoName( typeid( *_p ) ) + "'",
136 "AlgTool", StatusCode::FAILURE );
137 }
138
139 // inherit output level from parent
140 { // get the "OutputLevel" property from parent
141 SmartIF<IProperty> pprop( _p );
142 if ( pprop && pprop->hasProperty( "OutputLevel" ) ) { m_outputLevel.assign( pprop->getProperty( "OutputLevel" ) ); }
143 }
144
145 {
146 // Auditor monitoring properties
147 // Initialize the default value from ApplicationMgr AuditAlgorithms
148 Gaudi::Property<bool> audit( false );
149 // note that here we need that the service locator is already defined
150 auto appMgr = serviceLocator()->service<IProperty>( "ApplicationMgr" );
151 if ( appMgr && appMgr->hasProperty( "AuditTools" ) ) { audit.assign( appMgr->getProperty( "AuditTools" ) ); }
152 m_auditInit = audit;
153 m_auditorInitialize = audit;
154 m_auditorStart = audit;
155 m_auditorStop = audit;
156 m_auditorFinalize = audit;
157 m_auditorReinitialize = audit;
158 m_auditorRestart = audit;
159 }
160 }
161
162 //-----------------------------------------------------------------------------
163 StatusCode AlgTool::sysInitialize() {
164 //-----------------------------------------------------------------------------
165 return attempt( *this, "sysInitialize", [&]() {
166 m_targetState = Gaudi::StateMachine::ChangeState( Gaudi::StateMachine::INITIALIZE, m_state );
167 Gaudi::Guards::AuditorGuard guard( this,
168 // check if we want to audit the initialize
169 m_auditorInitialize ? auditorSvc() : nullptr, IAuditor::Initialize );
170 StatusCode sc = initialize();
171 if ( !sc ) return sc;
172
173 m_state = m_targetState;
174 if ( m_updateDataHandles ) acceptDHVisitor( m_updateDataHandles.get() );
175
176 // check for explicit circular data dependencies in declared handles
177 DataObjIDColl out;
178 for ( auto& h : outputHandles() ) {
179 if ( !h->objKey().empty() ) out.emplace( h->fullKey() );
180 }
181 for ( auto& h : inputHandles() ) {
182 if ( !h->objKey().empty() && out.find( h->fullKey() ) != out.end() ) {
183 error() << "Explicit circular data dependency found for id " << h->fullKey() << endmsg;
184 sc = StatusCode::FAILURE;
185 }
186 }
187
188 if ( !sc ) return sc;
189
190 // visit all sub-tools, build full set
191 DHHVisitor avis( m_inputDataObjs, m_outputDataObjs );
192 acceptDHVisitor( &avis );
193
194 // initialize handles
195 initDataHandleHolder(); // this should 'freeze' the handle configuration.
196
197 return sc;
198 } );
199 }
200 //------------------------------------------------------------------------------
201 StatusCode AlgTool::initialize()
202 //------------------------------------------------------------------------------
203 {
204 // For the time being there is nothing to be done here.
205 // Setting the properties is done by the ToolSvc calling setProperties()
206 // explicitly.
207 return StatusCode::SUCCESS;
208 }
209
210 //-----------------------------------------------------------------------------
211 StatusCode AlgTool::sysStart() {
212 //-----------------------------------------------------------------------------
213 return attempt( *this, "sysStart", [&]() {
214 m_targetState = Gaudi::StateMachine::ChangeState( Gaudi::StateMachine::START, m_state );
215 Gaudi::Guards::AuditorGuard guard( this,
216 // check if we want to audit the initialize
217 m_auditorStart ? auditorSvc() : nullptr, IAuditor::Start );
218 StatusCode sc = start();
219 if ( sc.isSuccess() ) m_state = m_targetState;
220 return sc;
221 } );
222 }
223
224 //------------------------------------------------------------------------------
225 StatusCode AlgTool::start()
226 //------------------------------------------------------------------------------
227 {
228 // For the time being there is nothing to be done here.
229 return StatusCode::SUCCESS;
230 }
231
232 //-----------------------------------------------------------------------------
233 StatusCode AlgTool::sysStop() {
234 //-----------------------------------------------------------------------------
235 return attempt( *this, "sysStop", [&]() {
236 m_targetState = Gaudi::StateMachine::ChangeState( Gaudi::StateMachine::STOP, m_state );
237 Gaudi::Guards::AuditorGuard guard( this,
238 // check if we want to audit the initialize
239 m_auditorStop ? auditorSvc() : nullptr, IAuditor::Stop );
240 StatusCode sc = stop();
241 if ( sc.isSuccess() ) m_state = m_targetState;
242 return sc;
243 } );
244 }
245
246 //------------------------------------------------------------------------------
247 StatusCode AlgTool::stop()
248 //------------------------------------------------------------------------------
249 {
250 // For the time being there is nothing to be done here.
251 return StatusCode::SUCCESS;
252 }
253
254 //-----------------------------------------------------------------------------
255 StatusCode AlgTool::sysFinalize() {
256 //-----------------------------------------------------------------------------
257 return attempt( *this, "sysFinalize", [&]() {
258 m_targetState = Gaudi::StateMachine::ChangeState( Gaudi::StateMachine::FINALIZE, m_state );
259 Gaudi::Guards::AuditorGuard guard( this,
260 // check if we want to audit the initialize
261 m_auditorFinalize ? auditorSvc() : nullptr, IAuditor::Finalize );
262 StatusCode sc = finalize();
263 if ( sc.isSuccess() ) m_state = m_targetState;
264 return sc;
265 } );
266 }
267 //------------------------------------------------------------------------------
268 StatusCode AlgTool::finalize()
269 //------------------------------------------------------------------------------
270 {
271 // For the time being there is nothing to be done here.
272 return StatusCode::SUCCESS;
273 }
274
275 //-----------------------------------------------------------------------------
276 StatusCode AlgTool::sysReinitialize() {
277 //-----------------------------------------------------------------------------
278
279 // Check that the current status is the correct one.
280 if ( Gaudi::StateMachine::INITIALIZED != FSMState() ) {
281 error() << "sysReinitialize(): cannot reinitialize tool not initialized" << endmsg;
282 return StatusCode::FAILURE;
283 }
284
285 return attempt( *this, "SysReinitialize()", [&]() {
286 Gaudi::Guards::AuditorGuard guard( this,
287 // check if we want to audit the initialize
288 m_auditorReinitialize ? auditorSvc() : nullptr, IAuditor::ReInitialize );
289 return reinitialize();
290 } );
291 }
292
293 //------------------------------------------------------------------------------
294 StatusCode AlgTool::reinitialize()
295 //------------------------------------------------------------------------------
296 {
297 /* @TODO
298 * MCl 2008-10-23: the implementation of reinitialize as finalize+initialize
299 * is causing too many problems
300 *
301 // Default implementation is finalize+initialize
302 StatusCode sc = finalize();
303 if (sc.isFailure()) {
304 error() << "reinitialize(): cannot be finalized" << endmsg;
305 return sc;
306 }
307 sc = initialize();
308 if (sc.isFailure()) {
309 error() << "reinitialize(): cannot be initialized" << endmsg;
310 return sc;
311 }
312 */
313 return StatusCode::SUCCESS;
314 }
315
316 //-----------------------------------------------------------------------------
317 StatusCode AlgTool::sysRestart() {
318 //-----------------------------------------------------------------------------
319
320 // Check that the current status is the correct one.
321 if ( Gaudi::StateMachine::RUNNING != FSMState() ) {
322 error() << "sysRestart(): cannot reinitialize tool not started" << endmsg;
323 return StatusCode::FAILURE;
324 }
325
326 return attempt( *this, "sysRestart", [&]() {
327 m_targetState = Gaudi::StateMachine::ChangeState( Gaudi::StateMachine::START, m_state );
328 Gaudi::Guards::AuditorGuard guard( this,
329 // check if we want to audit the initialize
330 m_auditorRestart ? auditorSvc() : nullptr, IAuditor::ReStart );
331 return restart();
332 } );
333 }
334
335 //------------------------------------------------------------------------------
336 StatusCode AlgTool::restart()
337 //------------------------------------------------------------------------------
338 {
339 // Default implementation is stop+start
340 StatusCode sc = stop();
341 if ( sc.isFailure() ) {
342 error() << "restart(): cannot be stopped" << endmsg;
343 return sc;
344 }
345 sc = start();
346 if ( sc.isFailure() ) {
347 error() << "restart(): cannot be started" << endmsg;
348 return sc;
349 }
350 return StatusCode::SUCCESS;
351 }
352
353 //------------------------------------------------------------------------------
354 AlgTool::~AlgTool()
355 //------------------------------------------------------------------------------
356 {
357 if ( m_pMonitorSvc ) { m_pMonitorSvc->undeclareAll( this ); }
358 }
359
360 void AlgTool::initToolHandles() const {
361
362 IAlgTool* tool = nullptr;
363 for ( auto thArr : m_toolHandleArrays ) {
364 if ( !thArr->retrieved() ) {
365 if ( UNLIKELY( msgLevel( MSG::DEBUG ) ) )
366 debug() << "ToolHandleArray " << thArr->propertyName() << " not used: not registering any of its Tools"
367 << endmsg;
368 } else {
369 if ( UNLIKELY( msgLevel( MSG::DEBUG ) ) )
370 debug() << "Registering all Tools in ToolHandleArray " << thArr->propertyName() << endmsg;
371 // Iterate over its tools:
372 for ( auto toolHandle : thArr->getBaseArray() ) {
373 // Try to cast it into a BaseToolHandle pointer:
374 BaseToolHandle* bth = dynamic_cast<BaseToolHandle*>( toolHandle );
375 if ( bth ) {
376 // If the cast was successful, the code is pretty simple:
377 tool = bth->get();
378 if ( UNLIKELY( msgLevel( MSG::DEBUG ) ) ) {
379 debug() << "Adding " << ( bth->isPublic() ? "public" : "private" ) << " ToolHandle tool " << tool->name()
380 << " (" << tool->type() << ") from ToolHandleArray " << thArr->propertyName() << endmsg;
381 }
382 m_tools.push_back( tool );
383 } else {
384 // If it wasn't for some strange reason, then fall back on the
385 // logic implemented previously:
386 if ( toolSvc()->retrieveTool( toolHandle->typeAndName(), tool, this, false ).isSuccess() ) {
387 if ( UNLIKELY( msgLevel( MSG::DEBUG ) ) ) {
388 debug() << "Adding private"
389 << " ToolHandle tool " << tool->name() << " (" << tool->type() << ") from ToolHandleArray "
390 << thArr->propertyName() << endmsg;
391 }
392 m_tools.push_back( tool );
393 } else if ( toolSvc()->retrieveTool( toolHandle->typeAndName(), tool, 0, false ).isSuccess() ) {
394 if ( UNLIKELY( msgLevel( MSG::DEBUG ) ) ) {
395 debug() << "Adding public"
396 << " ToolHandle tool " << tool->name() << " (" << tool->type() << ") from ToolHandleArray "
397 << thArr->propertyName() << endmsg;
398 }
399 m_tools.push_back( tool );
400 } else {
401 warning() << "Error retrieving Tool " << toolHandle->typeAndName() << " in ToolHandleArray "
402 << thArr->propertyName() << ". Not registered" << endmsg;
403 }
404 }
405 }
406 }
407 }
408
409 for ( auto th : m_toolHandles ) {
410 if ( !th->isEnabled() ) {
411 if ( UNLIKELY( msgLevel( MSG::DEBUG ) ) && !th->typeAndName().empty() )
412 debug() << "ToolHandle " << th->typeAndName() << " not used" << endmsg;
413 continue;
414 }
415 if ( !th->get() ) {
416 auto sc = th->retrieve();
417 if ( UNLIKELY( sc.isFailure() ) ) {
418 throw GaudiException( "Failed to retrieve tool " + th->typeAndName(), this->name(), StatusCode::FAILURE );
419 }
420 }
421 tool = th->get();
422 if ( UNLIKELY( msgLevel( MSG::DEBUG ) ) )
423 debug() << "Adding " << ( th->isPublic() ? "public" : "private" ) << " ToolHandle tool " << tool->name() << " ("
424 << tool->type() << ")" << endmsg;
425 m_tools.push_back( tool );
426 }
427 m_toolHandlesInit = true;
428 }
429
430 const std::vector<IAlgTool*>& AlgTool::tools() const {
431 if ( UNLIKELY( !m_toolHandlesInit ) ) initToolHandles();
432
433 return m_tools;
434 }
435
436 std::vector<IAlgTool*>& AlgTool::tools() {
437 if ( UNLIKELY( !m_toolHandlesInit ) ) initToolHandles();
438
439 return m_tools;
440 }
441
442 //------------------------------------------------------------------------------
444 StatusCode AlgTool::service_i( const std::string& svcName, bool createIf, const InterfaceID& iid, void** ppSvc ) const {
445 const ServiceLocatorHelper helper( *serviceLocator(), *this );
446 return helper.getService( svcName, createIf, iid, ppSvc );
447 }
448
449 //------------------------------------------------------------------------------
450 StatusCode AlgTool::service_i( const std::string& svcType, const std::string& svcName, const InterfaceID& iid,
451 void** ppSvc ) const {
452 const ServiceLocatorHelper helper( *serviceLocator(), *this );
453 return helper.createService( svcType, svcName, iid, ppSvc );
454 }
455
456 SmartIF<IService> AlgTool::service( const std::string& name, const bool createIf, const bool quiet ) const {
457 const ServiceLocatorHelper helper( *serviceLocator(), *this );
458 return helper.service( name, quiet, createIf );
459 }
460
461 //-----------------------------------------------------------------------------
462 IAuditorSvc* AlgTool::auditorSvc() const {
463 //---------------------------------------------------------------------------
464 if ( !m_pAuditorSvc ) {
465 m_pAuditorSvc = service( "AuditorSvc", true );
466 if ( !m_pAuditorSvc ) { throw GaudiException( "Service [AuditorSvc] not found", name(), StatusCode::FAILURE ); }
467 }
468 return m_pAuditorSvc.get();
469 }
470
471 //-----------------------------------------------------------------------------
472 void AlgTool::acceptDHVisitor( IDataHandleVisitor* vis ) const {
473 //-----------------------------------------------------------------------------
474 vis->visit( this );
475
476 for ( auto tool : tools() ) vis->visit( dynamic_cast<AlgTool*>( tool ) );
477 }
DataHandleHolderBase< PropertyHolder< CommonMessaging< implements< IAlgTool, IDataHandleHolder, IProperty, IStateful > > > >::inputHandles
std::vector< Gaudi::DataHandle * > inputHandles() const override
Definition: DataHandleHolderBase.h:28
IAuditor::Start
Definition: IAuditor.h:24
System.h
AlgTool::initToolHandles
void initToolHandles() const
Definition: AlgTool.cpp:360
IToolSvc
The interface implemented by the IToolSvc base class.
Definition: IToolSvc.h:19
UNLIKELY
#define UNLIKELY(x)
Definition: Kernel.h:96
MsgStream
Definition of the MsgStream class used to transmit messages.
Definition: MsgStream.h:24
ServiceLocatorHelper
an helper to share the implementation of service() among the various kernel base classes
Definition: ServiceLocatorHelper.h:17
Gaudi::StateMachine::INITIALIZED
Definition: StateMachine.h:15
AlgTool::m_pMonitorSvc
SmartIF< IMonitorSvc > m_pMonitorSvc
Online Monitoring Service.
Definition: AlgTool.h:285
SmartIF< ISvcLocator >
GaudiException
Define general base for Gaudi exception.
Definition: GaudiException.h:21
AlgTool::m_auditorStart
Gaudi::Property< bool > m_auditorStart
Definition: AlgTool.h:302
CommonMessagingBase::msgSvc
const SmartIF< IMessageSvc > & msgSvc() const
The standard message service.
Definition: CommonMessaging.h:68
ServiceLocatorHelper::createService
StatusCode createService(const std::string &name, const InterfaceID &iid, void **ppSvc) const
Definition: ServiceLocatorHelper.cpp:21
AlgTool::m_toolHandlesInit
bool m_toolHandlesInit
Definition: AlgTool.h:312
AlgTool::m_type
std::string m_type
AlgTool type (concrete class name)
Definition: AlgTool.h:278
gaudiComponentHelp.name
name
Definition: gaudiComponentHelp.py:41
Gaudi::Property
Implementation of property with value of concrete type.
Definition: Property.h:352
IAuditor::Stop
Definition: IAuditor.h:24
AlgTool::initialize
StatusCode initialize() override
Definition: AlgTool.cpp:201
CommonMessagingBase::warning
MsgStream & warning() const
shortcut for the method msgStream(MSG::WARNING)
Definition: CommonMessaging.h:101
System::typeinfoName
GAUDI_API const std::string typeinfoName(const std::type_info &)
Get platform independent information about the class type.
Definition: System.cpp:298
Gaudi::StateMachine::FINALIZE
Definition: StateMachine.h:28
ServiceLocatorHelper::getService
StatusCode getService(const std::string &name, bool createIf, const InterfaceID &iid, void **ppSvc) const
Definition: ServiceLocatorHelper.h:41
IAuditor::ReInitialize
Definition: IAuditor.h:24
AlgTool.h
MSG::DEBUG
Definition: IMessageSvc.h:15
GaudiException::tag
virtual const std::string & tag() const
name tag for the exception, or exception type
Definition: GaudiException.h:67
AlgTool::m_parent
const IInterface * m_parent
AlgTool parent.
Definition: AlgTool.h:280
StatusCode::SUCCESS
constexpr static const auto SUCCESS
Definition: StatusCode.h:85
BaseToolHandle
Non-templated base class for actual ToolHandle<T>.
Definition: ToolHandle.h:69
DataHandleHolderBase< PropertyHolder< CommonMessaging< implements< IAlgTool, IDataHandleHolder, IProperty, IStateful > > > >::initDataHandleHolder
void initDataHandleHolder()
initializes all handles - called by the sysInitialize method of any descendant of this
Definition: DataHandleHolderBase.h:67
AlgTool::sysReinitialize
StatusCode sysReinitialize() override
Initialize AlgTool.
Definition: AlgTool.cpp:276
std::end
T end(T... args)
AlgTool::m_auditorReinitialize
Gaudi::Property< bool > m_auditorReinitialize
Definition: AlgTool.h:305
IDataProviderSvc
Data provider interface definition.
Definition: IDataProviderSvc.h:43
AlgTool::~AlgTool
~AlgTool() override
Definition: AlgTool.cpp:354
AlgTool::m_tools
std::vector< IAlgTool * > m_tools
Definition: AlgTool.h:309
SmartIF::get
TYPE * get() const
Get interface pointer.
Definition: SmartIF.h:76
AlgTool::queryInterface
StatusCode queryInterface(const InterfaceID &riid, void **ppvUnknown) override
Query for a given interface.
Definition: AlgTool.cpp:41
IAuditor::ReStart
Definition: IAuditor.h:24
AlgTool::setProperties
StatusCode setProperties()
Method for setting declared properties to the values specified in the jobOptions via the job option s...
Definition: AlgTool.cpp:107
AlgTool::sysStart
StatusCode sysStart() override
Start AlgTool.
Definition: AlgTool.cpp:211
AlgTool::FSMState
Gaudi::StateMachine::State FSMState() const override
Definition: AlgTool.h:74
CommonMessaging< implements< IAlgTool, IDataHandleHolder, IProperty, IStateful > >::msgLevel
MSG::Level msgLevel() const
get the cached level (originally extracted from the embedded MsgStream)
Definition: CommonMessaging.h:138
INamedInterface::name
virtual const std::string & name() const =0
Retrieve the name of the instance.
std::string
STL class.
AlgTool::sysStop
StatusCode sysStop() override
Stop AlgTool.
Definition: AlgTool.cpp:233
AlgTool::service_i
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:444
Service.h
AlgTool::serviceLocator
SmartIF< ISvcLocator > & serviceLocator() const override
Retrieve pointer to service locator.
Definition: AlgTool.cpp:79
AlgTool::finalize
StatusCode finalize() override
Definition: AlgTool.cpp:268
AlgTool::m_name
const std::string m_name
AlgTool full name.
Definition: AlgTool.h:279
MSG::FATAL
Definition: IMessageSvc.h:15
IDataHandleVisitor::visit
virtual void visit(const IDataHandleHolder *)=0
ISvcLocator::service
StatusCode service(const Gaudi::Utils::TypeNameString &name, T *&svc, bool createIf=true)
Templated method to access a service by name.
Definition: ISvcLocator.h:76
std::vector::push_back
T push_back(T... args)
InterfaceID
Interface ID class.
Definition: IInterface.h:29
AlgTool::AlgTool
AlgTool(const std::string &type, const std::string &name, const IInterface *parent)
Standard Constructor.
Definition: AlgTool.cpp:118
Gaudi::StateMachine::INITIALIZE
Definition: StateMachine.h:25
DataHandleHolderBase< PropertyHolder< CommonMessaging< implements< IAlgTool, IDataHandleHolder, IProperty, IStateful > > > >::m_inputDataObjs
DataObjIDColl m_inputDataObjs
Definition: DataHandleHolderBase.h:71
CommonMessagingBase::error
MsgStream & error() const
shortcut for the method msgStream(MSG::ERROR)
Definition: CommonMessaging.h:98
IDataManagerSvc.h
IJobOptionsSvc
Main interface for the JobOptions service.
Definition: IJobOptionsSvc.h:20
std::exception::what
T what(T... args)
AlgTool::auditorSvc
IAuditorSvc * auditorSvc() const
Access the auditor service.
Definition: AlgTool.cpp:462
Algorithm.h
AlgTool::m_outputLevel
Gaudi::Property< int > m_outputLevel
Definition: AlgTool.h:292
StatusCode
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:50
ToolHandleInfo::isPublic
bool isPublic() const noexcept
Definition: ToolHandle.h:40
GaudiException.h
IInterface
Definition of the basic interface.
Definition: IInterface.h:244
gaudirun.type
type
Definition: gaudirun.py:142
IAuditor::Finalize
Definition: IAuditor.h:24
IProperty::hasProperty
virtual bool hasProperty(const std::string &name) const =0
Return true if we have a property with the given name.
AlgTool::m_auditorStop
Gaudi::Property< bool > m_auditorStop
Definition: AlgTool.h:303
IProperty::getProperty
virtual StatusCode getProperty(Gaudi::Details::PropertyBase *p) const =0
Get the property by property.
Guards.h
DHHVisitor
Definition: DataHandleHolderVisitor.h:8
CommonMessagingBase::debug
MsgStream & debug() const
shortcut for the method msgStream(MSG::DEBUG)
Definition: CommonMessaging.h:107
AlgTool::service
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.
Definition: AlgTool.h:128
std::unordered_set< DataObjID, DataObjID_Hasher >
AlgTool::restart
StatusCode restart() override
Definition: AlgTool.cpp:336
IMessageSvc.h
DataHandleHolderVisitor.h
AlgTool::tools
const std::vector< IAlgTool * > & tools() const
Definition: AlgTool.cpp:430
AlgTool::m_ptoolSvc
SmartIF< IToolSvc > m_ptoolSvc
Tool service.
Definition: AlgTool.h:284
ServiceLocatorHelper::service
SmartIF< IService > service(const std::string &name, const bool quiet=false, const bool createIf=true) const
Definition: ServiceLocatorHelper.cpp:38
IAlgTool::type
virtual const std::string & type() const =0
The type of an AlgTool, meaning the concrete AlgTool class.
StatusCode::isSuccess
bool isSuccess() const
Definition: StatusCode.h:267
std::exception
STL class.
IAuditor::Initialize
Definition: IAuditor.h:24
Gaudi::StateMachine::STOP
Definition: StateMachine.h:27
std::pair< InterfaceID, void * >
AlgTool::acceptDHVisitor
void acceptDHVisitor(IDataHandleVisitor *) const override
Definition: AlgTool.cpp:472
AlgTool::m_pAuditorSvc
SmartIF< IAuditorSvc > m_pAuditorSvc
Auditor Service.
Definition: AlgTool.h:286
AlgTool::m_auditorRestart
Gaudi::Property< bool > m_auditorRestart
Definition: AlgTool.h:306
std::unique_ptr::get
T get(T... args)
IDataHandleVisitor
Definition: IDataHandleHolder.h:35
std::find_if
T find_if(T... args)
Gaudi::StateMachine::RUNNING
Definition: StateMachine.h:16
std::vector< IAlgTool * >
AlgTool::m_state
Gaudi::StateMachine::State m_state
state of the Tool
Definition: AlgTool.h:319
Gaudi::StateMachine::ChangeState
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:9
AlgTool::m_toolHandles
std::vector< BaseToolHandle * > m_toolHandles
Definition: AlgTool.h:310
std::begin
T begin(T... args)
AlgTool::m_auditInit
Gaudi::Property< bool > m_auditInit
Definition: AlgTool.h:300
AlgTool::toolSvc
IToolSvc * toolSvc() const
The standard ToolSvc service, Return a pointer to the service if present.
Definition: AlgTool.cpp:96
AlgTool
Base class from which all the concrete tool classes should be derived.
Definition: AlgTool.h:47
IAlgTool
The interface implemented by the AlgTool base class.
Definition: IAlgTool.h:23
ToolHandle.h
Gaudi::Algorithm
Base class from which all concrete algorithm classes should be derived.
Definition: Algorithm.h:79
std::unordered_set::emplace
T emplace(T... args)
AlgTool::m_svcLocator
SmartIF< ISvcLocator > m_svcLocator
Pointer to Service Locator service.
Definition: AlgTool.h:282
IOTest.appMgr
appMgr
Definition: IOTest.py:92
AlgTool::m_evtSvc
SmartIF< IDataProviderSvc > m_evtSvc
Event data service.
Definition: AlgTool.h:283
Gaudi::StateMachine::START
Definition: StateMachine.h:26
StatusCode::FAILURE
constexpr static const auto FAILURE
Definition: StatusCode.h:86
ServiceLocatorHelper.h
MSG::ERROR
Definition: IMessageSvc.h:15
AlgTool::type
const std::string & type() const override
Retrieve type (concrete class) of the sub-algtool.
Definition: AlgTool.cpp:65
Gaudi::Property::assign
bool assign(const Details::PropertyBase &source) override
get the value from another property
Definition: Property.h:659
AlgTool::m_auditorInitialize
Gaudi::Property< bool > m_auditorInitialize
Definition: AlgTool.h:301
AlgTool::reinitialize
StatusCode reinitialize() override
Definition: AlgTool.cpp:294
AlgTool::m_interfaceList
InterfaceList m_interfaceList
Interface list.
Definition: AlgTool.h:288
StatusCode::isFailure
bool isFailure() const
Definition: StatusCode.h:130
AlgTool::stop
StatusCode stop() override
Definition: AlgTool.cpp:247
AlgTool::sysInitialize
StatusCode sysInitialize() override
Initialize AlgTool.
Definition: AlgTool.cpp:163
AlgTool::m_targetState
Gaudi::StateMachine::State m_targetState
state of the Tool
Definition: AlgTool.h:320
AlgTool::evtSvc
IDataProviderSvc * evtSvc() const
accessor to event service service
Definition: AlgTool.cpp:88
IProperty
The IProperty is the basic interface for all components which have properties that can be set or get.
Definition: IProperty.h:20
Gaudi::Guards::AuditorGuard
It is a simple guard, which "locks" the scope for the Auditor Service is am exception-safe way.
Definition: Guards.h:203
IAuditorSvc
The interface implemented by the IAuditorSvc base class.
Definition: IAuditorSvc.h:15
Service
Base class for all services.
Definition: Service.h:36
IMonitorSvc::undeclareAll
virtual void undeclareAll(const IInterface *owner)=0
Undeclare monitoring information.
DataHandleHolderBase< PropertyHolder< CommonMessaging< implements< IAlgTool, IDataHandleHolder, IProperty, IStateful > > > >::outputHandles
std::vector< Gaudi::DataHandle * > outputHandles() const override
Definition: DataHandleHolderBase.h:31
Auditor.h
AlgTool::name
const std::string & name() const override
Retrieve full identifying name of the concrete tool object.
Definition: AlgTool.cpp:58
ISvcLocator.h
BaseToolHandle::get
const IAlgTool * get() const
Definition: ToolHandle.h:83
endmsg
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:192
DataHandleHolderBase< PropertyHolder< CommonMessaging< implements< IAlgTool, IDataHandleHolder, IProperty, IStateful > > > >::m_outputDataObjs
DataObjIDColl m_outputDataObjs
Definition: DataHandleHolderBase.h:71
AlgTool::sysFinalize
StatusCode sysFinalize() override
Finalize AlgTool.
Definition: AlgTool.cpp:255
AlgTool::m_toolHandleArrays
std::vector< GaudiHandleArrayBase * > m_toolHandleArrays
Definition: AlgTool.h:311
AlgTool::m_updateDataHandles
std::unique_ptr< IDataHandleVisitor > m_updateDataHandles
Hook for for derived classes to provide a custom visitor for data handles.
Definition: AlgTool.h:222
AlgTool::m_auditorFinalize
Gaudi::Property< bool > m_auditorFinalize
Definition: AlgTool.h:304
Gaudi.Configuration.log
log
Definition: Configuration.py:13
Auditor
Base class from which all concrete auditor classes should be derived.
Definition: Auditor.h:34
IJobOptionsSvc.h
AlgTool::sysRestart
StatusCode sysRestart() override
Start AlgTool.
Definition: AlgTool.cpp:317
AlgTool::start
StatusCode start() override
Definition: AlgTool.cpp:225
AlgTool::parent
const IInterface * parent() const override
Retrieve parent of the sub-algtool.
Definition: AlgTool.cpp:72