Loading [MathJax]/extensions/tex2jax.js
Go to the documentation of this file.
28 #define ON_DEBUG if ( msgLevel( MSG::DEBUG ) )
29 #define DEBUG_MSG ON_DEBUG debug()
31 #define ON_VERBOSE if ( msgLevel( MSG::VERBOSE ) )
32 #define VERBOSE_MSG ON_VERBOSE verbose()
45 error() <<
"Failed to initialize Service Base class." <<
endmsg;
52 fatal() <<
"Error retrieving IncidentSvc." <<
endmsg;
59 fatal() <<
"Error retrieving EventDataSvc interface IDataManagerSvc." <<
endmsg;
64 fatal() <<
"Error retrieving EventDataSvc interface IHiveWhiteBoard." <<
endmsg;
69 fatal() <<
"Error retrieving SchedulerSvc interface IScheduler." <<
endmsg;
75 fatal() <<
"IProperty interface not found in ApplicationMgr." <<
endmsg;
88 fatal() <<
"Can not create the event selector Context." <<
endmsg;
92 fatal() <<
"EventSelector not found." <<
endmsg;
99 warning() <<
"Unable to locate service \"EventSelector\" " <<
endmsg;
100 warning() <<
"No events will be processed from external input." <<
endmsg;
107 fatal() <<
"Error retrieving HistogramDataSvc." <<
endmsg;
113 warning() <<
"Histograms cannot not be saved - though required." <<
endmsg;
120 fatal() <<
"Error retrieving AlgResourcePool" <<
endmsg;
126 fatal() <<
"Error retrieving AlgExecStateSvc" <<
endmsg;
155 sc = theSvc->reinitialize();
156 if ( !sc.isSuccess() ) {
157 error() <<
"Failure Reinitializing EventSelector " << theSvc->name() <<
endmsg;
161 sc = theSvc->sysInitialize();
162 if ( !sc.isSuccess() ) {
163 error() <<
"Failure Initializing EventSelector " << theSvc->name() <<
endmsg;
168 if ( !sc.isSuccess() ) {
169 error() <<
"Can not create Context " << theSvc->name() <<
endmsg;
179 if ( !sc.isSuccess() ) {
180 error() <<
"Can not create Context " << theSvc->name() <<
endmsg;
216 error() <<
"Problems finalizing Service base class" <<
endmsg;
229 if ( iret.
isSuccess() ) i->registry()->setAddress( pAddr );
230 return s.isFailure() ?
s : iret;
235 return s.isFailure() ?
s : iret;
237 if ( sc.isSuccess() ) {
238 info() <<
"Histograms converted successfully according to request." <<
endmsg;
240 error() <<
"Error while saving Histograms." <<
endmsg;
243 error() <<
"Error while traversing Histogram data store" <<
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();
382 while ( !loop_ended && ( maxevt < 0 || ( finishedEvts + skippedEvts ) < maxevt ) ) {
385 if ( ( newEvtAllowed || createdEvts == 0 ) &&
387 ( createdEvts < maxevt || maxevt < 0 ) &&
391 if ( 1 == createdEvts )
392 start_time = Clock::now();
405 && ( createdEvts < maxevt || maxevt < 0 ) ) {
408 if ( !
ctx.valid() ) {
430 if (
drainScheduler( finishedEvts ).isFailure() ) loop_ended =
true;
431 newEvtAllowed =
true;
434 auto end_time = Clock::now();
436 info() <<
"---> Loop Finished (skipping 1st evt) - "
438 << std::chrono::duration_cast<std::chrono::nanoseconds>( end_time - start_time ).count() <<
endmsg;
439 info() << skippedEvts <<
" events were SKIPed" <<
endmsg;
457 if ( !sc.
isSuccess() ) warning() <<
"Error creating IOpaqueAddress." <<
endmsg;
470 info() <<
"No more events in event selection " <<
endmsg;
474 if ( !sc.
isSuccess() ) { warning() <<
"Error declaring event root address." <<
endmsg; }
478 if ( !sc.
isSuccess() ) { warning() <<
"Error declaring event root DataObject" <<
endmsg; }
517 DEBUG_MSG <<
"Context " << ( sc.
isSuccess() ?
"obtained" :
"not obtained: a problem in the scheduling?" ) <<
endmsg;
518 finishedEvtContexts.
push_back( finishedEvtContext );
521 while (
m_schedulerSvc->tryPopFinishedEvent( finishedEvtContext ).isSuccess() ) {
522 finishedEvtContexts.
push_back( finishedEvtContext );
527 for (
auto& thisFinishedEvtContext : finishedEvtContexts ) {
528 if ( !thisFinishedEvtContext ) {
529 error() <<
"Detected nullptr ctxt before clearing WB!" <<
endmsg;
534 (
m_abortOnFailure ? fatal() : error() ) <<
"Failed event detected on " << thisFinishedEvtContext <<
endmsg;
544 DEBUG_MSG <<
"Clearing slot " << thisFinishedEvtContext->slot() <<
" (event " << thisFinishedEvtContext->evt()
545 <<
") of the whiteboard" <<
endmsg;
549 error() <<
"Whiteboard slot " << thisFinishedEvtContext->slot() <<
" could not be properly cleared";
551 delete thisFinishedEvtContext;
562 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.
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.
double * begin(CLHEP::HepVector &v)
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.