35 #define ON_DEBUG if ( UNLIKELY( outputLevel() <= MSG::DEBUG ) ) 36 #define ON_VERBOSE if ( UNLIKELY( outputLevel() <= MSG::VERBOSE ) ) 38 #define DEBMSG ON_DEBUG debug() 39 #define VERMSG ON_VERBOSE verbose() 45 :
base_class( name, svcLoc ), m_appMgrUI( svcLoc )
74 error() <<
"Failed to initialize Service Base class." <<
endmsg;
81 fatal() <<
"Error retrieving IncidentSvc." <<
endmsg;
88 fatal() <<
"Error retrieving EventDataSvc interface IDataManagerSvc." <<
endmsg;
93 fatal() <<
"Error retrieving EventDataSvc interface IHiveWhiteBoard." <<
endmsg;
98 fatal() <<
"Error retrieving SchedulerSvc interface IScheduler." <<
endmsg;
104 fatal() <<
"IProperty interface not found in ApplicationMgr." <<
endmsg;
117 fatal() <<
"Can not create the event selector Context." <<
endmsg;
128 warning() <<
"Unable to locate service \"EventSelector\" " <<
endmsg;
129 warning() <<
"No events will be processed from external input." <<
endmsg;
136 fatal() <<
"Error retrieving HistogramDataSvc." <<
endmsg;
142 warning() <<
"Histograms cannot not be saved - though required." <<
endmsg;
149 fatal() <<
"Error retrieving AlgResourcePool" <<
endmsg;
155 fatal() <<
"Error retrieving AlgExecStateSvc" <<
endmsg;
185 sc = theSvc->reinitialize();
187 error() <<
"Failure Reinitializing EventSelector " << theSvc->name() <<
endmsg;
193 error() <<
"Failure Initializing EventSelector " << theSvc->name() <<
endmsg;
199 error() <<
"Can not create Context " << theSvc->name() <<
endmsg;
210 error() <<
"Can not create Context " << theSvc->name() <<
endmsg;
248 error() <<
"Problems finalizing Service base class" <<
endmsg;
258 if ( objects->
size() > 0 ) {
259 IDataSelector::iterator i;
260 for ( i = objects->
begin(); i != objects->
end(); i++ ) {
264 ( *i )->registry()->setAddress( pAddr );
269 for ( i = objects->
begin(); i != objects->
end(); i++ ) {
278 info() <<
"Histograms converted successfully according to request." <<
endmsg;
280 error() <<
"Error while saving Histograms." <<
endmsg;
283 error() <<
"Error while traversing Histogram data store" <<
endmsg;
316 int& createdEvts = *( (
int*)createdEvts_IntPtr );
323 verbose() <<
"Event " << createdEvts <<
" on black list" <<
endmsg;
328 verbose() <<
"Event " << createdEvts <<
" on black list" <<
endmsg;
333 fatal() <<
"Impossible to create event context" <<
endmsg;
337 verbose() <<
"Beginning to process event " << createdEvts <<
endmsg;
357 verbose() <<
"Adding event " << evtContext->
evt() <<
", slot " << evtContext->
slot() <<
" to the scheduler" <<
endmsg;
366 fatal() <<
"An event processing slot should be now free in the scheduler, but it appears not to be the case." 380 bool eventfailed =
false;
383 const unsigned int umaxevt =
static_cast<unsigned int>(
maxevt );
392 if ( sc.
isFailure() ) eventfailed =
true;
396 if ( !sc.
isSuccess() ) eventfailed =
true;
399 if ( sc.
isFailure() ) eventfailed =
true;
440 int finishedEvts = 0;
443 info() <<
"Starting loop on events" <<
endmsg;
445 bool loop_ended =
false;
447 bool newEvtAllowed =
false;
449 constexpr
double oneOver1204 = 1. / 1024.;
453 while ( !loop_ended and ( maxevt < 0 or ( finishedEvts + skippedEvts ) < maxevt ) ) {
454 debug() <<
"work loop iteration " << iteration++ <<
endmsg;
456 if ( ( newEvtAllowed or createdEvts == 0 ) &&
458 ( createdEvts < maxevt or maxevt < 0 ) &&
461 if ( 1 == createdEvts )
475 && ( createdEvts < maxevt or maxevt < 0 ) ) {
505 newEvtAllowed =
true;
510 info() <<
"---> Loop Finished (skipping 1st evt) - " 513 info() << skippedEvts <<
" events were SKIPed" <<
endmsg;
553 info() <<
"No more events in event selection " <<
endmsg;
558 warning() <<
"Error declaring event root address." <<
endmsg;
564 warning() <<
"Error declaring event root DataObject" <<
endmsg;
582 warning() <<
"Slot " << evtContext->
slot() <<
" could not be selected for the WhiteBoard" <<
endmsg;
608 debug() <<
"Context not obtained: a problem in the scheduling?" <<
endmsg;
612 finishedEvtContexts.
push_back( finishedEvtContext );
616 finishedEvtContexts.
push_back( finishedEvtContext );
621 for (
auto& thisFinishedEvtContext : finishedEvtContexts ) {
622 if (
nullptr == thisFinishedEvtContext ) {
623 error() <<
"Detected nullptr ctxt before clearing WB!" <<
endmsg;
628 fatal() <<
"Failed event detected on " << thisFinishedEvtContext <<
endmsg;
638 debug() <<
"Clearing slot " << thisFinishedEvtContext->slot() <<
" (event " << thisFinishedEvtContext->evt()
639 <<
") of the whiteboard" <<
endmsg;
643 error() <<
"Whiteboard slot " << thisFinishedEvtContext->slot() <<
" could not be properly cleared";
645 delete thisFinishedEvtContext;
StatusCode clearWBSlot(int evtSlot)
Clear a slot in the WB.
StatusCode initialize() override
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's IDataManagerSvc interface.
The ISvcLocator is the interface implemented by the Service Factory in the Application Manager to loc...
StatusCode declareEventRootAddress()
Declare the root address of the event.
const std::string & name() const override
Retrieve name of the service.
void set(const ContextEvt_t &e=0, const ContextID_t &s=INVALID_CONTEXT_ID)
StatusCode finalize() override
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)
HiveSlimEventLoopMgr(const std::string &nam, ISvcLocator *svcLoc)
Standard Constructor.
StatusCode drainScheduler(int &finishedEvents)
Drain the scheduler from all actions that may be queued.
bool isSuccess() const
Test for a status code of SUCCESS.
HistogramAgent base in charge of collecting all the refereces to DataObjects in a transient store tha...
SmartIF< IHiveWhiteBoard > m_whiteboard
Reference to the Whiteboard.
SmartIF< IScheduler > m_schedulerSvc
A shortcut for the scheduler.
MsgStream & verbose() const
shortcut for the method msgStream(MSG::VERBOSE)
bool m_scheduledStop
Scheduled stop of event processing.
T binary_search(T...args)
Gaudi::Property< std::vector< unsigned int > > m_eventNumberBlacklist
T duration_cast(T...args)
virtual StatusCode getProperty(Gaudi::Details::PropertyBase *p) const =0
Get the property by property.
virtual StatusCode createRep(DataObject *pObject, IOpaqueAddress *&refpAddress)=0
Convert the transient object to the requested representation.
This class represents an entry point to all the event specific data.
SmartIF< IProperty > m_appMgrProperty
Property interface of ApplicationMgr.
bool isFailure() const
Test for a status code of FAILURE.
constexpr int ScheduledStop
TYPE * get() const
Get interface pointer.
virtual StatusCode sysInitialize()=0
Initialize Service.
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.
StatusCode finalize() override
implementation of IService::finalize
MsgStream & error() const
shortcut for the method msgStream(MSG::ERROR)
StatusCode stopRun() override
implementation of IEventProcessor::stopRun()
virtual StatusCode selectStore(size_t partitionIndex)=0
Activate an given 'slot' for all subsequent calls within the same thread id.
virtual void fireIncident(const Incident &incident)=0
Fire an Incident.
~HiveSlimEventLoopMgr() override
Standard Destructor.
MsgStream & warning() const
shortcut for the method msgStream(MSG::WARNING)
virtual StatusCode clearStore(size_t partitionIndex)=0
Clear an given 'slot'.
virtual StatusCode traverseTree(IDataStoreAgent *pAgent)=0
Analyse by traversing all data objects in the data store.
virtual StatusCode endRun()=0
End Run.
This class is used for returning status codes from appropriate routines.
StatusCode executeRun(int maxevt) override
implementation of IEventProcessor::executeRun()
StatusCode createEventContext(EventContext *&eventContext, int createdEvents)
Create event context.
The IRegistry represents the entry door to the environment any data object residing in a transient da...
virtual StatusCode pushNewEvent(EventContext *eventContext)=0
Make an event available to the scheduler.
#define DECLARE_SERVICE_FACTORY(x)
StatusCode getEventRoot(IOpaqueAddress *&refpAddr)
Create event address using event selector.
bool isRecoverable() const
virtual StatusCode releaseContext(Context *&) const =0
Release the Context object.
std::chrono::high_resolution_clock Clock
IDataSelector * selectedObjects()
Return the set of selected DataObjects.
StatusCode setAppReturnCode(SmartIF< IProperty > &appmgr, int value, bool force=false)
Set the application return code.
virtual StatusCode setRoot(std::string root_name, DataObject *pObject)=0
Initialize data store for new event by giving new event path.
virtual void reset(const EventContext &ctx)=0
GAUDI_API long mappedMemory(MemoryUnit unit=kByte, InfoType fetch=Memory, long pid=-1)
Basic Process Information: priority boost.
StatusCode initialize() override
implementation of IService::initialize
virtual StatusCode beginRun()=0
Begin Run.
SmartIF< IAlgExecStateSvc > m_algExecStateSvc
Reference to the AlgExecStateSvc.
MsgStream & debug() const
shortcut for the method msgStream(MSG::DEBUG)
SmartIF< IConversionSvc > m_histoPersSvc
Reference to the Histogram Persistency Service.
virtual size_t allocateStore(int evtnumber)=0
Allocate a store partition for new event.
Gaudi::Property< std::string > m_schedulerName
bool isValid() const
Allow for check if smart pointer is valid.
Clock::time_point time_point
virtual StatusCode tryPopFinishedEvent(EventContext *&eventContext)=0
Try to retrieve a finished event from the scheduler.
Base class for all Incidents (computing events).
virtual const EventStatus::Status & eventStatus(const EventContext &ctx) const =0
SmartIF< IDataManagerSvc > m_histoDataMgrSvc
Reference to the Histogram Data Service.
SmartIF< IEvtSelector > m_evtSelector
Reference to the Event Selector.
virtual StatusCode freeStore(size_t partitionIndex)=0
Free a store partition.
StatusCode reinitialize() override
implementation of IService::reinitialize
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...
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.
virtual StatusCode createContext(Context *&c) const =0
Create and return a context object that will keep track of the state of selection.
void reset(TYPE *ptr=nullptr)
Set the internal pointer to the passed one disposing of the old one.
virtual StatusCode createAddress(const Context &c, IOpaqueAddress *&iop) const =0
Create an IOpaqueAddress object from the event fetched.
Opaque address interface definition.
MsgStream & fatal() const
shortcut for the method msgStream(MSG::FATAL)
SmartIF< IAlgResourcePool > m_algResourcePool
Reference to the Algorithm resource pool.
StatusCode executeEvent(void *par) override
implementation of IEventProcessor::executeEvent(void* par)
virtual IOpaqueAddress * address() const =0
Retrieve opaque storage address.
virtual StatusCode fillRepRefs(IOpaqueAddress *pAddress, DataObject *pObject)=0
Resolve the references of the converted object.
StatusCode nextEvent(int maxevt) override
implementation of IService::nextEvent
virtual unsigned int freeSlots()=0
Get the free event processing slots.
SmartIF< ISvcLocator > & serviceLocator() const override
Retrieve pointer to service locator.
virtual StatusCode popFinishedEvent(EventContext *&eventContext)=0
Retrieve a finished event from the scheduler.
bool m_endEventFired
Flag to avoid to fire the EnvEvent incident twice in a row (and also not before the first event) ...
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
boost::dynamic_bitset * m_blackListBS
StatusCode stop() override
implementation of IService::stop
IEvtSelector::Context * m_evtContext
Event Iterator.