The Gaudi Framework  master (ff829712)
Loading...
Searching...
No Matches
EventLoopMgr Class Reference

Class definition of EventLoopMgr. More...

#include </builds/gaudi/Gaudi/GaudiCoreSvc/src/ApplicationMgr/EventLoopMgr.h>

Inheritance diagram for EventLoopMgr:
Collaboration diagram for EventLoopMgr:

Public Member Functions

 ~EventLoopMgr () override
 Standard Destructor.
 
StatusCode getEventRoot (IOpaqueAddress *&refpAddr)
 Create event address using event selector.
 
StatusCode initialize () override
 implementation of IService::initialize
 
StatusCode reinitialize () override
 implementation of IService::reinitialize
 
StatusCode stop () override
 implementation of IService::stop
 
StatusCode finalize () override
 implementation of IService::finalize
 
StatusCode nextEvent (int maxevt) override
 implementation of IEventProcessor::nextEvent
 
StatusCode executeEvent (EventContext &&ctx) override
 implementation of IEventProcessor::executeEvent(EventContext&&)
 
 MinimalEventLoopMgr (const std::string &nam, ISvcLocator *svcLoc)
 Standard Constructor.
 
 MinimalEventLoopMgr (const MinimalEventLoopMgr &)=delete
 No copy allowed.
 
- Public Member Functions inherited from MinimalEventLoopMgr
 MinimalEventLoopMgr (const std::string &nam, ISvcLocator *svcLoc)
 Standard Constructor.
 
 MinimalEventLoopMgr (const MinimalEventLoopMgr &)=delete
 No copy allowed.
 
MinimalEventLoopMgroperator= (const MinimalEventLoopMgr &)=delete
 No copy allowed.
 
StatusCode initialize () override
 implementation of IService::initialize
 
StatusCode start () override
 implementation of IService::start
 
StatusCode stop () override
 implementation of IService::stop
 
StatusCode finalize () override
 implementation of IService::finalize
 
StatusCode reinitialize () override
 implementation of IService::reinitialize
 
StatusCode restart () override
 implementation of IService::restart
 
EventContext createEventContext () override
 implementation of IEventProcessor::createEventContext()
 
StatusCode nextEvent (int maxevt) override
 implementation of IEventProcessor::nextEvent
 
StatusCode executeEvent (EventContext &&ctx) override
 implementation of IEventProcessor::executeEvent(EventContext&&)
 
StatusCode executeRun (int maxevt) override
 implementation of IEventProcessor::executeRun( )
 
StatusCode stopRun () override
 implementation of IEventProcessor::stopRun( )
 
void topAlgHandler (Gaudi::Details::PropertyBase &p)
 Top algorithm List handler.
 
StatusCode decodeTopAlgs ()
 decodeTopAlgNameList & topAlgNameListHandler
 
void outStreamHandler (Gaudi::Details::PropertyBase &p)
 Output stream List handler.
 
StatusCode decodeOutStreams ()
 decodeOutStreamNameList & outStreamNameListHandler
 
- Public Member Functions inherited from extends< Service, IEventProcessor >
void const * i_cast (const InterfaceID &tid) const override
 Implementation of IInterface::i_cast.
 
StatusCode queryInterface (const InterfaceID &ti, void **pp) override
 Implementation of IInterface::queryInterface.
 
std::vector< std::string > getInterfaceNames () const override
 Implementation of IInterface::getInterfaceNames.
 
- Public Member Functions inherited from Service
const std::string & name () const override
 Retrieve name of the service.
 
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.
 
StatusCode sysStart () override
 Initialize Service.
 
StatusCode sysStop () override
 Initialize Service.
 
StatusCode sysFinalize () override
 Finalize Service.
 
StatusCode sysReinitialize () override
 Re-initialize the Service.
 
StatusCode sysRestart () override
 Re-initialize the Service.
 
 Service (std::string name, ISvcLocator *svcloc)
 Standard Constructor.
 
SmartIF< ISvcLocator > & serviceLocator () const override
 Retrieve pointer to service locator.
 
template<typename IFace = IService>
SmartIF< IFace > service (const std::string &name, bool createIf=true) const
 
template<class T>
Gaudi::Details::PropertyBasedeclareProperty (const std::string &name, ToolHandle< T > &hndl, const std::string &doc="none")
 
template<class T>
StatusCode declareTool (ToolHandle< T > &handle, bool createIf=true)
 
template<class T>
StatusCode declareTool (ToolHandle< T > &handle, const std::string &toolTypeAndName, bool createIf=true)
 Declare used tool.
 
template<class T>
Gaudi::Details::PropertyBasedeclareProperty (const std::string &name, ToolHandleArray< T > &hndlArr, const std::string &doc="none")
 
template<class T>
void addToolsArray (ToolHandleArray< T > &hndlArr)
 
const std::vector< IAlgTool * > & tools () const
 
SmartIF< IAuditorSvc > & auditorSvc () const
 The standard auditor service.May not be invoked before sysInitialize() has been invoked.
 
- Public Member Functions inherited from PropertyHolder< CommonMessaging< implements< IService, IProperty, IStateful > > >
StatusCode setProperty (const Gaudi::Details::PropertyBase &p)
 Set the property from a property.
 
StatusCode setProperty (const std::string &name, const char *v)
 Special case for string literals.
 
StatusCode setProperty (const std::string &name, const std::string &v)
 Special case for std::string.
 
StatusCode setProperty (const std::string &name, const TYPE &value)
 set the property form the value
 
 PropertyHolder ()=default
 
Gaudi::Details::PropertyBasedeclareProperty (Gaudi::Details::PropertyBase &prop)
 Declare a property.
 
Gaudi::Details::PropertyBasedeclareProperty (const std::string &name, TYPE &value, const std::string &doc="none")
 Helper to wrap a regular data member and use it as a regular property.
 
Gaudi::Details::PropertyBasedeclareProperty (const std::string &name, Gaudi::Property< TYPE, VERIFIER, HANDLERS > &prop, const std::string &doc="none")
 Declare a PropertyBase instance setting name and documentation.
 
Gaudi::Details::PropertyBasedeclareRemoteProperty (const std::string &name, IProperty *rsvc, const std::string &rname="")
 Declare a remote property.
 
StatusCode setProperty (const std::string &name, const Gaudi::Details::PropertyBase &p) override
 set the property from another property with a different name
 
StatusCode setProperty (const std::string &s) override
 set the property from the formatted string
 
StatusCode setProperty (const Gaudi::Details::PropertyBase &p)
 Set the property from a property.
 
StatusCode setProperty (const std::string &name, const char *v)
 Special case for string literals.
 
StatusCode setProperty (const std::string &name, const std::string &v)
 Special case for std::string.
 
StatusCode setProperty (const std::string &name, const TYPE &value)
 set the property form the value
 
StatusCode setPropertyRepr (const std::string &n, const std::string &r) override
 set the property from name and value string representation
 
StatusCode getProperty (Gaudi::Details::PropertyBase *p) const override
 get the property
 
const Gaudi::Details::PropertyBasegetProperty (std::string_view name) const override
 get the property by name
 
StatusCode getProperty (std::string_view n, std::string &v) const override
 convert the property to the string
 
const std::vector< Gaudi::Details::PropertyBase * > & getProperties () const override
 get all properties
 
bool hasProperty (std::string_view name) const override
 Return true if we have a property with the given name.
 
Gaudi::Details::PropertyBaseproperty (std::string_view name) const
 \fixme property and bindPropertiesTo should be protected
 
void bindPropertiesTo (Gaudi::Interfaces::IOptionsSvc &optsSvc)
 
 PropertyHolder (const PropertyHolder &)=delete
 
PropertyHolderoperator= (const PropertyHolder &)=delete
 
- Public Member Functions inherited from CommonMessaging< implements< IService, IProperty, IStateful > >
MSG::Level msgLevel () const
 get the cached level (originally extracted from the embedded MsgStream)
 
bool msgLevel (MSG::Level lvl) const
 get the output level from the embedded MsgStream
 
- Public Member Functions inherited from CommonMessagingBase
virtual ~CommonMessagingBase ()=default
 Virtual destructor.
 
const SmartIF< IMessageSvc > & msgSvc () const
 The standard message service.
 
MsgStreammsgStream () const
 Return an uninitialized MsgStream.
 
MsgStreammsgStream (const MSG::Level level) const
 Predefined configurable message stream for the efficient printouts.
 
MsgStreamalways () const
 shortcut for the method msgStream(MSG::ALWAYS)
 
MsgStreamfatal () const
 shortcut for the method msgStream(MSG::FATAL)
 
MsgStreamerr () const
 shortcut for the method msgStream(MSG::ERROR)
 
MsgStreamerror () const
 shortcut for the method msgStream(MSG::ERROR)
 
MsgStreamwarning () const
 shortcut for the method msgStream(MSG::WARNING)
 
MsgStreaminfo () const
 shortcut for the method msgStream(MSG::INFO)
 
MsgStreamdebug () const
 shortcut for the method msgStream(MSG::DEBUG)
 
MsgStreamverbose () const
 shortcut for the method msgStream(MSG::VERBOSE)
 
MsgStreammsg () const
 shortcut for the method msgStream(MSG::INFO)
 

Protected Attributes

Gaudi::Property< std::string > m_histPersName { this, "HistogramPersistency", {}, "name of the Hist Pers type" }
 
Gaudi::Property< std::string > m_evtsel { this, "EvtSel", {}, "event selector" }
 
SmartIF< IDataManagerSvcm_evtDataMgrSvc = nullptr
 Reference to the Event Data Service's IDataManagerSvc interface.
 
SmartIF< IDataProviderSvcm_evtDataSvc = nullptr
 Reference to the Event Data Service's IDataProviderSvc interface.
 
SmartIF< IEvtSelectorm_evtSelector = nullptr
 Reference to the Event Selector.
 
IEvtSelector::Contextm_evtContext = nullptr
 Event Iterator.
 
SmartIF< IDataManagerSvcm_histoDataMgrSvc = nullptr
 Reference to the Histogram Data Service.
 
SmartIF< IConversionSvcm_histoPersSvc = nullptr
 Reference to the Histogram Persistency Service.
 
SmartIF< IPropertym_appMgrProperty = nullptr
 Property interface of ApplicationMgr.
 
bool m_endEventFired = true
 Flag to avoid to fire the EnvEvent incident twice in a row (and also not before the first event)
 
- Protected Attributes inherited from MinimalEventLoopMgr
Gaudi::Property< std::vector< std::string > > m_topAlgNames
 
Gaudi::Property< std::vector< std::string > > m_outStreamNames
 
Gaudi::Property< bool > m_printCFExp
 
SmartIF< IAppMgrUIm_appMgrUI
 Reference to the IAppMgrUI interface of the application manager.
 
SmartIF< IIncidentSvcm_incidentSvc
 Reference to the incident service.
 
SmartIF< IAlgExecStateSvcm_aess
 List of top level algorithms.
 
ListAlg m_topAlgList
 
ListAlg m_outStreamList
 List of output streams.
 
State m_state = OFFLINE
 State of the object.
 
bool m_scheduledStop = false
 Scheduled stop of event processing.
 
AbortEventListener m_abortEventListener
 Instance of the incident listener waiting for AbortEvent.
 
SmartIF< IHiveWhiteBoardm_WB
 < Event data service (whiteboard)
 
size_t m_nevt { 0 }
 
- Protected Attributes inherited from Service
Gaudi::StateMachine::State m_state = Gaudi::StateMachine::OFFLINE
 Service state.
 
Gaudi::StateMachine::State m_targetState = Gaudi::StateMachine::OFFLINE
 Service state.
 
Gaudi::Property< int > m_outputLevel { this, "OutputLevel", MSG::NIL, "output level" }
 flag indicating whether ToolHandle tools have been added to m_tools
 
Gaudi::Property< bool > m_auditorInitialize { this, "AuditInitialize", false, "trigger auditor on initialize()" }
 
Gaudi::Property< bool > m_auditorStart { this, "AuditStart", false, "trigger auditor on start()" }
 
Gaudi::Property< bool > m_auditorStop { this, "AuditStop", false, "trigger auditor on stop()" }
 
Gaudi::Property< bool > m_auditorFinalize { this, "AuditFinalize", false, "trigger auditor on finalize()" }
 
Gaudi::Property< bool > m_auditorReinitialize { this, "AuditReinitialize", false, "trigger auditor on reinitialize()" }
 
Gaudi::Property< bool > m_auditorRestart { this, "AuditRestart", false, "trigger auditor on restart()" }
 
Gaudi::Property< bool > m_autoRetrieveTools
 
Gaudi::Property< bool > m_checkToolDeps
 
SmartIF< IAuditorSvcm_pAuditorSvc
 Auditor Service.
 

Additional Inherited Members

- Public Types inherited from MinimalEventLoopMgr
typedef std::vector< SmartIF< IAlgorithm > > ListAlg
 
- Public Types inherited from extends< Service, IEventProcessor >
using base_class
 Typedef to this class.
 
using extend_interfaces_base
 Typedef to the base of this class.
 
- Public Types inherited from Service
using Factory = Gaudi::PluginService::Factory<IService*( const std::string&, ISvcLocator* )>
 
- Public Types inherited from PropertyHolder< CommonMessaging< implements< IService, IProperty, IStateful > > >
using PropertyHolderImpl
 Typedef used to refer to this class from derived classes, as in.
 
- Public Types inherited from CommonMessaging< implements< IService, IProperty, IStateful > >
using base_class
 
- Public Types inherited from extend_interfaces< Interfaces... >
using ext_iids
 take union of the ext_iids of all Interfaces...
 
- Protected Types inherited from MinimalEventLoopMgr
enum  State { OFFLINE , CONFIGURED , FINALIZED , INITIALIZED }
 
- Protected Member Functions inherited from Service
std::vector< IAlgTool * > & tools ()
 
 ~Service () override
 
int outputLevel () const
 get the Service's output level
 
- Protected Member Functions inherited from CommonMessaging< implements< IService, IProperty, IStateful > >
MSG::Level setUpMessaging () const
 Set up local caches.
 
MSG::Level resetMessaging ()
 Reinitialize internal states.
 
void updateMsgStreamOutputLevel (int level)
 Update the output level of the cached MsgStream.
 

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 43 of file EventLoopMgr.h.

Constructor & Destructor Documentation

◆ ~EventLoopMgr()

EventLoopMgr::~EventLoopMgr ( )
override

Standard Destructor.

Definition at line 31 of file EventLoopMgr.cpp.

31{ delete m_evtContext; }
IEvtSelector::Context * m_evtContext
Event Iterator.

Member Function Documentation

◆ executeEvent()

StatusCode EventLoopMgr::executeEvent ( EventContext && ctx)
override

implementation of IEventProcessor::executeEvent(EventContext&&)

Definition at line 229 of file EventLoopMgr.cpp.

229 {
230
231 // DP Monitoring
232
233 // Fire BeginEvent "Incident"
234 m_incidentSvc->fireIncident( Incident( name(), IncidentType::BeginEvent ) );
235 // An incident may schedule a stop, in which case is better to exit before the actual execution.
236 if ( m_scheduledStop ) {
237 always() << "Terminating event processing loop due to a stop scheduled by an incident listener" << endmsg;
238 return StatusCode::SUCCESS;
239 }
240
241 // Execute Algorithms
242 m_incidentSvc->fireIncident( Incident( name(), IncidentType::BeginProcessing ) );
243 StatusCode sc = MinimalEventLoopMgr::executeEvent( std::move( ctx ) );
244 m_incidentSvc->fireIncident( Incident( name(), IncidentType::EndProcessing ) );
245
246 // Check if there was an error processing current event
247 if ( !sc.isSuccess() ) { error() << "Terminating event processing loop due to errors" << endmsg; }
248 return sc;
249}
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition MsgStream.h:198
MsgStream & error() const
shortcut for the method msgStream(MSG::ERROR)
MsgStream & always() const
shortcut for the method msgStream(MSG::ALWAYS)
bool m_scheduledStop
Scheduled stop of event processing.
SmartIF< IIncidentSvc > m_incidentSvc
Reference to the incident service.
StatusCode executeEvent(EventContext &&ctx) override
implementation of IEventProcessor::executeEvent(EventContext&&)
const std::string & name() const override
Retrieve name of the service.
Definition Service.cpp:333
bool isSuccess() const
Definition StatusCode.h:314
constexpr static const auto SUCCESS
Definition StatusCode.h:99

◆ finalize()

StatusCode EventLoopMgr::finalize ( )
override

implementation of IService::finalize

Definition at line 171 of file EventLoopMgr.cpp.

171 {
172 // Finalize base class
173 StatusCode sc = MinimalEventLoopMgr::finalize();
174 if ( !sc.isSuccess() ) {
175 error() << "Error finalizing base class" << endmsg;
176 return sc;
177 }
178
179 // Save Histograms Now
180 if ( m_histoPersSvc ) {
181 std::vector<DataObject*> objects;
182 sc = m_histoDataMgrSvc->traverseTree( [&objects]( IRegistry* reg, int ) {
183 DataObject* obj = reg->object();
184 if ( !obj || obj->clID() == CLID_StatisticsFile ) return false;
185 objects.push_back( obj );
186 return true;
187 } );
188 if ( sc.isSuccess() ) {
189 // skip /stat entry!
190 sc = std::accumulate( begin( objects ), end( objects ), sc, [&]( StatusCode isc, auto& i ) {
191 IOpaqueAddress* pAddr = nullptr;
192 StatusCode iret = m_histoPersSvc->createRep( i, pAddr );
193 if ( iret.isFailure() ) return iret;
194 i->registry()->setAddress( pAddr );
195 return isc;
196 } );
197 sc = std::accumulate( begin( objects ), end( objects ), sc, [&]( StatusCode isc, auto& i ) {
198 IRegistry* reg = i->registry();
199 StatusCode iret = m_histoPersSvc->fillRepRefs( reg->address(), i );
200 return iret.isFailure() ? iret : isc;
201 } );
202 if ( sc.isSuccess() ) {
203 info() << "Histograms converted successfully according to request." << endmsg;
204 } else {
205 error() << "Error while saving Histograms." << endmsg;
206 }
207 } else {
208 error() << "Error while traversing Histogram data store" << endmsg;
209 }
210 }
211
212 // Release event selector context
213 if ( m_evtSelector && m_evtContext ) {
214 m_evtSelector->releaseContext( m_evtContext ).ignore();
215 m_evtContext = nullptr;
216 }
217
218 // Release all interfaces...
219 m_histoDataMgrSvc = nullptr;
220 m_histoPersSvc = nullptr;
221
222 m_evtSelector = nullptr;
223 m_evtDataSvc = nullptr;
224 m_evtDataMgrSvc = nullptr;
225
226 return StatusCode::SUCCESS;
227}
MsgStream & info() const
shortcut for the method msgStream(MSG::INFO)
virtual const CLID & clID() const
Retrieve reference to class definition structure.
SmartIF< IEvtSelector > m_evtSelector
Reference to the Event Selector.
SmartIF< IDataProviderSvc > m_evtDataSvc
Reference to the Event Data Service's IDataProviderSvc interface.
SmartIF< IDataManagerSvc > m_histoDataMgrSvc
Reference to the Histogram Data Service.
SmartIF< IConversionSvc > m_histoPersSvc
Reference to the Histogram Persistency Service.
SmartIF< IDataManagerSvc > m_evtDataMgrSvc
Reference to the Event Data Service's IDataManagerSvc interface.
virtual DataObject * object() const =0
Retrieve object behind the link.
virtual IOpaqueAddress * address() const =0
Retrieve opaque storage address.
StatusCode finalize() override
implementation of IService::finalize
bool isFailure() const
Definition StatusCode.h:129
AttribStringParser::Iterator begin(const AttribStringParser &parser)

◆ getEventRoot()

StatusCode EventLoopMgr::getEventRoot ( IOpaqueAddress *& refpAddr)

Create event address using event selector.

Definition at line 340 of file EventLoopMgr.cpp.

340 {
341 refpAddr = nullptr;
342 StatusCode sc = m_evtSelector->next( *m_evtContext );
343 if ( !sc.isSuccess() ) return sc;
344 // Create root address and assign address to data service
345 sc = m_evtSelector->createAddress( *m_evtContext, refpAddr );
346 if ( !sc.isSuccess() ) {
347 sc = m_evtSelector->next( *m_evtContext );
348 if ( sc.isSuccess() ) {
349 sc = m_evtSelector->createAddress( *m_evtContext, refpAddr );
350 if ( !sc.isSuccess() ) warning() << "Error creating IOpaqueAddress." << endmsg;
351 }
352 }
353 return sc;
354}
MsgStream & warning() const
shortcut for the method msgStream(MSG::WARNING)

◆ initialize()

StatusCode EventLoopMgr::initialize ( )
override

implementation of IService::initialize

Definition at line 33 of file EventLoopMgr.cpp.

33 {
34 // Initialize the base class
35 StatusCode sc = MinimalEventLoopMgr::initialize();
36 if ( !sc.isSuccess() ) {
37 DEBMSG << "Error Initializing base class MinimalEventLoopMgr." << endmsg;
38 return sc;
39 }
40
41 // Setup access to event data services
42 m_evtDataMgrSvc = serviceLocator()->service( "EventDataSvc" );
43 if ( !m_evtDataMgrSvc ) {
44 fatal() << "Error retrieving EventDataSvc interface IDataManagerSvc." << endmsg;
46 }
47 m_evtDataSvc = serviceLocator()->service( "EventDataSvc" );
48 if ( !m_evtDataSvc ) {
49 fatal() << "Error retrieving EventDataSvc interface IDataProviderSvc." << endmsg;
51 }
52
53 // Obtain the IProperty of the ApplicationMgr
55 if ( !m_appMgrProperty ) {
56 fatal() << "IProperty interface not found in ApplicationMgr." << endmsg;
58 }
59
60 // We do not expect a Event Selector necessarily being declared
61 setProperty( m_appMgrProperty->getProperty( "EvtSel" ) ).ignore();
62
63 if ( m_evtsel != "NONE" || m_evtsel.empty() ) {
64 m_evtSelector = serviceLocator()->service( "EventSelector" );
65 if ( m_evtSelector ) {
66 // Setup Event Selector
67 sc = m_evtSelector->createContext( m_evtContext );
68 if ( !sc.isSuccess() ) {
69 fatal() << "Can not create the event selector Context." << endmsg;
70 return sc;
71 }
72 } else {
73 fatal() << "EventSelector not found." << endmsg;
74 return sc;
75 }
76 } else {
77 m_evtSelector = nullptr;
78 m_evtContext = nullptr;
79 info() << "Unable to locate service \"EventSelector\": "
80 << "No events will be processed from external input." << endmsg;
81 }
82
83 setProperty( m_appMgrProperty->getProperty( "HistogramPersistency" ) ).ignore();
84 if ( m_histPersName != "NONE" && !m_histPersName.empty() ) {
85 // Setup access to histogramming services
86 m_histoDataMgrSvc = serviceLocator()->service( "HistogramDataSvc" );
87 if ( !m_histoDataMgrSvc ) {
88 fatal() << "Error retrieving HistogramDataSvc." << endmsg;
90 }
91 // Setup histogram persistency
92 m_histoPersSvc = serviceLocator()->service( "HistogramPersistencySvc" );
93 if ( !m_histoPersSvc ) { warning() << "Histograms cannot not be saved - though required." << endmsg; }
94 }
95
97}
bool PyHelper setProperty(IInterface *p, char *name, char *value)
#define DEBMSG
MsgStream & fatal() const
shortcut for the method msgStream(MSG::FATAL)
Gaudi::Property< std::string > m_histPersName
SmartIF< IProperty > m_appMgrProperty
Property interface of ApplicationMgr.
Gaudi::Property< std::string > m_evtsel
virtual SmartIF< IService > & service(const Gaudi::Utils::TypeNameString &typeName, const bool createIf=true)=0
Returns a smart pointer to a service.
StatusCode initialize() override
implementation of IService::initialize
SmartIF< ISvcLocator > & serviceLocator() const override
Retrieve pointer to service locator.
Definition Service.cpp:336
constexpr static const auto FAILURE
Definition StatusCode.h:100

◆ MinimalEventLoopMgr() [1/2]

MinimalEventLoopMgr::MinimalEventLoopMgr ( const MinimalEventLoopMgr & )
delete

No copy allowed.

◆ MinimalEventLoopMgr() [2/2]

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

Standard Constructor.

Definition at line 85 of file MinimalEventLoopMgr.cpp.

39 : base_class( nam, svcLoc ), m_appMgrUI( svcLoc ) {}
SmartIF< IAppMgrUI > m_appMgrUI
Reference to the IAppMgrUI interface of the application manager.

◆ nextEvent()

StatusCode EventLoopMgr::nextEvent ( int maxevt)
override

implementation of IEventProcessor::nextEvent

Definition at line 251 of file EventLoopMgr.cpp.

251 {
252
253 // DP Monitoring
254 // Calculate runtime
255 typedef std::chrono::high_resolution_clock Clock;
256 typedef Clock::time_point time_point;
257
258 const float oneOver1024 = 1.f / 1024.f;
259
260 DataObject* pObject = nullptr;
261 StatusCode sc = StatusCode::SUCCESS;
262
263 // loop over events if the maxevt (received as input) if different from -1.
264 // if evtmax is -1 it means infinite loop
265 time_point start_time = Clock::now();
266 for ( int nevt = 0; maxevt == -1 || nevt < maxevt; ++nevt ) {
267
268 if ( 1 == nevt ) // reset after first evt
269 start_time = Clock::now();
270
271 auto ctx = createEventContext();
272
273 // always() << "Event Number = " << total_nevt
274 // << " WSS (MB) = " << System::mappedMemory(System::MemoryUnit::kByte)*oneOver1024
275 // << " Time (s) = " << secsFromStart(start_time) << endmsg;
276
277 // Check if there is a scheduled stop issued by some algorithm/service
278 if ( m_scheduledStop ) {
279 m_scheduledStop = false;
280 always() << "Terminating event processing loop due to scheduled stop" << endmsg;
281 break;
282 }
283 // Clear the event store, if used in the event loop
284 if ( 0 != ctx.evt() ) {
285
286 if ( !m_endEventFired ) {
287 // Fire EndEvent "Incident" (it is considered part of the clearing of the TS)
288 m_incidentSvc->fireIncident( Incident( name(), IncidentType::EndEvent ) );
289 m_endEventFired = true;
290 }
291 sc = m_evtDataMgrSvc->clearStore();
292 if ( !sc.isSuccess() ) { DEBMSG << "Clear of Event data store failed" << endmsg; }
293 }
294
295 // Setup event in the event store
296 if ( m_evtContext ) {
297 IOpaqueAddress* addr = nullptr;
298 // Only if there is a EventSelector
299 sc = getEventRoot( addr );
300 if ( !sc.isSuccess() ) {
301 info() << "No more events in event selection " << endmsg;
302 break;
303 }
304 // Set root clears the event data store first
305 sc = m_evtDataMgrSvc->setRoot( "/Event", addr );
306 if ( !sc.isSuccess() ) {
307 warning() << "Error declaring event root address." << endmsg;
308 continue;
309 }
310 sc = m_evtDataSvc->retrieveObject( "/Event", pObject );
311 if ( !sc.isSuccess() ) {
312 warning() << "Unable to retrieve Event root object" << endmsg;
313 break;
314 }
315 } else {
316 sc = m_evtDataMgrSvc->setRoot( "/Event", new DataObject() );
317 if ( !sc.isSuccess() ) { warning() << "Error declaring event root DataObject" << endmsg; }
318 }
319 // Execute event for all required algorithms
320 sc = executeEvent( std::move( ctx ) );
321 m_endEventFired = false;
322 if ( !sc.isSuccess() ) {
323 error() << "Terminating event processing loop due to errors" << endmsg;
325 return sc;
326 }
327 }
328
329 if ( outputLevel() <= MSG::DEBUG )
330 debug() << "---> Loop Finished - "
331 << " WSS " << System::mappedMemory( System::MemoryUnit::kByte ) * oneOver1024
332 << " | total time (skipping 1st evt) "
333 << std::chrono::duration_cast<std::chrono::nanoseconds>( Clock::now() - start_time ).count() << " ns"
334 << endmsg;
335
336 return StatusCode::SUCCESS;
337}
MsgStream & debug() const
shortcut for the method msgStream(MSG::DEBUG)
StatusCode getEventRoot(IOpaqueAddress *&refpAddr)
Create event address using event selector.
StatusCode executeEvent(EventContext &&ctx) override
implementation of IEventProcessor::executeEvent(EventContext&&)
bool m_endEventFired
Flag to avoid to fire the EnvEvent incident twice in a row (and also not before the first event)
EventContext createEventContext() override
implementation of IEventProcessor::createEventContext()
int outputLevel() const
get the Service's output level
Definition Service.h:160
const StatusCode & ignore() const
Allow discarding a StatusCode without warning.
Definition StatusCode.h:139
constexpr int AlgorithmFailure
StatusCode setAppReturnCode(SmartIF< IProperty > &appmgr, int value, bool force=false)
Set the application return code.
@ DEBUG
Definition IMessageSvc.h:22
GAUDI_API long mappedMemory(MemoryUnit unit=kByte, InfoType fetch=Memory, long pid=-1)
Basic Process Information: priority boost.
Definition Memory.cpp:172
@ kByte
Definition Memory.h:50

◆ reinitialize()

StatusCode EventLoopMgr::reinitialize ( )
override

implementation of IService::reinitialize

Definition at line 99 of file EventLoopMgr.cpp.

99 {
100
101 // Initialize the base class
102 StatusCode sc = MinimalEventLoopMgr::reinitialize();
103 if ( !sc.isSuccess() ) {
104 DEBMSG << "Error Initializing base class MinimalEventLoopMgr." << endmsg;
105 return sc;
106 }
107
108 // Check to see whether a new Event Selector has been specified
109 if ( sc = setProperty( m_appMgrProperty->getProperty( "EvtSel" ) ); !sc ) return sc;
110 if ( m_evtsel != "NONE" || m_evtsel.length() == 0 ) {
111 auto theSvc = serviceLocator()->service<IService>( "EventSelector" );
112 auto theEvtSel = theSvc.as<IEvtSelector>();
113 if ( theEvtSel && ( theEvtSel.get() != m_evtSelector.get() ) ) {
114 // Setup Event Selector
115 if ( m_evtSelector.get() && m_evtContext ) {
116 // Need to release context before switching to new event selector
117 if ( sc = m_evtSelector->releaseContext( m_evtContext ); !sc ) return sc;
118 m_evtContext = nullptr;
119 }
120 m_evtSelector = theEvtSel;
121 if ( theSvc->FSMState() == Gaudi::StateMachine::INITIALIZED ) {
122 sc = theSvc->reinitialize();
123 if ( !sc.isSuccess() ) {
124 error() << "Failure Reinitializing EventSelector " << theSvc->name() << endmsg;
125 return sc;
126 }
127 } else {
128 sc = theSvc->sysInitialize();
129 if ( !sc.isSuccess() ) {
130 error() << "Failure Initializing EventSelector " << theSvc->name() << endmsg;
131 return sc;
132 }
133 }
134 sc = m_evtSelector->createContext( m_evtContext );
135 if ( !sc.isSuccess() ) {
136 error() << "Can not create Context " << theSvc->name() << endmsg;
137 return sc;
138 }
139 info() << "EventSelector service changed to " << theSvc->name() << endmsg;
140 } else if ( m_evtSelector ) {
141 if ( m_evtContext ) {
142 if ( sc = m_evtSelector->releaseContext( m_evtContext ); !sc ) return sc;
143 m_evtContext = nullptr;
144 }
145 sc = m_evtSelector->createContext( m_evtContext );
146 if ( !sc.isSuccess() ) {
147 error() << "Can not create Context " << theSvc->name() << endmsg;
148 return sc;
149 }
150 }
151 } else if ( m_evtSelector && m_evtContext ) {
152 sc = m_evtSelector->releaseContext( m_evtContext );
153 m_evtSelector = nullptr;
154 m_evtContext = nullptr;
155 }
156 return sc;
157}
StatusCode reinitialize() override
implementation of IService::reinitialize
SmartIF< IFace > as() const
return a new SmartIF instance to another interface
Definition SmartIF.h:110

◆ stop()

StatusCode EventLoopMgr::stop ( )
override

implementation of IService::stop

Definition at line 159 of file EventLoopMgr.cpp.

159 {
160 if ( !m_endEventFired ) {
161 // Fire pending EndEvent incident
162 m_incidentSvc->fireIncident( Incident( name(), IncidentType::EndEvent ) );
163 m_endEventFired = true;
164 }
165 return m_evtDataMgrSvc
166 ->clearStore() //
167 .andThen( [this]() { return MinimalEventLoopMgr::stop(); } ) //
168 .orElse( [this]() { DEBMSG << "Clear of Event data store failed" << endmsg; } );
169}
StatusCode stop() override
implementation of IService::stop

Member Data Documentation

◆ m_appMgrProperty

SmartIF<IProperty> EventLoopMgr::m_appMgrProperty = nullptr
protected

Property interface of ApplicationMgr.

Definition at line 64 of file EventLoopMgr.h.

◆ m_endEventFired

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 67 of file EventLoopMgr.h.

◆ m_evtContext

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

Event Iterator.

Definition at line 58 of file EventLoopMgr.h.

◆ m_evtDataMgrSvc

SmartIF<IDataManagerSvc> EventLoopMgr::m_evtDataMgrSvc = nullptr
protected

Reference to the Event Data Service's IDataManagerSvc interface.

Definition at line 52 of file EventLoopMgr.h.

◆ m_evtDataSvc

SmartIF<IDataProviderSvc> EventLoopMgr::m_evtDataSvc = nullptr
protected

Reference to the Event Data Service's IDataProviderSvc interface.

Definition at line 54 of file EventLoopMgr.h.

◆ m_evtsel

Gaudi::Property<std::string> EventLoopMgr::m_evtsel { this, "EvtSel", {}, "event selector" }
protected

Definition at line 49 of file EventLoopMgr.h.

49{ this, "EvtSel", {}, "event selector" };

◆ m_evtSelector

SmartIF<IEvtSelector> EventLoopMgr::m_evtSelector = nullptr
protected

Reference to the Event Selector.

Definition at line 56 of file EventLoopMgr.h.

◆ m_histoDataMgrSvc

SmartIF<IDataManagerSvc> EventLoopMgr::m_histoDataMgrSvc = nullptr
protected

Reference to the Histogram Data Service.

Definition at line 60 of file EventLoopMgr.h.

◆ m_histoPersSvc

SmartIF<IConversionSvc> EventLoopMgr::m_histoPersSvc = nullptr
protected

Reference to the Histogram Persistency Service.

Definition at line 62 of file EventLoopMgr.h.

◆ m_histPersName

Gaudi::Property<std::string> EventLoopMgr::m_histPersName { this, "HistogramPersistency", {}, "name of the Hist Pers type" }
protected

Definition at line 48 of file EventLoopMgr.h.

48{ this, "HistogramPersistency", {}, "name of the Hist Pers type" };

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