| The Gaudi Framework v27r1

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

Public Member Functions | Protected Attributes | List of all members
EventLoopMgr Class Reference

Class definition of EventLoopMgr. More...

`#include <src/ApplicationMgr/EventLoopMgr.h>`

Inheritance diagram for EventLoopMgr:
[legend]
Collaboration diagram for EventLoopMgr:
[legend]

## Public Member Functions
| EventLoopMgr (const std::string &nam, ISvcLocator *svcLoc)
| Standard Constructor. More...
| ~EventLoopMgr () override
| Standard Destructor. More...
StatusCode | getEventRoot (IOpaqueAddress *&refpAddr)
| Create event address using event selector. More...
StatusCode | initialize () override
| implementation of IService::initialize More...
StatusCode | reinitialize () override
| implementation of IService::reinitialize More...
StatusCode | stop () override
| implementation of IService::stop More...
StatusCode | finalize () override
| implementation of IService::finalize More...
StatusCode | nextEvent (int maxevt) override
| implementation of IService::nextEvent More...
StatusCode | executeEvent (void *par) override
| implementation of IEventProcessor::executeEvent(void* par) More...
Public Member Functions inherited from MinimalEventLoopMgr
| MinimalEventLoopMgr (const std::string &nam, ISvcLocator *svcLoc)
| Standard Constructor. More...
| ~MinimalEventLoopMgr () override=default
| Standard Destructor. More...
StatusCode | initialize () override
| implementation of IService::initialize More...
StatusCode | start () override
| implementation of IService::start More...
StatusCode | stop () override
| implementation of IService::stop More...
StatusCode | finalize () override
| implementation of IService::finalize More...
StatusCode | reinitialize () override
| implementation of IService::reinitialize More...
StatusCode | restart () override
| implementation of IService::restart More...
StatusCode | nextEvent (int maxevt) override
| implementation of IEventProcessor::nextEvent More...
StatusCode | executeEvent (void *par) override
| implementation of IEventProcessor::executeEvent(void* par) More...
StatusCode | executeRun (int maxevt) override
| implementation of IEventProcessor::executeRun( ) More...
StatusCode | stopRun () override
| implementation of IEventProcessor::stopRun( ) More...
void | topAlgHandler (Property &p)
| Top algorithm List handler. More...
StatusCode | decodeTopAlgs ()
| decodeTopAlgNameList & topAlgNameListHandler More...
void | outStreamHandler (Property &p)
| Output stream List handler. More...
StatusCode | decodeOutStreams ()
| decodeOutStreamNameList & outStreamNameListHandler More...
Public Member Functions inherited from extends< Service, IEventProcessor >
void * | i_cast (const InterfaceID &tid) const override
| Implementation of IInterface::i_cast. More...
StatusCode | queryInterface (const InterfaceID &ti, void **pp) override
| Implementation of IInterface::queryInterface. More...
std::vector< std::string > | getInterfaceNames () const override
| Implementation of IInterface::getInterfaceNames. More...
| ~extends () override=default
| Virtual destructor. More...
Public Member Functions inherited from Service
const std::string & | name () const override
| Retrieve name of the service. More...
StatusCode | configure () override
StatusCode | initialize () override
StatusCode | start () override
StatusCode | stop () override
StatusCode | finalize () override
StatusCode | terminate () override
Gaudi::StateMachine::State | FSMState () const override
Gaudi::StateMachine::State | targetFSMState () const override
StatusCode | reinitialize () override
StatusCode | restart () override
StatusCode | sysInitialize () override
| Initialize Service. More...
StatusCode | sysStart () override
| Initialize Service. More...
StatusCode | sysStop () override
| Initialize Service. More...
StatusCode | sysFinalize () override
| Finalize Service. More...
StatusCode | sysReinitialize () override
| Re-initialize the Service. More...
StatusCode | sysRestart () override
| Re-initialize the Service. More...
StatusCode | setProperty (const Property &p) override
StatusCode | setProperty (const std::string &s) override
StatusCode | setProperty (const std::string &n, const std::string &v) override
StatusCode | getProperty (Property *p) const override
const Property & | getProperty (const std::string &name) const override
StatusCode | getProperty (const std::string &n, std::string &v) const override
const std::vector< Property * > & | getProperties () const override
bool | hasProperty (const std::string &name) const override
template<class TYPE >
StatusCode | setProperty (const std::string &name, const TYPE &value)
| set the property form the value More...
| Service (std::string name, ISvcLocator *svcloc)
| Standard Constructor. More...
SmartIF< ISvcLocator > & | serviceLocator () const override
| Retrieve pointer to service locator. More...
StatusCode | setProperties ()
| Method for setting declared properties to the values specified for the job. More...
template<class T >
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. More...
template<class T >
StatusCode | service (const std::string &name, T *&psvc, bool createIf=true) const
template<typename IFace = IService>
SmartIF< IFace > | service (const std::string &name, bool createIf=true) const
template<class T >
StatusCode | service (const std::string &svcType, const std::string &svcName, T *&psvc) const
| Access a service by name and type, creating it if it doesn't already exist. More...
template<class T >
Property * | declareProperty (const std::string &name, T &property, const std::string &doc="none") const
| Declare the named property. More...
Property * | declareRemoteProperty (const std::string &name, IProperty *rsvc, const std::string &rname="") const
| Declare remote named properties. More...
template<class T >
StatusCode | declarePrivateTool (ToolHandle< T > &handle, std::string toolTypeAndName="", bool createIf=true)
| Declare used Private tool. More...
template<class T >
StatusCode | declarePublicTool (ToolHandle< T > &handle, std::string toolTypeAndName="", bool createIf=true)
| Declare used Public tool. More...
SmartIF< IAuditorSvc > & | auditorSvc () const
| The standard auditor service.May not be invoked before sysInitialize() has been invoked. More...
Public Member Functions inherited from CommonMessagingBase
virtual | ~CommonMessagingBase ()=default
| Virtual destructor. More...
SmartIF< IMessageSvc > & | msgSvc () const
| The standard message service. More...
MsgStream & | msgStream () const
| Return an uninitialized MsgStream. More...
MsgStream & | msgStream (const MSG::Level level) const
| Predefined configurable message stream for the efficient printouts. More...
MsgStream & | always () const
| shortcut for the method msgStream(MSG::ALWAYS) More...
MsgStream & | fatal () const
| shortcut for the method msgStream(MSG::FATAL) More...
MsgStream & | err () const
| shortcut for the method msgStream(MSG::ERROR) More...
MsgStream & | error () const
| shortcut for the method msgStream(MSG::ERROR) More...
MsgStream & | warning () const
| shortcut for the method msgStream(MSG::WARNING) More...
MsgStream & | info () const
| shortcut for the method msgStream(MSG::INFO) More...
MsgStream & | debug () const
| shortcut for the method msgStream(MSG::DEBUG) More...
MsgStream & | verbose () const
| shortcut for the method msgStream(MSG::VERBOSE) More...
MsgStream & | msg () const
| shortcut for the method msgStream(MSG::INFO) More...
MSG::Level | msgLevel () const
| get the output level from the embedded MsgStream More...
MSG::Level | outputLevel () const __attribute__((deprecated))
| Backward compatibility function for getting the output level. More...
bool | msgLevel (MSG::Level lvl) const
| get the output level from the embedded MsgStream More...
Public Member Functions inherited from extend_interfaces< Interfaces...>
| ~extend_interfaces () override=default
| Virtual destructor. More...

## Protected Attributes
SmartIF< IDataManagerSvc > | m_evtDataMgrSvc = nullptr
| Reference to the Event Data Service's IDataManagerSvc interface. More...
SmartIF< IDataProviderSvc > | m_evtDataSvc = nullptr
| Reference to the Event Data Service's IDataProviderSvc interface. More...
SmartIF< IEvtSelector > | m_evtSelector = nullptr
| Reference to the Event Selector. More...
IEvtSelector::Context * | m_evtContext = nullptr
| Event Iterator. More...
std::string | m_evtsel
| Event selector. More...
SmartIF< IDataManagerSvc > | m_histoDataMgrSvc = nullptr
| Reference to the Histogram Data Service. More...
SmartIF< IConversionSvc > | m_histoPersSvc = nullptr
| Reference to the Histogram Persistency Service. More...
std::string | m_histPersName
| Name of the Hist Pers type. More...
SmartIF< IProperty > | m_appMgrProperty = nullptr
| Property interface of ApplicationMgr. More...
bool | m_endEventFired = true
| Flag to avoid to fire the EnvEvent incident twice in a row (and also not before the first event) More...
bool | m_warnings = true
| Flag to disable warning messages when using external input. More...
Protected Attributes inherited from MinimalEventLoopMgr
SmartIF< IAppMgrUI > | m_appMgrUI
| Reference to the IAppMgrUI interface of the application manager. More...
SmartIF< IIncidentSvc > | m_incidentSvc
| Reference to the incident service. More...
ListAlg | m_topAlgList
| List of top level algorithms. More...
ListAlg | m_outStreamList
| List of output streams. More...
std::string | m_outStreamType
| Out Stream type. More...
StringArrayProperty | m_topAlgNames
| List of top level algorithms names. More...
StringArrayProperty | m_outStreamNames
| List of output stream names. More...
State | m_state = OFFLINE
| State of the object. More...
bool | m_scheduledStop = false
| Scheduled stop of event processing. More...
SmartIF< IIncidentListener > | m_abortEventListener
| Instance of the incident listener waiting for AbortEvent. More...
bool | m_abortEvent = false
| Flag signalling that the event being processedhas to be aborted (skip all following top algs). More...
std::string | m_abortEventSource
| Source of the AbortEvent incident. More...
Protected Attributes inherited from Service
IntegerProperty | m_outputLevel = MSG::NIL
| Service output level. More...
Gaudi::StateMachine::State | m_state = Gaudi::StateMachine::OFFLINE
| Service state. More...
Gaudi::StateMachine::State | m_targetState = Gaudi::StateMachine::OFFLINE
| Service state. More...

## Additional Inherited Members
Public Types inherited from MinimalEventLoopMgr
typedef std::vector< SmartIF< IAlgorithm > > | ListAlg
Public Types inherited from extends< Service, IEventProcessor >
using | base_class = extends
| Typedef to this class. More...
using | extend_interfaces_base = extend_interfaces< Interfaces...>
| Typedef to the base of this class. More...
Public Types inherited from Service
typedef Gaudi::PluginService::Factory< IService *, const std::string &, ISvcLocator * > | Factory
Public Types inherited from CommonMessaging< implements< IService, IProperty, IStateful > >
using | base_class = CommonMessaging
Public Types inherited from extend_interfaces< Interfaces...>
using | ext_iids = typename Gaudi::interface_list_cat< typename Interfaces::ext_iids...>::type
| take union of the ext_iids of all Interfaces... More...
Protected Types inherited from MinimalEventLoopMgr
enum | State { OFFLINE, CONFIGURED, FINALIZED, INITIALIZED }
Protected Member Functions inherited from Service
| ~Service () override
| Standard Destructor. More...
int | outputLevel () const
| get the `Service's` output level More...
Protected Member Functions inherited from CommonMessaging< implements< IService, IProperty, IStateful > >
void | updateMsgStreamOutputLevel (int level)
| Update the output level of the cached MsgStream. More...

## Detailed Description

Class definition of EventLoopMgr.

This is the default processing manager of the application manager. This object handles the minimal requirements needed by the application manager. It also handles the default user configuration setup for standard event processing.

- handling of the incidents when starting event processing
- handling of the event loop

History:

     +---------+----------------------------------------------+---------+
     |    Date |                 Comment                      | Who     |
     +---------+----------------------------------------------+---------+
     |13/12/00 | Initial version                              | M.Frank |
     +---------+----------------------------------------------+---------+

Author
  Markus Frank

Version
  1.0

Definition at line 38 of file EventLoopMgr.h.

## Constructor & Destructor Documentation

EventLoopMgr::EventLoopMgr | ( | const std::string & | nam,
|  | ISvcLocator * | svcLoc
| ) |  |

Standard Constructor.

Definition at line 32 of file EventLoopMgr.cpp.

33 : MinimalEventLoopMgr(nam, svcLoc)
34 {
35 // Declare properties
36 declareProperty("HistogramPersistency", m_histPersName );
37 declareProperty("EvtSel", m_evtsel );
38 declareProperty("Warnings",m_warnings=true,
39 "Set this property to false to suppress warning messages");
40 }
EventLoopMgr::m_histPersName
std::string m_histPersName
Name of the Hist Pers type.
Definition: EventLoopMgr.h:57
EventLoopMgr::m_warnings
bool m_warnings
Flag to disable warning messages when using external input.
Definition: EventLoopMgr.h:64
Service::declareProperty
Property * declareProperty(const std::string &name, T &property, const std::string &doc="none") const
Declare the named property.
Definition: Service.h:215
EventLoopMgr::m_evtsel
std::string m_evtsel
Event selector.
Definition: EventLoopMgr.h:51
MinimalEventLoopMgr::MinimalEventLoopMgr
MinimalEventLoopMgr(const std::string &nam, ISvcLocator *svcLoc)
Standard Constructor.
Definition: MinimalEventLoopMgr.cpp:52

EventLoopMgr::~EventLoopMgr | ( |  | ) |
| override

Standard Destructor.

Definition at line 45 of file EventLoopMgr.cpp.

45 {
46 delete m_evtContext;
47 }
EventLoopMgr::m_evtContext
IEvtSelector::Context * m_evtContext
Event Iterator.
Definition: EventLoopMgr.h:49

## Member Function Documentation

StatusCode EventLoopMgr::executeEvent | ( | void * | par | ) |
| override

implementation of IEventProcessor::executeEvent(void* par)

Definition at line 270 of file EventLoopMgr.cpp.

270 {
271
272 // DP Monitoring
273
274
275
276 // Fire BeginEvent "Incident"
277 m_incidentSvc->fireIncident(Incident(name(),IncidentType::BeginEvent));
278 // An incident may schedule a stop, in which case is better to exit before the actual execution.
279 if ( m_scheduledStop ) {
280 always() << "Terminating event processing loop due to a stop scheduled by an incident listener" << endmsg;
281 return StatusCode::SUCCESS;
282 }
283
284 // Execute Algorithms
285 m_incidentSvc->fireIncident(Incident(name(), IncidentType::BeginProcessing));
286 StatusCode sc = MinimalEventLoopMgr::executeEvent(par);
287 m_incidentSvc->fireIncident(Incident(name(), IncidentType::EndProcessing));
288
289 // Check if there was an error processing current event
290 if( UNLIKELY(!sc.isSuccess()) ){
291 error() << "Terminating event processing loop due to errors" << endmsg;
292 }
293 return sc;
294 }
UNLIKELY
#define UNLIKELY(x)
Definition: Kernel.h:126
MinimalEventLoopMgr::m_scheduledStop
bool m_scheduledStop
Scheduled stop of event processing.
Definition: MinimalEventLoopMgr.h:51
StatusCode::isSuccess
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:76
merge_files.sc
int sc
Definition: merge_files.py:167
Service::name
const std::string & name() const override
Retrieve name of the service.
Definition: Service.cpp:319
CommonMessagingBase::error
MsgStream & error() const
shortcut for the method msgStream(MSG::ERROR)
Definition: CommonMessaging.h:118
compareOutputFiles.par
string par
Definition: compareOutputFiles.py:386
IIncidentSvc::fireIncident
virtual void fireIncident(const Incident &incident)=0
Fire an Incident.
StatusCode::SUCCESS
Definition: StatusCode.h:30
StatusCode
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
MinimalEventLoopMgr::m_incidentSvc
SmartIF< IIncidentSvc > m_incidentSvc
Reference to the incident service.
Definition: MinimalEventLoopMgr.h:37
Incident
Base class for all Incidents (computing events).
Definition: Incident.h:17
CommonMessagingBase::always
MsgStream & always() const
shortcut for the method msgStream(MSG::ALWAYS)
Definition: CommonMessaging.h:109
endmsg
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
MinimalEventLoopMgr::executeEvent
StatusCode executeEvent(void *par) override
implementation of IEventProcessor::executeEvent(void* par)
Definition: MinimalEventLoopMgr.cpp:358

StatusCode EventLoopMgr::finalize | ( |  | ) |
| override

implementation of IService::finalize

Definition at line 204 of file EventLoopMgr.cpp.

204 {
205 StatusCode sc;
206
207 // Finalize base class
208 sc = MinimalEventLoopMgr::finalize();
209 if (! sc.isSuccess()) {
210 error() << "Error finalizing base class" << endmsg;
211 return sc;
212 }
213
214 // Save Histograms Now
215 if ( m_histoPersSvc ) {
216 HistogramAgent agent;
217 sc = m_histoDataMgrSvc->traverseTree( &agent );
218 if( sc.isSuccess() ) {
219 IDataSelector* objects = agent.selectedObjects();
220 // skip /stat entry!
221 if ( objects->size() > 0 ) {
222 for ( auto& i : *objects ) {
223 IOpaqueAddress* pAddr = nullptr;
224 StatusCode iret = m_histoPersSvc->createRep(i, pAddr);
225 if ( iret.isSuccess() ) {
226 i->registry()->setAddress(pAddr);
227 }
228 else {
229 sc = iret;
230 }
231 }
232 for ( auto& i : *objects ) {
233 IRegistry* reg = i->registry();
234 StatusCode iret = m_histoPersSvc->fillRepRefs(reg->address(), i);
235 if ( !iret.isSuccess() ) sc = iret;
236 }
237 }
238 if ( sc.isSuccess() ) {
239 info() << "Histograms converted successfully according to request." << endmsg;
240 }
241 else {
242 error() << "Error while saving Histograms." << endmsg;
243 }
244 }
245 else {
246 error() << "Error while traversing Histogram data store" << endmsg;
247 }
248 }
249
250 // Release event selector context
251 if ( m_evtSelector && m_evtContext ) {
252 m_evtSelector->releaseContext(m_evtContext).ignore();
253 m_evtContext = nullptr;
254 }
255
256 // Release all interfaces...
257 m_histoDataMgrSvc = nullptr;
258 m_histoPersSvc = nullptr;
259
260 m_evtSelector = nullptr;
261 m_evtDataSvc = nullptr;
262 m_evtDataMgrSvc = nullptr;
263
264 return StatusCode::SUCCESS;
265 }
MinimalEventLoopMgr::finalize
StatusCode finalize() override
implementation of IService::finalize
Definition: MinimalEventLoopMgr.cpp:247
EventLoopMgr::m_histoPersSvc
SmartIF< IConversionSvc > m_histoPersSvc
Reference to the Histogram Persistency Service.
Definition: EventLoopMgr.h:55
CommonMessagingBase::info
MsgStream & info() const
shortcut for the method msgStream(MSG::INFO)
Definition: CommonMessaging.h:124
StatusCode::isSuccess
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:76
HistogramAgent
HistogramAgent base in charge of collecting all the refereces to DataObjects in a transient store tha...
Definition: HistogramAgent.h:17
IConverter::createRep
virtual StatusCode createRep(DataObject *pObject, IOpaqueAddress *&refpAddress)=0
Convert the transient object to the requested representation.
merge_files.sc
int sc
Definition: merge_files.py:167
CommonMessagingBase::error
MsgStream & error() const
shortcut for the method msgStream(MSG::ERROR)
Definition: CommonMessaging.h:118
IDataManagerSvc::traverseTree
virtual StatusCode traverseTree(IDataStoreAgent *pAgent)=0
Analyse by traversing all data objects in the data store.
StatusCode::SUCCESS
Definition: StatusCode.h:30
StatusCode
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
IEvtSelector::releaseContext
virtual StatusCode releaseContext(Context *&) const =0
Release the Context object.
IRegistry
The IRegistry represents the entry door to the environment any data object residing in a transient da...
Definition: IRegistry.h:22
HistogramAgent::selectedObjects
IDataSelector * selectedObjects()
Return the set of selected DataObjects.
Definition: HistogramAgent.h:28
IRegistry::address
virtual IOpaqueAddress * address() const =0
Retrieve opaque storage address.
EventLoopMgr::m_evtDataMgrSvc
SmartIF< IDataManagerSvc > m_evtDataMgrSvc
Reference to the Event Data Service's IDataManagerSvc interface.
Definition: EventLoopMgr.h:43
std::vector::size
T size(T...args)
std::vector< DataObject * >
EventLoopMgr::m_evtContext
IEvtSelector::Context * m_evtContext
Event Iterator.
Definition: EventLoopMgr.h:49
EventLoopMgr::m_evtSelector
SmartIF< IEvtSelector > m_evtSelector
Reference to the Event Selector.
Definition: EventLoopMgr.h:47
EventLoopMgr::m_evtDataSvc
SmartIF< IDataProviderSvc > m_evtDataSvc
Reference to the Event Data Service's IDataProviderSvc interface.
Definition: EventLoopMgr.h:45
IOpaqueAddress
Opaque address interface definition.
Definition: IOpaqueAddress.h:23
StatusCode::ignore
void ignore() const
Definition: StatusCode.h:108
ana.i
list i
Definition: ana.py:128
IConverter::fillRepRefs
virtual StatusCode fillRepRefs(IOpaqueAddress *pAddress, DataObject *pObject)=0
Resolve the references of the converted object.
endmsg
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
EventLoopMgr::m_histoDataMgrSvc
SmartIF< IDataManagerSvc > m_histoDataMgrSvc
Reference to the Histogram Data Service.
Definition: EventLoopMgr.h:53

StatusCode EventLoopMgr::getEventRoot | ( | IOpaqueAddress *& | refpAddr | ) |

Create event address using event selector.

Definition at line 396 of file EventLoopMgr.cpp.

396 {
397 refpAddr = nullptr;
398 StatusCode sc = m_evtSelector->next(*m_evtContext);
399 if ( !sc.isSuccess() ) return sc;
400 // Create root address and assign address to data service
401 sc = m_evtSelector->createAddress(*m_evtContext,refpAddr);
402 if( !sc.isSuccess() ) {
403 sc = m_evtSelector->next(*m_evtContext);
404 if ( sc.isSuccess() ) {
405 sc = m_evtSelector->createAddress(*m_evtContext,refpAddr);
406 if ( !sc.isSuccess() ) {
407 warning() << "Error creating IOpaqueAddress." << endmsg;
408 }
409 }
410 }
411 return sc;
412 }
StatusCode::isSuccess
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:76
merge_files.sc
int sc
Definition: merge_files.py:167
CommonMessagingBase::warning
MsgStream & warning() const
shortcut for the method msgStream(MSG::WARNING)
Definition: CommonMessaging.h:121
StatusCode
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
IEvtSelector::next
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...
EventLoopMgr::m_evtContext
IEvtSelector::Context * m_evtContext
Event Iterator.
Definition: EventLoopMgr.h:49
EventLoopMgr::m_evtSelector
SmartIF< IEvtSelector > m_evtSelector
Reference to the Event Selector.
Definition: EventLoopMgr.h:47
IEvtSelector::createAddress
virtual StatusCode createAddress(const Context &c, IOpaqueAddress *&iop) const =0
Create an IOpaqueAddress object from the event fetched.
endmsg
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244

StatusCode EventLoopMgr::initialize | ( |  | ) |
| override

implementation of IService::initialize

Definition at line 52 of file EventLoopMgr.cpp.

52 {
53 // Initialize the base class
54 StatusCode sc = MinimalEventLoopMgr::initialize();
55 if( !sc.isSuccess() ) {
56 DEBMSG << "Error Initializing base class MinimalEventLoopMgr." << endmsg;
57 return sc;
58 }
59
60 // Setup access to event data services
61 m_evtDataMgrSvc = serviceLocator()->service("EventDataSvc");
62 if( !m_evtDataMgrSvc ) {
63 fatal() << "Error retrieving EventDataSvc interface IDataManagerSvc." << endmsg;
64 return StatusCode::FAILURE;
65 }
66 m_evtDataSvc = serviceLocator()->service("EventDataSvc");
67 if( !m_evtDataSvc ) {
68 fatal() << "Error retrieving EventDataSvc interface IDataProviderSvc." << endmsg;
69 return StatusCode::FAILURE;
70 }
71
72 // Obtain the IProperty of the ApplicationMgr
73 m_appMgrProperty = serviceLocator();
74 if ( ! m_appMgrProperty ) {
75 fatal() << "IProperty interface not found in ApplicationMgr." << endmsg;
76 return StatusCode::FAILURE;
77 }
78
79 // We do not expect a Event Selector necessarily being declared
80 setProperty(m_appMgrProperty->getProperty("EvtSel")).ignore();
81
82 if( m_evtsel != "NONE" || m_evtsel.length() == 0) {
83 m_evtSelector = serviceLocator()->service("EventSelector");
84 if( m_evtSelector ) {
85 // Setup Event Selector
86 sc=m_evtSelector->createContext(m_evtContext);
87 if( !sc.isSuccess() ) {
88 fatal() << "Can not create the event selector Context." << endmsg;
89 return sc;
90 }
91 }
92 else {
93 fatal() << "EventSelector not found." << endmsg;
94 return sc;
95 }
96 } else {
97 m_evtSelector = nullptr;
98 m_evtContext = nullptr;
99 if ( m_warnings ) {
100 warning() << "Unable to locate service \"EventSelector\" " << endmsg;
101 warning() << "No events will be processed from external input." << endmsg;
102 }
103 }
104
105 // Setup access to histogramming services
106 m_histoDataMgrSvc = serviceLocator()->service("HistogramDataSvc");
107 if( !m_histoDataMgrSvc ) {
108 fatal() << "Error retrieving HistogramDataSvc." << endmsg;
109 return sc;
110 }
111 // Setup histogram persistency
112 m_histoPersSvc = serviceLocator()->service("HistogramPersistencySvc");
113 if( !m_histoPersSvc ) {
114 warning() << "Histograms cannot not be saved - though required." << endmsg;
115 return sc;
116 }
117
118 return StatusCode::SUCCESS;
119 }
Service::serviceLocator
SmartIF< ISvcLocator > & serviceLocator() const override
Retrieve pointer to service locator.
Definition: Service.cpp:324
IProperty::getProperty
virtual StatusCode getProperty(Property *p) const =0
Get the property by property.
EventLoopMgr::m_histoPersSvc
SmartIF< IConversionSvc > m_histoPersSvc
Reference to the Histogram Persistency Service.
Definition: EventLoopMgr.h:55
StatusCode::isSuccess
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:76
MinimalEventLoopMgr::initialize
StatusCode initialize() override
implementation of IService::initialize
Definition: MinimalEventLoopMgr.cpp:65
Service::setProperty
StatusCode setProperty(const Property &p) override
Definition: Service.cpp:330
merge_files.sc
int sc
Definition: merge_files.py:167
ISvcLocator::service
StatusCode service(const Gaudi::Utils::TypeNameString &name, T *&svc, bool createIf=true)
Templated method to access a service by name.
Definition: ISvcLocator.h:78
CommonMessagingBase::warning
MsgStream & warning() const
shortcut for the method msgStream(MSG::WARNING)
Definition: CommonMessaging.h:121
StatusCode::FAILURE
Definition: StatusCode.h:29
EventLoopMgr::m_warnings
bool m_warnings
Flag to disable warning messages when using external input.
Definition: EventLoopMgr.h:64
StatusCode::SUCCESS
Definition: StatusCode.h:30
StatusCode
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
IEvtSelector::createContext
virtual StatusCode createContext(Context *&c) const =0
Create and return a context object that will keep track of the state of selection.
EventLoopMgr::m_evtDataMgrSvc
SmartIF< IDataManagerSvc > m_evtDataMgrSvc
Reference to the Event Data Service's IDataManagerSvc interface.
Definition: EventLoopMgr.h:43
std::string::length
T length(T...args)
EventLoopMgr::m_appMgrProperty
SmartIF< IProperty > m_appMgrProperty
Property interface of ApplicationMgr.
Definition: EventLoopMgr.h:59
EventLoopMgr::m_evtContext
IEvtSelector::Context * m_evtContext
Event Iterator.
Definition: EventLoopMgr.h:49
EventLoopMgr::m_evtSelector
SmartIF< IEvtSelector > m_evtSelector
Reference to the Event Selector.
Definition: EventLoopMgr.h:47
DEBMSG
#define DEBMSG
Definition: EventLoopMgr.cpp:26
EventLoopMgr::m_evtDataSvc
SmartIF< IDataProviderSvc > m_evtDataSvc
Reference to the Event Data Service's IDataProviderSvc interface.
Definition: EventLoopMgr.h:45
CommonMessagingBase::fatal
MsgStream & fatal() const
shortcut for the method msgStream(MSG::FATAL)
Definition: CommonMessaging.h:112
EventLoopMgr::m_evtsel
std::string m_evtsel
Event selector.
Definition: EventLoopMgr.h:51
endmsg
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
EventLoopMgr::m_histoDataMgrSvc
SmartIF< IDataManagerSvc > m_histoDataMgrSvc
Reference to the Histogram Data Service.
Definition: EventLoopMgr.h:53

StatusCode EventLoopMgr::nextEvent | ( | int | maxevt | ) |
| override

implementation of IService::nextEvent

Definition at line 301 of file EventLoopMgr.cpp.

301 {
302
303 // DP Monitoring
304 // Calculate runtime
305 typedef std::chrono::high_resolution_clock Clock;
306 typedef Clock::time_point time_point;
307
308 const float oneOver1024 = 1.f/1024.f;
309
310
311 static int total_nevt = 0;
312 DataObject* pObject = nullptr;
313 StatusCode sc(StatusCode::SUCCESS, true);
314
315 // loop over events if the maxevt (received as input) if different from -1.
316 // if evtmax is -1 it means infinite loop
317 time_point start_time = Clock::now();
318 for( int nevt = 0; maxevt == -1 || nevt < maxevt; ++nevt, ++total_nevt) {
319
320 if(1 == nevt) // reset after first evt
321 start_time = Clock::now();
322
323 //always() << "Event Number = " << total_nevt
324 // << " WSS (MB) = " << System::mappedMemory(System::MemoryUnit::kByte)*oneOver1024
325 // << " Time (s) = " << secsFromStart(start_time) << endmsg;
326
327
328 // Check if there is a scheduled stop issued by some algorithm/service
329 if ( m_scheduledStop ) {
330 m_scheduledStop = false;
331 always() << "Terminating event processing loop due to scheduled stop" << endmsg;
332 break;
333 }
334 // Clear the event store, if used in the event loop
335 if( 0 != total_nevt ) {
336
337 if ( ! m_endEventFired ) {
338 // Fire EndEvent "Incident" (it is considered part of the clearing of the TS)
339 m_incidentSvc->fireIncident(Incident(name(),IncidentType::EndEvent));
340 m_endEventFired = true;
341 }
342 sc = m_evtDataMgrSvc->clearStore();
343 if( !sc.isSuccess() ) {
344 DEBMSG << "Clear of Event data store failed" << endmsg;
345 }
346 }
347
348 // Setup event in the event store
349 if( m_evtContext ) {
350 IOpaqueAddress* addr = nullptr;
351 // Only if there is a EventSelector
352 sc = getEventRoot(addr);
353 if( !sc.isSuccess() ) {
354 info() << "No more events in event selection " << endmsg;
355 break;
356 }
357 // Set root clears the event data store first
358 sc = m_evtDataMgrSvc->setRoot ("/Event", addr);
359 if( !sc.isSuccess() ) {
360 warning() << "Error declaring event root address." << endmsg;
361 continue;
362 }
363 sc = m_evtDataSvc->retrieveObject("/Event", pObject);
364 if( !sc.isSuccess() ) {
365 warning() << "Unable to retrieve Event root object" << endmsg;
366 break;
367 }
368 } else {
369 sc = m_evtDataMgrSvc->setRoot ("/Event", new DataObject());
370 if( !sc.isSuccess() ) {
371 warning() << "Error declaring event root DataObject" << endmsg;
372 }
373 }
374 // Execute event for all required algorithms
375 sc = executeEvent(nullptr);
376 m_endEventFired = false;
377 if( !sc.isSuccess() ){
378 error() << "Terminating event processing loop due to errors" << endmsg;
379 Gaudi::setAppReturnCode(m_appMgrProperty, Gaudi::ReturnCode::AlgorithmFailure).ignore();
380 return sc;
381 }
382 }
383 time_point end_time = Clock::now();
384
385 if (UNLIKELY(outputLevel() <= MSG::DEBUG))
386 debug() << "---> Loop Finished - "
387 << " WSS " << System::mappedMemory(System::MemoryUnit::kByte)*oneOver1024
388 << " | total time (skipping 1st evt) "
389 << std::chrono::duration_cast < std::chrono::nanoseconds > (end_time - start_time).count()
390 << " ns" << endmsg;
391
392 return StatusCode::SUCCESS;
393 }
UNLIKELY
#define UNLIKELY(x)
Definition: Kernel.h:126
std::chrono::nanoseconds
MinimalEventLoopMgr::m_scheduledStop
bool m_scheduledStop
Scheduled stop of event processing.
Definition: MinimalEventLoopMgr.h:51
CommonMessagingBase::info
MsgStream & info() const
shortcut for the method msgStream(MSG::INFO)
Definition: CommonMessaging.h:124
Service::outputLevel
int outputLevel() const
get the Service's output level
Definition: Service.h:316
MSG::DEBUG
Definition: IMessageSvc.h:18
std::chrono::duration_cast
T duration_cast(T...args)
merge_files.sc
int sc
Definition: merge_files.py:167
System::kByte
Definition: Memory.h:56
Service::name
const std::string & name() const override
Retrieve name of the service.
Definition: Service.cpp:319
CommonMessagingBase::error
MsgStream & error() const
shortcut for the method msgStream(MSG::ERROR)
Definition: CommonMessaging.h:118
IIncidentSvc::fireIncident
virtual void fireIncident(const Incident &incident)=0
Fire an Incident.
std::chrono::high_resolution_clock
CommonMessagingBase::warning
MsgStream & warning() const
shortcut for the method msgStream(MSG::WARNING)
Definition: CommonMessaging.h:121
EventLoopMgr::executeEvent
StatusCode executeEvent(void *par) override
implementation of IEventProcessor::executeEvent(void* par)
Definition: EventLoopMgr.cpp:270
StatusCode::SUCCESS
Definition: StatusCode.h:30
StatusCode
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
EventLoopMgr::getEventRoot
StatusCode getEventRoot(IOpaqueAddress *&refpAddr)
Create event address using event selector.
Definition: EventLoopMgr.cpp:396
ana.nevt
list nevt
Definition: ana.py:134
Clock
std::chrono::high_resolution_clock Clock
Definition: ITimelineSvc.h:11
MinimalEventLoopMgr::m_incidentSvc
SmartIF< IIncidentSvc > m_incidentSvc
Reference to the incident service.
Definition: MinimalEventLoopMgr.h:37
Gaudi::setAppReturnCode
StatusCode setAppReturnCode(SmartIF< IProperty > &appmgr, int value, bool force=false)
Set the application return code.
Definition: AppReturnCode.h:50
IDataManagerSvc::setRoot
virtual StatusCode setRoot(std::string root_name, DataObject *pObject)=0
Initialize data store for new event by giving new event path.
std::count
T count(T...args)
EventLoopMgr::m_evtDataMgrSvc
SmartIF< IDataManagerSvc > m_evtDataMgrSvc
Reference to the Event Data Service's IDataManagerSvc interface.
Definition: EventLoopMgr.h:43
GaudiPython.Bindings.DataObject
DataObject
Definition: Bindings.py:50
System::mappedMemory
GAUDI_API long mappedMemory(MemoryUnit unit=kByte, InfoType fetch=Memory, long pid=-1)
Basic Process Information: priority boost.
Definition: Memory.cpp:180
CommonMessagingBase::debug
MsgStream & debug() const
shortcut for the method msgStream(MSG::DEBUG)
Definition: CommonMessaging.h:127
EventLoopMgr::m_appMgrProperty
SmartIF< IProperty > m_appMgrProperty
Property interface of ApplicationMgr.
Definition: EventLoopMgr.h:59
EventLoopMgr::m_evtContext
IEvtSelector::Context * m_evtContext
Event Iterator.
Definition: EventLoopMgr.h:49
DEBMSG
#define DEBMSG
Definition: EventLoopMgr.cpp:26
time_point
Clock::time_point time_point
Definition: ITimelineSvc.h:12
std::chrono::high_resolution_clock::now
T now(T...args)
Incident
Base class for all Incidents (computing events).
Definition: Incident.h:17
Gaudi::ReturnCode::AlgorithmFailure
constexpr int AlgorithmFailure
Definition: AppReturnCode.h:24
IDataManagerSvc::clearStore
virtual StatusCode clearStore()=0
Remove all data objects in the data store.
EventLoopMgr::m_endEventFired
bool m_endEventFired
Flag to avoid to fire the EnvEvent incident twice in a row (and also not before the first event) ...
Definition: EventLoopMgr.h:62
EventLoopMgr::m_evtDataSvc
SmartIF< IDataProviderSvc > m_evtDataSvc
Reference to the Event Data Service's IDataProviderSvc interface.
Definition: EventLoopMgr.h:45
IOpaqueAddress
Opaque address interface definition.
Definition: IOpaqueAddress.h:23
StatusCode::ignore
void ignore() const
Definition: StatusCode.h:108
CommonMessagingBase::always
MsgStream & always() const
shortcut for the method msgStream(MSG::ALWAYS)
Definition: CommonMessaging.h:109
DataObject
A DataObject is the base class of any identifiable object on any data store.
Definition: DataObject.h:30
endmsg
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
IDataProviderSvc::retrieveObject
virtual StatusCode retrieveObject(IRegistry *pDirectory, const std::string &path, DataObject *&pObject)=0
Retrieve object identified by its directory entry.

StatusCode EventLoopMgr::reinitialize | ( |  | ) |
| override

implementation of IService::reinitialize

Definition at line 123 of file EventLoopMgr.cpp.

123 {
124
125 // Initialize the base class
126 StatusCode sc = MinimalEventLoopMgr::reinitialize();
127 if( !sc.isSuccess() ) {
128 DEBMSG << "Error Initializing base class MinimalEventLoopMgr." << endmsg;
129 return sc;
130 }
131
132 // Check to see whether a new Event Selector has been specified
133 setProperty(m_appMgrProperty->getProperty("EvtSel"));
134 if( m_evtsel != "NONE" || m_evtsel.length() == 0) {
135 auto theSvc = serviceLocator()->service<IService>("EventSelector");
136 auto theEvtSel = theSvc.as<IEvtSelector>();
137 if( theEvtSel && ( theEvtSel.get() != m_evtSelector.get() ) ) {
138 // Setup Event Selector
139 if ( m_evtSelector.get() && m_evtContext ) {
140 // Need to release context before switching to new event selector
141 m_evtSelector->releaseContext(m_evtContext);
142 m_evtContext = nullptr;
143 }
144 m_evtSelector = theEvtSel;
145 if (theSvc->FSMState() == Gaudi::StateMachine::INITIALIZED) {
146 sc = theSvc->reinitialize();
147 if( !sc.isSuccess() ) {
148 error() << "Failure Reinitializing EventSelector "
149 << theSvc->name( ) << endmsg;
150 return sc;
151 }
152 } else {
153 sc = theSvc->sysInitialize();
154 if( !sc.isSuccess() ) {
155 error() << "Failure Initializing EventSelector "
156 << theSvc->name( ) << endmsg;
157 return sc;
158 }
159 }
160 sc = m_evtSelector->createContext(m_evtContext);
161 if( !sc.isSuccess() ) {
162 error() << "Can not create Context " << theSvc->name( ) << endmsg;
163 return sc;
164 }
165 info() << "EventSelector service changed to "
166 << theSvc->name( ) << endmsg;
167 }
168 else if ( m_evtSelector ) {
169 if ( m_evtContext ) {
170 m_evtSelector->releaseContext(m_evtContext);
171 m_evtContext = nullptr;
172 }
173 sc = m_evtSelector->createContext(m_evtContext);
174 if( !sc.isSuccess() ) {
175 error() << "Can not create Context " << theSvc->name( ) << endmsg;
176 return sc;
177 }
178 }
179 }
180 else if ( m_evtSelector && m_evtContext ) {
181 m_evtSelector->releaseContext(m_evtContext);
182 m_evtSelector = nullptr;
183 m_evtContext = nullptr;
184 }
185 return StatusCode::SUCCESS;
186 }
Gaudi::StateMachine::INITIALIZED
Definition: StateMachine.h:15
Service::serviceLocator
SmartIF< ISvcLocator > & serviceLocator() const override
Retrieve pointer to service locator.
Definition: Service.cpp:324
IProperty::getProperty
virtual StatusCode getProperty(Property *p) const =0
Get the property by property.
CommonMessagingBase::info
MsgStream & info() const
shortcut for the method msgStream(MSG::INFO)
Definition: CommonMessaging.h:124
IEvtSelector
The Event Selector Interface.
Definition: IEvtSelector.h:18
StatusCode::isSuccess
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:76
Service::setProperty
StatusCode setProperty(const Property &p) override
Definition: Service.cpp:330
merge_files.sc
int sc
Definition: merge_files.py:167
MinimalEventLoopMgr::reinitialize
StatusCode reinitialize() override
implementation of IService::reinitialize
Definition: MinimalEventLoopMgr.cpp:198
SmartIF::get
TYPE * get() const
Get interface pointer.
Definition: SmartIF.h:76
ISvcLocator::service
StatusCode service(const Gaudi::Utils::TypeNameString &name, T *&svc, bool createIf=true)
Templated method to access a service by name.
Definition: ISvcLocator.h:78
CommonMessagingBase::error
MsgStream & error() const
shortcut for the method msgStream(MSG::ERROR)
Definition: CommonMessaging.h:118
IService
General service interface definition.
Definition: IService.h:18
StatusCode::SUCCESS
Definition: StatusCode.h:30
StatusCode
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
IEvtSelector::createContext
virtual StatusCode createContext(Context *&c) const =0
Create and return a context object that will keep track of the state of selection.
IEvtSelector::releaseContext
virtual StatusCode releaseContext(Context *&) const =0
Release the Context object.
std::string::length
T length(T...args)
EventLoopMgr::m_appMgrProperty
SmartIF< IProperty > m_appMgrProperty
Property interface of ApplicationMgr.
Definition: EventLoopMgr.h:59
EventLoopMgr::m_evtContext
IEvtSelector::Context * m_evtContext
Event Iterator.
Definition: EventLoopMgr.h:49
EventLoopMgr::m_evtSelector
SmartIF< IEvtSelector > m_evtSelector
Reference to the Event Selector.
Definition: EventLoopMgr.h:47
DEBMSG
#define DEBMSG
Definition: EventLoopMgr.cpp:26
EventLoopMgr::m_evtsel
std::string m_evtsel
Event selector.
Definition: EventLoopMgr.h:51
endmsg
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244

StatusCode EventLoopMgr::stop | ( |  | ) |
| override

implementation of IService::stop

Definition at line 192 of file EventLoopMgr.cpp.

192 {
193 if ( ! m_endEventFired ) {
194 // Fire pending EndEvent incident
195 m_incidentSvc->fireIncident(Incident(name(),IncidentType::EndEvent));
196 m_endEventFired = true;
197 }
198 return MinimalEventLoopMgr::stop();
199 }
MinimalEventLoopMgr::stop
StatusCode stop() override
implementation of IService::stop
Definition: MinimalEventLoopMgr.cpp:171
Service::name
const std::string & name() const override
Retrieve name of the service.
Definition: Service.cpp:319
IIncidentSvc::fireIncident
virtual void fireIncident(const Incident &incident)=0
Fire an Incident.
MinimalEventLoopMgr::m_incidentSvc
SmartIF< IIncidentSvc > m_incidentSvc
Reference to the incident service.
Definition: MinimalEventLoopMgr.h:37
Incident
Base class for all Incidents (computing events).
Definition: Incident.h:17
EventLoopMgr::m_endEventFired
bool m_endEventFired
Flag to avoid to fire the EnvEvent incident twice in a row (and also not before the first event) ...
Definition: EventLoopMgr.h:62

## Member Data Documentation

SmartIF<IProperty> EventLoopMgr::m_appMgrProperty = nullptr
| protected

Property interface of ApplicationMgr.

Definition at line 59 of file EventLoopMgr.h.

bool EventLoopMgr::m_endEventFired = true
| protected

Flag to avoid to fire the EnvEvent incident twice in a row (and also not before the first event)

Definition at line 62 of file EventLoopMgr.h.

IEvtSelector::Context* EventLoopMgr::m_evtContext = nullptr
| protected

Event Iterator.

Definition at line 49 of file EventLoopMgr.h.

SmartIF<IDataManagerSvc> EventLoopMgr::m_evtDataMgrSvc = nullptr
| protected

Reference to the Event Data Service's IDataManagerSvc interface.

Definition at line 43 of file EventLoopMgr.h.

SmartIF<IDataProviderSvc> EventLoopMgr::m_evtDataSvc = nullptr
| protected

Reference to the Event Data Service's IDataProviderSvc interface.

Definition at line 45 of file EventLoopMgr.h.

std::string EventLoopMgr::m_evtsel
| protected

Event selector.

Definition at line 51 of file EventLoopMgr.h.

SmartIF<IEvtSelector> EventLoopMgr::m_evtSelector = nullptr
| protected

Reference to the Event Selector.

Definition at line 47 of file EventLoopMgr.h.

SmartIF<IDataManagerSvc> EventLoopMgr::m_histoDataMgrSvc = nullptr
| protected

Reference to the Histogram Data Service.

Definition at line 53 of file EventLoopMgr.h.

SmartIF<IConversionSvc> EventLoopMgr::m_histoPersSvc = nullptr
| protected

Reference to the Histogram Persistency Service.

Definition at line 55 of file EventLoopMgr.h.

std::string EventLoopMgr::m_histPersName
| protected

Name of the Hist Pers type.

Definition at line 57 of file EventLoopMgr.h.

bool EventLoopMgr::m_warnings = true
| protected

Flag to disable warning messages when using external input.

Definition at line 64 of file EventLoopMgr.h.

The documentation for this class was generated from the following files:

- GaudiCoreSvc/src/ApplicationMgr/EventLoopMgr.h
- GaudiCoreSvc/src/ApplicationMgr/EventLoopMgr.cpp