Go to the documentation of this file.
   29 #define ON_DEBUG if ( msgLevel( MSG::DEBUG ) ) 
   30 #define DEBUG_MSG ON_DEBUG debug() 
   32 #define ON_VERBOSE if ( msgLevel( MSG::VERBOSE ) ) 
   33 #define VERBOSE_MSG ON_VERBOSE verbose() 
   46     error() << 
"Failed to initialize Service Base class." << 
endmsg;
 
   53     fatal() << 
"Error retrieving IncidentSvc." << 
endmsg;
 
   60     fatal() << 
"Error retrieving EventDataSvc interface IDataManagerSvc." << 
endmsg;
 
   65     fatal() << 
"Error retrieving EventDataSvc interface IHiveWhiteBoard." << 
endmsg;
 
   70     fatal() << 
"Error retrieving SchedulerSvc interface IScheduler." << 
endmsg;
 
   76     fatal() << 
"IProperty interface not found in ApplicationMgr." << 
endmsg;
 
   89         fatal() << 
"Can not create the event selector Context." << 
endmsg;
 
   93       fatal() << 
"EventSelector not found." << 
endmsg;
 
  100       warning() << 
"Unable to locate service \"EventSelector\" " << 
endmsg;
 
  101       warning() << 
"No events will be processed from external input." << 
endmsg;
 
  108     fatal() << 
"Error retrieving HistogramDataSvc." << 
endmsg;
 
  114     warning() << 
"Histograms cannot not be saved - though required." << 
endmsg;
 
  121     fatal() << 
"Error retrieving AlgResourcePool" << 
endmsg;
 
  127     fatal() << 
"Error retrieving AlgExecStateSvc" << 
endmsg;
 
  156         sc = theSvc->reinitialize();
 
  157         if ( !sc.isSuccess() ) {
 
  158           error() << 
"Failure Reinitializing EventSelector " << theSvc->name() << 
endmsg;
 
  162         sc = theSvc->sysInitialize();
 
  163         if ( !sc.isSuccess() ) {
 
  164           error() << 
"Failure Initializing EventSelector " << theSvc->name() << 
endmsg;
 
  169       if ( !sc.isSuccess() ) {
 
  170         error() << 
"Can not create Context " << theSvc->name() << 
endmsg;
 
  180       if ( !sc.isSuccess() ) {
 
  181         error() << 
"Can not create Context " << theSvc->name() << 
endmsg;
 
  217     error() << 
"Problems finalizing Service base class" << 
endmsg;
 
  230         if ( iret.
isSuccess() ) i->registry()->setAddress( pAddr );
 
  231         return s.isFailure() ? 
s : iret;
 
  236         return s.isFailure() ? 
s : iret;
 
  238       if ( sc.isSuccess() ) {
 
  239         info() << 
"Histograms converted successfully according to request." << 
endmsg;
 
  241         error() << 
"Error while saving Histograms." << 
endmsg;
 
  244       error() << 
"Error while traversing Histogram data store" << 
endmsg;
 
  293     always() << 
"Terminating event processing loop due to a stop scheduled by an incident listener" << 
endmsg;
 
  298   m_incidentSvc->fireIncident( std::make_unique<Incident>( 
name(), IncidentType::BeginEvent, 
ctx ) );
 
  303   m_incidentSvc->fireIncident( std::make_unique<Incident>( 
name(), IncidentType::BeginProcessing, 
ctx ) );
 
  309     fatal() << 
"An event processing slot should be now free in the scheduler, but it appears not to be the case." 
  321   bool       eventfailed = 
false;
 
  324     const unsigned int umaxevt = 
static_cast<unsigned int>( maxevt );
 
  325     m_blackListBS              = std::make_unique<boost::dynamic_bitset<>>( maxevt ); 
 
  334   if ( sc.
isFailure() ) eventfailed = 
true;
 
  369   int finishedEvts = 0;
 
  372   info() << 
"Starting loop on events" << 
endmsg;
 
  374   bool loop_ended = 
false;
 
  376   bool newEvtAllowed = 
false;
 
  378   constexpr 
double oneOver1024 = 1. / 1024.;
 
  381   auto       start_time = Clock::now();
 
  383   while ( !loop_ended && ( maxevt < 0 || ( finishedEvts + skippedEvts ) < maxevt ) ) {
 
  386     if ( ( newEvtAllowed || createdEvts == 0 ) &&  
 
  388          ( createdEvts < maxevt || maxevt < 0 ) && 
 
  394       if ( 1 == createdEvts ) 
 
  395         start_time = Clock::now();
 
  408               && ( createdEvts < maxevt || maxevt < 0 ) ) { 
 
  411           if ( !
ctx.valid() ) {
 
  437       newEvtAllowed = 
true;
 
  440   auto end_time = Clock::now();
 
  442   info() << 
"---> Loop Finished (skipping 1st evt) - " 
  444          << std::chrono::duration_cast<std::chrono::nanoseconds>( end_time - start_time ).count() << 
endmsg;
 
  445   info() << skippedEvts << 
" events were SKIPed" << 
endmsg;
 
  463   if ( !sc.
isSuccess() ) warning() << 
"Error creating IOpaqueAddress." << 
endmsg;
 
  476       info() << 
"No more events in event selection " << 
endmsg;
 
  480     if ( !sc.
isSuccess() ) { warning() << 
"Error declaring event root address." << 
endmsg; }
 
  484     if ( !sc.
isSuccess() ) { warning() << 
"Error declaring event root DataObject" << 
endmsg; }
 
  523   DEBUG_MSG << 
"Context " << ( sc.
isSuccess() ? 
"obtained" : 
"not obtained: a problem in the scheduling?" ) << 
endmsg;
 
  524   finishedEvtContexts.
push_back( finishedEvtContext );
 
  527   while ( 
m_schedulerSvc->tryPopFinishedEvent( finishedEvtContext ).isSuccess() ) {
 
  528     finishedEvtContexts.
push_back( finishedEvtContext );
 
  533   for ( 
auto& thisFinishedEvtContext : finishedEvtContexts ) {
 
  534     if ( !thisFinishedEvtContext ) {
 
  535       error() << 
"Detected nullptr ctxt before clearing WB!" << 
endmsg;
 
  540       ( 
m_abortOnFailure ? fatal() : error() ) << 
"Failed event detected on " << thisFinishedEvtContext << 
endmsg;
 
  550     DEBUG_MSG << 
"Clearing slot " << thisFinishedEvtContext->slot() << 
" (event " << thisFinishedEvtContext->evt()
 
  551               << 
") of the whiteboard" << 
endmsg;
 
  555       error() << 
"Whiteboard slot " << thisFinishedEvtContext->slot() << 
" could not be properly cleared";
 
  557     delete thisFinishedEvtContext;
 
  568   if ( !sc.
isSuccess() ) warning() << 
"Clear of Event data store failed" << 
endmsg;
 
  
 
SmartIF< IProperty > m_appMgrProperty
Property interface of ApplicationMgr.
Gaudi::Property< bool > m_abortOnFailure
bool isRecoverable() const
StatusCode initialize() override
SmartIF< IScheduler > m_schedulerSvc
A shortcut for the scheduler.
Gaudi::Property< std::vector< unsigned int > > m_eventNumberBlacklist
StatusCode reinitialize() override
implementation of IService::reinitialize
StatusCode clearWBSlot(int evtSlot)
Clear a slot in the WB.
void reset(TYPE *ptr=nullptr)
Set the internal pointer to the passed one disposing of the old one.
StatusCode setProperty(const Gaudi::Details::PropertyBase &p)
Set the property from a property.
bool m_endEventFired
Flag to avoid to fire the EnvEvent incident twice in a row (and also not before the first event)
SmartIF< IDataManagerSvc > m_evtDataMgrSvc
Reference to the Event Data Service's IDataManagerSvc interface.
StatusCode finalize() override
implementation of IService::finalize
EventContext createEventContext() override
implementation of IEventProcessor::createEventContext()
EventContext::ContextEvt_t m_nevt
StatusCode stop() override
implementation of IService::stop
SmartIF< IAlgResourcePool > m_algResourcePool
Reference to the Algorithm resource pool.
~HiveSlimEventLoopMgr() override
StatusCode finalize() override
const IDataSelector & selectedObjects() const
Return the set of selected DataObjects.
AttribStringParser::Iterator begin(const AttribStringParser &parser)
const std::string & name() const override
Retrieve name of the service
SmartIF< IDataManagerSvc > m_histoDataMgrSvc
Reference to the Histogram Data Service.
StatusCode setAppReturnCode(SmartIF< IProperty > &appmgr, int value, bool force=false)
Set the application return code.
StatusCode executeRun(int maxevt) override
implementation of IEventProcessor::executeRun()
constexpr int ScheduledStop
SmartIF< IIncidentSvc > m_incidentSvc
Reference to the incident service.
Gaudi::Property< bool > m_warnings
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
bool m_scheduledStop
Scheduled stop of event processing.
const StatusCode & ignore() const
Allow discarding a StatusCode without warning.
StatusCode drainScheduler(int &finishedEvents)
Drain the scheduler from all actions that may be queued.
SmartIF< IFace > as() const
return a new SmartIF instance to another interface
StatusCode stopRun() override
implementation of IEventProcessor::stopRun()
virtual IOpaqueAddress * address() const =0
Retrieve opaque storage address.
SmartIF< IHiveWhiteBoard > m_whiteboard
Reference to the Whiteboard.
StatusCode executeEvent(EventContext &&ctx) override
implementation of IEventProcessor::executeEvent(EventContext&&)
constexpr static const auto SUCCESS
TYPE * get() const
Get interface pointer.
std::unique_ptr< boost::dynamic_bitset<> > m_blackListBS
IEvtSelector::Context * m_evtContext
Event Iterator.
#define DECLARE_COMPONENT(type)
StatusCode nextEvent(int maxevt) override
implementation of IService::nextEvent
SmartIF< IAlgExecStateSvc > m_algExecStateSvc
Reference to the AlgExecStateSvc.
StatusCode declareEventRootAddress()
Declare the root address of the event.
GAUDI_API long mappedMemory(MemoryUnit unit=kByte, InfoType fetch=Memory, long pid=-1)
Basic Process Information: priority boost.
Gaudi::Property< std::string > m_schedulerName
StatusCode getEventRoot(IOpaqueAddress *&refpAddr)
Create event address using event selector.
StatusCode initialize() override
implementation of IService::initialize
constexpr static const auto FAILURE
SmartIF< IConversionSvc > m_histoPersSvc
Reference to the Histogram Persistency Service.
T binary_search(T... args)
Gaudi::Property< std::string > m_evtsel
constexpr static const auto RECOVERABLE
SmartIF< ISvcLocator > & serviceLocator() const override
Retrieve pointer to service locator
SmartIF< IEvtSelector > m_evtSelector
Reference to the Event Selector.