The Gaudi Framework  v30r1 (5d4f4ae2)
HiveSlimEventLoopMgr Class Reference

#include <GaudiHive/HiveSlimEventLoopMgr.h>

Inheritance diagram for HiveSlimEventLoopMgr:
Collaboration diagram for HiveSlimEventLoopMgr:

Public Member Functions

 HiveSlimEventLoopMgr (const std::string &nam, ISvcLocator *svcLoc)
 Standard Constructor. More...
 
 ~HiveSlimEventLoopMgr () 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 IService::nextEvent More...
 
StatusCode executeEvent (void *par) override
 implementation of IEventProcessor::executeEvent(void* par) More...
 
StatusCode executeRun (int maxevt) override
 implementation of IEventProcessor::executeRun() More...
 
StatusCode stopRun () override
 implementation of IEventProcessor::stopRun() 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...
 
StatusCode setProperties ()
 Method for setting declared properties to the values specified for the job. 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 >
StatusCode declareTool (ToolHandle< T > &handle, std::string toolTypeAndName, bool createIf=true)
 Declare used tool. More...
 
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 Gaudi::Details::PropertyBase &p) override
 set the property form another property More...
 
StatusCode setProperty (const std::string &s) override
 set the property from the formatted string More...
 
StatusCode setProperty (const std::string &n, const std::string &v) override
 set the property from name and the value More...
 
StatusCode setProperty (const std::string &name, const TYPE &value)
 set the property form the value More...
 
StatusCode getProperty (Gaudi::Details::PropertyBase *p) const override
 get the property More...
 
const Gaudi::Details::PropertyBasegetProperty (const std::string &name) const override
 get the property by name More...
 
StatusCode getProperty (const std::string &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 (const std::string &name) const override
 Return true if we have a property with the given name. More...
 
 PropertyHolder (const PropertyHolder &)=delete
 
PropertyHolderoperator= (const PropertyHolder &)=delete
 
- Public Member Functions inherited from CommonMessagingBase
virtual ~CommonMessagingBase ()=default
 Virtual destructor. More...
 
const SmartIF< IMessageSvc > & msgSvc () const
 The standard message service. More...
 
MsgStreammsgStream () const
 Return an uninitialized MsgStream. More...
 
MsgStreammsgStream (const MSG::Level level) const
 Predefined configurable message stream for the efficient printouts. More...
 
MsgStreamalways () const
 shortcut for the method msgStream(MSG::ALWAYS) More...
 
MsgStreamfatal () const
 shortcut for the method msgStream(MSG::FATAL) More...
 
MsgStreamerr () const
 shortcut for the method msgStream(MSG::ERROR) More...
 
MsgStreamerror () const
 shortcut for the method msgStream(MSG::ERROR) More...
 
MsgStreamwarning () const
 shortcut for the method msgStream(MSG::WARNING) More...
 
MsgStreaminfo () const
 shortcut for the method msgStream(MSG::INFO) More...
 
MsgStreamdebug () const
 shortcut for the method msgStream(MSG::DEBUG) More...
 
MsgStreamverbose () const
 shortcut for the method msgStream(MSG::VERBOSE) More...
 
MsgStreammsg () const
 shortcut for the method msgStream(MSG::INFO) More...
 
MSG::Level msgLevel () const
 get the cached level (originally extracted from the embedded MsgStream) More...
 
MSG::Level outputLevel () const __attribute__((deprecated))
 Backward compatibility function for getting the output level. More...
 
bool msgLevel (MSG::Level lvl) const
 get the output level from the embedded MsgStream More...
 

Protected Member Functions

StatusCode clearWBSlot (int evtSlot)
 Clear a slot in the WB. More...
 
StatusCode declareEventRootAddress ()
 Declare the root address of the event. More...
 
StatusCode createEventContext (EventContext *&eventContext, int createdEvents)
 Create event context. More...
 
StatusCode drainScheduler (int &finishedEvents)
 Drain the scheduler from all actions that may be queued. More...
 
- Protected Member Functions inherited from Service
 ~Service () override
 Standard Destructor. More...
 
int outputLevel () const
 get the Service's output level More...
 
- Protected Member Functions inherited from PropertyHolder< CommonMessaging< implements< IService, IProperty, IStateful > > >
Gaudi::Details::PropertyBaseproperty (const std::string &name) const
 
- Protected Member Functions inherited from CommonMessaging< implements< IService, IProperty, IStateful > >
MSG::Level setUpMessaging ()
 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...
 

Protected Attributes

Gaudi::Property< std::stringm_histPersName {this, "HistogramPersistency", "", ""}
 
Gaudi::Property< std::stringm_evtsel {this, "EvtSel", "", ""}
 
Gaudi::Property< bool > m_warnings {this, "Warnings", true, "Set this property to false to suppress warning messages"}
 
Gaudi::Property< std::stringm_schedulerName
 
Gaudi::Property< std::vector< unsigned int > > m_eventNumberBlacklist {this, "EventNumberBlackList", {}, ""}
 
SmartIF< IDataManagerSvcm_evtDataMgrSvc
 Reference to the Event Data Service's IDataManagerSvc interface. More...
 
SmartIF< IEvtSelectorm_evtSelector
 Reference to the Event Selector. More...
 
IEvtSelector::Contextm_evtContext = nullptr
 Event Iterator. More...
 
SmartIF< IDataManagerSvcm_histoDataMgrSvc
 Reference to the Histogram Data Service. More...
 
SmartIF< IConversionSvcm_histoPersSvc
 Reference to the Histogram Persistency Service. More...
 
SmartIF< IHiveWhiteBoardm_whiteboard
 Reference to the Whiteboard. More...
 
SmartIF< IAlgResourcePoolm_algResourcePool
 Reference to the Algorithm resource pool. More...
 
SmartIF< IAlgExecStateSvcm_algExecStateSvc
 Reference to the AlgExecStateSvc. More...
 
SmartIF< IPropertym_appMgrProperty
 Property interface of ApplicationMgr. More...
 
bool m_endEventFired = false
 Flag to avoid to fire the EnvEvent incident twice in a row (and also not before the first event) More...
 
SmartIF< ISchedulerm_schedulerSvc
 A shortcut for the scheduler. More...
 
SmartIF< IIncidentListenerm_abortEventListener
 Instance of the incident listener waiting for AbortEvent. More...
 
bool m_scheduledStop = false
 Scheduled stop of event processing. More...
 
SmartIF< IAppMgrUIm_appMgrUI
 Reference to the IAppMgrUI interface of the application manager. More...
 
SmartIF< IIncidentSvcm_incidentSvc
 Reference to the incident service. More...
 
boost::dynamic_bitset * m_blackListBS = nullptr
 
- 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"}
 
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()"}
 
SmartIF< IAuditorSvcm_pAuditorSvc
 Auditor Service. More...
 

Additional Inherited Members

- 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
typedef Gaudi::PluginService::Factory< IService *, const std::string &, ISvcLocator * > Factory
 
- 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...
 

Detailed Description

Definition at line 26 of file HiveSlimEventLoopMgr.h.

Constructor & Destructor Documentation

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

Standard Constructor.

Definition at line 44 of file HiveSlimEventLoopMgr.cpp.

45  : base_class( name, svcLoc ), m_appMgrUI( svcLoc )
46 {
47 }
const std::string & name() const override
Retrieve name of the service.
Definition: Service.cpp:289
SmartIF< IAppMgrUI > m_appMgrUI
Reference to the IAppMgrUI interface of the application manager.
extends base_class
Typedef to this class.
Definition: extends.h:15
HiveSlimEventLoopMgr::~HiveSlimEventLoopMgr ( )
override

Standard Destructor.

Definition at line 52 of file HiveSlimEventLoopMgr.cpp.

53 {
59  delete m_evtContext;
60 }
SmartIF< IDataManagerSvc > m_evtDataMgrSvc
Reference to the Event Data Service&#39;s IDataManagerSvc interface.
SmartIF< IHiveWhiteBoard > m_whiteboard
Reference to the Whiteboard.
SmartIF< IConversionSvc > m_histoPersSvc
Reference to the Histogram Persistency Service.
SmartIF< IDataManagerSvc > m_histoDataMgrSvc
Reference to the Histogram Data Service.
SmartIF< IEvtSelector > m_evtSelector
Reference to the Event Selector.
void reset(TYPE *ptr=nullptr)
Set the internal pointer to the passed one disposing of the old one.
Definition: SmartIF.h:92
IEvtSelector::Context * m_evtContext
Event Iterator.

Member Function Documentation

StatusCode HiveSlimEventLoopMgr::clearWBSlot ( int  evtSlot)
protected

Clear a slot in the WB.

Definition at line 628 of file HiveSlimEventLoopMgr.cpp.

629 {
630  StatusCode sc = m_whiteboard->clearStore( evtSlot );
631  if ( !sc.isSuccess() ) warning() << "Clear of Event data store failed" << endmsg;
632  return m_whiteboard->freeStore( evtSlot );
633 }
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:50
SmartIF< IHiveWhiteBoard > m_whiteboard
Reference to the Whiteboard.
MsgStream & warning() const
shortcut for the method msgStream(MSG::WARNING)
virtual StatusCode clearStore(size_t partitionIndex)=0
Clear an given &#39;slot&#39;.
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
virtual StatusCode freeStore(size_t partitionIndex)=0
Free a store partition.
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:209
StatusCode HiveSlimEventLoopMgr::createEventContext ( EventContext *&  eventContext,
int  createdEvents 
)
protected

Create event context.

Definition at line 548 of file HiveSlimEventLoopMgr.cpp.

549 {
550  evtContext = new EventContext;
551  evtContext->set( createdEvts, m_whiteboard->allocateStore( createdEvts ) );
552  m_algExecStateSvc->reset( *evtContext );
553 
554  StatusCode sc = m_whiteboard->selectStore( evtContext->slot() );
555  if ( sc.isFailure() ) {
556  warning() << "Slot " << evtContext->slot() << " could not be selected for the WhiteBoard" << endmsg;
557  }
558  return sc;
559 }
void set(const ContextEvt_t &e=0, const ContextID_t &s=INVALID_CONTEXT_ID)
Definition: EventContext.h:44
SmartIF< IHiveWhiteBoard > m_whiteboard
Reference to the Whiteboard.
This class represents an entry point to all the event specific data.
Definition: EventContext.h:24
bool isFailure() const
Test for a status code of FAILURE.
Definition: StatusCode.h:61
virtual StatusCode selectStore(size_t partitionIndex)=0
Activate an given &#39;slot&#39; for all subsequent calls within the same thread id.
MsgStream & warning() const
shortcut for the method msgStream(MSG::WARNING)
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
virtual void reset(const EventContext &ctx)=0
SmartIF< IAlgExecStateSvc > m_algExecStateSvc
Reference to the AlgExecStateSvc.
virtual size_t allocateStore(int evtnumber)=0
Allocate a store partition for new event.
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:209
StatusCode HiveSlimEventLoopMgr::declareEventRootAddress ( )
protected

Declare the root address of the event.

Definition at line 521 of file HiveSlimEventLoopMgr.cpp.

522 {
523  StatusCode sc;
524  if ( m_evtContext ) {
525  //---This is the "event iterator" context from EventSelector
526  IOpaqueAddress* pAddr = nullptr;
527  sc = getEventRoot( pAddr );
528  if ( !sc.isSuccess() ) {
529  info() << "No more events in event selection " << endmsg;
530  return StatusCode::FAILURE;
531  }
532  sc = m_evtDataMgrSvc->setRoot( "/Event", pAddr );
533  if ( !sc.isSuccess() ) {
534  warning() << "Error declaring event root address." << endmsg;
535  }
536  } else {
537  //---In case of no event selector----------------
538  sc = m_evtDataMgrSvc->setRoot( "/Event", new DataObject() );
539  if ( !sc.isSuccess() ) {
540  warning() << "Error declaring event root DataObject" << endmsg;
541  }
542  }
543  return StatusCode::SUCCESS;
544 }
SmartIF< IDataManagerSvc > m_evtDataMgrSvc
Reference to the Event Data Service&#39;s IDataManagerSvc interface.
MsgStream & info() const
shortcut for the method msgStream(MSG::INFO)
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:50
virtual StatusCode setRoot(std::string root_name, DataObject *pObject)=0
Initialize data store for new event by giving new event path.
MsgStream & warning() const
shortcut for the method msgStream(MSG::WARNING)
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
StatusCode getEventRoot(IOpaqueAddress *&refpAddr)
Create event address using event selector.
Opaque address interface definition.
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:209
IEvtSelector::Context * m_evtContext
Event Iterator.
StatusCode HiveSlimEventLoopMgr::drainScheduler ( int &  finishedEvents)
protected

Drain the scheduler from all actions that may be queued.

Definition at line 563 of file HiveSlimEventLoopMgr.cpp.

564 {
565 
567 
568  // maybe we can do better
569  std::vector<EventContext*> finishedEvtContexts;
570 
571  EventContext* finishedEvtContext( nullptr );
572 
573  // Here we wait not to loose cpu resources
574  debug() << "Waiting for a context" << endmsg;
575  sc = m_schedulerSvc->popFinishedEvent( finishedEvtContext );
576 
577  // We got past it: cache the pointer
578  if ( sc.isSuccess() ) {
579  debug() << "Context obtained" << endmsg;
580  } else {
581  // A problem occurred.
582  debug() << "Context not obtained: a problem in the scheduling?" << endmsg;
583  // return StatusCode::FAILURE;
584  }
585 
586  finishedEvtContexts.push_back( finishedEvtContext );
587 
588  // Let's see if we can pop other event contexts
589  while ( m_schedulerSvc->tryPopFinishedEvent( finishedEvtContext ).isSuccess() ) {
590  finishedEvtContexts.push_back( finishedEvtContext );
591  }
592 
593  // Now we flush them
594  StatusCode finalSC;
595  for ( auto& thisFinishedEvtContext : finishedEvtContexts ) {
596  if ( !thisFinishedEvtContext ) {
597  error() << "Detected nullptr ctxt before clearing WB!" << endmsg;
598  finalSC = StatusCode::FAILURE;
599  continue;
600  }
601  if ( m_algExecStateSvc->eventStatus( *thisFinishedEvtContext ) != EventStatus::Success ) {
602  fatal() << "Failed event detected on " << thisFinishedEvtContext << endmsg;
603  finalSC = StatusCode::FAILURE;
604  }
605  // shouldn't these incidents move to the forward scheduler?
606  // If we want to consume incidents with an algorithm at the end of the graph
607  // we need to add this to forward scheduler lambda action,
608  // otherwise we have to do this serially on this thread!
609  m_incidentSvc->fireIncident( Incident( name(), IncidentType::EndProcessing, *thisFinishedEvtContext ) );
610  m_incidentSvc->fireIncident( Incident( name(), IncidentType::EndEvent, *thisFinishedEvtContext ) );
611 
612  debug() << "Clearing slot " << thisFinishedEvtContext->slot() << " (event " << thisFinishedEvtContext->evt()
613  << ") of the whiteboard" << endmsg;
614 
615  StatusCode sc = clearWBSlot( thisFinishedEvtContext->slot() );
616  if ( !sc.isSuccess() )
617  error() << "Whiteboard slot " << thisFinishedEvtContext->slot() << " could not be properly cleared";
618 
619  delete thisFinishedEvtContext;
620 
621  finishedEvts++;
622  }
623  return finalSC;
624 }
StatusCode clearWBSlot(int evtSlot)
Clear a slot in the WB.
SmartIF< IIncidentSvc > m_incidentSvc
Reference to the incident service.
const std::string & name() const override
Retrieve name of the service.
Definition: Service.cpp:289
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:50
SmartIF< IScheduler > m_schedulerSvc
A shortcut for the scheduler.
This class represents an entry point to all the event specific data.
Definition: EventContext.h:24
T push_back(T...args)
MsgStream & error() const
shortcut for the method msgStream(MSG::ERROR)
virtual void fireIncident(const Incident &incident)=0
Fire an Incident.
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
STL class.
SmartIF< IAlgExecStateSvc > m_algExecStateSvc
Reference to the AlgExecStateSvc.
MsgStream & debug() const
shortcut for the method msgStream(MSG::DEBUG)
virtual StatusCode tryPopFinishedEvent(EventContext *&eventContext)=0
Try to retrieve a finished event from the scheduler.
Base class for all Incidents (computing events).
Definition: Incident.h:17
virtual const EventStatus::Status & eventStatus(const EventContext &ctx) const =0
MsgStream & fatal() const
shortcut for the method msgStream(MSG::FATAL)
virtual StatusCode popFinishedEvent(EventContext *&eventContext)=0
Retrieve a finished event from the scheduler.
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:209
StatusCode HiveSlimEventLoopMgr::executeEvent ( void *  par)
override

implementation of IEventProcessor::executeEvent(void* par)

Definition at line 302 of file HiveSlimEventLoopMgr.cpp.

303 {
304 
305  // Leave the interface intact and swallow this C trick.
306  int& createdEvts = *( (int*)createdEvts_IntPtr );
307 
308  EventContext* evtContext( nullptr );
309 
310  // Check if event number is in blacklist
311  if ( LIKELY( m_blackListBS != nullptr ) ) { // we are processing a finite number of events, use bitset blacklist
312  if ( m_blackListBS->test( createdEvts ) ) {
313  verbose() << "Event " << createdEvts << " on black list" << endmsg;
315  }
316  } else if ( std::binary_search( m_eventNumberBlacklist.begin(), m_eventNumberBlacklist.end(), createdEvts ) ) {
317 
318  verbose() << "Event " << createdEvts << " on black list" << endmsg;
320  }
321 
322  if ( createEventContext( evtContext, createdEvts ).isFailure() ) {
323  fatal() << "Impossible to create event context" << endmsg;
324  return StatusCode::FAILURE;
325  }
326 
327  verbose() << "Beginning to process event " << createdEvts << endmsg;
328 
329  // An incident may schedule a stop, in which case is better to exit before the actual execution.
330  // DP have to find out who shoots this
331  /* if ( m_scheduledStop ) {
332  always() << "Terminating event processing loop due to a stop scheduled by an incident listener" << endmsg;
333  return StatusCode::SUCCESS;
334  }*/
335 
336  StatusCode declEvtRootSc = declareEventRootAddress();
337  if ( declEvtRootSc.isFailure() ) { // We ran out of events!
338  createdEvts = -1; // Set created event to a negative value: we finished!
339  return StatusCode::SUCCESS;
340  }
341 
342  // Fire BeginEvent "Incident"
343  m_incidentSvc->fireIncident( std::make_unique<Incident>( name(), IncidentType::BeginEvent, *evtContext ) );
344 
345  // Now add event to the scheduler
346  verbose() << "Adding event " << evtContext->evt() << ", slot " << evtContext->slot() << " to the scheduler" << endmsg;
347 
348  m_incidentSvc->fireIncident( std::make_unique<Incident>( name(), IncidentType::BeginProcessing, *evtContext ) );
349 
350  StatusCode addEventStatus = m_schedulerSvc->pushNewEvent( evtContext );
351 
352  // If this fails, we need to wait for something to complete
353  if ( !addEventStatus.isSuccess() ) {
354  fatal() << "An event processing slot should be now free in the scheduler, but it appears not to be the case."
355  << endmsg;
356  }
357 
358  createdEvts++;
359  return StatusCode::SUCCESS;
360 }
SmartIF< IIncidentSvc > m_incidentSvc
Reference to the incident service.
StatusCode declareEventRootAddress()
Declare the root address of the event.
const std::string & name() const override
Retrieve name of the service.
Definition: Service.cpp:289
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:50
SmartIF< IScheduler > m_schedulerSvc
A shortcut for the scheduler.
MsgStream & verbose() const
shortcut for the method msgStream(MSG::VERBOSE)
T binary_search(T...args)
Gaudi::Property< std::vector< unsigned int > > m_eventNumberBlacklist
This class represents an entry point to all the event specific data.
Definition: EventContext.h:24
bool isFailure() const
Test for a status code of FAILURE.
Definition: StatusCode.h:61
virtual void fireIncident(const Incident &incident)=0
Fire an Incident.
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
StatusCode createEventContext(EventContext *&eventContext, int createdEvents)
Create event context.
virtual StatusCode pushNewEvent(EventContext *eventContext)=0
Make an event available to the scheduler.
#define LIKELY(x)
Definition: Kernel.h:127
MsgStream & fatal() const
shortcut for the method msgStream(MSG::FATAL)
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:209
boost::dynamic_bitset * m_blackListBS
StatusCode HiveSlimEventLoopMgr::executeRun ( int  maxevt)
override

implementation of IEventProcessor::executeRun()

Definition at line 365 of file HiveSlimEventLoopMgr.cpp.

366 {
367  StatusCode sc;
368  bool eventfailed = false;
369 
370  if ( maxevt > 0 ) { // finite number of events to process
371  const unsigned int umaxevt = static_cast<unsigned int>( maxevt );
372  m_blackListBS = new boost::dynamic_bitset<>( maxevt ); // all initialized to zero
373  for ( unsigned int i = 0; i < m_eventNumberBlacklist.size() && m_eventNumberBlacklist[i] <= umaxevt;
374  ++i ) { // black list is sorted in init
375  m_blackListBS->set( m_eventNumberBlacklist[i], true );
376  }
377  }
378 
379  sc = m_algResourcePool->beginRun();
380  if ( sc.isFailure() ) eventfailed = true;
381 
382  // Call now the nextEvent(...)
383  sc = nextEvent( maxevt );
384  if ( sc.isFailure() ) eventfailed = true;
385 
386  sc = m_algResourcePool->endRun();
387  if ( sc.isFailure() ) eventfailed = true;
388 
389  delete m_blackListBS;
390 
391  return eventfailed ? StatusCode::FAILURE : StatusCode::SUCCESS;
392 }
Gaudi::Property< std::vector< unsigned int > > m_eventNumberBlacklist
bool isFailure() const
Test for a status code of FAILURE.
Definition: StatusCode.h:61
virtual StatusCode endRun()=0
End Run.
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
virtual StatusCode beginRun()=0
Begin Run.
int maxevt
Definition: Bootstrap.cpp:276
SmartIF< IAlgResourcePool > m_algResourcePool
Reference to the Algorithm resource pool.
StatusCode nextEvent(int maxevt) override
implementation of IService::nextEvent
boost::dynamic_bitset * m_blackListBS
StatusCode HiveSlimEventLoopMgr::finalize ( )
override

implementation of IService::finalize

Definition at line 238 of file HiveSlimEventLoopMgr.cpp.

239 {
240 
241  StatusCode scRet;
243 
244  if ( sc.isFailure() ) {
245  scRet = StatusCode::FAILURE;
246  error() << "Problems finalizing Service base class" << endmsg;
247  }
248 
249  // Save Histograms Now
250  if ( m_histoPersSvc ) {
251  HistogramAgent agent;
252  sc = m_histoDataMgrSvc->traverseTree( &agent );
253  if ( sc.isSuccess() ) {
254  const IDataSelector& objects = agent.selectedObjects();
255  // skip /stat entry!
256  sc = std::accumulate( begin( objects ), end( objects ), sc, [&]( StatusCode s, const auto& i ) {
257  IOpaqueAddress* pAddr = nullptr;
258  StatusCode iret = m_histoPersSvc->createRep( i, pAddr );
259  if ( iret.isSuccess() ) i->registry()->setAddress( pAddr );
260  return s.isFailure() ? s : iret;
261  } );
262  sc = std::accumulate( begin( objects ), end( objects ), sc, [&]( StatusCode s, const auto& i ) {
263  IRegistry* reg = i->registry();
264  StatusCode iret = m_histoPersSvc->fillRepRefs( reg->address(), i );
265  return s.isFailure() ? s : iret;
266  } );
267  if ( sc.isSuccess() ) {
268  info() << "Histograms converted successfully according to request." << endmsg;
269  } else {
270  error() << "Error while saving Histograms." << endmsg;
271  }
272  } else {
273  error() << "Error while traversing Histogram data store" << endmsg;
274  }
275  }
276 
277  scRet = sc;
278 
279  // Release event selector context
280  if ( m_evtSelector && m_evtContext ) {
282  m_evtContext = nullptr;
283  }
284 
286  m_appMgrUI.reset();
287 
288  // Release all interfaces...
291 
295 
296  return scRet;
297 }
virtual StatusCode traverseTree(IDataStoreAgent *pAgent)=0
Analyse by traversing all data objects in the data store.
SmartIF< IIncidentSvc > m_incidentSvc
Reference to the incident service.
SmartIF< IDataManagerSvc > m_evtDataMgrSvc
Reference to the Event Data Service&#39;s IDataManagerSvc interface.
StatusCode finalize() override
Definition: Service.cpp:174
SmartIF< IAppMgrUI > m_appMgrUI
Reference to the IAppMgrUI interface of the application manager.
MsgStream & info() const
shortcut for the method msgStream(MSG::INFO)
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:50
HistogramAgent base in charge of collecting all the refereces to DataObjects in a transient store tha...
SmartIF< IHiveWhiteBoard > m_whiteboard
Reference to the Whiteboard.
virtual StatusCode createRep(DataObject *pObject, IOpaqueAddress *&refpAddress)=0
Convert the transient object to the requested representation.
bool isFailure() const
Test for a status code of FAILURE.
Definition: StatusCode.h:61
auto begin(reverse_wrapper< T > &w)
Definition: reverse.h:58
MsgStream & error() const
shortcut for the method msgStream(MSG::ERROR)
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
The IRegistry represents the entry door to the environment any data object residing in a transient da...
Definition: IRegistry.h:22
auto end(reverse_wrapper< T > &w)
Definition: reverse.h:64
virtual StatusCode releaseContext(Context *&) const =0
Release the Context object.
IDataSelector * selectedObjects()
Return the set of selected DataObjects.
SmartIF< IConversionSvc > m_histoPersSvc
Reference to the Histogram Persistency Service.
SmartIF< IDataManagerSvc > m_histoDataMgrSvc
Reference to the Histogram Data Service.
SmartIF< IEvtSelector > m_evtSelector
Reference to the Event Selector.
string s
Definition: gaudirun.py:253
void reset(TYPE *ptr=nullptr)
Set the internal pointer to the passed one disposing of the old one.
Definition: SmartIF.h:92
T accumulate(T...args)
Opaque address interface definition.
void ignore() const
Definition: StatusCode.h:84
virtual IOpaqueAddress * address() const =0
Retrieve opaque storage address.
virtual StatusCode fillRepRefs(IOpaqueAddress *pAddress, DataObject *pObject)=0
Resolve the references of the converted object.
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:209
IEvtSelector::Context * m_evtContext
Event Iterator.
StatusCode HiveSlimEventLoopMgr::getEventRoot ( IOpaqueAddress *&  refpAddr)

Create event address using event selector.

Definition at line 504 of file HiveSlimEventLoopMgr.cpp.

505 {
506  refpAddr = nullptr;
508  if ( sc.isFailure() ) return sc;
509  // Create root address and assign address to data service
510  sc = m_evtSelector->createAddress( *m_evtContext, refpAddr );
511  if ( sc.isSuccess() ) return sc;
512  sc = m_evtSelector->next( *m_evtContext );
513  if ( sc.isFailure() ) return sc;
514  sc = m_evtSelector->createAddress( *m_evtContext, refpAddr );
515  if ( !sc.isSuccess() ) warning() << "Error creating IOpaqueAddress." << endmsg;
516  return sc;
517 }
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:50
bool isFailure() const
Test for a status code of FAILURE.
Definition: StatusCode.h:61
MsgStream & warning() const
shortcut for the method msgStream(MSG::WARNING)
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
SmartIF< IEvtSelector > m_evtSelector
Reference to the Event Selector.
virtual StatusCode next(Context &c) const =0
Fetch the next event or the first event if it will be use soon after the creation of the context...
virtual StatusCode createAddress(const Context &c, IOpaqueAddress *&iop) const =0
Create an IOpaqueAddress object from the event fetched.
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:209
IEvtSelector::Context * m_evtContext
Event Iterator.
StatusCode HiveSlimEventLoopMgr::initialize ( )
override

implementation of IService::initialize

Definition at line 65 of file HiveSlimEventLoopMgr.cpp.

66 {
67 
68  if ( !m_appMgrUI ) return StatusCode::FAILURE;
69 
71  if ( !sc.isSuccess() ) {
72  error() << "Failed to initialize Service Base class." << endmsg;
73  return StatusCode::FAILURE;
74  }
75 
76  // Get the references to the services that are needed by the ApplicationMgr itself
77  m_incidentSvc = serviceLocator()->service( "IncidentSvc" );
78  if ( !m_incidentSvc ) {
79  fatal() << "Error retrieving IncidentSvc." << endmsg;
80  return StatusCode::FAILURE;
81  }
82 
83  // Setup access to event data services
84  m_evtDataMgrSvc = serviceLocator()->service( "EventDataSvc" );
85  if ( !m_evtDataMgrSvc ) {
86  fatal() << "Error retrieving EventDataSvc interface IDataManagerSvc." << endmsg;
87  return StatusCode::FAILURE;
88  }
89  m_whiteboard = serviceLocator()->service( "EventDataSvc" );
90  if ( !m_whiteboard ) {
91  fatal() << "Error retrieving EventDataSvc interface IHiveWhiteBoard." << endmsg;
92  return StatusCode::FAILURE;
93  }
95  if ( !m_schedulerSvc ) {
96  fatal() << "Error retrieving SchedulerSvc interface IScheduler." << endmsg;
97  return StatusCode::FAILURE;
98  }
99  // Obtain the IProperty of the ApplicationMgr
101  if ( !m_appMgrProperty ) {
102  fatal() << "IProperty interface not found in ApplicationMgr." << endmsg;
103  return StatusCode::FAILURE;
104  }
105 
106  // We do not expect a Event Selector necessarily being declared
107  setProperty( m_appMgrProperty->getProperty( "EvtSel" ) ).ignore();
108 
109  if ( m_evtsel != "NONE" || m_evtsel.length() == 0 ) {
110  m_evtSelector = serviceLocator()->service( "EventSelector" );
111  if ( m_evtSelector ) {
112  // Setup Event Selector
114  if ( !sc.isSuccess() ) {
115  fatal() << "Can not create the event selector Context." << endmsg;
116  return sc;
117  }
118  } else {
119  fatal() << "EventSelector not found." << endmsg;
120  return sc;
121  }
122  } else {
123  m_evtSelector = 0;
124  m_evtContext = 0;
125  if ( m_warnings ) {
126  warning() << "Unable to locate service \"EventSelector\" " << endmsg;
127  warning() << "No events will be processed from external input." << endmsg;
128  }
129  }
130 
131  // Setup access to histogramming services
132  m_histoDataMgrSvc = serviceLocator()->service( "HistogramDataSvc" );
133  if ( !m_histoDataMgrSvc ) {
134  fatal() << "Error retrieving HistogramDataSvc." << endmsg;
135  return sc;
136  }
137  // Setup histogram persistency
138  m_histoPersSvc = serviceLocator()->service( "HistogramPersistencySvc" );
139  if ( !m_histoPersSvc ) {
140  warning() << "Histograms cannot not be saved - though required." << endmsg;
141  return sc;
142  }
143 
144  // Setup algorithm resource pool
145  m_algResourcePool = serviceLocator()->service( "AlgResourcePool" );
146  if ( !m_algResourcePool ) {
147  fatal() << "Error retrieving AlgResourcePool" << endmsg;
148  return StatusCode::FAILURE;
149  }
150 
151  m_algExecStateSvc = serviceLocator()->service( "AlgExecStateSvc" );
152  if ( !m_algExecStateSvc ) {
153  fatal() << "Error retrieving AlgExecStateSvc" << endmsg;
154  return StatusCode::FAILURE;
155  }
156 
158  info() << "Found " << m_eventNumberBlacklist.size() << " events in black list" << endmsg;
159 
160  return StatusCode::SUCCESS;
161 }
StatusCode initialize() override
Definition: Service.cpp:64
Gaudi::Property< std::string > m_evtsel
SmartIF< IIncidentSvc > m_incidentSvc
Reference to the incident service.
SmartIF< IDataManagerSvc > m_evtDataMgrSvc
Reference to the Event Data Service&#39;s IDataManagerSvc interface.
StatusCode setProperty(const Gaudi::Details::PropertyBase &p) override
set the property form another property
SmartIF< IAppMgrUI > m_appMgrUI
Reference to the IAppMgrUI interface of the application manager.
MsgStream & info() const
shortcut for the method msgStream(MSG::INFO)
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:50
SmartIF< IHiveWhiteBoard > m_whiteboard
Reference to the Whiteboard.
SmartIF< IScheduler > m_schedulerSvc
A shortcut for the scheduler.
Gaudi::Property< std::vector< unsigned int > > m_eventNumberBlacklist
virtual StatusCode getProperty(Gaudi::Details::PropertyBase *p) const =0
Get the property by property.
SmartIF< IProperty > m_appMgrProperty
Property interface of ApplicationMgr.
Gaudi::Property< bool > m_warnings
StatusCode service(const Gaudi::Utils::TypeNameString &name, T *&svc, bool createIf=true)
Templated method to access a service by name.
Definition: ISvcLocator.h:79
MsgStream & error() const
shortcut for the method msgStream(MSG::ERROR)
MsgStream & warning() const
shortcut for the method msgStream(MSG::WARNING)
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
SmartIF< IAlgExecStateSvc > m_algExecStateSvc
Reference to the AlgExecStateSvc.
SmartIF< IConversionSvc > m_histoPersSvc
Reference to the Histogram Persistency Service.
Gaudi::Property< std::string > m_schedulerName
SmartIF< IDataManagerSvc > m_histoDataMgrSvc
Reference to the Histogram Data Service.
SmartIF< IEvtSelector > m_evtSelector
Reference to the Event Selector.
T sort(T...args)
virtual StatusCode createContext(Context *&c) const =0
Create and return a context object that will keep track of the state of selection.
MsgStream & fatal() const
shortcut for the method msgStream(MSG::FATAL)
SmartIF< IAlgResourcePool > m_algResourcePool
Reference to the Algorithm resource pool.
SmartIF< ISvcLocator > & serviceLocator() const override
Retrieve pointer to service locator.
Definition: Service.cpp:292
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:209
IEvtSelector::Context * m_evtContext
Event Iterator.
StatusCode HiveSlimEventLoopMgr::nextEvent ( int  maxevt)
override

implementation of IService::nextEvent

Definition at line 415 of file HiveSlimEventLoopMgr.cpp.

416 {
417 
418  // Calculate runtime
420 
421  // Reset the application return code.
423 
424  int finishedEvts = 0;
425  int createdEvts = 0;
426  int skippedEvts = 0;
427  info() << "Starting loop on events" << endmsg;
428  // Loop until the finished events did not reach the maxevt number
429  bool loop_ended = false;
430  // Run the first event before spilling more than one
431  bool newEvtAllowed = false;
432 
433  constexpr double oneOver1024 = 1. / 1024.;
434 
435  uint iteration = 0;
436  auto start_time = Clock::now();
437  while ( !loop_ended && ( maxevt < 0 || ( finishedEvts + skippedEvts ) < maxevt ) ) {
438  debug() << "work loop iteration " << iteration++ << endmsg;
439  // if the created events did not reach maxevt, create an event
440  if ( ( newEvtAllowed || createdEvts == 0 ) && // Launch the first event alone
441  createdEvts >= 0 && // The events are not finished with an unlimited number of events
442  ( createdEvts < maxevt || maxevt < 0 ) && // The events are not finished with a limited number of events
443  m_schedulerSvc->freeSlots() > 0 && // There are still free slots in the scheduler
444  m_whiteboard->freeSlots() > 0 ) { // There are still free slots in the whiteboard
445 
446  if ( 1 == createdEvts ) // reset counter to count from event 1
447  start_time = Clock::now();
448 
449  debug() << "createdEvts: " << createdEvts << ", freeslots: " << m_schedulerSvc->freeSlots() << endmsg;
450  // DP remove to remove the syscalls...
451  // if (0!=createdEvts){
452  // info() << "Event Number = " << createdEvts
453  // << " WSS (MB) = " << System::mappedMemory(System::MemoryUnit::kByte)*oneOver1024
454  // << " Time (s) = " << secsFromStart(start_time) << endmsg;
455  // }
456 
457  // TODO can we adapt the interface of executeEvent for a nicer solution?
459  while ( !sc.isSuccess() // we haven't created an event yet
460  && ( createdEvts < maxevt || maxevt < 0 ) ) { // redunant check for maxEvts, can we do better?
461  sc = executeEvent( &createdEvts );
462 
463  if ( sc.isRecoverable() ) { // we skipped an event
464 
465  // this is all to skip the event
466  size_t slot =
467  m_whiteboard->allocateStore( createdEvts ); // we need a new store, not to change the previous event
468  m_whiteboard->selectStore( slot );
469  declareEventRootAddress(); // actually skip over the event
470  m_whiteboard->freeStore( slot ); // delete the store
471 
472  ++createdEvts;
473  ++skippedEvts;
474  } else if ( sc.isRecoverable() ) { // exit immediatly
475  return StatusCode::FAILURE;
476  } // else we have an success --> exit loop
477  }
478 
479  } // end if condition createdEvts < maxevt
480  else {
481  // all the events were created but not all finished or the slots were
482  // all busy: the scheduler should finish its job
483 
484  debug() << "Draining the scheduler" << endmsg;
485 
486  // Pull out of the scheduler the finished events
487  if ( drainScheduler( finishedEvts ).isFailure() ) loop_ended = true;
488  newEvtAllowed = true;
489  }
490  } // end main loop on finished events
491  auto end_time = Clock::now();
492 
493  info() << "---> Loop Finished (skipping 1st evt) - "
494  << " WSS " << System::mappedMemory( System::MemoryUnit::kByte ) * oneOver1024 << " total time "
495  << std::chrono::duration_cast<std::chrono::nanoseconds>( end_time - start_time ).count() << endmsg;
496  info() << skippedEvts << " events were SKIPed" << endmsg;
497 
498  return StatusCode::SUCCESS;
499 }
StatusCode declareEventRootAddress()
Declare the root address of the event.
MsgStream & info() const
shortcut for the method msgStream(MSG::INFO)
StatusCode drainScheduler(int &finishedEvents)
Drain the scheduler from all actions that may be queued.
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:50
SmartIF< IHiveWhiteBoard > m_whiteboard
Reference to the Whiteboard.
SmartIF< IScheduler > m_schedulerSvc
A shortcut for the scheduler.
T duration_cast(T...args)
virtual size_t freeSlots()=0
Get free slots number.
SmartIF< IProperty > m_appMgrProperty
Property interface of ApplicationMgr.
virtual StatusCode selectStore(size_t partitionIndex)=0
Activate an given &#39;slot&#39; for all subsequent calls within the same thread id.
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
bool isRecoverable() const
Definition: StatusCode.h:62
StatusCode setAppReturnCode(SmartIF< IProperty > &appmgr, int value, bool force=false)
Set the application return code.
Definition: AppReturnCode.h:51
T count(T...args)
GAUDI_API long mappedMemory(MemoryUnit unit=kByte, InfoType fetch=Memory, long pid=-1)
Basic Process Information: priority boost.
Definition: Memory.cpp:204
MsgStream & debug() const
shortcut for the method msgStream(MSG::DEBUG)
virtual size_t allocateStore(int evtnumber)=0
Allocate a store partition for new event.
virtual StatusCode freeStore(size_t partitionIndex)=0
Free a store partition.
int maxevt
Definition: Bootstrap.cpp:276
void ignore() const
Definition: StatusCode.h:84
constexpr int Success
Definition: AppReturnCode.h:18
StatusCode executeEvent(void *par) override
implementation of IEventProcessor::executeEvent(void* par)
virtual unsigned int freeSlots()=0
Get the free event processing slots.
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:209
StatusCode HiveSlimEventLoopMgr::reinitialize ( )
override

implementation of IService::reinitialize

Definition at line 165 of file HiveSlimEventLoopMgr.cpp.

166 {
167 
168  // Check to see whether a new Event Selector has been specified
169  setProperty( m_appMgrProperty->getProperty( "EvtSel" ) );
170  if ( m_evtsel != "NONE" || m_evtsel.empty() ) {
171  auto theSvc = serviceLocator()->service( "EventSelector" );
172  auto theEvtSel = theSvc.as<IEvtSelector>();
173  StatusCode sc;
174  if ( theEvtSel && ( theEvtSel.get() != m_evtSelector.get() ) ) {
175  // Setup Event Selector
176  if ( m_evtSelector.get() && m_evtContext ) {
177  // Need to release context before switching to new event selector
179  m_evtContext = nullptr;
180  }
181  m_evtSelector = theEvtSel;
182  if ( theSvc->FSMState() == Gaudi::StateMachine::INITIALIZED ) {
183  sc = theSvc->reinitialize();
184  if ( !sc.isSuccess() ) {
185  error() << "Failure Reinitializing EventSelector " << theSvc->name() << endmsg;
186  return sc;
187  }
188  } else {
189  sc = theSvc->sysInitialize();
190  if ( !sc.isSuccess() ) {
191  error() << "Failure Initializing EventSelector " << theSvc->name() << endmsg;
192  return sc;
193  }
194  }
196  if ( !sc.isSuccess() ) {
197  error() << "Can not create Context " << theSvc->name() << endmsg;
198  return sc;
199  }
200 
201  } else if ( m_evtSelector ) {
202  if ( m_evtContext ) {
204  m_evtContext = nullptr;
205  }
207  if ( !sc.isSuccess() ) {
208  error() << "Can not create Context " << theSvc->name() << endmsg;
209  return sc;
210  }
211  }
212  } else if ( m_evtSelector && m_evtContext ) {
214  m_evtSelector = nullptr;
215  m_evtContext = nullptr;
216  }
217  return StatusCode::SUCCESS;
218 }
Gaudi::Property< std::string > m_evtsel
StatusCode setProperty(const Gaudi::Details::PropertyBase &p) override
set the property form another property
The Event Selector Interface.
Definition: IEvtSelector.h:18
virtual StatusCode getProperty(Gaudi::Details::PropertyBase *p) const =0
Get the property by property.
SmartIF< IProperty > m_appMgrProperty
Property interface of ApplicationMgr.
TYPE * get() const
Get interface pointer.
Definition: SmartIF.h:82
StatusCode service(const Gaudi::Utils::TypeNameString &name, T *&svc, bool createIf=true)
Templated method to access a service by name.
Definition: ISvcLocator.h:79
MsgStream & error() const
shortcut for the method msgStream(MSG::ERROR)
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
virtual StatusCode releaseContext(Context *&) const =0
Release the Context object.
SmartIF< IEvtSelector > m_evtSelector
Reference to the Event Selector.
virtual StatusCode createContext(Context *&c) const =0
Create and return a context object that will keep track of the state of selection.
SmartIF< ISvcLocator > & serviceLocator() const override
Retrieve pointer to service locator.
Definition: Service.cpp:292
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:209
IEvtSelector::Context * m_evtContext
Event Iterator.
StatusCode HiveSlimEventLoopMgr::stop ( )
override

implementation of IService::stop

Definition at line 224 of file HiveSlimEventLoopMgr.cpp.

225 {
226  if ( !m_endEventFired ) {
227  // Fire pending EndEvent incident
228  m_incidentSvc->fireIncident( Incident( name(), IncidentType::EndEvent ) );
229  m_endEventFired = true;
230  }
231  return StatusCode::SUCCESS;
232 }
SmartIF< IIncidentSvc > m_incidentSvc
Reference to the incident service.
const std::string & name() const override
Retrieve name of the service.
Definition: Service.cpp:289
virtual void fireIncident(const Incident &incident)=0
Fire an Incident.
Base class for all Incidents (computing events).
Definition: Incident.h:17
bool m_endEventFired
Flag to avoid to fire the EnvEvent incident twice in a row (and also not before the first event) ...
StatusCode HiveSlimEventLoopMgr::stopRun ( )
override

implementation of IEventProcessor::stopRun()

Definition at line 397 of file HiveSlimEventLoopMgr.cpp.

398 {
399  // Set the application return code
400  auto appmgr = serviceLocator()->as<IProperty>();
402  error() << "Could not set return code of the application (" << Gaudi::ReturnCode::ScheduledStop << ")" << endmsg;
403  }
404  m_scheduledStop = true;
405  return StatusCode::SUCCESS;
406 }
bool m_scheduledStop
Scheduled stop of event processing.
SmartIF< IFace > as()
Definition: ISvcLocator.h:109
bool isFailure() const
Test for a status code of FAILURE.
Definition: StatusCode.h:61
constexpr int ScheduledStop
Definition: AppReturnCode.h:27
MsgStream & error() const
shortcut for the method msgStream(MSG::ERROR)
StatusCode setAppReturnCode(SmartIF< IProperty > &appmgr, int value, bool force=false)
Set the application return code.
Definition: AppReturnCode.h:51
The IProperty is the basic interface for all components which have properties that can be set or get...
Definition: IProperty.h:20
SmartIF< ISvcLocator > & serviceLocator() const override
Retrieve pointer to service locator.
Definition: Service.cpp:292
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:209

Member Data Documentation

SmartIF<IIncidentListener> HiveSlimEventLoopMgr::m_abortEventListener
protected

Instance of the incident listener waiting for AbortEvent.

Definition at line 69 of file HiveSlimEventLoopMgr.h.

SmartIF<IAlgExecStateSvc> HiveSlimEventLoopMgr::m_algExecStateSvc
protected

Reference to the AlgExecStateSvc.

Definition at line 52 of file HiveSlimEventLoopMgr.h.

SmartIF<IAlgResourcePool> HiveSlimEventLoopMgr::m_algResourcePool
protected

Reference to the Algorithm resource pool.

Definition at line 50 of file HiveSlimEventLoopMgr.h.

SmartIF<IProperty> HiveSlimEventLoopMgr::m_appMgrProperty
protected

Property interface of ApplicationMgr.

Definition at line 54 of file HiveSlimEventLoopMgr.h.

SmartIF<IAppMgrUI> HiveSlimEventLoopMgr::m_appMgrUI
protected

Reference to the IAppMgrUI interface of the application manager.

Definition at line 73 of file HiveSlimEventLoopMgr.h.

boost::dynamic_bitset* HiveSlimEventLoopMgr::m_blackListBS = nullptr
protected

Definition at line 78 of file HiveSlimEventLoopMgr.h.

bool HiveSlimEventLoopMgr::m_endEventFired = false
protected

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

Definition at line 57 of file HiveSlimEventLoopMgr.h.

Gaudi::Property<std::vector<unsigned int> > HiveSlimEventLoopMgr::m_eventNumberBlacklist {this, "EventNumberBlackList", {}, ""}
protected

Definition at line 35 of file HiveSlimEventLoopMgr.h.

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

Event Iterator.

Definition at line 42 of file HiveSlimEventLoopMgr.h.

SmartIF<IDataManagerSvc> HiveSlimEventLoopMgr::m_evtDataMgrSvc
protected

Reference to the Event Data Service's IDataManagerSvc interface.

Definition at line 38 of file HiveSlimEventLoopMgr.h.

Gaudi::Property<std::string> HiveSlimEventLoopMgr::m_evtsel {this, "EvtSel", "", ""}
protected

Definition at line 31 of file HiveSlimEventLoopMgr.h.

SmartIF<IEvtSelector> HiveSlimEventLoopMgr::m_evtSelector
protected

Reference to the Event Selector.

Definition at line 40 of file HiveSlimEventLoopMgr.h.

SmartIF<IDataManagerSvc> HiveSlimEventLoopMgr::m_histoDataMgrSvc
protected

Reference to the Histogram Data Service.

Definition at line 44 of file HiveSlimEventLoopMgr.h.

SmartIF<IConversionSvc> HiveSlimEventLoopMgr::m_histoPersSvc
protected

Reference to the Histogram Persistency Service.

Definition at line 46 of file HiveSlimEventLoopMgr.h.

Gaudi::Property<std::string> HiveSlimEventLoopMgr::m_histPersName {this, "HistogramPersistency", "", ""}
protected

Definition at line 30 of file HiveSlimEventLoopMgr.h.

SmartIF<IIncidentSvc> HiveSlimEventLoopMgr::m_incidentSvc
protected

Reference to the incident service.

Definition at line 75 of file HiveSlimEventLoopMgr.h.

bool HiveSlimEventLoopMgr::m_scheduledStop = false
protected

Scheduled stop of event processing.

Definition at line 71 of file HiveSlimEventLoopMgr.h.

Gaudi::Property<std::string> HiveSlimEventLoopMgr::m_schedulerName
protected
Initial value:
{this, "SchedulerName", "AvalancheSchedulerSvc",
"Name of the scheduler to be used"}

Definition at line 33 of file HiveSlimEventLoopMgr.h.

SmartIF<IScheduler> HiveSlimEventLoopMgr::m_schedulerSvc
protected

A shortcut for the scheduler.

Definition at line 59 of file HiveSlimEventLoopMgr.h.

Gaudi::Property<bool> HiveSlimEventLoopMgr::m_warnings {this, "Warnings", true, "Set this property to false to suppress warning messages"}
protected

Definition at line 32 of file HiveSlimEventLoopMgr.h.

SmartIF<IHiveWhiteBoard> HiveSlimEventLoopMgr::m_whiteboard
protected

Reference to the Whiteboard.

Definition at line 48 of file HiveSlimEventLoopMgr.h.


The documentation for this class was generated from the following files: