The Gaudi Framework  v41r0 (bdbe7744)
Loading...
Searching...
No Matches
Algorithm.cpp
Go to the documentation of this file.
1/***********************************************************************************\
2* (c) Copyright 1998-2026 CERN for the benefit of the LHCb and ATLAS collaborations *
3* *
4* This software is distributed under the terms of the Apache version 2 licence, *
5* copied verbatim in the file "LICENSE". *
6* *
7* In applying this licence, CERN does not waive the privileges and immunities *
8* granted to it by virtue of its status as an Intergovernmental Organization *
9* or submit itself to any jurisdiction. *
10\***********************************************************************************/
11#include <Gaudi/Algorithm.h>
12
13#include <algorithm>
14
29#include <GaudiKernel/Kernel.h>
30
31#include <GaudiKernel/AlgTool.h>
32#include <GaudiKernel/Chrono.h>
35#include <GaudiKernel/Guards.h>
38#include <GaudiKernel/Stat.h>
41
42namespace Gaudi {
43 namespace Details {
45 assert( loc != nullptr );
46 Gaudi::Property<bool> audit{ "AuditAlgorithms", false };
47 if ( auto appMgr = loc->service<IProperty>( "ApplicationMgr" ) ) { appMgr->getProperty( &audit ).ignore(); }
48 return audit.value();
49 }
50 } // namespace Details
51
52 // IAlgorithm implementation
54
55 // Bypass the initialization if the algorithm
56 // has already been initialized.
58
59 // this initializes the messaging, in case property update handlers need to print
60 // and update the property value bypassing the update handler
61 m_outputLevel.value() = setUpMessaging();
62
63 // Set the Algorithm's properties
64 bindPropertiesTo( serviceLocator()->getOptsSvc() );
65
66 // Bypass the initialization if the algorithm is disabled.
67 // Need to do this after setProperties.
68 if ( !isEnabled() ) return StatusCode::SUCCESS;
69
71
72 // TODO: (MCl) where should we do this? initialize or start?
73 // Reset Error count
74 // m_errorCount = 0;
75
76 // lock the context service
77 Gaudi::Utils::AlgContext cnt( this, registerContext() ? contextSvc().get() : nullptr );
78
79 // Get WhiteBoard interface if implemented by EventDataSvc
80 m_WB = service( "EventDataSvc" );
81
82 // check whether timeline should be done
84
85 StatusCode sc;
86 // Invoke initialize() method of the derived class inside a try/catch clause
87 try {
88
89 { // limit the scope of the guard
91 // check if we want to audit the initialize
92 ( m_auditorInitialize ) ? auditorSvc().get() : nullptr,
94 // Invoke the initialize() method of the derived class
95 sc = initialize();
96 }
97
98 if ( sc.isSuccess() ) {
99 // Update the state.
101 }
102 } catch ( const GaudiException& Exception ) {
103 fatal() << " Exception with tag=" << Exception.tag() << " is caught " << endmsg;
104 error() << Exception << endmsg;
105 Stat stat( chronoSvc(), Exception.tag() );
107 } catch ( const std::exception& Exception ) {
108 fatal() << "Standard std::exception is caught in " << __func__ << endmsg;
109 error() << Exception.what() << endmsg;
110 Stat stat( chronoSvc(), "*std::exception*" );
112 } catch ( ... ) {
113 fatal() << "UNKNOWN Exception is caught " << endmsg;
114 Stat stat( chronoSvc(), "*UNKNOWN Exception*" );
116 }
117
119
120 //
122 //
123
124 // ignore this step if we're a Sequence
125 if ( this->isSequence() ) { return sc; }
126
127 if ( msgLevel( MSG::DEBUG ) ) {
128 debug() << "input handles: " << inputHandles().size() << endmsg;
129 debug() << "output handles: " << outputHandles().size() << endmsg;
130 }
131
132 // check for explicit circular data dependencies in declared handles
133 DataObjIDColl out;
134 for ( auto& h : outputHandles() ) {
135 if ( !h->objKey().empty() ) out.emplace( h->fullKey() );
136 }
137 for ( auto& h : inputHandles() ) {
138 if ( !h->objKey().empty() && out.find( h->fullKey() ) != out.end() ) {
139 // TODO: this case leads to a segfault as the SC, seemingly, is not propagated up properly
140 error() << "Explicit circular data dependency detected for id " << h->fullKey() << endmsg;
142 }
143 }
144
145 if ( !sc ) return sc;
146
148
149 // visit all sub-algs and tools, build full set. First initialize ToolHandles if needed
150 try {
152 } catch ( const GaudiException& Exception ) {
153 error() << "Failing initializing ToolHandles : " << Exception << endmsg;
154 return StatusCode::FAILURE;
155 }
157 acceptDHVisitor( &avis );
158
159 // check for implicit circular data deps from child Algs/AlgTools
160 for ( auto& h : m_outputDataObjs ) {
161 auto i = m_inputDataObjs.find( h );
162 if ( i != m_inputDataObjs.end() ) {
163 if ( m_filterCircDeps ) {
164 warning() << "Implicit circular data dependency detected for id " << h << endmsg;
165 m_inputDataObjs.erase( i );
166 } else {
167 error() << "Implicit circular data dependency detected for id " << h << endmsg;
169 }
170 }
171 }
172
173 if ( !sc ) return sc;
174
175 if ( msgLevel( MSG::DEBUG ) && !avis.empty() ) { debug() << "data dependencies:" << avis << endmsg; }
176
177 // initialize handles
179
180 return sc;
181 }
182
184 vis->visit( this );
185
186 // loop through tools
187 for ( auto tool : tools() ) vis->visit( dynamic_cast<AlgTool*>( tool ) );
188 }
189
190 // IAlgorithm implementation
192
193 // Bypass the startup if already running or disabled.
195
197
198 // lock the context service
199 Gaudi::Utils::AlgContext cnt( this, registerContext() ? contextSvc().get() : nullptr );
200
202 // Invoke start() method of the derived class inside a try/catch clause
203 try {
204 { // limit the scope of the guard
206 // check if we want to audit the initialize
207 ( m_auditorStart ) ? auditorSvc().get() : nullptr, IAuditor::Start );
208 // Invoke the start() method of the derived class
209 sc = start();
210 }
211 if ( sc.isSuccess() ) {
212 // Update the state.
214 }
215 } catch ( const GaudiException& Exception ) {
216 fatal() << "in sysStart(): exception with tag=" << Exception.tag() << " is caught" << endmsg;
217 error() << Exception << endmsg;
218 Stat stat( chronoSvc(), Exception.tag() );
220 } catch ( const std::exception& Exception ) {
221 fatal() << "in sysStart(): standard std::exception is caught" << endmsg;
222 error() << Exception.what() << endmsg;
223 Stat stat( chronoSvc(), "*std::exception*" );
225 } catch ( ... ) {
226 fatal() << "in sysStart(): UNKNOWN Exception is caught" << endmsg;
227 Stat stat( chronoSvc(), "*UNKNOWN Exception*" );
229 }
230
231 return sc;
232 }
233
234 // IAlgorithm implementation
236
237 // Bypass the initialization if the algorithm is disabled.
238 if ( !isEnabled() ) return StatusCode::SUCCESS;
239
240 // Check that the current status is the correct one.
242 error() << "sysReinitialize(): cannot reinitialize algorithm not initialized" << endmsg;
243 return StatusCode::FAILURE;
244 }
245
246 // Reset Error count
247 // m_errorCount = 0; // done during start
248
249 // lock the context service
250 Gaudi::Utils::AlgContext cnt( this, registerContext() ? contextSvc().get() : nullptr );
251
253 // Invoke reinitialize() method of the derived class inside a try/catch clause
254 try {
256 // check if we want to audit the initialize
257 ( m_auditorReinitialize ) ? auditorSvc().get() : nullptr,
259 // Invoke the reinitialize() method of the derived class
260 sc = reinitialize();
261 } catch ( const GaudiException& Exception ) {
262 fatal() << "sysReinitialize(): Exception with tag=" << Exception.tag() << " is caught" << endmsg;
263 error() << Exception << endmsg;
264 Stat stat( chronoSvc(), Exception.tag() );
266 } catch ( const std::exception& Exception ) {
267 fatal() << "sysReinitialize(): Standard std::exception is caught" << endmsg;
268 error() << Exception.what() << endmsg;
269 Stat stat( chronoSvc(), "*std::exception*" );
271 } catch ( ... ) {
272 fatal() << "sysReinitialize(): UNKNOWN Exception is caught" << endmsg;
273 Stat stat( chronoSvc(), "*UNKNOWN Exception*" );
275 }
276
277 return sc;
278 }
279
280 // IAlgorithm implementation
282
283 // Bypass the initialization if the algorithm is disabled.
284 if ( !isEnabled() ) return StatusCode::SUCCESS;
285
286 // Check that the current status is the correct one.
288 error() << "sysRestart(): cannot restart algorithm not started" << endmsg;
289 return StatusCode::FAILURE;
290 }
291
292 // lock the context service
293 Gaudi::Utils::AlgContext cnt( this, registerContext() ? contextSvc().get() : nullptr );
294
296 // Invoke reinitialize() method of the derived class inside a try/catch clause
297 try {
299 // check if we want to audit the initialize
300 ( m_auditorRestart ) ? auditorSvc().get() : nullptr, IAuditor::ReStart );
301 // Invoke the reinitialize() method of the derived class
302 sc = restart();
303 } catch ( const GaudiException& Exception ) {
304 fatal() << "sysRestart(): Exception with tag=" << Exception.tag() << " is caught" << endmsg;
305 error() << Exception << endmsg;
306 Stat stat( chronoSvc(), Exception.tag() );
308 } catch ( const std::exception& Exception ) {
309 fatal() << "sysRestart(): Standard std::exception is caught" << endmsg;
310 error() << Exception.what() << endmsg;
311 Stat stat( chronoSvc(), "*std::exception*" );
313 } catch ( ... ) {
314 fatal() << "sysRestart(): UNKNOWN Exception is caught" << endmsg;
315 Stat stat( chronoSvc(), "*UNKNOWN Exception*" );
317 }
318
319 return sc;
320 }
321
323 if ( !isEnabled() ) {
324 if ( msgLevel( MSG::VERBOSE ) ) { verbose() << ".sysExecute(): is not enabled. Skip execution" << endmsg; }
325 return StatusCode::SUCCESS;
326 }
327
328 AlgExecStateRef algState{ *algExecStateSvc(), ctx, m_execSvcKey };
330 StatusCode status;
331
332 // Should performance profile be performed ?
333 // invoke execute() method of Algorithm class
334 // and catch all uncaught exceptions
335
336 // lock the context service
337 Gaudi::Utils::AlgContext cnt( this, registerContext() ? contextSvc().get() : nullptr, ctx );
338
340 // check if we want to audit the initialize
341 ( m_auditorExecute ) ? auditorSvc().get() : nullptr, IAuditor::Execute, status,
342 ctx );
343
344 try {
345 ITimelineSvc::TimelineRecorder timelineRecoder;
346 if ( m_doTimeline ) { timelineRecoder = timelineSvc()->getRecorder( name(), ctx ); }
347
348 status = execute( ctx );
349
351 algState.setFilterPassed( false );
352 } else if ( status.isFailure() ) {
353 status = exceptionSvc()->handleErr( *this, status );
354 }
355
356 } catch ( const GaudiException& Exception ) {
357
358 if ( Exception.code() == StatusCode::FAILURE ) {
359 fatal();
360 } else {
361 error() << " Recoverable";
362 }
363
364 msgStream() << " Exception with tag=" << Exception.tag() << " is caught " << endmsg;
365
366 error() << Exception << endmsg;
367
368 // Stat stat( chronoSvc() , Exception.tag() ) ;
369 status = exceptionSvc()->handle( *this, Exception );
370 } catch ( const std::exception& Exception ) {
371
372 fatal() << "Standard std::exception is caught in " << __func__ << endmsg;
373 error() << Exception.what() << endmsg;
374 // Stat stat( chronoSvc() , "*std::exception*" ) ;
375 status = exceptionSvc()->handle( *this, Exception );
376 } catch ( ... ) {
377
378 fatal() << "UNKNOWN Exception is caught " << endmsg;
379 // Stat stat( chronoSvc() , "*UNKNOWN Exception*" ) ;
380
381 status = exceptionSvc()->handle( *this );
382 }
383
384 if ( status.isFailure() ) { m_aess->incrementErrorCount( this ); }
385
386 algState.setState( AlgExecState::Done, status );
387
388 return status;
389 }
390
391 // IAlgorithm implementation
393
394 // Bypass the startup if already running or disabled.
396
398
399 // lock the context service
400 Gaudi::Utils::AlgContext cnt( this, registerContext() ? contextSvc().get() : nullptr );
401
403 // Invoke stop() method of the derived class inside a try/catch clause
404 try {
405 { // limit the scope of the guard
407 // check if we want to audit the initialize
408 ( m_auditorStop ) ? auditorSvc().get() : nullptr, IAuditor::Stop );
409
410 // Invoke the stop() method of the derived class
411 sc = stop();
412 }
413 if ( sc.isSuccess() ) {
414 // Update the state.
416 }
417 } catch ( const GaudiException& Exception ) {
418 fatal() << "in sysStop(): exception with tag=" << Exception.tag() << " is caught" << endmsg;
419 error() << Exception << endmsg;
420 Stat stat( chronoSvc(), Exception.tag() );
422 } catch ( const std::exception& Exception ) {
423 fatal() << "in sysStop(): standard std::exception is caught" << endmsg;
424 error() << Exception.what() << endmsg;
425 Stat stat( chronoSvc(), "*std::exception*" );
427 } catch ( ... ) {
428 fatal() << "in sysStop(): UNKNOWN Exception is caught" << endmsg;
429 Stat stat( chronoSvc(), "*UNKNOWN Exception*" );
431 }
432
433 return sc;
434 }
435
437
438 // Bypass the finalialization if the algorithm hasn't been initilized.
440
442
443 // lock the context service
444 Gaudi::Utils::AlgContext cnt( this, registerContext() ? contextSvc().get() : nullptr );
445
447 // Invoke finalize() method of the derived class inside a try/catch clause
448 try {
449 { // limit the scope of the guard
451 // check if we want to audit the initialize
452 ( m_auditorFinalize ) ? auditorSvc().get() : nullptr, IAuditor::Finalize );
453 // Invoke the finalize() method of the derived class
454 sc = finalize();
455
456 // Finalize ToolHandles
458 thArr->release().orThrow( "Cannot release " + thArr->propertyName() );
459 for ( BaseToolHandle* th : m_toolHandles ) th->release().orThrow( "Cannot release " + th->typeAndName() );
460 }
461 if ( sc.isSuccess() ) {
462 // Indicate that this Algorithm has been finalized to prevent duplicate attempts
464 }
465 } catch ( const GaudiException& Exception ) {
466 fatal() << " Exception with tag=" << Exception.tag() << " is caught " << endmsg;
467 error() << Exception << endmsg;
468 Stat stat( chronoSvc(), Exception.tag() );
470 } catch ( const std::exception& Exception ) {
471 fatal() << "Standard std::exception is caught in " << __func__ << endmsg;
472 error() << Exception.what() << endmsg;
473 Stat stat( chronoSvc(), "*std::exception*" );
475 } catch ( ... ) {
476 fatal() << "UNKNOWN Exception is caught " << endmsg;
477 Stat stat( chronoSvc(), "*UNKNOWN Exception*" );
479 }
480 return sc;
481 }
482
484 /* @TODO
485 * MCl 2008-10-23: the implementation of reinitialize as finalize+initialize
486 * is causing too many problems
487 *
488 // Default implementation is finalize+initialize
489 StatusCode sc = finalize();
490 if (sc.isFailure()) {
491 error() << "reinitialize(): cannot be finalized" << endmsg;
492 return sc;
493 }
494 sc = initialize();
495 if (sc.isFailure()) {
496 error() << "reinitialize(): cannot be initialized" << endmsg;
497 return sc;
498 }
499 */
500 return StatusCode::SUCCESS;
501 }
502
504 // Default implementation is stop+start
505 StatusCode sc = stop();
506 if ( sc.isFailure() ) {
507 error() << "restart(): cannot be stopped" << endmsg;
508 return sc;
509 }
510 sc = start();
511 if ( sc.isFailure() ) {
512 error() << "restart(): cannot be started" << endmsg;
513 return sc;
514 }
515 return StatusCode::SUCCESS;
516 }
517
518 const std::string& Algorithm::name() const { return m_name.str(); }
519
520 const Gaudi::StringKey& Algorithm::nameKey() const { return m_name; }
521
522 const std::string& Algorithm::version() const { return m_version; }
523
524 unsigned int Algorithm::index() const { return m_index; }
525
526 void Algorithm::setIndex( const unsigned int& idx ) { m_index = idx; }
527
528 bool Algorithm::isEnabled() const { return m_isEnabled; }
529
531 return { *algExecStateSvc(), ctx, m_execSvcKey };
532 }
533
534 template <typename IFace>
535 SmartIF<IFace>& Algorithm::get_svc_( SmartIF<IFace>& p, const char* service_name ) const {
536 if ( !p ) {
537 p = this->service( service_name );
538 if ( !p ) {
539 throw GaudiException( "Service [" + std::string{ service_name } + "] not found", this->name(),
541 }
542 }
543 return p;
544 }
545
546 SmartIF<IAlgExecStateSvc>& Algorithm::algExecStateSvc() const { return get_svc_( m_aess, "AlgExecStateSvc" ); }
548 SmartIF<IChronoStatSvc>& Algorithm::chronoSvc() const { return get_svc_( m_CSS, "ChronoStatSvc" ); }
549 SmartIF<IDataProviderSvc>& Algorithm::detSvc() const { return get_svc_( m_DDS, "DetectorDataSvc" ); }
550 SmartIF<IConversionSvc>& Algorithm::detCnvSvc() const { return get_svc_( m_DCS, "DetectorPersistencySvc" ); }
551 SmartIF<IDataProviderSvc>& Algorithm::eventSvc() const { return get_svc_( m_EDS, "EventDataSvc" ); }
552 SmartIF<IConversionSvc>& Algorithm::eventCnvSvc() const { return get_svc_( m_ECS, "EventPersistencySvc" ); }
553 SmartIF<IHistogramSvc>& Algorithm::histoSvc() const { return get_svc_( m_HDS, "HistogramDataSvc" ); }
554 SmartIF<INTupleSvc>& Algorithm::ntupleSvc() const { return get_svc_( m_NTS, "NTupleSvc" ); }
555 SmartIF<IRndmGenSvc>& Algorithm::randSvc() const { return get_svc_( m_RGS, "RndmGenSvc" ); }
556 SmartIF<IToolSvc>& Algorithm::toolSvc() const { return get_svc_( m_ptoolSvc, "ToolSvc" ); }
557 SmartIF<IExceptionSvc>& Algorithm::exceptionSvc() const { return get_svc_( m_EXS, "ExceptionSvc" ); }
560 SmartIF<IHiveWhiteBoard>& Algorithm::whiteboard() const { return get_svc_( m_WB, "EventDataSvc" ); }
561
565
567
568 auto init_one = [&]( BaseToolHandle* th ) {
569 if ( !th->isEnabled() ) {
570 if ( msgLevel( MSG::DEBUG ) && !th->typeAndName().empty() )
571 debug() << "ToolHandle " << th->typeAndName() << " not used" << endmsg;
572 return;
573 }
574 if ( !th->get() ) {
575 auto sc = th->retrieve();
576 if ( sc.isFailure() ) {
577 throw GaudiException( "Failed to retrieve tool " + th->typeAndName(), this->name(), StatusCode::FAILURE );
578 }
579 }
580 auto tool = th->get();
581 if ( msgLevel( MSG::DEBUG ) )
582 debug() << "Adding " << ( th->isPublic() ? "public" : "private" ) << " ToolHandle tool " << tool->name() << " ("
583 << tool->type() << ")" << endmsg;
584 m_tools.push_back( tool );
585 };
586
587 for ( auto thArr : m_toolHandleArrays ) {
588 if ( msgLevel( MSG::DEBUG ) )
589 debug() << "Registering all Tools in ToolHandleArray " << thArr->propertyName() << endmsg;
590 // Iterate over its tools:
591 for ( auto toolHandle : thArr->getBaseArray() ) {
592 BaseToolHandle* bth = dynamic_cast<BaseToolHandle*>( toolHandle );
593 if ( bth ) {
594 init_one( bth );
595 } else {
596 error() << "Error retrieving ToolHandle " << toolHandle->typeAndName() << " in ToolHandleArray "
597 << thArr->propertyName() << ". Not registered" << endmsg;
598 }
599 }
600 }
601
602 for ( BaseToolHandle* th : m_toolHandles ) init_one( th );
603
604 m_toolHandlesInit = true;
605 }
606
607 const std::vector<IAlgTool*>& Algorithm::tools() const {
609 return m_tools;
610 }
611
612 std::vector<IAlgTool*>& Algorithm::tools() {
614 return m_tools;
615 }
616
620
621 SmartIF<IService> Algorithm::service( std::string_view name, const bool createIf, const bool quiet ) const {
622 const ServiceLocatorHelper helper( *serviceLocator(), *this );
623 return helper.service( name, quiet, createIf );
624 }
625
626 void Algorithm::registerTool( IAlgTool* tool ) const {
627 if ( msgLevel( MSG::DEBUG ) ) { debug() << "Registering tool " << tool->name() << endmsg; }
628 m_tools.push_back( tool );
629 }
630
632 std::vector<IAlgTool*>::iterator it = std::find( m_tools.begin(), m_tools.end(), tool );
633 if ( it != m_tools.end() ) {
634 if ( msgLevel( MSG::DEBUG ) ) debug() << "De-Registering tool " << tool->name() << endmsg;
635 m_tools.erase( it );
636 } else {
637 if ( msgLevel( MSG::DEBUG ) ) debug() << "Could not de-register tool " << tool->name() << endmsg;
638 }
639 }
640
641 std::ostream& Algorithm::toControlFlowExpression( std::ostream& os ) const {
642 return os << type() << "('" << name() << "')";
643 }
644
645 unsigned int Algorithm::errorCount() const { return m_aess->algErrorCount( static_cast<const IAlgorithm*>( this ) ); }
646} // namespace Gaudi
std::unordered_set< DataObjID, DataObjID_Hasher > DataObjIDColl
Definition DataObjID.h:121
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition MsgStream.h:198
wrapper on an Algorithm state.
void setFilterPassed(bool f=true)
void setState(State s)
Base class from which all the concrete tool classes should be derived.
Definition AlgTool.h:55
Non-templated base class for actual ToolHandle<T>.
Definition ToolHandle.h:78
MsgStream & error() const
shortcut for the method msgStream(MSG::ERROR)
MsgStream & verbose() const
shortcut for the method msgStream(MSG::VERBOSE)
MsgStream & warning() const
shortcut for the method msgStream(MSG::WARNING)
MsgStream & fatal() const
shortcut for the method msgStream(MSG::FATAL)
MsgStream & msgStream() const
Return an uninitialized MsgStream.
MsgStream & debug() const
shortcut for the method msgStream(MSG::DEBUG)
MSG::Level msgLevel() const
get the cached level (originally extracted from the embedded MsgStream)
bool empty() const
return true if no DataHandle was found
This class represents an entry point to all the event specific data.
StatusCode restart() override
the default (empty) implementation of IStateful::restart() method
Gaudi::StringKey m_name
Algorithm's name for identification.
Definition Algorithm.h:424
SmartIF< IAuditorSvc > & auditorSvc() const
The standard auditor service.May not be invoked before sysInitialize() has been invoked.
unsigned int m_index
Algorithm's index.
Definition Algorithm.h:427
const std::vector< IAlgTool * > & tools() const
const Gaudi::StringKey & nameKey() const override
StatusCode sysStart() override
Reinitialization method invoked by the framework.
SmartIF< IDataProviderSvc > m_EDS
Event data service.
Definition Algorithm.h:442
Gaudi::Property< bool > m_auditorStart
Definition Algorithm.h:484
SmartIF< IAlgContextSvc > m_contextSvc
Algorithm Context Service.
Definition Algorithm.h:455
SmartIF< IChronoStatSvc > m_CSS
Chrono & Stat Service.
Definition Algorithm.h:449
SmartIF< IRndmGenSvc > m_RGS
Random Number Generator Service.
Definition Algorithm.h:450
std::unique_ptr< IDataHandleVisitor > m_updateDataHandles
Hook for for derived classes to provide a custom visitor for data handles.
Definition Algorithm.h:464
StatusCode sysExecute(const EventContext &ctx) override
The actions to be performed by the algorithm on an event.
void acceptDHVisitor(IDataHandleVisitor *) const override
AlgExecStateRef::AlgKey m_execSvcKey
identifier of this algorithm in the AlgExecStateSvc
Definition Algorithm.h:430
SmartIF< IConversionSvc > & detCnvSvc() const
The standard detector data persistency conversion service.
SmartIF< IHistogramSvc > & histoSvc() const
The standard histogram service.
SmartIF< IDataProviderSvc > & eventSvc() const
The standard event data service.
Gaudi::Property< bool > m_doTimeline
Definition Algorithm.h:488
Gaudi::StateMachine::State FSMState() const override
returns the current state of the algorithm
Definition Algorithm.h:187
SmartIF< IConversionSvc > & eventCnvSvc() const
The standard event data persistency conversion service.
SmartIF< IFace > & get_svc_(SmartIF< IFace > &p, const char *service_name) const
Gaudi::Property< int > m_outputLevel
Definition Algorithm.h:468
void deregisterTool(IAlgTool *tool) const
Gaudi::StateMachine::State m_targetState
Algorithm has been initialized flag.
Definition Algorithm.h:511
SmartIF< IConversionSvc > m_ECS
Event conversion service.
Definition Algorithm.h:444
StatusCode sysReinitialize() override
Reinitialization method invoked by the framework.
StatusCode initialize() override
the default (empty) implementation of IStateful::initialize() method
Definition Algorithm.h:175
SmartIF< IExceptionSvc > m_EXS
Exception Handler Service.
Definition Algorithm.h:451
std::vector< GaudiHandleArrayBase * > m_toolHandleArrays
Definition Algorithm.h:435
SmartIF< IAlgExecStateSvc > & algExecStateSvc() const
SmartIF< IAlgContextSvc > & contextSvc() const
get Algorithm Context Service
const std::string & version() const override
bool registerContext() const
register for Algorithm Context Service?
Definition Algorithm.h:280
StatusCode finalize() override
the default (empty) implementation of IStateful::finalize() method
Definition Algorithm.h:181
Gaudi::Property< bool > m_auditorExecute
Definition Algorithm.h:480
SmartIF< IChronoStatSvc > & chronoSvc() const
The standard Chrono & Stat service, Return a pointer to the service if present.
SmartIF< IRndmGenSvc > & randSvc() const
The standard RandomGen service, Return a pointer to the service if present.
unsigned int errorCount() const
Get the number of failures of the algorithm.
SmartIF< ISvcLocator > & serviceLocator() const override
The standard service locator.
Gaudi::Property< bool > m_auditorFinalize
Definition Algorithm.h:482
SmartIF< ITimelineSvc > & timelineSvc() const
void initToolHandles() const
SmartIF< IDataProviderSvc > m_DDS
Detector data service.
Definition Algorithm.h:445
SmartIF< IConversionSvc > m_DCS
Detector conversion service.
Definition Algorithm.h:446
StatusCode stop() override
the default (empty) implementation of IStateful::stop() method
Definition Algorithm.h:179
Gaudi::Property< bool > m_auditorRestart
Definition Algorithm.h:478
const std::string & name() const override
The identifying name of the algorithm object.
StatusCode sysFinalize() override
System finalization.
StatusCode reinitialize() override
the default (empty) implementation of IStateful::reinitialize() method
SmartIF< INTupleSvc > m_NTS
N tuple service.
Definition Algorithm.h:448
SmartIF< IDataProviderSvc > & detSvc() const
The standard detector data service.
Gaudi::StateMachine::State m_state
flag indicating whether ToolHandle tools have been added to m_tools
Definition Algorithm.h:510
Gaudi::Property< bool > m_filterCircDeps
Definition Algorithm.h:505
SmartIF< IHiveWhiteBoard > & whiteboard() const
SmartIF< IHiveWhiteBoard > m_WB
Event data service (whiteboard).
Definition Algorithm.h:443
StatusCode sysRestart() override
Restart method invoked by the framework.
AlgExecStateRef execState(const EventContext &ctx) const override
get the AlgExecStateRef of current algorithm Actually a small wrapper around it, thus the plain objec...
SmartIF< IAlgExecStateSvc > m_aess
Alg execution state mgr.
Definition Algorithm.h:458
void registerTool(IAlgTool *tool) const
SmartIF< IAuditorSvc > m_pAuditorSvc
Auditor Service.
Definition Algorithm.h:452
unsigned int index() const override
std::vector< BaseToolHandle * > m_toolHandles
Definition Algorithm.h:434
Gaudi::Property< bool > m_auditorInitialize
Definition Algorithm.h:474
const std::string & type() const override
The type of the algorithm object.
Definition Algorithm.h:162
bool isEnabled() const override
Is this algorithm enabled or disabled?
SmartIF< IService > service(std::string_view name, const bool createIf=true, const bool quiet=false) const
Return a pointer to the service identified by name (or "type/name").
SmartIF< IExceptionSvc > & exceptionSvc() const
Get the exception Service.
SmartIF< ITimelineSvc > m_timelineSvc
Timeline Service.
Definition Algorithm.h:457
std::ostream & toControlFlowExpression(std::ostream &os) const override
Produce string represention of the control flow expression.
StatusCode start() override
the default (empty) implementation of IStateful::start() method
Definition Algorithm.h:177
Gaudi::Property< bool > m_auditorStop
Definition Algorithm.h:486
SmartIF< INTupleSvc > & ntupleSvc() const
The standard N tuple service.
SmartIF< IHistogramSvc > m_HDS
Histogram data service.
Definition Algorithm.h:447
Gaudi::Property< bool > m_isEnabled
Definition Algorithm.h:472
Gaudi::Property< bool > m_auditorReinitialize
Definition Algorithm.h:476
void setIndex(const unsigned int &idx) override
set instantiation index of Alg
SmartIF< IToolSvc > & toolSvc() const
The standard ToolSvc service, Return a pointer to the service if present.
bool isSequence() const override
Are we a Sequence?
Definition Algorithm.h:195
SmartIF< ISvcLocator > m_pSvcLocator
Pointer to service locator service.
Definition Algorithm.h:460
std::string m_version
Algorithm's version.
Definition Algorithm.h:426
StatusCode sysStop() override
System stop.
SmartIF< IToolSvc > m_ptoolSvc
ToolSvc Service.
Definition Algorithm.h:453
StatusCode sysInitialize() override
Initialization method invoked by the framework.
Definition Algorithm.cpp:53
std::vector< IAlgTool * > m_tools
Definition Algorithm.h:433
It is a simple guard, which "locks" the scope for the Auditor Service is am exception-safe way.
Definition Guards.h:202
static const std::string Stop
Definition IAuditor.h:52
static const std::string Initialize
Definition IAuditor.h:47
static const std::string Finalize
Definition IAuditor.h:53
static const std::string Execute
Definition IAuditor.h:51
static const std::string Start
Definition IAuditor.h:49
static const std::string ReInitialize
Definition IAuditor.h:48
static const std::string ReStart
Definition IAuditor.h:50
Implementation of property with value of concrete type.
Definition Property.h:35
const ValueType & value() const
Definition Property.h:246
Helper class for efficient "key" access for strings.
Definition StringKey.h:68
Helper "sentry" class to automatize the safe register/unregister the algorithm's context.
Define general base for Gaudi exception.
Base class of array's of various gaudihandles.
virtual AlgExecStateRef::AlgKey addAlg(const Gaudi::StringKey &algName)=0
adds a new algorithm to the service
The interface implemented by the AlgTool base class.
Definition IAlgTool.h:29
The IAlgorithm is the interface implemented by the Algorithm base class.
Definition IAlgorithm.h:37
virtual void visit(const IDataHandleHolder *)=0
virtual StatusCode handle(const INamedInterface &o, const GaudiException &e) const =0
Handle caught GaudiExceptions.
virtual StatusCode handleErr(const INamedInterface &o, const StatusCode &s) const =0
Handle errors.
The IProperty is the basic interface for all components which have properties that can be set or get.
Definition IProperty.h:32
The ISvcLocator is the interface implemented by the Service Factory in the Application Manager to loc...
Definition ISvcLocator.h:42
virtual SmartIF< IService > & service(const Gaudi::Utils::TypeNameString &typeName, const bool createIf=true)=0
Returns a smart pointer to a service.
RAII helper to record timeline events.
virtual bool isEnabled() const =0
virtual TimelineRecorder getRecorder(std::string alg, const EventContext &ctx)=0
an helper to share the implementation of service() among the various kernel base classes
SmartIF< IService > service(std::string_view name, const bool quiet=false, const bool createIf=true) const
Small smart pointer class with automatic reference counting for IInterface.
Definition SmartIF.h:28
Small wrapper class for easy manipulation with generic counters and IStatSvc interface.
Definition Stat.h:48
This class is used for returning status codes from appropriate routines.
Definition StatusCode.h:64
bool isFailure() const
Definition StatusCode.h:118
bool isSuccess() const
Definition StatusCode.h:302
constexpr static const auto SUCCESS
Definition StatusCode.h:99
constexpr static const auto FAILURE
Definition StatusCode.h:100
bool getDefaultAuditorValue(ISvcLocator *loc)
Definition Algorithm.cpp:44
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...
This file provides a Grammar for the type Gaudi::Accumulators::Axis It allows to use that type from p...
Definition __init__.py:1
@ DEBUG
Definition IMessageSvc.h:22
@ VERBOSE
Definition IMessageSvc.h:22