11#define GAUDIKERNEL_MINIMALEVENTLOOPMGR_CPP
29#define ON_DEBUG if ( outputLevel() <= MSG::DEBUG )
30#define ON_VERBOSE if ( outputLevel() <= MSG::VERBOSE )
32#define DEBMSG ON_DEBUG debug()
33#define VERMSG ON_VERBOSE verbose()
50 error() <<
"Failed to initialize Service Base class." <<
endmsg;
56 error() <<
"Error retrieving AppMgr interface IProperty." <<
endmsg;
65 fatal() <<
"Error retrieving IncidentSvc." <<
endmsg;
87 error() <<
"Failed to initialize Output streams." <<
endmsg;
98 error() <<
"Failed to initialize Top Algorithms streams." <<
endmsg;
106 sc = ita->sysInitialize();
108 error() <<
"Unable to initialize Algorithm: " << ita->name() <<
endmsg;
113 sc = ita->sysInitialize();
115 error() <<
"Unable to initialize Output Stream: " << ita->name() <<
endmsg;
123 fatal() <<
"Error retrieving AlgExecStateSvc." <<
endmsg;
128 info() <<
"Control Flow Expression:" <<
endmsg;
129 std::stringstream expr;
132 if ( ialg != first ) expr <<
" >> ";
133 ialg->toControlFlowExpression( expr );
150 sc = ita->sysStart();
152 error() <<
"Unable to start Algorithm: " << ita->name() <<
endmsg;
157 sc = ita->sysStart();
159 error() <<
"Unable to start Output Stream: " << ita->name() <<
endmsg;
177 error() <<
"Unable to stop Algorithm: " << ita->name() <<
endmsg;
184 error() <<
"Unable to stop Output Stream: " << ita->name() <<
endmsg;
200 sc = ita->sysReinitialize();
202 error() <<
"Unable to reinitialize Algorithm: " << ita->name() <<
endmsg;
207 sc = ita->sysReinitialize();
209 error() <<
"Unable to reinitialize Output Stream: " << ita->name() <<
endmsg;
224 m_aess->resetErrorCount( ita );
225 sc = ita->sysRestart();
227 error() <<
"Unable to restart Algorithm: " << ita->name() <<
endmsg;
232 m_aess->resetErrorCount( ita );
233 sc = ita->sysRestart();
235 error() <<
"Unable to restart Output Stream: " << ita->name() <<
endmsg;
251 sc = ita->sysFinalize();
254 warning() <<
"Finalization of algorithm " << ita->name() <<
" failed" <<
endmsg;
259 sc = ita->sysFinalize();
262 warning() <<
"Finalization of algorithm " << ita->name() <<
" failed" <<
endmsg;
268 if ( algMan->removeAlgorithm( ita ).isFailure() ) {
270 warning() <<
"Problems removing Algorithm " << ita->name() <<
endmsg;
286 error() <<
"Problems finalizing Service base class" <<
endmsg;
330 bool eventfailed =
false;
335 if (
m_WB.isValid() )
m_WB->selectStore( context.slot() ).ignore();
350 sc = ita->sysExecute( context );
353 fatal() <<
".executeEvent(): Exception with tag=" << Exception.tag() <<
" thrown by " << ita->name() <<
endmsg;
355 }
catch (
const std::exception& Exception ) {
356 fatal() <<
".executeEvent(): Standard std::exception thrown by " << ita->name() <<
endmsg;
358 }
catch ( ... ) {
fatal() <<
".executeEvent(): UNKNOWN Exception thrown by " << ita->name() <<
endmsg; }
361 warning() <<
"Execution of algorithm " << ita->name() <<
" failed" <<
endmsg;
366 m_aess->updateEventStatus( eventfailed, context );
377 state.setFilterPassed(
true );
380 warning() <<
"Execution of output stream " << ito->name() <<
" failed" <<
endmsg;
387 error() <<
"Error processing event loop." <<
endmsg;
388 std::ostringstream ost;
389 m_aess->dump( ost, context );
390 debug() <<
"Dumping AlgExecStateSvc status:\n" << ost.str() <<
endmsg;
414 throw GaudiException(
"Failed to initialize Top Algorithms streams.",
"MinimalEventLoopMgr::topAlgHandler",
433 std::string item_name = item.
name();
434 const bool CREATE =
false;
437 DEBMSG <<
"Top Algorithm " << item_name <<
" already exists" <<
endmsg;
439 DEBMSG <<
"Creating Top Algorithm " << item.
type() <<
" with name " << item_name <<
endmsg;
441 StatusCode sc1 = algMan->createAlgorithm( item.
type(), item_name, ialg );
443 error() <<
"Unable to create Top Algorithm " << item.
type() <<
" with name " << item_name <<
endmsg;
462 throw GaudiException(
"Failed to initialize output streams.",
"MinimalEventLoopMgr::outStreamHandler",
479 const bool CREATE =
false;
488 error() <<
"Unable to create Output Stream " << it <<
endmsg;
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
wrapper on an Algorithm state.
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 & debug() const
shortcut for the method msgStream(MSG::DEBUG)
MsgStream & info() const
shortcut for the method msgStream(MSG::INFO)
This class represents an entry point to all the event specific data.
PropertyBase base class allowing PropertyBase* collections to be "homogeneous".
Helper class to parse a string of format "type/name".
const std::string & type() const
const std::string & name() const
Define general base for Gaudi exception.
The IAlgManager is the interface implemented by the Algorithm Factory in the Application Manager to s...
The IAlgorithm is the interface implemented by the Algorithm base class.
The IProperty is the basic interface for all components which have properties that can be set or get.
The ISvcLocator is the interface implemented by the Service Factory in the Application Manager to loc...
virtual SmartIF< IService > & service(const Gaudi::Utils::TypeNameString &typeName, const bool createIf=true)=0
Returns a smart pointer to a service.
StatusCode stop() override
implementation of IService::stop
Gaudi::Property< std::vector< std::string > > m_outStreamNames
StatusCode restart() override
implementation of IService::restart
StatusCode nextEvent(int maxevt) override
implementation of IEventProcessor::nextEvent
StatusCode start() override
implementation of IService::start
void outStreamHandler(Gaudi::Details::PropertyBase &p)
Output stream List handler.
Gaudi::Property< bool > m_printCFExp
StatusCode executeRun(int maxevt) override
implementation of IEventProcessor::executeRun( )
bool m_scheduledStop
Scheduled stop of event processing.
MinimalEventLoopMgr(const std::string &nam, ISvcLocator *svcLoc)
Standard Constructor.
ListAlg m_outStreamList
List of output streams.
StatusCode decodeTopAlgs()
decodeTopAlgNameList & topAlgNameListHandler
Gaudi::Property< std::vector< std::string > > m_topAlgNames
EventContext createEventContext() override
implementation of IEventProcessor::createEventContext()
SmartIF< IAppMgrUI > m_appMgrUI
Reference to the IAppMgrUI interface of the application manager.
SmartIF< IIncidentSvc > m_incidentSvc
Reference to the incident service.
StatusCode finalize() override
implementation of IService::finalize
void topAlgHandler(Gaudi::Details::PropertyBase &p)
Top algorithm List handler.
StatusCode decodeOutStreams()
decodeOutStreamNameList & outStreamNameListHandler
AbortEventListener m_abortEventListener
Instance of the incident listener waiting for AbortEvent.
StatusCode executeEvent(EventContext &&ctx) override
implementation of IEventProcessor::executeEvent(EventContext&&)
SmartIF< IAlgExecStateSvc > m_aess
List of top level algorithms.
StatusCode initialize() override
implementation of IService::initialize
StatusCode reinitialize() override
implementation of IService::reinitialize
SmartIF< IHiveWhiteBoard > m_WB
< Event data service (whiteboard)
State m_state
State of the object.
StatusCode stopRun() override
implementation of IEventProcessor::stopRun( )
StatusCode setProperty(const Gaudi::Details::PropertyBase &p)
Helper class to set the application return code in case of early exit (e.g.
RetCodeGuard(const SmartIF< IProperty > &appmgr, int retcode)
SmartIF< IProperty > m_appmgr
SmartIF< ISvcLocator > & serviceLocator() const override
Retrieve pointer to service locator.
StatusCode finalize() override
StatusCode stop() override
SmartIF< IFace > service(const std::string &name, bool createIf=true) const
StatusCode start() override
StatusCode initialize() override
Small smart pointer class with automatic reference counting for IInterface.
This class is used for returning status codes from appropriate routines.
void ignore() const
Allow discarding a StatusCode without warning.
constexpr static const auto SUCCESS
constexpr static const auto FAILURE
constexpr int ScheduledStop
constexpr int UnhandledException
GAUDI_API void setCurrentContextId(ContextIdType newId)
Used by the framework to change the value of the current context id.
std::size_t ContextIdType
Internal type used for the ContextId.
StatusCode setAppReturnCode(SmartIF< IProperty > &appmgr, int value, bool force=false)
Set the application return code.
GAUDI_API const std::string typeinfoName(const std::type_info &)
Get platform independent information about the class type.