1 #define GAUDISVC_EVENTLOOPMGR_CPP
3 #include "GaudiKernel/Incident.h"
4 #include "GaudiKernel/MsgStream.h"
5 #include "GaudiKernel/DataObject.h"
6 #include "GaudiKernel/IIncidentSvc.h"
7 #include "GaudiKernel/IEvtSelector.h"
8 #include "GaudiKernel/IDataManagerSvc.h"
9 #include "GaudiKernel/IDataProviderSvc.h"
10 #include "GaudiKernel/IConversionSvc.h"
11 #include "GaudiKernel/AppReturnCode.h"
23 #define ON_DEBUG if (UNLIKELY(outputLevel() <= MSG::DEBUG))
24 #define ON_VERBOSE if (UNLIKELY(outputLevel() <= MSG::VERBOSE))
26 #define DEBMSG ON_DEBUG debug()
27 #define VERMSG ON_VERBOSE verbose()
37 declareProperty(
"EvtSel",
m_evtsel );
39 "Set this property to false to suppress warning messages");
56 DEBMSG <<
"Error Initializing base class MinimalEventLoopMgr." <<
endmsg;
63 fatal() <<
"Error retrieving EventDataSvc interface IDataManagerSvc." <<
endmsg;
66 m_evtDataSvc = serviceLocator()->service(
"EventDataSvc");
68 fatal() <<
"Error retrieving EventDataSvc interface IDataProviderSvc." <<
endmsg;
75 fatal() <<
"IProperty interface not found in ApplicationMgr." <<
endmsg;
88 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;
112 m_histoPersSvc = serviceLocator()->service(
"HistogramPersistencySvc");
114 warning() <<
"Histograms cannot not be saved - though required." <<
endmsg;
128 DEBMSG <<
"Error Initializing base class MinimalEventLoopMgr." <<
endmsg;
135 auto theSvc = serviceLocator()->service<
IService>(
"EventSelector");
146 sc = theSvc->reinitialize();
148 error() <<
"Failure Reinitializing EventSelector "
149 << theSvc->name( ) <<
endmsg;
153 sc = theSvc->sysInitialize();
155 error() <<
"Failure Initializing EventSelector "
156 << theSvc->name( ) <<
endmsg;
162 error() <<
"Can not create Context " << theSvc->name( ) <<
endmsg;
165 info() <<
"EventSelector service changed to "
166 << theSvc->name( ) <<
endmsg;
175 error() <<
"Can not create Context " << theSvc->name( ) <<
endmsg;
210 error() <<
"Error finalizing base class" <<
endmsg;
221 if ( objects->size() > 0 ) {
222 for (
auto&
i : *objects ) {
226 i->registry()->setAddress(pAddr);
232 for (
auto&
i : *objects ) {
239 info() <<
"Histograms converted successfully according to request." <<
endmsg;
242 error() <<
"Error while saving Histograms." <<
endmsg;
246 error() <<
"Error while traversing Histogram data store" <<
endmsg;
280 always() <<
"Terminating event processing loop due to a stop scheduled by an incident listener" <<
endmsg;
291 error() <<
"Terminating event processing loop due to errors" <<
endmsg;
300 #include "GaudiKernel/Memory.h"
305 typedef std::chrono::high_resolution_clock
Clock;
308 const float oneOver1024 = 1.f/1024.f;
311 static int total_nevt = 0;
317 time_point start_time = Clock::now();
318 for(
int nevt = 0; maxevt == -1 ||
nevt < maxevt; ++
nevt, ++total_nevt) {
321 start_time = Clock::now();
331 always() <<
"Terminating event processing loop due to scheduled stop" <<
endmsg;
335 if( 0 != total_nevt ) {
354 info() <<
"No more events in event selection " <<
endmsg;
360 warning() <<
"Error declaring event root address." <<
endmsg;
365 warning() <<
"Unable to retrieve Event root object" <<
endmsg;
371 warning() <<
"Error declaring event root DataObject" <<
endmsg;
378 error() <<
"Terminating event processing loop due to errors" <<
endmsg;
383 time_point end_time = Clock::now();
386 debug() <<
"---> Loop Finished - "
388 <<
" | total time (skipping 1st evt) "
389 << std::chrono::duration_cast < std::chrono::nanoseconds > (end_time - start_time).count()
407 warning() <<
"Error creating IOpaqueAddress." <<
endmsg;
SmartIF< IIncidentSvc > m_incidentSvc
Reference to the incident service.
The ISvcLocator is the interface implemented by the Service Factory in the Application Manager to loc...
virtual StatusCode getProperty(Property *p) const =0
Get the property by property.
StatusCode finalize() override
implementation of IService::finalize
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
StatusCode finalize() override
implementation of IService::finalize
bool m_scheduledStop
Scheduled stop of event processing.
SmartIF< IConversionSvc > m_histoPersSvc
Reference to the Histogram Persistency Service.
The Event Selector Interface.
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...
Clock::time_point time_point
std::string m_histPersName
Name of the Hist Pers type.
StatusCode initialize() override
implementation of IService::initialize
StatusCode reinitialize() override
implementation of IService::reinitialize
virtual StatusCode createRep(DataObject *pObject, IOpaqueAddress *&refpAddress)=0
Convert the transient object to the requested representation.
std::vector< DataObject * > IDataSelector
This is only a placeholder to allow me compiling until the responsible guy does his work! M...
Class definition of EventLoopMgr.
GAUDI_API long mappedMemory(MemoryUnit unit=kByte, InfoType fetch=Memory, long pid=-1)
Basic Process Information: priority boost.
StatusCode reinitialize() override
implementation of IService::reinitialize
StatusCode stop() override
implementation of IService::stop
TYPE * get() const
Get interface pointer.
virtual void fireIncident(const Incident &incident)=0
Fire an Incident.
bool m_warnings
Flag to disable warning messages when using external input.
virtual StatusCode traverseTree(IDataStoreAgent *pAgent)=0
Analyse by traversing all data objects in the data store.
StatusCode executeEvent(void *par) override
implementation of IEventProcessor::executeEvent(void* par)
StatusCode nextEvent(int maxevt) override
implementation of IService::nextEvent
General service interface definition.
This class is used for returning status codes from appropriate routines.
#define DECLARE_COMPONENT(type)
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.
StatusCode getEventRoot(IOpaqueAddress *&refpAddr)
Create event address using event selector.
bool PyHelper() setProperty(IInterface *p, char *name, char *value)
virtual StatusCode releaseContext(Context *&) const =0
Release the Context object.
The IRegistry represents the entry door to the environment any data object residing in a transient da...
IDataSelector * selectedObjects()
Return the set of selected DataObjects.
StatusCode setAppReturnCode(SmartIF< IProperty > &appmgr, int value, bool force=false)
Set the application return code.
virtual IOpaqueAddress * address() const =0
Retrieve opaque storage address.
virtual StatusCode setRoot(std::string root_name, DataObject *pObject)=0
Initialize data store for new event by giving new event path.
EventLoopMgr(const std::string &nam, ISvcLocator *svcLoc)
Standard Constructor.
SmartIF< IDataManagerSvc > m_evtDataMgrSvc
Reference to the Event Data Service's IDataManagerSvc interface.
StatusCode initialize() override
implementation of IService::initialize
SmartIF< IProperty > m_appMgrProperty
Property interface of ApplicationMgr.
IEvtSelector::Context * m_evtContext
Event Iterator.
SmartIF< IEvtSelector > m_evtSelector
Reference to the Event Selector.
StatusCode stop() override
implementation of IService::stop
Base class for all Incidents (computing events).
constexpr int AlgorithmFailure
virtual StatusCode clearStore()=0
Remove all data objects in the data store.
bool m_endEventFired
Flag to avoid to fire the EnvEvent incident twice in a row (and also not before the first event) ...
SmartIF< IDataProviderSvc > m_evtDataSvc
Reference to the Event Data Service's IDataProviderSvc interface.
This is the default processing manager of the application manager.
~EventLoopMgr() override
Standard Destructor.
std::chrono::high_resolution_clock Clock
Opaque address interface definition.
std::string m_evtsel
Event selector.
virtual StatusCode createAddress(const Context &c, IOpaqueAddress *&iop) const =0
Create an IOpaqueAddress object from the event fetched.
A DataObject is the base class of any identifiable object on any data store.
virtual StatusCode fillRepRefs(IOpaqueAddress *pAddress, DataObject *pObject)=0
Resolve the references of the converted object.
StatusCode executeEvent(void *par) override
implementation of IEventProcessor::executeEvent(void* par)
SmartIF< IDataManagerSvc > m_histoDataMgrSvc
Reference to the Histogram Data Service.
virtual StatusCode retrieveObject(IRegistry *pDirectory, const std::string &path, DataObject *&pObject)=0
Retrieve object identified by its directory entry.