| The Gaudi Framework v30r0 (c919700c)

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

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