File indexing completed on 2025-12-16 10:15:13
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011 #ifndef GAUDIKERNEL_MINIMALEVENTLOOPMGR_H
0012 #define GAUDIKERNEL_MINIMALEVENTLOOPMGR_H 1
0013
0014 #include <GaudiKernel/EventContext.h>
0015 #include <GaudiKernel/IAlgExecStateSvc.h>
0016 #include <GaudiKernel/IAlgorithm.h>
0017 #include <GaudiKernel/IAppMgrUI.h>
0018 #include <GaudiKernel/IEventProcessor.h>
0019 #include <GaudiKernel/IHiveWhiteBoard.h>
0020 #include <GaudiKernel/IIncidentListener.h>
0021 #include <GaudiKernel/IIncidentSvc.h>
0022 #include <GaudiKernel/Service.h>
0023 #include <vector>
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034 class GAUDI_API MinimalEventLoopMgr : public extends<Service, IEventProcessor> {
0035 private:
0036 class AbortEventListener : public implements<IIncidentListener> {
0037 public:
0038
0039 void handle( const Incident& i ) override {
0040 if ( i.type() == IncidentType::AbortEvent ) {
0041 abortEvent = true;
0042 abortEventSource = i.source();
0043 }
0044 }
0045
0046 public:
0047
0048
0049 bool abortEvent = false;
0050
0051 std::string abortEventSource;
0052 };
0053
0054 public:
0055 typedef std::vector<SmartIF<IAlgorithm>> ListAlg;
0056
0057 protected:
0058
0059 Gaudi::Property<std::vector<std::string>> m_topAlgNames{
0060 this, "TopAlg", {}, &MinimalEventLoopMgr::topAlgHandler, "list of top level algorithms names" };
0061 Gaudi::Property<std::vector<std::string>> m_outStreamNames{
0062 this, "OutStream", {}, &MinimalEventLoopMgr::outStreamHandler, "list of output stream names" };
0063 Gaudi::Property<bool> m_printCFExp{ this, "PrintControlFlowExpression", false,
0064 "Print the control flow expression representing the content of TopAlg" };
0065
0066
0067 enum State { OFFLINE, CONFIGURED, FINALIZED, INITIALIZED };
0068
0069 SmartIF<IAppMgrUI> m_appMgrUI;
0070
0071 SmartIF<IIncidentSvc> m_incidentSvc;
0072
0073 SmartIF<IAlgExecStateSvc> m_aess;
0074 ListAlg m_topAlgList;
0075
0076 ListAlg m_outStreamList;
0077
0078 State m_state = OFFLINE;
0079
0080 bool m_scheduledStop = false;
0081
0082 AbortEventListener m_abortEventListener;
0083
0084 public:
0085
0086 MinimalEventLoopMgr( const std::string& nam, ISvcLocator* svcLoc );
0087
0088 MinimalEventLoopMgr( const MinimalEventLoopMgr& ) = delete;
0089
0090 MinimalEventLoopMgr& operator=( const MinimalEventLoopMgr& ) = delete;
0091
0092 #if defined( GAUDI_V20_COMPAT ) && !defined( G21_NO_DEPRECATED )
0093 protected:
0094
0095 template <class T>
0096 [[deprecated]] T* releaseInterface( T* iface ) {
0097 if ( 0 != iface ) iface->release();
0098 return 0;
0099 }
0100
0101 public:
0102 #endif
0103
0104
0105 StatusCode initialize() override;
0106
0107 StatusCode start() override;
0108
0109 StatusCode stop() override;
0110
0111 StatusCode finalize() override;
0112
0113 StatusCode reinitialize() override;
0114
0115 StatusCode restart() override;
0116
0117 EventContext createEventContext() override;
0118
0119 StatusCode nextEvent( int maxevt ) override;
0120
0121 StatusCode executeEvent( EventContext&& ctx ) override;
0122
0123 StatusCode executeRun( int maxevt ) override;
0124
0125 StatusCode stopRun() override;
0126
0127
0128 void topAlgHandler( Gaudi::Details::PropertyBase& p );
0129
0130 StatusCode decodeTopAlgs();
0131
0132 void outStreamHandler( Gaudi::Details::PropertyBase& p );
0133
0134 StatusCode decodeOutStreams();
0135
0136 protected:
0137
0138 SmartIF<IHiveWhiteBoard> m_WB;
0139
0140
0141 size_t m_nevt{ 0 };
0142 };
0143 #endif