| The Gaudi Framework v27r1

- 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/IMessageSvc.h"
4 #include "GaudiKernel/ISvcLocator.h"
5 #include "GaudiKernel/IJobOptionsSvc.h"
6 #include "GaudiKernel/IDataManagerSvc.h"
7
8 #include "GaudiKernel/Algorithm.h"
9 #include "GaudiKernel/Service.h"
10 #include "GaudiKernel/Auditor.h"
11 #include "GaudiKernel/System.h"
12 #include "GaudiKernel/GaudiException.h"
13 #include "GaudiKernel/ServiceLocatorHelper.h"
14 #include "GaudiKernel/ThreadGaudi.h"
15 #include "GaudiKernel/Guards.h"
16 #include "GaudiKernel/ToolHandle.h"
17 #include "GaudiKernel/DataObjIDProperty.h"
18
19 //------------------------------------------------------------------------------
20 namespace {
21 template <typename FUN>
22 StatusCode attempt( AlgTool& tool, const char* label, FUN&& fun ) {
23 try { return fun(); }
24 catch( const GaudiException& Exception ) {
25 MsgStream log ( tool.msgSvc(), tool.name() + "." + label );
26 log << MSG::FATAL << " Exception with tag=" << Exception.tag()
27 << " is caught" << endmsg;
28 log << MSG::ERROR << Exception << endmsg;
29 }
30 catch( const std::exception& Exception ) {
31 MsgStream log ( tool.msgSvc(), tool.name() + "." + label );
32 log << MSG::FATAL << " Standard std::exception is caught" << endmsg;
33 log << MSG::ERROR << Exception.what() << endmsg;
34 }
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
45 ( const InterfaceID& riid,
46 void** ppvi )
47 //------------------------------------------------------------------------------
48 {
49 if ( !ppvi ) { return StatusCode::FAILURE ; } // 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) {
54 return item.first.versionMatch(riid);
55 } );
56 if ( i == std::end(m_interfaceList) ) {
57 *ppvi = nullptr ;
58 return NO_INTERFACE ; // RETURN
59 }
60 *ppvi = i->second ;
61 addRef() ;
62 return SUCCESS ; // RETURN
63 }
64 //------------------------------------------------------------------------------
65 const std::string& AlgTool::name() const
66 //------------------------------------------------------------------------------
67 {
68 return m_name;
69 }
70
71 //------------------------------------------------------------------------------
72 const std::string& AlgTool::type() const
73 //------------------------------------------------------------------------------
74 {
75 return m_type;
76 }
77
78 //------------------------------------------------------------------------------
79 const IInterface* AlgTool::parent() const
80 //------------------------------------------------------------------------------
81 {
82 return m_parent;
83 }
84
85 //------------------------------------------------------------------------------
86 SmartIF<ISvcLocator>& AlgTool::serviceLocator() const
87 //------------------------------------------------------------------------------
88 {
89 return m_svcLocator;
90 }
91
92 // ============================================================================
93 // accessor to event service service
94 // ============================================================================
95 IDataProviderSvc* AlgTool::evtSvc () const
96 {
97 if ( !m_evtSvc ) {
98 m_evtSvc = service("EventDataSvc", true);
99 if ( !m_evtSvc ) {
100 throw GaudiException("Service [EventDataSvc] not found", name(), StatusCode::FAILURE);
101 }
102 }
103 return m_evtSvc.get();
104 }
105 //------------------------------------------------------------------------------
106 IToolSvc* AlgTool::toolSvc() const
107 //------------------------------------------------------------------------------
108 {
109 if ( !m_ptoolSvc ) {
110 m_ptoolSvc = service( "ToolSvc", true );
111 if( !m_ptoolSvc ) {
112 throw GaudiException("Service [ToolSvc] not found", name(), StatusCode::FAILURE);
113 }
114 }
115 return m_ptoolSvc.get();
116 }
117
118 //------------------------------------------------------------------------------
119 StatusCode AlgTool::setProperty(const Property& p)
120 //------------------------------------------------------------------------------
121 {
122 return m_propertyMgr->setProperty(p);
123 }
124
125 //------------------------------------------------------------------------------
126 StatusCode AlgTool::setProperty(const std::string& s)
127 //------------------------------------------------------------------------------
128 {
129 return m_propertyMgr->setProperty(s);
130 }
131
132 //------------------------------------------------------------------------------
133 StatusCode AlgTool::setProperty(const std::string& n, const std::string& v)
134 //------------------------------------------------------------------------------
135 {
136 return m_propertyMgr->setProperty(n,v);
137 }
138
139 //------------------------------------------------------------------------------
140 StatusCode AlgTool::getProperty(Property* p) const
141 //------------------------------------------------------------------------------
142 {
143 return m_propertyMgr->getProperty(p);
144 }
145
146 //------------------------------------------------------------------------------
147 const Property& AlgTool::getProperty(const std::string& n) const
148 {
149 return m_propertyMgr->getProperty(n);
150 }
151
152 //------------------------------------------------------------------------------
153 StatusCode AlgTool::getProperty(const std::string& n, std::string& v ) const
154 //------------------------------------------------------------------------------
155 {
156 return m_propertyMgr->getProperty(n,v);
157 }
158
159 //------------------------------------------------------------------------------
160 const std::vector<Property*>& AlgTool::getProperties() const
161 //------------------------------------------------------------------------------
162 {
163 return m_propertyMgr->getProperties();
164 }
165
166 bool AlgTool::hasProperty(const std::string& name) const {
167 return m_propertyMgr->hasProperty(name);
168 }
169
170 //------------------------------------------------------------------------------
171 StatusCode AlgTool::setProperties()
172 //------------------------------------------------------------------------------
173 {
174 if( !m_svcLocator ) return StatusCode::FAILURE;
175 auto jos = m_svcLocator->service<IJobOptionsSvc>("JobOptionsSvc");
176 if( !jos ) return StatusCode::FAILURE;
177
178 // set first generic Properties
179 StatusCode sc = jos->setMyProperties( getGaudiThreadGenericName(name()), this );
180 if( sc.isFailure() ) return StatusCode::FAILURE;
181
182 // set specific Properties
183 if (isGaudiThreaded(name())) {
184 if(jos->setMyProperties( name(), this ).isFailure()) {
185 return StatusCode::FAILURE;
186 }
187 }
188 updateMsgStreamOutputLevel( m_outputLevel );
189 return StatusCode::SUCCESS;
190 }
191
192 //------------------------------------------------------------------------------
193 AlgTool::AlgTool( const std::string& type,
194 const std::string& name,
195 const IInterface* parent)
196 //------------------------------------------------------------------------------
197 : m_type ( type )
198 , m_name ( name )
199 , m_parent ( parent )
200 , m_propertyMgr ( new PropertyMgr() )
201 {
202 addRef(); // Initial count set to 1
203
204 declareProperty( "MonitorService", m_monitorSvcName = "MonitorSvc" );
205
206 { // get the "OutputLevel" property from parent
207 const Property* _p = Gaudi::Utils::getProperty ( parent , "OutputLevel") ;
208 if ( _p ) { m_outputLevel.assign( *_p ) ; }
209 declareProperty ( "OutputLevel" , m_outputLevel ) ;
210 m_outputLevel.declareUpdateHandler([this](Property&) { this->updateMsgStreamOutputLevel(this->m_outputLevel) ; } );
211 }
212
213 IInterface* _p = const_cast<IInterface*> ( parent ) ;
214
215 if ( Algorithm* _alg = dynamic_cast<Algorithm*> ( _p ) )
216 {
217 m_svcLocator = _alg -> serviceLocator () ;
218 m_threadID = getGaudiThreadIDfromName ( _alg -> name() ) ;
219 }
220 else if ( Service* _svc = dynamic_cast<Service*> ( _p ) )
221 {
222 m_svcLocator = _svc -> serviceLocator () ;
223 m_threadID = getGaudiThreadIDfromName ( _svc -> name() ) ;
224 }
225 else if ( AlgTool* _too = dynamic_cast<AlgTool*> ( _p ) )
226 {
227 m_svcLocator = _too -> serviceLocator ();
228 m_threadID = getGaudiThreadIDfromName ( _too ->m_threadID ) ;
229 }
230 else if ( Auditor* _aud = dynamic_cast<Auditor*> ( _p ) )
231 {
232 m_svcLocator = _aud -> serviceLocator() ;
233 m_threadID = getGaudiThreadIDfromName ( _aud -> name() ) ;
234 }
235 else
236 {
237 throw GaudiException
238 ( "Failure to create tool '"
239 + type + "/" + name + "': illegal parent type '"
240 + System::typeinfoName(typeid(*_p)) + "'", "AlgTool", 0 );
241 }
242
243
244 { // audit tools
245 auto appMgr = m_svcLocator->service<IProperty>("ApplicationMgr");
246 if ( !appMgr ) {
247 throw GaudiException("Could not locate ApplicationMgr","AlgTool",0);
248 }
249 const Property* p = Gaudi::Utils::getProperty( appMgr , "AuditTools");
250 if ( p ) { m_auditInit.assign ( *p ) ; }
251 declareProperty ( "AuditTools", m_auditInit );
252 bool audit = m_auditInit.value();
253 // Declare common AlgTool properties with their defaults
254 declareProperty ( "AuditInitialize" , m_auditorInitialize = audit ) ;
255 declareProperty ( "AuditStart" , m_auditorStart = audit ) ;
256 declareProperty ( "AuditStop" , m_auditorStop = audit ) ;
257 declareProperty ( "AuditFinalize" , m_auditorFinalize = audit ) ;
258 }
259
260 //declare Extra input and output properties
261 declareProperty( "ExtraInputs", m_extInputDataObjs);
262 declareProperty( "ExtraOutputs", m_extOutputDataObjs);
263
264
265 // check thread ID and try if tool name indicates thread ID
266 if ( m_threadID.empty() )
267 { m_threadID = getGaudiThreadIDfromName ( AlgTool::name() ) ; }
268 }
269
270 //-----------------------------------------------------------------------------
271 StatusCode AlgTool::sysInitialize() {
272 //-----------------------------------------------------------------------------
273 return attempt( *this, "sysInitialize", [&]() {
274 m_targetState = Gaudi::StateMachine::ChangeState( Gaudi::StateMachine::INITIALIZE, m_state);
275 Gaudi::Guards::AuditorGuard guard(this,
276 // check if we want to audit the initialize
277 m_auditorInitialize ? auditorSvc() : nullptr,
278 IAuditor::Initialize);
279 StatusCode sc = initialize();
280 if (!sc) return sc;
281
282 m_state = m_targetState;
283 if (m_updateDataHandles)
284 acceptDHVisitor(m_updateDataHandles.get());
285
286 return sc;
287 } );
288 }
289 //------------------------------------------------------------------------------
290 StatusCode AlgTool::initialize()
291 //------------------------------------------------------------------------------
292 {
293 // For the time being there is nothing to be done here.
294 // Setting the properties is done by the ToolSvc calling setProperties()
295 // explicitly.
296 return StatusCode::SUCCESS;
297 }
298
299 //-----------------------------------------------------------------------------
300 StatusCode AlgTool::sysStart() {
301 //-----------------------------------------------------------------------------
302 return attempt( *this, "sysInitialize", [&]() {
303 m_targetState = Gaudi::StateMachine::ChangeState( Gaudi::StateMachine::START, m_state);
304 Gaudi::Guards::AuditorGuard guard(this,
305 // check if we want to audit the initialize
306 m_auditorStart ? auditorSvc() : nullptr,
307 IAuditor::Start);
308 StatusCode sc = start();
309 if (sc.isSuccess()) m_state = m_targetState;
310 return sc;
311 } );
312 }
313
314 //------------------------------------------------------------------------------
315 StatusCode AlgTool::start()
316 //------------------------------------------------------------------------------
317 {
318 // For the time being there is nothing to be done here.
319 return StatusCode::SUCCESS;
320 }
321
322 //-----------------------------------------------------------------------------
323 StatusCode AlgTool::sysStop() {
324 //-----------------------------------------------------------------------------
325 return attempt( *this, "sysStop", [&]() {
326 m_targetState = Gaudi::StateMachine::ChangeState( Gaudi::StateMachine::STOP, m_state);
327 Gaudi::Guards::AuditorGuard guard(this,
328 // check if we want to audit the initialize
329 m_auditorStop ? auditorSvc() : nullptr,
330 IAuditor::Stop);
331 StatusCode sc = stop();
332 if (sc.isSuccess()) m_state = m_targetState;
333 return sc;
334 } );
335 }
336
337 //------------------------------------------------------------------------------
338 StatusCode AlgTool::stop()
339 //------------------------------------------------------------------------------
340 {
341 // For the time being there is nothing to be done here.
342 return StatusCode::SUCCESS;
343 }
344
345 //-----------------------------------------------------------------------------
346 StatusCode AlgTool::sysFinalize() {
347 //-----------------------------------------------------------------------------
348 return attempt( *this, "sysFinalize", [&]() {
349 m_targetState = Gaudi::StateMachine::ChangeState( Gaudi::StateMachine::FINALIZE, m_state);
350 Gaudi::Guards::AuditorGuard guard(this,
351 // check if we want to audit the initialize
352 m_auditorFinalize ? auditorSvc() : nullptr,
353 IAuditor::Finalize);
354 StatusCode sc = finalize();
355 if (sc.isSuccess()) m_state = m_targetState;
356 return sc;
357 } );
358 }
359 //------------------------------------------------------------------------------
360 StatusCode AlgTool::finalize()
361 //------------------------------------------------------------------------------
362 {
363 // For the time being there is nothing to be done here.
364 return StatusCode::SUCCESS;
365 }
366
367 //-----------------------------------------------------------------------------
368 StatusCode AlgTool::sysReinitialize() {
369 //-----------------------------------------------------------------------------
370
371 // Check that the current status is the correct one.
372 if ( Gaudi::StateMachine::INITIALIZED != FSMState() ) {
373 error()
374 << "sysReinitialize(): cannot reinitialize tool not initialized"
375 << endmsg;
376 return StatusCode::FAILURE;
377 }
378
379 return attempt(*this, "SysReinitialize()", [&]() {
380 Gaudi::Guards::AuditorGuard guard(this,
381 // check if we want to audit the initialize
382 m_auditorReinitialize ? auditorSvc() : nullptr,
383 IAuditor::ReInitialize);
384 return reinitialize();
385 } );
386
387 }
388
389 //------------------------------------------------------------------------------
390 StatusCode AlgTool::reinitialize()
391 //------------------------------------------------------------------------------
392 {
393 /* @TODO
394 * MCl 2008-10-23: the implementation of reinitialize as finalize+initialize
395 * is causing too many problems
396 *
397 // Default implementation is finalize+initialize
398 StatusCode sc = finalize();
399 if (sc.isFailure()) {
400 error() << "reinitialize(): cannot be finalized" << endmsg;
401 return sc;
402 }
403 sc = initialize();
404 if (sc.isFailure()) {
405 error() << "reinitialize(): cannot be initialized" << endmsg;
406 return sc;
407 }
408 */
409 return StatusCode::SUCCESS;
410 }
411
412 //-----------------------------------------------------------------------------
413 StatusCode AlgTool::sysRestart() {
414 //-----------------------------------------------------------------------------
415
416 // Check that the current status is the correct one.
417 if ( Gaudi::StateMachine::RUNNING != FSMState() ) {
418 error()
419 << "sysRestart(): cannot reinitialize tool not started"
420 << endmsg;
421 return StatusCode::FAILURE;
422 }
423
424 return attempt(*this, "sysRestart", [&]() {
425 m_targetState = Gaudi::StateMachine::ChangeState(Gaudi::StateMachine::START,m_state);
426 Gaudi::Guards::AuditorGuard guard(this,
427 // check if we want to audit the initialize
428 m_auditorRestart ? auditorSvc() : nullptr,
429 IAuditor::ReStart);
430 return restart();
431 } );
432 }
433
434 //------------------------------------------------------------------------------
435 StatusCode AlgTool::restart()
436 //------------------------------------------------------------------------------
437 {
438 // Default implementation is stop+start
439 StatusCode sc = stop();
440 if (sc.isFailure()) {
441 error() << "restart(): cannot be stopped" << endmsg;
442 return sc;
443 }
444 sc = start();
445 if (sc.isFailure()) {
446 error() << "restart(): cannot be started" << endmsg;
447 return sc;
448 }
449 return StatusCode::SUCCESS;
450 }
451
452 //------------------------------------------------------------------------------
453 AlgTool::~AlgTool()
454 //------------------------------------------------------------------------------
455 {
456 if( m_pMonitorSvc ) { m_pMonitorSvc->undeclareAll(this); }
457 }
458
459
460 void AlgTool::initToolHandles() const{
461
462 IAlgTool* tool(0);
463 for (auto thArr : m_toolHandleArrays) {
464 if (! thArr->retrieved()) {
465 if (UNLIKELY(msgLevel(MSG::DEBUG)))
466 debug() << "ToolHandleArray " << thArr->propertyName()
467 << " not used: not registering any of its Tools" << endmsg;
468 } else {
469 if (UNLIKELY(msgLevel(MSG::DEBUG)))
470 debug() << "Registering all Tools in ToolHandleArray "
471 << thArr->propertyName() ;
472 for (auto th_name : thArr->typesAndNames()) {
473 if (UNLIKELY(msgLevel(MSG::DEBUG)))
474 debug() << std::endl << " + " << th_name;
475 if (toolSvc()->retrieveTool(th_name, tool, this).isSuccess()) {
476 if (UNLIKELY(msgLevel(MSG::DEBUG)))
477 debug() << " (private)";
478 m_tools.push_back(tool);
479 } else if (toolSvc()->retrieveTool(th_name, tool, 0).isSuccess()) {
480 if (UNLIKELY(msgLevel(MSG::DEBUG)))
481 debug() << " (public)";
482 m_tools.push_back(tool);
483 } else {
484 if (UNLIKELY(msgLevel(MSG::DEBUG)))
485 debug() << " - ERROR" << endmsg;
486 warning() << "Error retrieving Tool " << th_name
487 << " in ToolHandleArray" << thArr->propertyName()
488 << ". Not registered" << endmsg;
489 }
490 }
491 if (UNLIKELY(msgLevel(MSG::DEBUG))) debug() << endmsg;
492 }
493 }
494
495 for(auto th : m_toolHandles){
496 tool = th->get();
497 if(tool){
498 m_tools.push_back(tool);
499 if (UNLIKELY(msgLevel(MSG::DEBUG)))
500 debug() << "Adding "
501 << (th->isPublic() ? "Public" : "Private" )
502 << " ToolHandle tool " << tool->name()
503 << " (" << tool->type() << ")" << endmsg;
504 } else {
505 if (UNLIKELY(msgLevel(MSG::DEBUG)))
506 debug() << "ToolHandle " << th->typeAndName() << " not used" << endmsg;
507 }
508 }
509 m_toolHandlesInit = true;
510 }
511
512 const std::vector<IAlgTool *> & AlgTool::tools() const {
513 if(UNLIKELY(!m_toolHandlesInit))
514 initToolHandles();
515
516 return m_tools;
517 }
518
519 std::vector<IAlgTool *> & AlgTool::tools() {
520 if(UNLIKELY(!m_toolHandlesInit))
521 initToolHandles();
522
523 return m_tools;
524 }
525
526 //------------------------------------------------------------------------------
528 StatusCode
529 AlgTool::service_i(const std::string& svcName,
530 bool createIf,
531 const InterfaceID& iid,
532 void** ppSvc) const {
533 const ServiceLocatorHelper helper(*serviceLocator(), *this);
534 return helper.getService(svcName, createIf, iid, ppSvc);
535 }
536
537 //------------------------------------------------------------------------------
538 StatusCode
539 AlgTool::service_i(const std::string& svcType,
540 const std::string& svcName,
541 const InterfaceID& iid,
542 void** ppSvc) const {
543 const ServiceLocatorHelper helper(*serviceLocator(), *this);
544 return helper.createService(svcType, svcName, iid, ppSvc);
545 }
546
547 SmartIF<IService> AlgTool::service(const std::string& name, const bool createIf, const bool quiet) const {
548 const ServiceLocatorHelper helper(*serviceLocator(), *this);
549 return helper.service(name, quiet, createIf);
550 }
551
552 //-----------------------------------------------------------------------------
553 IAuditorSvc* AlgTool::auditorSvc() const {
554 //---------------------------------------------------------------------------
555 if ( !m_pAuditorSvc ) {
556 m_pAuditorSvc = service( "AuditorSvc", true );
557 if( !m_pAuditorSvc ) {
558 throw GaudiException("Service [AuditorSvc] not found", name(), StatusCode::FAILURE);
559 }
560 }
561 return m_pAuditorSvc.get();
562 }
563
564 //-----------------------------------------------------------------------------
565 void
566 AlgTool::acceptDHVisitor(IDataHandleVisitor *vis) const{
567 //-----------------------------------------------------------------------------
568 vis->visit(this);
569
570 for (auto tool : tools()) {
571 AlgTool *at = dynamic_cast<AlgTool*>(tool);
572 vis->visit(at);
573 }
574
575 }
576
577 //-----------------------------------------------------------------------------
578 void
579 AlgTool::commitHandles() {
580 //-----------------------------------------------------------------------------
581
582 for (auto h : m_outputHandles) {
583 h->commit();
584 }
585
586 for (auto t : m_tools) {
587 AlgTool* at = dynamic_cast<AlgTool*>(t);
588 if (at != 0) at->commitHandles();
589 }
590
591 }
IAuditor::Start
Definition: IAuditor.h:31
System.h
IToolSvc
The interface implemented by the IToolSvc base class.
Definition: IToolSvc.h:18
UNLIKELY
#define UNLIKELY(x)
Definition: Kernel.h:126
AlgTool::m_tools
std::vector< IAlgTool * > m_tools
Definition: AlgTool.h:496
AlgTool::m_toolHandles
std::vector< BaseToolHandle * > m_toolHandles
Definition: AlgTool.h:497
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
Algorithm.h
AlgTool::m_pMonitorSvc
SmartIF< IMonitorSvc > m_pMonitorSvc
Online Monitoring Service.
Definition: AlgTool.h:487
SmartIF< ISvcLocator >
std::string::empty
T empty(T...args)
GaudiException
Define general base for Gaudi exception.
Definition: GaudiException.h:23
AlgTool::m_toolHandlesInit
bool m_toolHandlesInit
Definition: AlgTool.h:499
AlgTool::m_type
std::string m_type
AlgTool type (concrete class name)
Definition: AlgTool.h:481
gaudiComponentHelp.name
name
Definition: gaudiComponentHelp.py:28
IAuditor::Stop
Definition: IAuditor.h:32
AlgTool::commitHandles
void commitHandles() override
Definition: AlgTool.cpp:579
AlgTool::initialize
StatusCode initialize() override
Definition: AlgTool.cpp:290
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:529
Property::declareUpdateHandler
virtual Property & declareUpdateHandler(std::function< void(Property &)> fun)
set new callback for update
Definition: Property.cpp:72
PropertyMgr::setProperty
StatusCode setProperty(const Property &p) override
set the property form another property
Definition: PropertyMgr.cpp:105
System::typeinfoName
GAUDI_API const std::string typeinfoName(const std::type_info &)
Get platform independent information about the class type.
Definition: System.cpp:297
Gaudi.Configuration.log
tuple log
Definition: Configuration.py:13
Gaudi::StateMachine::FINALIZE
Definition: StateMachine.h:28
IAuditor::ReInitialize
Definition: IAuditor.h:26
StatusCode::isSuccess
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:76
AlgTool.h
MSG::DEBUG
Definition: IMessageSvc.h:18
std::endl
T endl(T...args)
AlgTool::m_parent
const IInterface * m_parent
AlgTool parent.
Definition: AlgTool.h:483
AlgTool::toolSvc
IToolSvc * toolSvc() const
The standard ToolSvc service, Return a pointer to the service if present.
Definition: AlgTool.cpp:106
AlgTool::sysReinitialize
StatusCode sysReinitialize() override
Initialize AlgTool.
Definition: AlgTool.cpp:368
AlgTool::m_outputLevel
IntegerProperty m_outputLevel
AlgTool output level.
Definition: AlgTool.h:480
std::end
T end(T...args)
Gaudi::Utils::getProperty
GAUDI_API Property * getProperty(const IProperty *p, const std::string &name)
simple function which gets the property with given name from the component
Definition: Property.cpp:278
IDataProviderSvc
Data provider interface definition.
Definition: IDataProviderSvc.h:45
AlgTool::~AlgTool
~AlgTool() override
Definition: AlgTool.cpp:453
merge_files.sc
int sc
Definition: merge_files.py:167
PropertyMgr
Property manager helper class.
Definition: PropertyMgr.h:37
AlgTool::queryInterface
StatusCode queryInterface(const InterfaceID &riid, void **ppvUnknown) override
Query for a given interface.
Definition: AlgTool.cpp:45
StatusCode::isFailure
bool isFailure() const
Test for a status code of FAILURE.
Definition: StatusCode.h:86
GaudiPluginService.cpluginsvc.n
list n
Definition: cpluginsvc.py:217
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:73
IAuditor::ReStart
Definition: IAuditor.h:33
IToolSvc::retrieveTool
StatusCode retrieveTool(const std::string &type, T *&tool, const IInterface *parent=nullptr, bool createIf=true)
Retrieve specified tool sub-type with tool dependent part of the name automatically assigned...
Definition: IToolSvc.h:145
AlgTool::setProperties
StatusCode setProperties()
Method for setting declared properties to the values specified in the jobOptions via the job option s...
Definition: AlgTool.cpp:171
AlgTool::sysStart
StatusCode sysStart() override
Start AlgTool.
Definition: AlgTool.cpp:300
AlgTool::FSMState
Gaudi::StateMachine::State FSMState() const override
Definition: AlgTool.h:78
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:323
PropertyMgr::getProperty
StatusCode getProperty(Property *p) const override
get the property
Definition: PropertyMgr.cpp:144
AlgTool::hasProperty
bool hasProperty(const std::string &name) const override
Definition: AlgTool.cpp:166
Service.h
SmartIF::get
TYPE * get() const
Get interface pointer.
Definition: SmartIF.h:76
AlgTool::serviceLocator
SmartIF< ISvcLocator > & serviceLocator() const override
Retrieve pointer to service locator.
Definition: AlgTool.cpp:86
AlgTool::m_monitorSvcName
std::string m_monitorSvcName
Name to use for Monitor Service.
Definition: AlgTool.h:488
AlgTool::finalize
StatusCode finalize() override
Definition: AlgTool.cpp:360
AlgTool::m_name
const std::string m_name
AlgTool full name.
Definition: AlgTool.h:482
MSG::FATAL
Definition: IMessageSvc.h:22
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:78
std::vector::push_back
T push_back(T...args)
InterfaceID
Interface ID class.
Definition: IInterface.h:30
CommonMessagingBase::error
MsgStream & error() const
shortcut for the method msgStream(MSG::ERROR)
Definition: CommonMessaging.h:118
AlgTool::AlgTool
AlgTool(const std::string &type, const std::string &name, const IInterface *parent)
Standard Constructor.
Definition: AlgTool.cpp:193
Gaudi::StateMachine::INITIALIZE
Definition: StateMachine.h:25
AlgTool::m_propertyMgr
SmartIF< PropertyMgr > m_propertyMgr
Property Manager.
Definition: AlgTool.h:490
IDataManagerSvc.h
GaudiPython.Bindings.SUCCESS
tuple SUCCESS
Definition: Bindings.py:51
IJobOptionsSvc
Main interface for the JobOptions service.
Definition: IJobOptionsSvc.h:20
gaudirun.type
string type
Definition: gaudirun.py:151
AlgTool::setProperty
StatusCode setProperty(const Property &p) override
Default implementations for IProperty interface.
Definition: AlgTool.cpp:119
CommonMessagingBase::warning
MsgStream & warning() const
shortcut for the method msgStream(MSG::WARNING)
Definition: CommonMessaging.h:121
StatusCode::FAILURE
Definition: StatusCode.h:29
std::exception::what
T what(T...args)
StatusCode::SUCCESS
Definition: StatusCode.h:30
CommonMessaging< implements< IAlgTool, IDataHandleHolder, IProperty, IStateful > >::updateMsgStreamOutputLevel
void updateMsgStreamOutputLevel(int level)
Update the output level of the cached MsgStream.
Definition: CommonMessaging.h:187
StatusCode
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
AlgTool::declareProperty
Property * declareProperty(const std::string &name, T &property, const std::string &doc="none") const
Declare the named property.
Definition: AlgTool.h:249
GaudiException.h
IInterface
Definition of the basic interface.
Definition: IInterface.h:234
IAuditor::Finalize
Definition: IAuditor.h:30
PropertyMgr::getProperties
const std::vector< Property * > & getProperties() const override
get all properties
Definition: PropertyMgr.cpp:186
AlgTool::m_threadID
std::string m_threadID
Thread Id for Alg Tool.
Definition: AlgTool.h:493
HiveAlgSequencer.h
tuple h
Definition: HiveAlgSequencer.py:24
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:195
Guards.h
GaudiException::tag
virtual const std::string & tag() const
name tag for the exception, or exception type
Definition: GaudiException.h:119
AlgTool::restart
StatusCode restart() override
Definition: AlgTool.cpp:435
IMessageSvc.h
AlgTool::m_ptoolSvc
SmartIF< IToolSvc > m_ptoolSvc
Tool service.
Definition: AlgTool.h:486
IAlgTool::type
virtual const std::string & type() const =0
The type of an AlgTool, meaning the concrete AlgTool class.
AlgTool::tools
const std::vector< IAlgTool * > & tools() const
Definition: AlgTool.cpp:512
std::exception
STL class.
IAuditor::Initialize
Definition: IAuditor.h:25
PropertyWithValue::value
const TYPE & value() const
explicit conversion
Definition: Property.h:341
DataObjIDProperty.h
Gaudi::StateMachine::STOP
Definition: StateMachine.h:27
AlgTool::m_auditorFinalize
bool m_auditorFinalize
flag for auditors in "finalize()"
Definition: AlgTool.h:517
AlgTool::evtSvc
IDataProviderSvc * evtSvc() const
accessor to event service service
Definition: AlgTool.cpp:95
std::pair< InterfaceID, void * >
AlgTool::acceptDHVisitor
virtual void acceptDHVisitor(IDataHandleVisitor *) const override
Definition: AlgTool.cpp:566
AlgTool::m_pAuditorSvc
SmartIF< IAuditorSvc > m_pAuditorSvc
Auditor Service.
Definition: AlgTool.h:511
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:74
std::find_if
T find_if(T...args)
Gaudi::StateMachine::RUNNING
Definition: StateMachine.h:16
Property
Property base class allowing Property* collections to be "homogeneous".
Definition: Property.h:38
PropertyWithValue::assign
bool assign(const Property &source) override
get the value from another property
Definition: Property.h:269
std::vector< Property * >
AlgTool::m_state
Gaudi::StateMachine::State m_state
state of the Tool
Definition: AlgTool.h:521
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:8
CommonMessagingBase::debug
MsgStream & debug() const
shortcut for the method msgStream(MSG::DEBUG)
Definition: CommonMessaging.h:127
AlgTool::m_outputHandles
std::vector< Gaudi::DataHandle * > m_outputHandles
Definition: AlgTool.h:330
std::begin
T begin(T...args)
fun
double fun(const std::vector< double > &x)
Definition: PFuncTest.cpp:26
AlgTool::m_auditorReinitialize
bool m_auditorReinitialize
flag for auditors in "reinitialize()"
Definition: AlgTool.h:518
AlgTool
Base class from which all the concrete tool classes should be derived.
Definition: AlgTool.h:45
IAlgTool
The interface implemented by the AlgTool base class.
Definition: IAlgTool.h:23
ToolHandle.h
AlgTool::m_svcLocator
SmartIF< ISvcLocator > m_svcLocator
Pointer to Service Locator service.
Definition: AlgTool.h:484
gaudirun.s
string s
Definition: gaudirun.py:245
AlgTool::m_evtSvc
SmartIF< IDataProviderSvc > m_evtSvc
Event data service.
Definition: AlgTool.h:485
PropertyMgr::hasProperty
bool hasProperty(const std::string &name) const override
Return true if we have a property with the given name.
Definition: PropertyMgr.cpp:201
Gaudi::StateMachine::START
Definition: StateMachine.h:26
ana.item
tuple item
print s1,s2
Definition: ana.py:146
CommonMessagingBase::msgSvc
SmartIF< IMessageSvc > & msgSvc() const
The standard message service.
Definition: CommonMessaging.h:73
ServiceLocatorHelper.h
MSG::ERROR
Definition: IMessageSvc.h:21
AlgTool::m_auditorRestart
bool m_auditorRestart
flag for auditors in "restart()"
Definition: AlgTool.h:519
IOTest.appMgr
tuple appMgr
Definition: IOTest.py:83
AlgTool::getProperties
const std::vector< Property * > & getProperties() const override
Definition: AlgTool.cpp:160
AlgTool::type
const std::string & type() const override
Retrieve type (concrete class) of the sub-algtool.
Definition: AlgTool.cpp:72
ServiceLocatorHelper::service
SmartIF< IService > service(const std::string &name, const bool quiet=false, const bool createIf=true) const
Definition: ServiceLocatorHelper.cpp:63
AlgTool::reinitialize
StatusCode reinitialize() override
Definition: AlgTool.cpp:390
AlgTool::m_extInputDataObjs
DataObjIDColl m_extInputDataObjs
Definition: AlgTool.h:333
AlgTool::stop
StatusCode stop() override
Definition: AlgTool.cpp:338
AlgTool::m_auditInit
BooleanProperty m_auditInit
Definition: AlgTool.h:513
AlgTool::sysInitialize
StatusCode sysInitialize() override
Initialize AlgTool.
Definition: AlgTool.cpp:271
AlgTool::m_auditorStart
bool m_auditorStart
flag for auditors in "start()"
Definition: AlgTool.h:515
AlgTool::m_targetState
Gaudi::StateMachine::State m_targetState
state of the Tool
Definition: AlgTool.h:522
IProperty
The IProperty is the basic interface for all components which have properties that can be set or get...
Definition: IProperty.h:21
Gaudi::Guards::AuditorGuard
It is a simple guard, which "locks" the scope for the Auditor Service is am exception-safe way...
Definition: Guards.h:214
IAuditorSvc
The interface implemented by the IAuditorSvc base class.
Definition: IAuditorSvc.h:15
Service
Base class for all services.
Definition: Service.h:36
AlgTool::getProperty
StatusCode getProperty(Property *p) const override
Definition: AlgTool.cpp:140
CommonMessagingBase::msgLevel
MSG::Level msgLevel() const
get the output level from the embedded MsgStream
Definition: CommonMessaging.h:136
AlgTool::m_auditorStop
bool m_auditorStop
flag for auditors in "stop()"
Definition: AlgTool.h:516
getGaudiThreadIDfromName
GAUDI_API std::string getGaudiThreadIDfromName(const std::string &name)
helper function to extract Gaudi Thread ID from thread copy name
Definition: ThreadGaudi.cpp:26
IMonitorSvc::undeclareAll
virtual void undeclareAll(const IInterface *owner)=0
Undeclare monitoring information.
ana.i
list i
Definition: ana.py:128
AlgTool::initToolHandles
void initToolHandles() const
Definition: AlgTool.cpp:460
Auditor.h
AlgTool::name
const std::string & name() const override
Retrieve full identifying name of the concrete tool object.
Definition: AlgTool.cpp:65
ISvcLocator.h
ServiceLocatorHelper::getService
StatusCode getService(const std::string &name, bool createIf, const InterfaceID &iid, void **ppSvc) const
Definition: ServiceLocatorHelper.h:43
AlgTool::m_auditorInitialize
bool m_auditorInitialize
flag for auditors in "initialize()"
Definition: AlgTool.h:514
AlgTool::auditorSvc
IAuditorSvc * auditorSvc() const
Access the auditor service.
Definition: AlgTool.cpp:553
endmsg
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
AlgTool::sysFinalize
StatusCode sysFinalize() override
Finalize AlgTool.
Definition: AlgTool.cpp:346
getGaudiThreadGenericName
GAUDI_API std::string getGaudiThreadGenericName(const std::string &name)
helper function to extract Gaudi instance name from thread copy name
Definition: ThreadGaudi.cpp:50
AlgTool::m_extOutputDataObjs
DataObjIDColl m_extOutputDataObjs
Definition: AlgTool.h:333
AlgTool::m_toolHandleArrays
std::vector< GaudiHandleArrayBase * > m_toolHandleArrays
Definition: AlgTool.h:498
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:416
ServiceLocatorHelper::createService
StatusCode createService(const std::string &name, const InterfaceID &iid, void **ppSvc) const
Definition: ServiceLocatorHelper.cpp:40
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:413
AlgTool::start
StatusCode start() override
Definition: AlgTool.cpp:315
AlgTool::parent
const IInterface * parent() const override
Retrieve parent of the sub-algtool.
Definition: AlgTool.cpp:79