18 #define ON_DEBUG if ( msgLevel( MSG::DEBUG ) ) 19 #define DEBUG_MSG ON_DEBUG debug() 21 #define ON_VERBOSE if ( msgLevel( MSG::VERBOSE ) ) 22 #define VERBOSE_MSG ON_VERBOSE verbose() 28 :
base_class( name, svcLoc ), m_appMgrUI( svcLoc ) {}
51 error() <<
"Failed to initialize Service Base class." <<
endmsg;
58 fatal() <<
"Error retrieving IncidentSvc." <<
endmsg;
65 fatal() <<
"Error retrieving EventDataSvc interface IDataManagerSvc." <<
endmsg;
70 fatal() <<
"Error retrieving EventDataSvc interface IHiveWhiteBoard." <<
endmsg;
75 fatal() <<
"Error retrieving SchedulerSvc interface IScheduler." <<
endmsg;
81 fatal() <<
"IProperty interface not found in ApplicationMgr." <<
endmsg;
94 fatal() <<
"Can not create the event selector Context." <<
endmsg;
105 warning() <<
"Unable to locate service \"EventSelector\" " <<
endmsg;
106 warning() <<
"No events will be processed from external input." <<
endmsg;
113 fatal() <<
"Error retrieving HistogramDataSvc." <<
endmsg;
119 warning() <<
"Histograms cannot not be saved - though required." <<
endmsg;
126 fatal() <<
"Error retrieving AlgResourcePool" <<
endmsg;
132 fatal() <<
"Error retrieving AlgExecStateSvc" <<
endmsg;
161 sc = theSvc->reinitialize();
162 if ( !sc.isSuccess() ) {
163 error() <<
"Failure Reinitializing EventSelector " << theSvc->name() <<
endmsg;
167 sc = theSvc->sysInitialize();
168 if ( !sc.isSuccess() ) {
169 error() <<
"Failure Initializing EventSelector " << theSvc->name() <<
endmsg;
174 if ( !sc.isSuccess() ) {
175 error() <<
"Can not create Context " << theSvc->name() <<
endmsg;
185 if ( !sc.isSuccess() ) {
186 error() <<
"Can not create Context " << theSvc->name() <<
endmsg;
222 error() <<
"Problems finalizing Service base class" <<
endmsg;
235 if ( iret.
isSuccess() ) i->registry()->setAddress( pAddr );
243 if ( sc.isSuccess() ) {
244 info() <<
"Histograms converted successfully according to request." <<
endmsg;
246 error() <<
"Error while saving Histograms." <<
endmsg;
249 error() <<
"Error while traversing Histogram data store" <<
endmsg;
281 int& createdEvts = *( (
int*)createdEvts_IntPtr );
298 fatal() <<
"Impossible to create event context" <<
endmsg;
321 VERBOSE_MSG <<
"Adding event " << evtContext->
evt() <<
", slot " << evtContext->
slot() <<
" to the scheduler" 330 fatal() <<
"An event processing slot should be now free in the scheduler, but it appears not to be the case." 343 bool eventfailed =
false;
346 const unsigned int umaxevt =
static_cast<unsigned int>(
maxevt );
356 if ( sc.
isFailure() ) eventfailed =
true;
391 int finishedEvts = 0;
394 info() <<
"Starting loop on events" <<
endmsg;
396 bool loop_ended =
false;
398 bool newEvtAllowed =
false;
400 constexpr
double oneOver1024 = 1. / 1024.;
403 auto start_time = Clock::now();
404 while ( !loop_ended && ( maxevt < 0 || ( finishedEvts + skippedEvts ) < maxevt ) ) {
407 if ( ( newEvtAllowed || createdEvts == 0 ) &&
409 ( createdEvts < maxevt || maxevt < 0 ) &&
413 if ( 1 == createdEvts )
414 start_time = Clock::now();
427 && ( createdEvts < maxevt || maxevt < 0 ) ) {
455 newEvtAllowed =
true;
458 auto end_time = Clock::now();
460 info() <<
"---> Loop Finished (skipping 1st evt) - " 463 info() << skippedEvts <<
" events were SKIPed" <<
endmsg;
494 info() <<
"No more events in event selection " <<
endmsg;
515 warning() <<
"Slot " << evtContext->
slot() <<
" could not be selected for the WhiteBoard" <<
endmsg;
536 DEBUG_MSG <<
"Context " << ( sc.
isSuccess() ?
"obtained" :
"not obtained: a problem in the scheduling?" ) << endmsg;
537 finishedEvtContexts.
push_back( finishedEvtContext );
541 finishedEvtContexts.
push_back( finishedEvtContext );
546 for (
auto& thisFinishedEvtContext : finishedEvtContexts ) {
547 if ( !thisFinishedEvtContext ) {
548 error() <<
"Detected nullptr ctxt before clearing WB!" <<
endmsg;
563 DEBUG_MSG <<
"Clearing slot " << thisFinishedEvtContext->slot() <<
" (event " << thisFinishedEvtContext->evt()
564 <<
") of the whiteboard" <<
endmsg;
568 error() <<
"Whiteboard slot " << thisFinishedEvtContext->slot() <<
" could not be properly cleared";
570 delete thisFinishedEvtContext;
virtual StatusCode traverseTree(IDataStoreAgent *pAgent)=0
Analyse by traversing all data objects in the data store.
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.
std::unique_ptr< boost::dynamic_bitset<> > m_blackListBS
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.
Gaudi::Property< bool > m_abortOnFailure
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.
The Event Selector Interface.
HistogramAgent base in charge of collecting all the references to DataObjects in a transient store th...
SmartIF< IHiveWhiteBoard > m_whiteboard
Reference to the Whiteboard.
virtual StatusCode setRoot(std::string root_name, DataObject *pObject)=0
Initialize data store for new event by giving new event path.
SmartIF< IScheduler > m_schedulerSvc
A shortcut for the scheduler.
constexpr static const auto RECOVERABLE
bool m_scheduledStop
Scheduled stop of event processing.
T binary_search(T...args)
constexpr static const auto SUCCESS
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.
virtual size_t freeSlots()=0
Get free slots number.
This class represents an entry point to all the event specific data.
SmartIF< IProperty > m_appMgrProperty
Property interface of ApplicationMgr.
constexpr int ScheduledStop
#define DECLARE_COMPONENT(type)
TYPE * get() const
Get interface pointer.
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'.
This class is used for returning status codes from appropriate routines.
StatusCode executeRun(int maxevt) override
implementation of IEventProcessor::executeRun()
The IRegistry represents the entry door to the environment any data object residing in a transient da...
const IDataSelector & selectedObjects() const
Return the set of selected DataObjects.
virtual StatusCode pushNewEvent(EventContext *eventContext)=0
Make an event available to the scheduler.
StatusCode getEventRoot(IOpaqueAddress *&refpAddr)
Create event address using event selector.
bool isRecoverable() const
virtual StatusCode releaseContext(Context *&) const =0
Release the Context object.
StatusCode setAppReturnCode(SmartIF< IProperty > &appmgr, int value, bool force=false)
Set the application return code.
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 createEventContext(std::unique_ptr< EventContext > &eventContext, int createdEvents)
Create event context.
StatusCode initialize() override
implementation of IService::initialize
SmartIF< IAlgExecStateSvc > m_algExecStateSvc
Reference to the AlgExecStateSvc.
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
const StatusCode & ignore() const
Ignore/check StatusCode.
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.
constexpr static const auto FAILURE
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...
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.
AttribStringParser::Iterator begin(const AttribStringParser &parser)
Opaque address interface definition.
MsgStream & fatal() const
shortcut for the method msgStream(MSG::FATAL)
The IProperty is the basic interface for all components which have properties that can be set or get...
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.
StatusCode stop() override
implementation of IService::stop
IEvtSelector::Context * m_evtContext
Event Iterator.