The Gaudi Framework  master (e199b415)
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
EventLoopMgr Class Reference

Class definition of EventLoopMgr. More...

#include </builds/gaudi/Gaudi/GaudiCoreSvc/src/ApplicationMgr/EventLoopMgr.h>

Inheritance diagram for EventLoopMgr:
Collaboration diagram for EventLoopMgr:

Public Member Functions

 ~EventLoopMgr () override
 Standard Destructor. More...
 
StatusCode getEventRoot (IOpaqueAddress *&refpAddr)
 Create event address using event selector. More...
 
StatusCode initialize () override
 implementation of IService::initialize More...
 
StatusCode reinitialize () override
 implementation of IService::reinitialize More...
 
StatusCode stop () override
 implementation of IService::stop More...
 
StatusCode finalize () override
 implementation of IService::finalize More...
 
StatusCode nextEvent (int maxevt) override
 implementation of IEventProcessor::nextEvent More...
 
StatusCode executeEvent (EventContext &&ctx) override
 implementation of IEventProcessor::executeEvent(EventContext&&) More...
 
 MinimalEventLoopMgr (const std::string &nam, ISvcLocator *svcLoc)
 Standard Constructor. More...
 
 MinimalEventLoopMgr (const MinimalEventLoopMgr &)=delete
 No copy allowed. More...
 
- Public Member Functions inherited from MinimalEventLoopMgr
 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, Gaudi::Property< TYPE, VERIFIER, HANDLERS > &prop, const std::string &doc="none")
 Declare a PropertyBase instance setting name and documentation. More...
 
 requires (!Gaudi::Details::is_gaudi_property_v< TYPE >) Gaudi
 Helper to wrap a regular data member and use it as a regular property. 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 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 Attributes

Gaudi::Property< std::stringm_histPersName { this, "HistogramPersistency", {}, "name of the Hist Pers type" }
 
Gaudi::Property< std::stringm_evtsel { this, "EvtSel", {}, "event selector" }
 
SmartIF< IDataManagerSvcm_evtDataMgrSvc = nullptr
 Reference to the Event Data Service's IDataManagerSvc interface. More...
 
SmartIF< IDataProviderSvcm_evtDataSvc = nullptr
 Reference to the Event Data Service's IDataProviderSvc interface. More...
 
SmartIF< IEvtSelectorm_evtSelector = nullptr
 Reference to the Event Selector. More...
 
IEvtSelector::Contextm_evtContext = nullptr
 Event Iterator. More...
 
SmartIF< IDataManagerSvcm_histoDataMgrSvc = nullptr
 Reference to the Histogram Data Service. More...
 
SmartIF< IConversionSvcm_histoPersSvc = nullptr
 Reference to the Histogram Persistency Service. More...
 
SmartIF< IPropertym_appMgrProperty = nullptr
 Property interface of ApplicationMgr. More...
 
bool m_endEventFired = true
 Flag to avoid to fire the EnvEvent incident twice in a row (and also not before the first event) More...
 
- Protected Attributes inherited from MinimalEventLoopMgr
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

- Public Types inherited from MinimalEventLoopMgr
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...
 
- Protected Types inherited from MinimalEventLoopMgr
enum  State { OFFLINE, CONFIGURED, FINALIZED, INITIALIZED }
 
- 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

Class definition of EventLoopMgr.

This is the default processing manager of the application manager. This object handles the minimal requirements needed by the application manager. It also handles the default user configuration setup for standard event processing.

  • handling of the incidents when starting event processing
  • handling of the event loop

History:

 +---------+----------------------------------------------+---------+
 |    Date |                 Comment                      | Who     |
 +---------+----------------------------------------------+---------+
 |13/12/00 | Initial version                              | M.Frank |
 +---------+----------------------------------------------+---------+
 
Author
Markus Frank
Version
1.0

Definition at line 44 of file EventLoopMgr.h.

Constructor & Destructor Documentation

◆ ~EventLoopMgr()

EventLoopMgr::~EventLoopMgr ( )
override

Standard Destructor.

Definition at line 35 of file EventLoopMgr.cpp.

35 { delete m_evtContext; }

Member Function Documentation

◆ executeEvent()

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

implementation of IEventProcessor::executeEvent(EventContext&&)

Definition at line 247 of file EventLoopMgr.cpp.

247  {
248 
249  // DP Monitoring
250 
251  // Fire BeginEvent "Incident"
252  m_incidentSvc->fireIncident( Incident( name(), IncidentType::BeginEvent ) );
253  // An incident may schedule a stop, in which case is better to exit before the actual execution.
254  if ( m_scheduledStop ) {
255  always() << "Terminating event processing loop due to a stop scheduled by an incident listener" << endmsg;
256  return StatusCode::SUCCESS;
257  }
258 
259  // Execute Algorithms
260  m_incidentSvc->fireIncident( Incident( name(), IncidentType::BeginProcessing ) );
262  m_incidentSvc->fireIncident( Incident( name(), IncidentType::EndProcessing ) );
263 
264  // Check if there was an error processing current event
265  if ( !sc.isSuccess() ) { error() << "Terminating event processing loop due to errors" << endmsg; }
266  return sc;
267 }

◆ finalize()

StatusCode EventLoopMgr::finalize ( )
override

implementation of IService::finalize

Definition at line 186 of file EventLoopMgr.cpp.

186  {
187  // Finalize base class
189  if ( !sc.isSuccess() ) {
190  error() << "Error finalizing base class" << endmsg;
191  return sc;
192  }
193 
194  // Save Histograms Now
195  if ( m_histoPersSvc ) {
196  std::vector<DataObject*> objects;
197  sc = m_histoDataMgrSvc->traverseTree( [&objects]( IRegistry* reg, int ) {
198  DataObject* obj = reg->object();
199  if ( !obj || obj->clID() == CLID_StatisticsFile ) return false;
200  objects.push_back( obj );
201  return true;
202  } );
203  if ( sc.isSuccess() ) {
204  // skip /stat entry!
205  sc = std::accumulate( begin( objects ), end( objects ), sc, [&]( StatusCode isc, auto& i ) {
206  IOpaqueAddress* pAddr = nullptr;
207  StatusCode iret = m_histoPersSvc->createRep( i, pAddr );
208  if ( iret.isFailure() ) return iret;
209  i->registry()->setAddress( pAddr );
210  return isc;
211  } );
212  sc = std::accumulate( begin( objects ), end( objects ), sc, [&]( StatusCode isc, auto& i ) {
213  IRegistry* reg = i->registry();
214  StatusCode iret = m_histoPersSvc->fillRepRefs( reg->address(), i );
215  return iret.isFailure() ? iret : isc;
216  } );
217  if ( sc.isSuccess() ) {
218  info() << "Histograms converted successfully according to request." << endmsg;
219  } else {
220  error() << "Error while saving Histograms." << endmsg;
221  }
222  } else {
223  error() << "Error while traversing Histogram data store" << endmsg;
224  }
225  }
226 
227  // Release event selector context
228  if ( m_evtSelector && m_evtContext ) {
229  m_evtSelector->releaseContext( m_evtContext ).ignore();
230  m_evtContext = nullptr;
231  }
232 
233  // Release all interfaces...
234  m_histoDataMgrSvc = nullptr;
235  m_histoPersSvc = nullptr;
236 
237  m_evtSelector = nullptr;
238  m_evtDataSvc = nullptr;
239  m_evtDataMgrSvc = nullptr;
240 
241  return StatusCode::SUCCESS;
242 }

◆ getEventRoot()

StatusCode EventLoopMgr::getEventRoot ( IOpaqueAddress *&  refpAddr)

Create event address using event selector.

Definition at line 363 of file EventLoopMgr.cpp.

363  {
364  refpAddr = nullptr;
365  StatusCode sc = m_evtSelector->next( *m_evtContext );
366  if ( !sc.isSuccess() ) return sc;
367  // Create root address and assign address to data service
368  sc = m_evtSelector->createAddress( *m_evtContext, refpAddr );
369  if ( !sc.isSuccess() ) {
370  sc = m_evtSelector->next( *m_evtContext );
371  if ( sc.isSuccess() ) {
372  sc = m_evtSelector->createAddress( *m_evtContext, refpAddr );
373  if ( !sc.isSuccess() ) warning() << "Error creating IOpaqueAddress." << endmsg;
374  }
375  }
376  return sc;
377 }

◆ initialize()

StatusCode EventLoopMgr::initialize ( )
override

implementation of IService::initialize

Definition at line 40 of file EventLoopMgr.cpp.

40  {
41  // Initialize the base class
43  if ( !sc.isSuccess() ) {
44  DEBMSG << "Error Initializing base class MinimalEventLoopMgr." << endmsg;
45  return sc;
46  }
47 
48  // Setup access to event data services
49  m_evtDataMgrSvc = serviceLocator()->service( "EventDataSvc" );
50  if ( !m_evtDataMgrSvc ) {
51  fatal() << "Error retrieving EventDataSvc interface IDataManagerSvc." << endmsg;
52  return StatusCode::FAILURE;
53  }
54  m_evtDataSvc = serviceLocator()->service( "EventDataSvc" );
55  if ( !m_evtDataSvc ) {
56  fatal() << "Error retrieving EventDataSvc interface IDataProviderSvc." << endmsg;
57  return StatusCode::FAILURE;
58  }
59 
60  // Obtain the IProperty of the ApplicationMgr
62  if ( !m_appMgrProperty ) {
63  fatal() << "IProperty interface not found in ApplicationMgr." << endmsg;
64  return StatusCode::FAILURE;
65  }
66 
67  // We do not expect a Event Selector necessarily being declared
68  setProperty( m_appMgrProperty->getProperty( "EvtSel" ) ).ignore();
69 
70  if ( m_evtsel != "NONE" || m_evtsel.empty() ) {
71  m_evtSelector = serviceLocator()->service( "EventSelector" );
72  if ( m_evtSelector ) {
73  // Setup Event Selector
74  sc = m_evtSelector->createContext( m_evtContext );
75  if ( !sc.isSuccess() ) {
76  fatal() << "Can not create the event selector Context." << endmsg;
77  return sc;
78  }
79  } else {
80  fatal() << "EventSelector not found." << endmsg;
81  return sc;
82  }
83  } else {
84  m_evtSelector = nullptr;
85  m_evtContext = nullptr;
86  info() << "Unable to locate service \"EventSelector\": "
87  << "No events will be processed from external input." << endmsg;
88  }
89 
90  setProperty( m_appMgrProperty->getProperty( "HistogramPersistency" ) ).ignore();
91  if ( m_histPersName != "NONE" && !m_histPersName.empty() ) {
92  // Setup access to histogramming services
93  m_histoDataMgrSvc = serviceLocator()->service( "HistogramDataSvc" );
94  if ( !m_histoDataMgrSvc ) {
95  fatal() << "Error retrieving HistogramDataSvc." << endmsg;
96  return StatusCode::FAILURE;
97  }
98  // Setup histogram persistency
99  m_histoPersSvc = serviceLocator()->service( "HistogramPersistencySvc" );
100  if ( !m_histoPersSvc ) { warning() << "Histograms cannot not be saved - though required." << endmsg; }
101  }
102 
103  return StatusCode::SUCCESS;
104 }

◆ MinimalEventLoopMgr() [1/2]

MinimalEventLoopMgr::MinimalEventLoopMgr
delete

No copy allowed.

◆ MinimalEventLoopMgr() [2/2]

MinimalEventLoopMgr::MinimalEventLoopMgr

Standard Constructor.

Definition at line 86 of file MinimalEventLoopMgr.cpp.

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

◆ nextEvent()

StatusCode EventLoopMgr::nextEvent ( int  maxevt)
override

implementation of IEventProcessor::nextEvent

Definition at line 274 of file EventLoopMgr.cpp.

274  {
275 
276  // DP Monitoring
277  // Calculate runtime
279  typedef Clock::time_point time_point;
280 
281  const float oneOver1024 = 1.f / 1024.f;
282 
283  DataObject* pObject = nullptr;
285 
286  // loop over events if the maxevt (received as input) if different from -1.
287  // if evtmax is -1 it means infinite loop
288  time_point start_time = Clock::now();
289  for ( int nevt = 0; maxevt == -1 || nevt < maxevt; ++nevt ) {
290 
291  if ( 1 == nevt ) // reset after first evt
292  start_time = Clock::now();
293 
294  auto ctx = createEventContext();
295 
296  // always() << "Event Number = " << total_nevt
297  // << " WSS (MB) = " << System::mappedMemory(System::MemoryUnit::kByte)*oneOver1024
298  // << " Time (s) = " << secsFromStart(start_time) << endmsg;
299 
300  // Check if there is a scheduled stop issued by some algorithm/service
301  if ( m_scheduledStop ) {
302  m_scheduledStop = false;
303  always() << "Terminating event processing loop due to scheduled stop" << endmsg;
304  break;
305  }
306  // Clear the event store, if used in the event loop
307  if ( 0 != ctx.evt() ) {
308 
309  if ( !m_endEventFired ) {
310  // Fire EndEvent "Incident" (it is considered part of the clearing of the TS)
311  m_incidentSvc->fireIncident( Incident( name(), IncidentType::EndEvent ) );
312  m_endEventFired = true;
313  }
314  sc = m_evtDataMgrSvc->clearStore();
315  if ( !sc.isSuccess() ) { DEBMSG << "Clear of Event data store failed" << endmsg; }
316  }
317 
318  // Setup event in the event store
319  if ( m_evtContext ) {
320  IOpaqueAddress* addr = nullptr;
321  // Only if there is a EventSelector
322  sc = getEventRoot( addr );
323  if ( !sc.isSuccess() ) {
324  info() << "No more events in event selection " << endmsg;
325  break;
326  }
327  // Set root clears the event data store first
328  sc = m_evtDataMgrSvc->setRoot( "/Event", addr );
329  if ( !sc.isSuccess() ) {
330  warning() << "Error declaring event root address." << endmsg;
331  continue;
332  }
333  sc = m_evtDataSvc->retrieveObject( "/Event", pObject );
334  if ( !sc.isSuccess() ) {
335  warning() << "Unable to retrieve Event root object" << endmsg;
336  break;
337  }
338  } else {
339  sc = m_evtDataMgrSvc->setRoot( "/Event", new DataObject() );
340  if ( !sc.isSuccess() ) { warning() << "Error declaring event root DataObject" << endmsg; }
341  }
342  // Execute event for all required algorithms
343  sc = executeEvent( std::move( ctx ) );
344  m_endEventFired = false;
345  if ( !sc.isSuccess() ) {
346  error() << "Terminating event processing loop due to errors" << endmsg;
348  return sc;
349  }
350  }
351 
352  if ( outputLevel() <= MSG::DEBUG )
353  debug() << "---> Loop Finished - "
354  << " WSS " << System::mappedMemory( System::MemoryUnit::kByte ) * oneOver1024
355  << " | total time (skipping 1st evt) "
356  << std::chrono::duration_cast<std::chrono::nanoseconds>( Clock::now() - start_time ).count() << " ns"
357  << endmsg;
358 
359  return StatusCode::SUCCESS;
360 }

◆ reinitialize()

StatusCode EventLoopMgr::reinitialize ( )
override

implementation of IService::reinitialize

Definition at line 108 of file EventLoopMgr.cpp.

108  {
109 
110  // Initialize the base class
112  if ( !sc.isSuccess() ) {
113  DEBMSG << "Error Initializing base class MinimalEventLoopMgr." << endmsg;
114  return sc;
115  }
116 
117  // Check to see whether a new Event Selector has been specified
118  if ( sc = setProperty( m_appMgrProperty->getProperty( "EvtSel" ) ); !sc ) return sc;
119  if ( m_evtsel != "NONE" || m_evtsel.length() == 0 ) {
120  auto theSvc = serviceLocator()->service<IService>( "EventSelector" );
121  auto theEvtSel = theSvc.as<IEvtSelector>();
122  if ( theEvtSel && ( theEvtSel.get() != m_evtSelector.get() ) ) {
123  // Setup Event Selector
124  if ( m_evtSelector.get() && m_evtContext ) {
125  // Need to release context before switching to new event selector
126  if ( sc = m_evtSelector->releaseContext( m_evtContext ); !sc ) return sc;
127  m_evtContext = nullptr;
128  }
129  m_evtSelector = theEvtSel;
130  if ( theSvc->FSMState() == Gaudi::StateMachine::INITIALIZED ) {
131  sc = theSvc->reinitialize();
132  if ( !sc.isSuccess() ) {
133  error() << "Failure Reinitializing EventSelector " << theSvc->name() << endmsg;
134  return sc;
135  }
136  } else {
137  sc = theSvc->sysInitialize();
138  if ( !sc.isSuccess() ) {
139  error() << "Failure Initializing EventSelector " << theSvc->name() << endmsg;
140  return sc;
141  }
142  }
143  sc = m_evtSelector->createContext( m_evtContext );
144  if ( !sc.isSuccess() ) {
145  error() << "Can not create Context " << theSvc->name() << endmsg;
146  return sc;
147  }
148  info() << "EventSelector service changed to " << theSvc->name() << endmsg;
149  } else if ( m_evtSelector ) {
150  if ( m_evtContext ) {
151  if ( sc = m_evtSelector->releaseContext( m_evtContext ); !sc ) return sc;
152  m_evtContext = nullptr;
153  }
154  sc = m_evtSelector->createContext( m_evtContext );
155  if ( !sc.isSuccess() ) {
156  error() << "Can not create Context " << theSvc->name() << endmsg;
157  return sc;
158  }
159  }
160  } else if ( m_evtSelector && m_evtContext ) {
161  sc = m_evtSelector->releaseContext( m_evtContext );
162  m_evtSelector = nullptr;
163  m_evtContext = nullptr;
164  }
165  return sc;
166 }

◆ stop()

StatusCode EventLoopMgr::stop ( )
override

implementation of IService::stop

Definition at line 171 of file EventLoopMgr.cpp.

171  {
172  if ( !m_endEventFired ) {
173  // Fire pending EndEvent incident
174  m_incidentSvc->fireIncident( Incident( name(), IncidentType::EndEvent ) );
175  m_endEventFired = true;
176  }
177  return m_evtDataMgrSvc
178  ->clearStore() //
179  .andThen( [this]() { return MinimalEventLoopMgr::stop(); } ) //
180  .orElse( [this]() { DEBMSG << "Clear of Event data store failed" << endmsg; } );
181 }

Member Data Documentation

◆ m_appMgrProperty

SmartIF<IProperty> EventLoopMgr::m_appMgrProperty = nullptr
protected

Property interface of ApplicationMgr.

Definition at line 65 of file EventLoopMgr.h.

◆ m_endEventFired

bool EventLoopMgr::m_endEventFired = true
protected

Flag to avoid to fire the EnvEvent incident twice in a row (and also not before the first event)

Definition at line 68 of file EventLoopMgr.h.

◆ m_evtContext

IEvtSelector::Context* EventLoopMgr::m_evtContext = nullptr
protected

Event Iterator.

Definition at line 59 of file EventLoopMgr.h.

◆ m_evtDataMgrSvc

SmartIF<IDataManagerSvc> EventLoopMgr::m_evtDataMgrSvc = nullptr
protected

Reference to the Event Data Service's IDataManagerSvc interface.

Definition at line 53 of file EventLoopMgr.h.

◆ m_evtDataSvc

SmartIF<IDataProviderSvc> EventLoopMgr::m_evtDataSvc = nullptr
protected

Reference to the Event Data Service's IDataProviderSvc interface.

Definition at line 55 of file EventLoopMgr.h.

◆ m_evtsel

Gaudi::Property<std::string> EventLoopMgr::m_evtsel { this, "EvtSel", {}, "event selector" }
protected

Definition at line 50 of file EventLoopMgr.h.

◆ m_evtSelector

SmartIF<IEvtSelector> EventLoopMgr::m_evtSelector = nullptr
protected

Reference to the Event Selector.

Definition at line 57 of file EventLoopMgr.h.

◆ m_histoDataMgrSvc

SmartIF<IDataManagerSvc> EventLoopMgr::m_histoDataMgrSvc = nullptr
protected

Reference to the Histogram Data Service.

Definition at line 61 of file EventLoopMgr.h.

◆ m_histoPersSvc

SmartIF<IConversionSvc> EventLoopMgr::m_histoPersSvc = nullptr
protected

Reference to the Histogram Persistency Service.

Definition at line 63 of file EventLoopMgr.h.

◆ m_histPersName

Gaudi::Property<std::string> EventLoopMgr::m_histPersName { this, "HistogramPersistency", {}, "name of the Hist Pers type" }
protected

Definition at line 49 of file EventLoopMgr.h.


The documentation for this class was generated from the following files:
MSG::DEBUG
@ DEBUG
Definition: IMessageSvc.h:25
IService
Definition: IService.h:28
EventLoopMgr::m_endEventFired
bool m_endEventFired
Flag to avoid to fire the EnvEvent incident twice in a row (and also not before the first event)
Definition: EventLoopMgr.h:68
MinimalEventLoopMgr::createEventContext
EventContext createEventContext() override
implementation of IEventProcessor::createEventContext()
Definition: MinimalEventLoopMgr.cpp:292
EventLoopMgr::m_histoDataMgrSvc
SmartIF< IDataManagerSvc > m_histoDataMgrSvc
Reference to the Histogram Data Service.
Definition: EventLoopMgr.h:61
GaudiPython.Bindings.DataObject
DataObject
Definition: Bindings.py:82
EventLoopMgr::m_evtsel
Gaudi::Property< std::string > m_evtsel
Definition: EventLoopMgr.h:50
EventLoopMgr::m_evtDataSvc
SmartIF< IDataProviderSvc > m_evtDataSvc
Reference to the Event Data Service's IDataProviderSvc interface.
Definition: EventLoopMgr.h:55
std::move
T move(T... args)
StatusCode::isSuccess
bool isSuccess() const
Definition: StatusCode.h:315
IOpaqueAddress
Definition: IOpaqueAddress.h:33
std::vector< DataObject * >
PropertyHolder< CommonMessaging< implements< IService, IProperty, IStateful > > >::setProperty
StatusCode setProperty(const Gaudi::Details::PropertyBase &p)
Set the property from a property.
Definition: IProperty.h:39
IEvtSelector
Definition: IEvtSelector.h:28
EventLoopMgr::m_evtSelector
SmartIF< IEvtSelector > m_evtSelector
Reference to the Event Selector.
Definition: EventLoopMgr.h:57
EventLoopMgr::m_appMgrProperty
SmartIF< IProperty > m_appMgrProperty
Property interface of ApplicationMgr.
Definition: EventLoopMgr.h:65
IRegistry
Definition: IRegistry.h:32
extends< Service, IEventProcessor >::base_class
extends base_class
Typedef to this class.
Definition: extends.h:24
MinimalEventLoopMgr::finalize
StatusCode finalize() override
implementation of IService::finalize
Definition: MinimalEventLoopMgr.cpp:246
std::chrono::high_resolution_clock
std::vector::push_back
T push_back(T... args)
EventLoopMgr::m_evtDataMgrSvc
SmartIF< IDataManagerSvc > m_evtDataMgrSvc
Reference to the Event Data Service's IDataManagerSvc interface.
Definition: EventLoopMgr.h:53
Gaudi::Utils::begin
AttribStringParser::Iterator begin(const AttribStringParser &parser)
Definition: AttribStringParser.h:136
GaudiPython.Pythonizations.ctx
ctx
Definition: Pythonizations.py:578
Service::name
const std::string & name() const override
Retrieve name of the service
Definition: Service.cpp:332
StatusCode
Definition: StatusCode.h:65
Gaudi::setAppReturnCode
StatusCode setAppReturnCode(SmartIF< IProperty > &appmgr, int value, bool force=false)
Set the application return code.
Definition: AppReturnCode.h:59
MinimalEventLoopMgr::reinitialize
StatusCode reinitialize() override
implementation of IService::reinitialize
Definition: MinimalEventLoopMgr.cpp:195
MinimalEventLoopMgr::stop
StatusCode stop() override
implementation of IService::stop
Definition: MinimalEventLoopMgr.cpp:168
std::accumulate
T accumulate(T... args)
endmsg
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:202
Gaudi::ReturnCode::AlgorithmFailure
constexpr int AlgorithmFailure
Definition: AppReturnCode.h:34
EventLoopMgr::m_histoPersSvc
SmartIF< IConversionSvc > m_histoPersSvc
Reference to the Histogram Persistency Service.
Definition: EventLoopMgr.h:63
EventLoopMgr::m_evtContext
IEvtSelector::Context * m_evtContext
Event Iterator.
Definition: EventLoopMgr.h:59
StatusCode::ignore
const StatusCode & ignore() const
Allow discarding a StatusCode without warning.
Definition: StatusCode.h:140
IRegistry::address
virtual IOpaqueAddress * address() const =0
Retrieve opaque storage address.
StatusCode::isFailure
bool isFailure() const
Definition: StatusCode.h:130
MinimalEventLoopMgr::m_appMgrUI
SmartIF< IAppMgrUI > m_appMgrUI
Reference to the IAppMgrUI interface of the application manager.
Definition: MinimalEventLoopMgr.h:69
EventLoopMgr::executeEvent
StatusCode executeEvent(EventContext &&ctx) override
implementation of IEventProcessor::executeEvent(EventContext&&)
Definition: EventLoopMgr.cpp:247
StatusCode::SUCCESS
constexpr static const auto SUCCESS
Definition: StatusCode.h:100
SmartIF::get
TYPE * get() const
Get interface pointer.
Definition: SmartIF.h:86
EventLoopMgr::m_histPersName
Gaudi::Property< std::string > m_histPersName
Definition: EventLoopMgr.h:49
MinimalEventLoopMgr::m_incidentSvc
SmartIF< IIncidentSvc > m_incidentSvc
Reference to the incident service.
Definition: MinimalEventLoopMgr.h:71
Gaudi::StateMachine::INITIALIZED
@ INITIALIZED
Definition: StateMachine.h:25
System::kByte
@ kByte
Definition: Memory.h:65
IRegistry::object
virtual DataObject * object() const =0
Retrieve object behind the link.
Service::outputLevel
int outputLevel() const
get the Service's output level
Definition: Service.h:208
DataObject
Definition: DataObject.h:36
DEBMSG
#define DEBMSG
Definition: EventLoopMgr.cpp:29
MinimalEventLoopMgr::executeEvent
StatusCode executeEvent(EventContext &&ctx) override
implementation of IEventProcessor::executeEvent(EventContext&&)
Definition: MinimalEventLoopMgr.cpp:329
System::mappedMemory
GAUDI_API long mappedMemory(MemoryUnit unit=kByte, InfoType fetch=Memory, long pid=-1)
Basic Process Information: priority boost.
Definition: Memory.cpp:197
EventLoopMgr::getEventRoot
StatusCode getEventRoot(IOpaqueAddress *&refpAddr)
Create event address using event selector.
Definition: EventLoopMgr.cpp:363
IOTest.end
end
Definition: IOTest.py:125
StatusCode::FAILURE
constexpr static const auto FAILURE
Definition: StatusCode.h:101
Incident
Definition: Incident.h:27
DataObject::clID
virtual const CLID & clID() const
Retrieve reference to class definition structure.
Definition: DataObject.cpp:66
MinimalEventLoopMgr::initialize
StatusCode initialize() override
implementation of IService::initialize
Definition: MinimalEventLoopMgr.cpp:44
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