The Gaudi Framework  master (37c0b60a)
MinimalEventLoopMgr Class Reference

#include </builds/gaudi/Gaudi/GaudiKernel/include/GaudiKernel/MinimalEventLoopMgr.h>

Inheritance diagram for MinimalEventLoopMgr:
Collaboration diagram for MinimalEventLoopMgr:

Classes

class  AbortEventListener
 

Public Types

typedef std::vector< SmartIF< IAlgorithm > > ListAlg
 
- Public Types inherited from extends< Service, IEventProcessor >
using base_class = extends
 Typedef to this class. More...
 
using extend_interfaces_base = extend_interfaces< Interfaces... >
 Typedef to the base of this class. More...
 
- Public Types inherited from Service
using Factory = Gaudi::PluginService::Factory< IService *(const std::string &, ISvcLocator *)>
 
- Public Types inherited from PropertyHolder< CommonMessaging< implements< IService, IProperty, IStateful > > >
using PropertyHolderImpl = PropertyHolder< CommonMessaging< implements< IService, IProperty, IStateful > > >
 Typedef used to refer to this class from derived classes, as in. More...
 
- Public Types inherited from CommonMessaging< implements< IService, IProperty, IStateful > >
using base_class = CommonMessaging
 
- Public Types inherited from extend_interfaces< Interfaces... >
using ext_iids = typename Gaudi::interface_list_cat< typename Interfaces::ext_iids... >::type
 take union of the ext_iids of all Interfaces... More...
 

Public Member Functions

 MinimalEventLoopMgr (const std::string &nam, ISvcLocator *svcLoc)
 Standard Constructor. More...
 
 MinimalEventLoopMgr (const MinimalEventLoopMgr &)=delete
 No copy allowed. More...
 
MinimalEventLoopMgroperator= (const MinimalEventLoopMgr &)=delete
 No copy allowed. More...
 
StatusCode initialize () override
 implementation of IService::initialize More...
 
StatusCode start () override
 implementation of IService::start More...
 
StatusCode stop () override
 implementation of IService::stop More...
 
StatusCode finalize () override
 implementation of IService::finalize More...
 
StatusCode reinitialize () override
 implementation of IService::reinitialize More...
 
StatusCode restart () override
 implementation of IService::restart More...
 
EventContext createEventContext () override
 implementation of IEventProcessor::createEventContext() More...
 
StatusCode nextEvent (int maxevt) override
 implementation of IEventProcessor::nextEvent More...
 
StatusCode executeEvent (EventContext &&ctx) override
 implementation of IEventProcessor::executeEvent(EventContext&&) More...
 
StatusCode executeRun (int maxevt) override
 implementation of IEventProcessor::executeRun( ) More...
 
StatusCode stopRun () override
 implementation of IEventProcessor::stopRun( ) More...
 
void topAlgHandler (Gaudi::Details::PropertyBase &p)
 Top algorithm List handler. More...
 
StatusCode decodeTopAlgs ()
 decodeTopAlgNameList & topAlgNameListHandler More...
 
void outStreamHandler (Gaudi::Details::PropertyBase &p)
 Output stream List handler. More...
 
StatusCode decodeOutStreams ()
 decodeOutStreamNameList & outStreamNameListHandler More...
 
- Public Member Functions inherited from extends< Service, IEventProcessor >
void * i_cast (const InterfaceID &tid) const override
 Implementation of IInterface::i_cast. More...
 
StatusCode queryInterface (const InterfaceID &ti, void **pp) override
 Implementation of IInterface::queryInterface. More...
 
std::vector< std::stringgetInterfaceNames () const override
 Implementation of IInterface::getInterfaceNames. More...
 
- Public Member Functions inherited from Service
const std::stringname () const override
 Retrieve name of the service
More...
 
StatusCode configure () override
 
StatusCode initialize () override
 
StatusCode start () override
 
StatusCode stop () override
 
StatusCode finalize () override
 
StatusCode terminate () override
 
Gaudi::StateMachine::State FSMState () const override
 
Gaudi::StateMachine::State targetFSMState () const override
 
StatusCode reinitialize () override
 
StatusCode restart () override
 
StatusCode sysInitialize () override
 Initialize Service
More...
 
StatusCode sysStart () override
 Initialize Service
More...
 
StatusCode sysStop () override
 Initialize Service
More...
 
StatusCode sysFinalize () override
 Finalize Service
More...
 
StatusCode sysReinitialize () override
 Re-initialize the Service. More...
 
StatusCode sysRestart () override
 Re-initialize the Service. More...
 
 Service (std::string name, ISvcLocator *svcloc)
 Standard Constructor
More...
 
SmartIF< ISvcLocator > & serviceLocator () const override
 Retrieve pointer to service locator
More...
 
template<class T >
StatusCode service (const std::string &name, const T *&psvc, bool createIf=true) const
 Access a service by name, creating it if it doesn't already exist. More...
 
template<class T >
StatusCode service (const std::string &name, T *&psvc, bool createIf=true) const
 
template<typename IFace = IService>
SmartIF< IFace > service (const std::string &name, bool createIf=true) const
 
template<class T >
StatusCode service (const std::string &svcType, const std::string &svcName, T *&psvc) const
 Access a service by name and type, creating it if it doesn't already exist. More...
 
template<class T >
Gaudi::Details::PropertyBasedeclareProperty (const std::string &name, ToolHandle< T > &hndl, const std::string &doc="none")
 
template<class T >
StatusCode declareTool (ToolHandle< T > &handle, bool createIf=true)
 
template<class T >
StatusCode declareTool (ToolHandle< T > &handle, const std::string &toolTypeAndName, bool createIf=true)
 Declare used tool. More...
 
template<class T >
Gaudi::Details::PropertyBasedeclareProperty (const std::string &name, ToolHandleArray< T > &hndlArr, const std::string &doc="none")
 
template<class T >
void addToolsArray (ToolHandleArray< T > &hndlArr)
 
const std::vector< IAlgTool * > & tools () const
 
SmartIF< IAuditorSvc > & auditorSvc () const
 The standard auditor service.May not be invoked before sysInitialize() has been invoked. More...
 
- Public Member Functions inherited from PropertyHolder< CommonMessaging< implements< IService, IProperty, IStateful > > >
 PropertyHolder ()=default
 
Gaudi::Details::PropertyBasedeclareProperty (Gaudi::Details::PropertyBase &prop)
 Declare a property. More...
 
Gaudi::Details::PropertyBasedeclareProperty (const std::string &name, TYPE &value, const std::string &doc="none")
 Helper to wrap a regular data member and use it as a regular property. More...
 
Gaudi::Details::PropertyBasedeclareProperty (const std::string &name, Gaudi::Property< TYPE, VERIFIER, HANDLERS > &prop, const std::string &doc="none")
 Declare a PropertyBase instance setting name and documentation. More...
 
Gaudi::Details::PropertyBasedeclareRemoteProperty (const std::string &name, IProperty *rsvc, const std::string &rname="")
 Declare a remote property. More...
 
StatusCode setProperty (const std::string &name, const Gaudi::Details::PropertyBase &p) override
 set the property from another property with a different name More...
 
StatusCode setProperty (const std::string &s) override
 set the property from the formatted string More...
 
StatusCode setProperty (const Gaudi::Details::PropertyBase &p)
 Set the property from a property. More...
 
virtual StatusCode setProperty (const std::string &name, const Gaudi::Details::PropertyBase &p)=0
 Set the property from a property with a different name. More...
 
virtual StatusCode setProperty (const std::string &s)=0
 Set the property by string. More...
 
StatusCode setProperty (const std::string &name, const char *v)
 Special case for string literals. More...
 
StatusCode setProperty (const std::string &name, const std::string &v)
 Special case for std::string. More...
 
StatusCode setProperty (const std::string &name, const TYPE &value)
 set the property form the value More...
 
StatusCode setPropertyRepr (const std::string &n, const std::string &r) override
 set the property from name and value string representation More...
 
StatusCode getProperty (Gaudi::Details::PropertyBase *p) const override
 get the property More...
 
const Gaudi::Details::PropertyBasegetProperty (std::string_view name) const override
 get the property by name More...
 
StatusCode getProperty (std::string_view n, std::string &v) const override
 convert the property to the string More...
 
const std::vector< Gaudi::Details::PropertyBase * > & getProperties () const override
 get all properties More...
 
bool hasProperty (std::string_view name) const override
 Return true if we have a property with the given name. More...
 
Gaudi::Details::PropertyBaseproperty (std::string_view name) const
 \fixme property and bindPropertiesTo should be protected More...
 
void bindPropertiesTo (Gaudi::Interfaces::IOptionsSvc &optsSvc)
 
 PropertyHolder (const PropertyHolder &)=delete
 
PropertyHolderoperator= (const PropertyHolder &)=delete
 
- Public Member Functions inherited from CommonMessaging< implements< IService, IProperty, IStateful > >
MSG::Level msgLevel () const
 get the cached level (originally extracted from the embedded MsgStream) More...
 
bool msgLevel (MSG::Level lvl) const
 get the output level from the embedded MsgStream More...
 

Protected Types

enum  State { OFFLINE, CONFIGURED, FINALIZED, INITIALIZED }
 

Protected Attributes

Gaudi::Property< std::vector< std::string > > m_topAlgNames
 
Gaudi::Property< std::vector< std::string > > m_outStreamNames
 
Gaudi::Property< bool > m_printCFExp
 
SmartIF< IAppMgrUIm_appMgrUI
 Reference to the IAppMgrUI interface of the application manager. More...
 
SmartIF< IIncidentSvcm_incidentSvc
 Reference to the incident service. More...
 
SmartIF< IAlgExecStateSvcm_aess
 List of top level algorithms. More...
 
ListAlg m_topAlgList
 
ListAlg m_outStreamList
 List of output streams. More...
 
State m_state = OFFLINE
 State of the object. More...
 
bool m_scheduledStop = false
 Scheduled stop of event processing. More...
 
AbortEventListener m_abortEventListener
 Instance of the incident listener waiting for AbortEvent. More...
 
SmartIF< IHiveWhiteBoardm_WB
 < Event data service (whiteboard) More...
 
size_t m_nevt { 0 }
 
- Protected Attributes inherited from Service
Gaudi::StateMachine::State m_state = Gaudi::StateMachine::OFFLINE
 Service state
More...
 
Gaudi::StateMachine::State m_targetState = Gaudi::StateMachine::OFFLINE
 Service state
More...
 
Gaudi::Property< int > m_outputLevel { this, "OutputLevel", MSG::NIL, "output level" }
 flag indicating whether ToolHandle tools have been added to m_tools More...
 
Gaudi::Property< bool > m_auditInit { this, "AuditServices", false, "[[deprecated]] unused" }
 
Gaudi::Property< bool > m_auditorInitialize { this, "AuditInitialize", false, "trigger auditor on initialize()" }
 
Gaudi::Property< bool > m_auditorStart { this, "AuditStart", false, "trigger auditor on start()" }
 
Gaudi::Property< bool > m_auditorStop { this, "AuditStop", false, "trigger auditor on stop()" }
 
Gaudi::Property< bool > m_auditorFinalize { this, "AuditFinalize", false, "trigger auditor on finalize()" }
 
Gaudi::Property< bool > m_auditorReinitialize { this, "AuditReinitialize", false, "trigger auditor on reinitialize()" }
 
Gaudi::Property< bool > m_auditorRestart { this, "AuditRestart", false, "trigger auditor on restart()" }
 
Gaudi::Property< bool > m_autoRetrieveTools
 
Gaudi::Property< bool > m_checkToolDeps
 
SmartIF< IAuditorSvcm_pAuditorSvc
 Auditor Service
More...
 

Additional Inherited Members

- Protected Member Functions inherited from Service
std::vector< IAlgTool * > & tools ()
 
 ~Service () override
 Standard Destructor
More...
 
int outputLevel () const
 get the Service's output level More...
 
- Protected Member Functions inherited from CommonMessaging< implements< IService, IProperty, IStateful > >
MSG::Level setUpMessaging () const
 Set up local caches. More...
 
MSG::Level resetMessaging ()
 Reinitialize internal states. More...
 
void updateMsgStreamOutputLevel (int level)
 Update the output level of the cached MsgStream. More...
 

Detailed Description

This is the default processing manager of the application manager. This object handles the minimal requirements needed by the application manager. It also is capable of handling a bunch of algorithms and output streams. However, the list may as well be empty.

Author
Markus Frank
Version
1.0

Definition at line 34 of file MinimalEventLoopMgr.h.

Member Typedef Documentation

◆ ListAlg

Member Enumeration Documentation

◆ State

Enumerator
OFFLINE 
CONFIGURED 
FINALIZED 
INITIALIZED 

Definition at line 67 of file MinimalEventLoopMgr.h.

Constructor & Destructor Documentation

◆ MinimalEventLoopMgr() [1/2]

MinimalEventLoopMgr::MinimalEventLoopMgr ( const std::string nam,
ISvcLocator svcLoc 
)

Standard Constructor.

Definition at line 38 of file MinimalEventLoopMgr.cpp.

39  : base_class( nam, svcLoc ), m_appMgrUI( svcLoc ) {}

◆ MinimalEventLoopMgr() [2/2]

MinimalEventLoopMgr::MinimalEventLoopMgr ( const MinimalEventLoopMgr )
delete

No copy allowed.

Member Function Documentation

◆ createEventContext()

EventContext MinimalEventLoopMgr::createEventContext ( )
override

implementation of IEventProcessor::createEventContext()

Definition at line 292 of file MinimalEventLoopMgr.cpp.

292 { return EventContext{ m_nevt++, 0 }; }

◆ decodeOutStreams()

StatusCode MinimalEventLoopMgr::decodeOutStreams ( )

decodeOutStreamNameList & outStreamNameListHandler

Definition at line 470 of file MinimalEventLoopMgr.cpp.

470  {
472  if ( CONFIGURED == m_state || INITIALIZED == m_state ) {
473  auto algMan = serviceLocator()->as<IAlgManager>();
474  if ( algMan ) {
475  // Reset the existing Top Algorithm List
477  for ( const auto& it : m_outStreamNames.value() ) {
478  Gaudi::Utils::TypeNameString item( it );
479  const bool CREATE = false;
480  SmartIF<IAlgorithm> os = algMan->algorithm( item, CREATE );
481  if ( os ) {
482  DEBMSG << "Output Stream " << item.name() << " already exists" << endmsg;
483  } else {
484  DEBMSG << "Creating Output Stream " << it << endmsg;
485  IAlgorithm* ios = nullptr;
486  StatusCode sc1 = algMan->createAlgorithm( item.type(), item.name(), ios );
487  if ( !sc1.isSuccess() ) {
488  error() << "Unable to create Output Stream " << it << endmsg;
489  return sc1;
490  }
491  os = ios; // manage reference counting
492  }
494  }
495  return sc;
496  }
497  sc = StatusCode::FAILURE;
498  }
499  return sc;
500 }

◆ decodeTopAlgs()

StatusCode MinimalEventLoopMgr::decodeTopAlgs ( )

decodeTopAlgNameList & topAlgNameListHandler

Definition at line 422 of file MinimalEventLoopMgr.cpp.

422  {
424  if ( CONFIGURED == m_state || INITIALIZED == m_state ) {
425  auto algMan = serviceLocator()->as<IAlgManager>();
426  if ( algMan ) {
427  // Reset the existing Top Algorithm List
430  for ( const auto& it : m_topAlgNames.value() ) {
431  Gaudi::Utils::TypeNameString item{ it };
432  // Got the type and name. Now creating the algorithm, avoiding duplicate creation.
433  std::string item_name = item.name();
434  const bool CREATE = false;
435  SmartIF<IAlgorithm> alg = algMan->algorithm( item_name, CREATE );
436  if ( alg ) {
437  DEBMSG << "Top Algorithm " << item_name << " already exists" << endmsg;
438  } else {
439  DEBMSG << "Creating Top Algorithm " << item.type() << " with name " << item_name << endmsg;
440  IAlgorithm* ialg = nullptr;
441  StatusCode sc1 = algMan->createAlgorithm( item.type(), item_name, ialg );
442  if ( !sc1.isSuccess() ) {
443  error() << "Unable to create Top Algorithm " << item.type() << " with name " << item_name << endmsg;
444  return sc1;
445  }
446  alg = ialg; // manage reference counting
447  }
449  }
450  return sc;
451  }
452  sc = StatusCode::FAILURE;
453  }
454  return sc;
455 }

◆ executeEvent()

StatusCode MinimalEventLoopMgr::executeEvent ( EventContext &&  ctx)
override

implementation of IEventProcessor::executeEvent(EventContext&&)

Definition at line 329 of file MinimalEventLoopMgr.cpp.

329  {
330  bool eventfailed = false;
331 
332  m_aess->reset( context );
333 
334  // select the appropriate store
335  if ( m_WB.isValid() ) m_WB->selectStore( context.slot() ).ignore();
336 
337  // Get the IProperty interface of the ApplicationMgr to pass it to RetCodeGuard
338  const auto appmgr = serviceLocator()->as<IProperty>();
339  // Call the execute() method of all top algorithms
340  for ( auto& ita : m_topAlgList ) {
342  try {
344  DEBMSG << "AbortEvent incident fired by " << m_abortEventListener.abortEventSource << endmsg;
346  sc.ignore();
347  break;
348  }
350  sc = ita->sysExecute( context );
351  rcg.ignore(); // disarm the guard
352  } catch ( const GaudiException& Exception ) {
353  fatal() << ".executeEvent(): Exception with tag=" << Exception.tag() << " thrown by " << ita->name() << endmsg;
354  error() << Exception << endmsg;
355  } catch ( const std::exception& Exception ) {
356  fatal() << ".executeEvent(): Standard std::exception thrown by " << ita->name() << endmsg;
357  error() << Exception.what() << endmsg;
358  } catch ( ... ) { fatal() << ".executeEvent(): UNKNOWN Exception thrown by " << ita->name() << endmsg; }
359 
360  if ( !sc.isSuccess() ) {
361  warning() << "Execution of algorithm " << ita->name() << " failed" << endmsg;
362  eventfailed = true;
363  }
364  }
365 
366  m_aess->updateEventStatus( eventfailed, context );
367 
368  // ensure that the abortEvent flag is cleared before the next event
370  DEBMSG << "AbortEvent incident fired by " << m_abortEventListener.abortEventSource << endmsg;
372  }
373 
374  // Call the execute() method of all output streams
375  for ( auto& ito : m_outStreamList ) {
376  AlgExecState& state = m_aess->algExecState( ito, context );
377  state.setFilterPassed( true );
378  StatusCode sc = ito->sysExecute( context );
379  if ( !sc.isSuccess() ) {
380  warning() << "Execution of output stream " << ito->name() << " failed" << endmsg;
381  eventfailed = true;
382  }
383  }
384 
385  // Check if there was an error processing current event
386  if ( eventfailed ) {
387  error() << "Error processing event loop." << endmsg;
388  std::ostringstream ost;
389  m_aess->dump( ost, context );
390  debug() << "Dumping AlgExecStateSvc status:\n" << ost.str() << endmsg;
391  return StatusCode::FAILURE;
392  }
393 
394  return StatusCode::SUCCESS;
395 }

◆ executeRun()

StatusCode MinimalEventLoopMgr::executeRun ( int  maxevt)
override

implementation of IEventProcessor::executeRun( )

Definition at line 304 of file MinimalEventLoopMgr.cpp.

304  {
305  // Call now the nextEvent(...)
306  return nextEvent( maxevt );
307 }

◆ finalize()

StatusCode MinimalEventLoopMgr::finalize ( )
override

implementation of IService::finalize

Definition at line 246 of file MinimalEventLoopMgr.cpp.

246  {
249  // Call the finalize() method of all top algorithms
250  for ( auto& ita : m_topAlgList ) {
251  sc = ita->sysFinalize();
252  if ( !sc.isSuccess() ) {
253  scRet = StatusCode::FAILURE;
254  warning() << "Finalization of algorithm " << ita->name() << " failed" << endmsg;
255  }
256  }
257  // Call the finalize() method of all Output streams
258  for ( auto& ita : m_outStreamList ) {
259  sc = ita->sysFinalize();
260  if ( !sc.isSuccess() ) {
261  scRet = StatusCode::FAILURE;
262  warning() << "Finalization of algorithm " << ita->name() << " failed" << endmsg;
263  }
264  }
265  // release all top algorithms
266  auto algMan = serviceLocator()->as<IAlgManager>();
267  for ( auto& ita : m_topAlgList ) {
268  if ( algMan->removeAlgorithm( ita ).isFailure() ) {
269  scRet = StatusCode::FAILURE;
270  warning() << "Problems removing Algorithm " << ita->name() << endmsg;
271  }
272  }
275  if ( sc.isSuccess() ) m_state = FINALIZED;
276 
277  m_incidentSvc->removeListener( &m_abortEventListener, IncidentType::AbortEvent );
278 
280  m_appMgrUI.reset();
281 
282  sc = Service::finalize();
283 
284  if ( sc.isFailure() ) {
285  scRet = StatusCode::FAILURE;
286  error() << "Problems finalizing Service base class" << endmsg;
287  }
288 
289  return scRet;
290 }

◆ initialize()

StatusCode MinimalEventLoopMgr::initialize ( )
override

implementation of IService::initialize

Definition at line 44 of file MinimalEventLoopMgr.cpp.

44  {
45 
46  if ( !m_appMgrUI ) return StatusCode::FAILURE;
47 
49  if ( !sc.isSuccess() ) {
50  error() << "Failed to initialize Service Base class." << endmsg;
51  return StatusCode::FAILURE;
52  }
53 
54  auto prpMgr = serviceLocator()->as<IProperty>();
55  if ( !prpMgr ) {
56  error() << "Error retrieving AppMgr interface IProperty." << endmsg;
57  return StatusCode::FAILURE;
58  }
59  if ( m_topAlgNames.value().empty() ) { setProperty( prpMgr->getProperty( "TopAlg" ) ).ignore(); }
60  if ( m_outStreamNames.value().empty() ) { setProperty( prpMgr->getProperty( "OutStream" ) ).ignore(); }
61 
62  // Get the references to the services that are needed by the ApplicationMgr itself
63  m_incidentSvc = serviceLocator()->service( "IncidentSvc" );
64  if ( !m_incidentSvc ) {
65  fatal() << "Error retrieving IncidentSvc." << endmsg;
66  return StatusCode::FAILURE;
67  }
68 
69  m_incidentSvc->addListener( &m_abortEventListener, IncidentType::AbortEvent );
70 
71  // The state is changed at this moment to allow decodeXXXX() to do something
73 
74  // Get WhiteBoard interface if implemented by EventDataSvc
75  m_WB = service( "EventDataSvc" );
76 
77  // setup the default EventContext with slot 0
79 
80  //--------------------------------------------------------------------------------------------
81  // Create output streams. Do not initialize them yet.
82  // The state is updated temporarily in order to enable the handler, which
83  // is also triggered by a change to the "OutputStream" Property.
84  //--------------------------------------------------------------------------------------------
85  sc = decodeOutStreams();
86  if ( !sc.isSuccess() ) {
87  error() << "Failed to initialize Output streams." << endmsg;
89  return sc;
90  }
91  //--------------------------------------------------------------------------------------------
92  // Create all needed Top Algorithms. Do not initialize them yet.
93  // The state is updated temporarily in order to enable the handler, which
94  // is also triggered by a change to the "TopAlg" Property.
95  //--------------------------------------------------------------------------------------------
96  sc = decodeTopAlgs();
97  if ( !sc.isSuccess() ) {
98  error() << "Failed to initialize Top Algorithms streams." << endmsg;
100  return sc;
101  }
102 
103  // Initialize all the new TopAlgs. In fact Algorithms are protected against
104  // getting initialized twice.
105  for ( auto& ita : m_topAlgList ) {
106  sc = ita->sysInitialize();
107  if ( !sc.isSuccess() ) {
108  error() << "Unable to initialize Algorithm: " << ita->name() << endmsg;
109  return sc;
110  }
111  }
112  for ( auto& ita : m_outStreamList ) {
113  sc = ita->sysInitialize();
114  if ( !sc.isSuccess() ) {
115  error() << "Unable to initialize Output Stream: " << ita->name() << endmsg;
116  return sc;
117  }
118  }
119 
120  // get hold of the Algorithm Execution State mgr
121  m_aess = serviceLocator()->service( "AlgExecStateSvc" );
122  if ( !m_aess ) {
123  fatal() << "Error retrieving AlgExecStateSvc." << endmsg;
124  return StatusCode::FAILURE;
125  }
126 
127  if ( m_printCFExp && !m_topAlgList.empty() ) {
128  info() << "Control Flow Expression:" << endmsg;
129  std::stringstream expr;
130  auto& first = m_topAlgList.front();
131  for ( auto& ialg : m_topAlgList ) {
132  if ( ialg != first ) expr << " >> ";
133  ialg->toControlFlowExpression( expr );
134  }
135  info() << expr.str() << endmsg;
136  }
137  return StatusCode::SUCCESS;
138 }

◆ nextEvent()

StatusCode MinimalEventLoopMgr::nextEvent ( int  maxevt)
override

implementation of IEventProcessor::nextEvent

Definition at line 296 of file MinimalEventLoopMgr.cpp.

296  {
297  error() << "This method cannot be called on an object of type " << System::typeinfoName( typeid( *this ) ) << endmsg;
298  return StatusCode::FAILURE;
299 }

◆ operator=()

MinimalEventLoopMgr& MinimalEventLoopMgr::operator= ( const MinimalEventLoopMgr )
delete

No copy allowed.

◆ outStreamHandler()

void MinimalEventLoopMgr::outStreamHandler ( Gaudi::Details::PropertyBase p)

Output stream List handler.

Definition at line 460 of file MinimalEventLoopMgr.cpp.

460  {
461  if ( !( decodeOutStreams() ).isSuccess() ) {
462  throw GaudiException( "Failed to initialize output streams.", "MinimalEventLoopMgr::outStreamHandler",
464  }
465 }

◆ reinitialize()

StatusCode MinimalEventLoopMgr::reinitialize ( )
override

implementation of IService::reinitialize

Definition at line 195 of file MinimalEventLoopMgr.cpp.

195  {
197 
198  // Reinitialize all the TopAlgs.
199  for ( auto& ita : m_topAlgList ) {
200  sc = ita->sysReinitialize();
201  if ( !sc.isSuccess() ) {
202  error() << "Unable to reinitialize Algorithm: " << ita->name() << endmsg;
203  return sc;
204  }
205  }
206  for ( auto& ita : m_outStreamList ) {
207  sc = ita->sysReinitialize();
208  if ( !sc.isSuccess() ) {
209  error() << "Unable to reinitialize Output Stream: " << ita->name() << endmsg;
210  return sc;
211  }
212  }
213 
214  return sc;
215 }

◆ restart()

StatusCode MinimalEventLoopMgr::restart ( )
override

implementation of IService::restart

Definition at line 219 of file MinimalEventLoopMgr.cpp.

219  {
221 
222  // Restart all the TopAlgs.
223  for ( auto& ita : m_topAlgList ) {
224  m_aess->resetErrorCount( ita );
225  sc = ita->sysRestart();
226  if ( !sc.isSuccess() ) {
227  error() << "Unable to restart Algorithm: " << ita->name() << endmsg;
228  return sc;
229  }
230  }
231  for ( auto& ita : m_outStreamList ) {
232  m_aess->resetErrorCount( ita );
233  sc = ita->sysRestart();
234  if ( !sc.isSuccess() ) {
235  error() << "Unable to restart Output Stream: " << ita->name() << endmsg;
236  return sc;
237  }
238  }
239 
240  return sc;
241 }

◆ start()

StatusCode MinimalEventLoopMgr::start ( )
override

implementation of IService::start

Definition at line 142 of file MinimalEventLoopMgr.cpp.

142  {
143 
144  StatusCode sc = Service::start();
145  if ( !sc.isSuccess() ) return sc;
146 
147  // Start all the new TopAlgs. In fact Algorithms are protected against getting
148  // started twice.
149  for ( auto& ita : m_topAlgList ) {
150  sc = ita->sysStart();
151  if ( !sc.isSuccess() ) {
152  error() << "Unable to start Algorithm: " << ita->name() << endmsg;
153  return sc;
154  }
155  }
156  for ( auto& ita : m_outStreamList ) {
157  sc = ita->sysStart();
158  if ( !sc.isSuccess() ) {
159  error() << "Unable to start Output Stream: " << ita->name() << endmsg;
160  return sc;
161  }
162  }
163  return StatusCode::SUCCESS;
164 }

◆ stop()

StatusCode MinimalEventLoopMgr::stop ( )
override

implementation of IService::stop

Definition at line 168 of file MinimalEventLoopMgr.cpp.

168  {
169 
171 
172  // Stop all the TopAlgs. In fact Algorithms are protected against getting
173  // stopped twice.
174  for ( auto& ita : m_topAlgList ) {
175  sc = ita->sysStop();
176  if ( !sc.isSuccess() ) {
177  error() << "Unable to stop Algorithm: " << ita->name() << endmsg;
178  return sc;
179  }
180  }
181  for ( auto& ita : m_outStreamList ) {
182  sc = ita->sysStop();
183  if ( !sc.isSuccess() ) {
184  error() << "Unable to stop Output Stream: " << ita->name() << endmsg;
185  return sc;
186  }
187  }
188 
189  return Service::stop();
190 }

◆ stopRun()

StatusCode MinimalEventLoopMgr::stopRun ( )
override

implementation of IEventProcessor::stopRun( )

Definition at line 399 of file MinimalEventLoopMgr.cpp.

399  {
400  // Set the application return code
401  auto appmgr = serviceLocator()->as<IProperty>();
403  error() << "Could not set return code of the application (" << Gaudi::ReturnCode::ScheduledStop << ")" << endmsg;
404  }
405  m_scheduledStop = true;
406  return StatusCode::SUCCESS;
407 }

◆ topAlgHandler()

void MinimalEventLoopMgr::topAlgHandler ( Gaudi::Details::PropertyBase p)

Top algorithm List handler.

Definition at line 412 of file MinimalEventLoopMgr.cpp.

412  {
413  if ( !( decodeTopAlgs() ).isSuccess() ) {
414  throw GaudiException( "Failed to initialize Top Algorithms streams.", "MinimalEventLoopMgr::topAlgHandler",
416  }
417 }

Member Data Documentation

◆ m_abortEventListener

AbortEventListener MinimalEventLoopMgr::m_abortEventListener
protected

Instance of the incident listener waiting for AbortEvent.

Definition at line 82 of file MinimalEventLoopMgr.h.

◆ m_aess

SmartIF<IAlgExecStateSvc> MinimalEventLoopMgr::m_aess
protected

List of top level algorithms.

Definition at line 73 of file MinimalEventLoopMgr.h.

◆ m_appMgrUI

SmartIF<IAppMgrUI> MinimalEventLoopMgr::m_appMgrUI
protected

Reference to the IAppMgrUI interface of the application manager.

Definition at line 69 of file MinimalEventLoopMgr.h.

◆ m_incidentSvc

SmartIF<IIncidentSvc> MinimalEventLoopMgr::m_incidentSvc
protected

Reference to the incident service.

Definition at line 71 of file MinimalEventLoopMgr.h.

◆ m_nevt

size_t MinimalEventLoopMgr::m_nevt { 0 }
protected

Definition at line 141 of file MinimalEventLoopMgr.h.

◆ m_outStreamList

ListAlg MinimalEventLoopMgr::m_outStreamList
protected

List of output streams.

Definition at line 76 of file MinimalEventLoopMgr.h.

◆ m_outStreamNames

Gaudi::Property<std::vector<std::string> > MinimalEventLoopMgr::m_outStreamNames
protected
Initial value:
{
this, "OutStream", {}, &MinimalEventLoopMgr::outStreamHandler, "list of output stream names" }

Definition at line 61 of file MinimalEventLoopMgr.h.

◆ m_printCFExp

Gaudi::Property<bool> MinimalEventLoopMgr::m_printCFExp
protected
Initial value:
{ this, "PrintControlFlowExpression", false,
"Print the control flow expression representing the content of TopAlg" }

Definition at line 63 of file MinimalEventLoopMgr.h.

◆ m_scheduledStop

bool MinimalEventLoopMgr::m_scheduledStop = false
protected

Scheduled stop of event processing.

Definition at line 80 of file MinimalEventLoopMgr.h.

◆ m_state

State MinimalEventLoopMgr::m_state = OFFLINE
protected

State of the object.

Definition at line 78 of file MinimalEventLoopMgr.h.

◆ m_topAlgList

ListAlg MinimalEventLoopMgr::m_topAlgList
protected

Definition at line 74 of file MinimalEventLoopMgr.h.

◆ m_topAlgNames

Gaudi::Property<std::vector<std::string> > MinimalEventLoopMgr::m_topAlgNames
protected
Initial value:
{
this, "TopAlg", {}, &MinimalEventLoopMgr::topAlgHandler, "list of top level algorithms names" }

Definition at line 59 of file MinimalEventLoopMgr.h.

◆ m_WB

SmartIF<IHiveWhiteBoard> MinimalEventLoopMgr::m_WB
protected

< Event data service (whiteboard)

Definition at line 138 of file MinimalEventLoopMgr.h.


The documentation for this class was generated from the following files:
MinimalEventLoopMgr::m_printCFExp
Gaudi::Property< bool > m_printCFExp
Definition: MinimalEventLoopMgr.h:63
MinimalEventLoopMgr::decodeTopAlgs
StatusCode decodeTopAlgs()
decodeTopAlgNameList & topAlgNameListHandler
Definition: MinimalEventLoopMgr.cpp:422
Service::initialize
StatusCode initialize() override
Definition: Service.cpp:118
std::string
STL class.
std::exception
STL class.
MinimalEventLoopMgr::AbortEventListener::abortEventSource
std::string abortEventSource
Source of the AbortEvent incident.
Definition: MinimalEventLoopMgr.h:51
StatusCode::isSuccess
bool isSuccess() const
Definition: StatusCode.h:314
MinimalEventLoopMgr::outStreamHandler
void outStreamHandler(Gaudi::Details::PropertyBase &p)
Output stream List handler.
Definition: MinimalEventLoopMgr.cpp:460
Service::start
StatusCode start() override
Definition: Service.cpp:187
MinimalEventLoopMgr::AbortEventListener::abortEvent
bool abortEvent
Flag signalling that the event being processed has to be aborted (skip all following top algs).
Definition: MinimalEventLoopMgr.h:49
std::vector::reserve
T reserve(T... args)
MinimalEventLoopMgr::OFFLINE
@ OFFLINE
Definition: MinimalEventLoopMgr.h:67
SmartIF::reset
void reset(TYPE *ptr=nullptr)
Set the internal pointer to the passed one disposing of the old one.
Definition: SmartIF.h:96
PropertyHolder< CommonMessaging< implements< IService, IProperty, IStateful > > >::setProperty
StatusCode setProperty(const Gaudi::Details::PropertyBase &p)
Set the property from a property.
Definition: IProperty.h:39
GaudiException
Definition: GaudiException.h:31
std::stringstream
STL class.
RetCodeGuard
Helper class to set the application return code in case of early exit (e.g.
Definition: RetCodeGuard.h:19
System::typeinfoName
GAUDI_API const std::string typeinfoName(const std::type_info &)
Get platform independent information about the class type.
Definition: System.cpp:315
Gaudi::Hive::setCurrentContextId
GAUDI_API void setCurrentContextId(ContextIdType newId)
Used by the framework to change the value of the current context id.
Definition: ThreadLocalContext.cpp:33
MinimalEventLoopMgr::topAlgHandler
void topAlgHandler(Gaudi::Details::PropertyBase &p)
Top algorithm List handler.
Definition: MinimalEventLoopMgr.cpp:412
std::vector::front
T front(T... args)
Service::finalize
StatusCode finalize() override
Definition: Service.cpp:222
extends< Service, IEventProcessor >::base_class
extends base_class
Typedef to this class.
Definition: extends.h:24
std::vector::clear
T clear(T... args)
std::vector::push_back
T push_back(T... args)
ManySmallAlgs.alg
alg
Definition: ManySmallAlgs.py:81
IProperty
Definition: IProperty.h:33
IAlgManager
Definition: IAlgManager.h:37
MinimalEventLoopMgr::m_aess
SmartIF< IAlgExecStateSvc > m_aess
List of top level algorithms.
Definition: MinimalEventLoopMgr.h:73
SmartIF::isValid
bool isValid() const
Allow for check if smart pointer is valid.
Definition: SmartIF.h:72
Gaudi::Utils::TypeNameString
Helper class to parse a string of format "type/name".
Definition: TypeNameString.h:20
StatusCode
Definition: StatusCode.h:65
MinimalEventLoopMgr::m_outStreamList
ListAlg m_outStreamList
List of output streams.
Definition: MinimalEventLoopMgr.h:76
IAlgorithm
Definition: IAlgorithm.h:38
Gaudi::setAppReturnCode
StatusCode setAppReturnCode(SmartIF< IProperty > &appmgr, int value, bool force=false)
Set the application return code.
Definition: AppReturnCode.h:59
Gaudi::Property::value
const ValueType & value() const
Definition: Property.h:237
Gaudi::ReturnCode::ScheduledStop
constexpr int ScheduledStop
Definition: AppReturnCode.h:35
MinimalEventLoopMgr::m_state
State m_state
State of the object.
Definition: MinimalEventLoopMgr.h:78
SmartIF< IAlgorithm >
Gaudi::ReturnCode::UnhandledException
constexpr int UnhandledException
Definition: AppReturnCode.h:37
endmsg
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:202
MinimalEventLoopMgr::m_outStreamNames
Gaudi::Property< std::vector< std::string > > m_outStreamNames
Definition: MinimalEventLoopMgr.h:61
MinimalEventLoopMgr::m_WB
SmartIF< IHiveWhiteBoard > m_WB
< Event data service (whiteboard)
Definition: MinimalEventLoopMgr.h:138
MinimalEventLoopMgr::CONFIGURED
@ CONFIGURED
Definition: MinimalEventLoopMgr.h:67
StatusCode::ignore
const StatusCode & ignore() const
Allow discarding a StatusCode without warning.
Definition: StatusCode.h:139
SmartIF::as
SmartIF< IFace > as() const
return a new SmartIF instance to another interface
Definition: SmartIF.h:117
std::ostringstream
STL class.
StatusCode::isFailure
bool isFailure() const
Definition: StatusCode.h:129
MinimalEventLoopMgr::m_appMgrUI
SmartIF< IAppMgrUI > m_appMgrUI
Reference to the IAppMgrUI interface of the application manager.
Definition: MinimalEventLoopMgr.h:69
MinimalEventLoopMgr::m_topAlgList
ListAlg m_topAlgList
Definition: MinimalEventLoopMgr.h:74
StatusCode::SUCCESS
constexpr static const auto SUCCESS
Definition: StatusCode.h:100
MinimalEventLoopMgr::m_topAlgNames
Gaudi::Property< std::vector< std::string > > m_topAlgNames
Definition: MinimalEventLoopMgr.h:59
MinimalEventLoopMgr::decodeOutStreams
StatusCode decodeOutStreams()
decodeOutStreamNameList & outStreamNameListHandler
Definition: MinimalEventLoopMgr.cpp:470
Service::stop
StatusCode stop() override
Definition: Service.cpp:181
MinimalEventLoopMgr::m_nevt
size_t m_nevt
Definition: MinimalEventLoopMgr.h:141
MinimalEventLoopMgr::nextEvent
StatusCode nextEvent(int maxevt) override
implementation of IEventProcessor::nextEvent
Definition: MinimalEventLoopMgr.cpp:296
Io::CREATE
@ CREATE
Definition: IFileMgr.h:41
MinimalEventLoopMgr::m_incidentSvc
SmartIF< IIncidentSvc > m_incidentSvc
Reference to the incident service.
Definition: MinimalEventLoopMgr.h:71
EventContext
Definition: EventContext.h:34
std::vector::empty
T empty(T... args)
std::ostringstream::str
T str(T... args)
std::size_t
MinimalEventLoopMgr::m_abortEventListener
AbortEventListener m_abortEventListener
Instance of the incident listener waiting for AbortEvent.
Definition: MinimalEventLoopMgr.h:82
MinimalEventLoopMgr::FINALIZED
@ FINALIZED
Definition: MinimalEventLoopMgr.h:67
AlgExecState
Definition: IAlgExecStateSvc.h:36
StatusCode::FAILURE
constexpr static const auto FAILURE
Definition: StatusCode.h:101
DEBMSG
#define DEBMSG
Definition: MinimalEventLoopMgr.cpp:32
compareRootHistos.state
state
Definition: compareRootHistos.py:496
Gaudi::Details::Property::ParsingErrorPolicy::Exception
@ Exception
MinimalEventLoopMgr::INITIALIZED
@ INITIALIZED
Definition: MinimalEventLoopMgr.h:67
Service::service
StatusCode service(const std::string &name, const T *&psvc, bool createIf=true) const
Access a service by name, creating it if it doesn't already exist.
Definition: Service.h:89
MinimalEventLoopMgr::m_scheduledStop
bool m_scheduledStop
Scheduled stop of event processing.
Definition: MinimalEventLoopMgr.h:80
Service::serviceLocator
SmartIF< ISvcLocator > & serviceLocator() const override
Retrieve pointer to service locator
Definition: Service.cpp:335