45 "Name of the scheduler to be used" };
93 using extends::extends;
122#define ON_DEBUG if ( msgLevel( MSG::DEBUG ) )
123#define DEBUG_MSG ON_DEBUG debug()
125#define ON_VERBOSE if ( msgLevel( MSG::VERBOSE ) )
126#define VERBOSE_MSG ON_VERBOSE verbose()
139 error() <<
"Failed to initialize Service Base class." <<
endmsg;
146 fatal() <<
"Error retrieving IncidentSvc." <<
endmsg;
153 fatal() <<
"Error retrieving EventDataSvc interface IDataManagerSvc." <<
endmsg;
158 fatal() <<
"Error retrieving EventDataSvc interface IHiveWhiteBoard." <<
endmsg;
163 fatal() <<
"Error retrieving SchedulerSvc interface IScheduler." <<
endmsg;
169 fatal() <<
"IProperty interface not found in ApplicationMgr." <<
endmsg;
182 fatal() <<
"Can not create the event selector Context." <<
endmsg;
192 info() <<
"\"EventSelector\" disabled: no events will be processed from external input." <<
endmsg;
200 fatal() <<
"Error retrieving HistogramDataSvc." <<
endmsg;
211 fatal() <<
"Error retrieving AlgResourcePool" <<
endmsg;
217 fatal() <<
"Error retrieving AlgExecStateSvc" <<
endmsg;
246 sc = theSvc->reinitialize();
247 if ( !sc.isSuccess() ) {
248 error() <<
"Failure Reinitializing EventSelector " << theSvc->name() <<
endmsg;
252 sc = theSvc->sysInitialize();
253 if ( !sc.isSuccess() ) {
254 error() <<
"Failure Initializing EventSelector " << theSvc->name() <<
endmsg;
259 if ( !sc.isSuccess() ) {
260 error() <<
"Can not create Context " << theSvc->name() <<
endmsg;
270 if ( !sc.isSuccess() ) {
271 error() <<
"Can not create Context " << theSvc->name() <<
endmsg;
307 error() <<
"Problems finalizing Service base class" <<
endmsg;
320 if ( iret.
isSuccess() ) i->registry()->setAddress( pAddr );
321 return s.isFailure() ? s : iret;
326 return s.isFailure() ? s : iret;
328 if ( sc.isSuccess() ) {
329 info() <<
"Histograms converted successfully according to request." <<
endmsg;
331 error() <<
"Error while saving Histograms." <<
endmsg;
334 error() <<
"Error while traversing Histogram data store" <<
endmsg;
383 always() <<
"Terminating event processing loop due to a stop scheduled by an incident listener" <<
endmsg;
391 VERBOSE_MSG <<
"Adding event " << ctx.evt() <<
", slot " << ctx.slot() <<
" to the scheduler" <<
endmsg;
399 fatal() <<
"An event processing slot should be now free in the scheduler, but it appears not to be the case."
411 bool eventfailed =
false;
414 const unsigned int umaxevt =
static_cast<unsigned int>( maxevt );
424 if ( sc.
isFailure() ) eventfailed =
true;
459 int finishedEvts = 0;
462 info() <<
"Starting loop on events" <<
endmsg;
464 bool loop_ended =
false;
466 bool newEvtAllowed =
false;
468 constexpr double oneOver1024 = 1. / 1024.;
471 auto start_time = Clock::now();
473 while ( !loop_ended && ( maxevt < 0 || ( finishedEvts + skippedEvts ) < maxevt ) ) {
476 if ( ( newEvtAllowed || createdEvts == 0 ) &&
478 ( createdEvts < maxevt || maxevt < 0 ) &&
485 if ( 1 == createdEvts )
486 start_time = Clock::now();
499 && ( createdEvts < maxevt || maxevt < 0 ) ) {
502 if ( !ctx.valid() ) {
528 newEvtAllowed =
true;
531 auto end_time = Clock::now();
533 info() <<
"---> Loop Finished (skipping 1st evt) - "
536 info() << skippedEvts <<
" events were SKIPed" <<
endmsg;
567 info() <<
"No more events in event selection " <<
endmsg;
588 throw GaudiException(
"Slot " + std::to_string( ctx.slot() ) +
" could not be selected for the WhiteBoard",
name(),
614 DEBUG_MSG <<
"Context " << ( sc.
isSuccess() ?
"obtained" :
"not obtained: a problem in the scheduling?" ) <<
endmsg;
615 finishedEvtContexts.
push_back( finishedEvtContext );
619 finishedEvtContexts.
push_back( finishedEvtContext );
624 for (
auto& thisFinishedEvtContext : finishedEvtContexts ) {
625 if ( !thisFinishedEvtContext ) {
626 error() <<
"Detected nullptr ctxt before clearing WB!" <<
endmsg;
641 DEBUG_MSG <<
"Clearing slot " << thisFinishedEvtContext->slot() <<
" (event " << thisFinishedEvtContext->evt()
642 <<
") of the whiteboard" <<
endmsg;
646 error() <<
"Whiteboard slot " << thisFinishedEvtContext->slot() <<
" could not be properly cleared";
648 delete thisFinishedEvtContext;
std::vector< DataObject * > IDataSelector
This is only a placeholder to allow me compiling until the responsible guy does his work!
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
#define DECLARE_COMPONENT(type)
system_clock high_resolution_clock
constexpr __enable_if_is_duration< _ToDur > duration_cast(const duration< _Rep, _Period > &__d)
constexpr _OI move(_II __first, _II __last, _OI __result)
constexpr void sort(_RandomAccessIterator __first, _RandomAccessIterator __last)
constexpr bool binary_search(_ForwardIterator __first, _ForwardIterator __last, const _Tp &__val)
constexpr _Tp accumulate(_InputIterator __first, _InputIterator __last, _Tp __init)
constexpr auto begin(_Container &__cont) -> decltype(__cont.begin())
constexpr auto end(_Container &__cont) -> decltype(__cont.end())
constexpr void push_back(const value_type &__x)
constexpr void assign(_InputIterator __first, _InputIterator __last)
constexpr reference at(size_type __n)
constexpr bool empty() const noexcept
constexpr void clear() noexcept
MsgStream & error() const
shortcut for the method msgStream(MSG::ERROR)
MsgStream & warning() const
shortcut for the method msgStream(MSG::WARNING)
MsgStream & fatal() const
shortcut for the method msgStream(MSG::FATAL)
MsgStream & info() const
shortcut for the method msgStream(MSG::INFO)
MsgStream & always() const
shortcut for the method msgStream(MSG::ALWAYS)
DataObject()
Standard Constructor.
This class represents an entry point to all the event specific data.
Implementation of property with value of concrete type.
GaudiException(std::string Message, std::string Tag, StatusCode Code)
Constructor (1).
HistogramAgent base in charge of collecting all the references to DataObjects in a transient store th...
const IDataSelector & selectedObjects() const
Return the set of selected DataObjects.
EventContext::ContextEvt_t m_nevt
SmartIF< IScheduler > m_schedulerSvc
A shortcut for the scheduler.
StatusCode stopRun() override
implementation of IEventProcessor::stopRun()
std::vector< uint8_t > m_blackList
Gaudi::Property< bool > m_abortOnFailure
StatusCode getEventRoot(IOpaqueAddress *&refpAddr)
Create event address using event selector.
Gaudi::Property< std::string > m_histPersName
StatusCode executeRun(int maxevt) override
implementation of IEventProcessor::executeRun()
SmartIF< IDataManagerSvc > m_evtDataMgrSvc
Reference to the Event Data Service's IDataManagerSvc interface.
StatusCode stop() override
implementation of IService::stop
StatusCode initialize() override
implementation of IService::initialize
StatusCode drainScheduler(int &finishedEvents)
Drain the scheduler from all actions that may be queued.
StatusCode nextEvent(int maxevt) override
implementation of IService::nextEvent
StatusCode reinitialize() override
implementation of IService::reinitialize
StatusCode executeEvent(EventContext &&ctx) override
implementation of IEventProcessor::executeEvent(EventContext&&)
Gaudi::Property< std::string > m_schedulerName
~HiveSlimEventLoopMgr() override
SmartIF< IConversionSvc > m_histoPersSvc
Reference to the Histogram Persistency Service.
SmartIF< IIncidentSvc > m_incidentSvc
Reference to the incident service.
SmartIF< IEvtSelector > m_evtSelector
Reference to the Event Selector.
bool m_endEventFired
Flag to avoid to fire the EnvEvent incident twice in a row (and also not before the first event).
StatusCode clearWBSlot(int evtSlot)
Clear a slot in the WB.
Gaudi::Property< std::vector< unsigned int > > m_eventNumberBlacklist
SmartIF< IHiveWhiteBoard > m_whiteboard
Reference to the Whiteboard.
SmartIF< IProperty > m_appMgrProperty
Property interface of ApplicationMgr.
SmartIF< IAlgResourcePool > m_algResourcePool
Reference to the Algorithm resource pool.
StatusCode declareEventRootAddress()
Declare the root address of the event.
SmartIF< IDataManagerSvc > m_histoDataMgrSvc
Reference to the Histogram Data Service.
IEvtSelector::Context * m_evtContext
Event Iterator.
bool m_scheduledStop
Scheduled stop of event processing.
StatusCode finalize() override
implementation of IService::finalize
SmartIF< IAlgExecStateSvc > m_algExecStateSvc
Reference to the AlgExecStateSvc.
SmartIF< IIncidentListener > m_abortEventListener
Instance of the incident listener waiting for AbortEvent.
Gaudi::Property< std::string > m_evtsel
EventContext createEventContext() override
implementation of IEventProcessor::createEventContext()
virtual const EventStatus::Status & eventStatus(const EventContext &ctx) const =0
virtual void reset(const EventContext &ctx)=0
reset all states for the given EventContext
virtual StatusCode createRep(DataObject *pObject, IOpaqueAddress *&refpAddress)=0
Convert the transient object to the requested representation.
virtual StatusCode fillRepRefs(IOpaqueAddress *pAddress, DataObject *pObject)=0
Resolve the references of the converted object.
The Event Selector Interface.
virtual StatusCode releaseContext(Context *&) const =0
Release the Context object.
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.
virtual StatusCode createContext(Context *&c) const =0
Create and return a context object that will keep track of the state of selection.
virtual StatusCode freeStore(size_t partitionIndex)=0
Free a store partition.
virtual size_t allocateStore(int evtnumber)=0
Allocate a store partition for new event.
virtual size_t freeSlots()=0
Get free slots number.
virtual StatusCode clearStore(size_t partitionIndex)=0
Clear an given 'slot'.
virtual StatusCode selectStore(size_t partitionIndex)=0
Activate an given 'slot' for all subsequent calls within the same thread id.
virtual size_t getNumberOfStores() const =0
Get the number of 'slots'.
virtual void fireIncident(const Incident &incident)=0
Fire an Incident.
Opaque address interface definition.
The IProperty is the basic interface for all components which have properties that can be set or get.
virtual StatusCode getProperty(Gaudi::Details::PropertyBase *p) const =0
Get the property by property.
The IRegistry represents the entry door to the environment any data object residing in a transient da...
virtual IOpaqueAddress * address() const =0
Retrieve opaque storage address.
virtual unsigned int freeSlots()=0
Get the free event processing slots.
virtual StatusCode pushNewEvent(EventContext *eventContext)=0
Make an event available to the scheduler.
virtual StatusCode popFinishedEvent(EventContext *&eventContext)=0
Retrieve a finished event from the scheduler.
virtual StatusCode tryPopFinishedEvent(EventContext *&eventContext)=0
Try to retrieve a finished event from the scheduler.
virtual SmartIF< IService > & service(const Gaudi::Utils::TypeNameString &typeName, const bool createIf=true)=0
Returns a smart pointer to a service.
Incident(const std::string &source, const std::string &type)
Default Constructor.
StatusCode setProperty(const Gaudi::Details::PropertyBase &p)
SmartIF< ISvcLocator > & serviceLocator() const override
Retrieve pointer to service locator.
StatusCode finalize() override
const std::string & name() const override
Retrieve name of the service.
StatusCode initialize() override
Small smart pointer class with automatic reference counting for IInterface.
TYPE * get() const
Get interface pointer.
SmartIF< IFace > as() const
return a new SmartIF instance to another interface
void reset(TYPE *ptr=nullptr)
Set the internal pointer to the passed one disposing of the old one.
This class is used for returning status codes from appropriate routines.
constexpr static const auto RECOVERABLE
void ignore() const
Allow discarding a StatusCode without warning.
bool isRecoverable() const
constexpr static const auto SUCCESS
constexpr static const auto FAILURE
Base class used to extend a class implementing other interfaces.
constexpr int ScheduledStop
StatusCode setAppReturnCode(SmartIF< IProperty > &appmgr, int value, bool force=false)
Set the application return code.
GAUDI_API long mappedMemory(MemoryUnit unit=kByte, InfoType fetch=Memory, long pid=-1)
Basic Process Information: priority boost.
virtual StatusCode setRoot(std::string root_name, DataObject *pObject)=0
Initialize data store for new event by giving new event path.
virtual StatusCode traverseTree(IDataStoreAgent *pAgent)=0
Analyse by traversing all data objects in the data store.