All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
MinimalEventLoopMgr Class Reference

This is the default processing manager of the application manager. More...

#include <GaudiKernel/MinimalEventLoopMgr.h>

Inheritance diagram for MinimalEventLoopMgr:
Collaboration diagram for MinimalEventLoopMgr:

Public Types

typedef std::list< SmartIF
< IAlgorithm > > 
ListAlg
 
typedef std::list< IAlgorithm * > ListAlgPtrs
 
typedef std::list< std::string > ListName
 
typedef std::vector< std::string > VectorName
 
- Public Types inherited from extends1< Service, IEventProcessor >
typedef extends1 base_class
 Typedef to this class. More...
 
typedef extend_interfaces1
< IEventProcessor
extend_interfaces_base
 Typedef to the base of this class. More...
 
typedef
extend_interfaces_base::ext_iids 
interfaces
 MPL set of all the implemented interfaces. More...
 
- Public Types inherited from Service
typedef
Gaudi::PluginService::Factory
< IService *, const
std::string &, ISvcLocator * > 
Factory
 
- Public Types inherited from CommonMessaging< implements3< IService, IProperty, IStateful > >
typedef CommonMessaging base_class
 
- Public Types inherited from implements3< IService, IProperty, IStateful >
typedef implements3 base_class
 Typedef to this class. More...
 
typedef extend_interfaces3
< IService, IProperty,
IStateful
extend_interfaces_base
 Typedef to the base of this class. More...
 
typedef
extend_interfaces_base::ext_iids 
interfaces
 MPL set of all the implemented interfaces. More...
 
- Public Types inherited from extend_interfaces3< IService, IProperty, IStateful >
typedef mpl::fold< typename
IService::iid::iids::type,
typename mpl::fold< typename
IProperty::iid::iids::type,
typename
IStateful::iid::iids::type,
mpl::insert< mpl::_1, mpl::_2 >
>::type, mpl::insert< mpl::_1,
mpl::_2 > >::type 
ext_iids
 MPL set of interfaces extended by this one. More...
 
- Public Types inherited from IInterface
enum  Status { SUCCESS = 1, NO_INTERFACE, VERSMISMATCH, LAST_ERROR }
 Return status. More...
 
typedef Gaudi::InterfaceId
< IInterface, 0, 0 > 
iid
 Interface ID. More...
 
typedef mpl::set1< iidext_iids
 Extra interfaces. More...
 
- Public Types inherited from extend_interfaces1< IEventProcessor >
typedef
IEventProcessor::iid::iids::type 
ext_iids
 MPL set of interfaces extended by this one. More...
 

Public Member Functions

 MinimalEventLoopMgr (const std::string &nam, ISvcLocator *svcLoc)
 Standard Constructor. More...
 
virtual ~MinimalEventLoopMgr ()
 Standard Destructor. More...
 
virtual StatusCode initialize ()
 implementation of IService::initialize More...
 
virtual StatusCode start ()
 implementation of IService::start More...
 
virtual StatusCode stop ()
 implementation of IService::stop More...
 
virtual StatusCode finalize ()
 implementation of IService::finalize More...
 
virtual StatusCode reinitialize ()
 implementation of IService::reinitialize More...
 
virtual StatusCode restart ()
 implementation of IService::restart More...
 
virtual StatusCode nextEvent (int maxevt)
 implementation of IEventProcessor::nextEvent More...
 
virtual StatusCode executeEvent (void *par)
 implementation of IEventProcessor::executeEvent(void* par) More...
 
virtual StatusCode executeRun (int maxevt)
 implementation of IEventProcessor::executeRun( ) More...
 
virtual StatusCode stopRun ()
 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 extends1< Service, IEventProcessor >
 extends1 (A1 a1, A2 a2, A3 a3)
 Templated constructor with 3 arguments. More...
 
 extends1 (A1 a1, A2 a2)
 Templated constructor with 2 arguments. More...
 
 extends1 (A1 a1)
 Templated constructor with 1 argument. More...
 
 extends1 ()
 Default constructor. More...
 
virtual void * i_cast (const InterfaceID &tid) const
 Implementation of IInterface::i_cast. More...
 
virtual StatusCode queryInterface (const InterfaceID &ti, void **pp)
 Implementation of IInterface::queryInterface. More...
 
virtual std::vector< std::string > getInterfaceNames () const
 Implementation of IInterface::getInterfaceNames. More...
 
virtual ~extends1 ()
 Virtual destructor. More...
 
- Public Member Functions inherited from Service
virtual unsigned long release ()
 Release Interface instance. More...
 
virtual const std::string & name () const
 Retrieve name of the service. More...
 
virtual StatusCode configure ()
 Configuration (from OFFLINE to CONFIGURED). More...
 
virtual StatusCode terminate ()
 Initialization (from CONFIGURED to OFFLINE). More...
 
virtual Gaudi::StateMachine::State FSMState () const
 Get the current state. More...
 
virtual Gaudi::StateMachine::State targetFSMState () const
 When we are in the middle of a transition, get the state where the transition is leading us. More...
 
virtual StatusCode sysInitialize ()
 Initialize Service. More...
 
virtual StatusCode sysStart ()
 Initialize Service. More...
 
virtual StatusCode sysStop ()
 Initialize Service. More...
 
virtual StatusCode sysFinalize ()
 Finalize Service. More...
 
virtual StatusCode sysReinitialize ()
 Re-initialize the Service. More...
 
virtual StatusCode sysRestart ()
 Re-initialize the Service. More...
 
virtual StatusCode setProperty (const Property &p)
 Set the property by property. More...
 
virtual StatusCode setProperty (const std::string &s)
 Set the property by string. More...
 
virtual StatusCode setProperty (const std::string &n, const std::string &v)
 Set the property by std::string. More...
 
virtual StatusCode getProperty (Property *p) const
 Get the property by property. More...
 
virtual const PropertygetProperty (const std::string &name) const
 Get the property by name. More...
 
virtual StatusCode getProperty (const std::string &n, std::string &v) const
 Get the property by std::string. More...
 
virtual const std::vector
< Property * > & 
getProperties () const
 Get list of properties. More...
 
template<class TYPE >
StatusCode setProperty (const std::string &name, const TYPE &value)
 set the property form the value More...
 
 Service (const std::string &name, ISvcLocator *svcloc)
 Standard Constructor. More...
 
SmartIF< ISvcLocator > & serviceLocator () const
 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<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 >
PropertydeclareProperty (const std::string &name, T &property, const std::string &doc="none") const
 Declare the named property. More...
 
PropertydeclareRemoteProperty (const std::string &name, IProperty *rsvc, const std::string &rname="") const
 Declare remote named properties. More...
 
SmartIF< IAuditorSvc > & auditorSvc () const
 The standard auditor service.May not be invoked before sysInitialize() has been invoked. More...
 
- Public Member Functions inherited from CommonMessaging< implements3< IService, IProperty, IStateful > >
 CommonMessaging (const A1 &a1, const A2 &a2, const A3 &a3)
 Templated constructor with 3 arguments. More...
 
 CommonMessaging (const A1 &a1, const A2 &a2)
 Templated constructor with 2 arguments. More...
 
 CommonMessaging (const A1 &a1)
 Templated constructor with 1 argument. More...
 
 CommonMessaging ()
 Default constructor. More...
 
virtual ~CommonMessaging ()
 Virtual destructor. More...
 
SmartIF< IMessageSvc > & msgSvc () const
 The standard message service. More...
 
MsgStreammsgStream () const
 Return an uninitialized MsgStream. More...
 
MsgStreammsgStream (const MSG::Level level) const
 Predefined configurable message stream for the efficient printouts. More...
 
MsgStreamalways () const
 shortcut for the method msgStream(MSG::ALWAYS) More...
 
MsgStreamfatal () const
 shortcut for the method msgStream(MSG::FATAL) More...
 
MsgStreamerr () const
 shortcut for the method msgStream(MSG::ERROR) More...
 
MsgStreamerror () const
 shortcut for the method msgStream(MSG::ERROR) More...
 
MsgStreamwarning () const
 shortcut for the method msgStream(MSG::WARNING) More...
 
MsgStreaminfo () const
 shortcut for the method msgStream(MSG::INFO) More...
 
MsgStreamdebug () const
 shortcut for the method msgStream(MSG::DEBUG) More...
 
MsgStreamverbose () const
 shortcut for the method msgStream(MSG::VERBOSE) More...
 
MsgStreammsg () const
 shortcut for the method msgStream(MSG::INFO) More...
 
MSG::Level msgLevel () const
 get the output level from the embedded MsgStream More...
 
bool msgLevel (MSG::Level lvl) const
 get the output level from the embedded MsgStream More...
 
- Public Member Functions inherited from extend_interfaces3< IService, IProperty, IStateful >
virtual ~extend_interfaces3 ()
 Virtual destructor. More...
 
- Public Member Functions inherited from IService
 DeclareInterfaceID (IService, 3, 0)
 InterfaceID. More...
 
virtual ~IService ()
 virtual destructor More...
 
- Public Member Functions inherited from INamedInterface
 DeclareInterfaceID (INamedInterface, 1, 0)
 InterfaceID. More...
 
virtual ~INamedInterface ()
 Virtual destructor (always needed for abstract classes). More...
 
- Public Member Functions inherited from IInterface
virtual unsigned long addRef ()=0
 Increment the reference count of Interface instance. More...
 
virtual unsigned long refCount () const =0
 Current reference count. More...
 
virtual ~IInterface ()
 Virtual destructor. More...
 
- Public Member Functions inherited from IProperty
 DeclareInterfaceID (IProperty, 2, 0)
 InterfaceID. More...
 
- Public Member Functions inherited from IStateful
 DeclareInterfaceID (IStateful, 1, 0)
 InterfaceID. More...
 
virtual ~IStateful ()
 
- Public Member Functions inherited from extend_interfaces1< IEventProcessor >
virtual ~extend_interfaces1 ()
 Virtual destructor. More...
 
- Public Member Functions inherited from IEventProcessor
 DeclareInterfaceID (IEventProcessor, 3, 0)
 InterfaceID. More...
 

Protected Types

enum  State { OFFLINE, CONFIGURED, FINALIZED, INITIALIZED }
 

Protected Attributes

SmartIF< IAppMgrUIm_appMgrUI
 Reference to the IAppMgrUI interface of the application manager. More...
 
SmartIF< IIncidentSvcm_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
 State of the object. More...
 
bool m_scheduledStop
 Scheduled stop of event processing. More...
 
SmartIF< IIncidentListenerm_abortEventListener
 Instance of the incident listener waiting for AbortEvent. More...
 
bool m_abortEvent
 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
 Service output level. More...
 
Gaudi::StateMachine::State m_state
 Service state. More...
 
Gaudi::StateMachine::State m_targetState
 Service state. More...
 
- Protected Attributes inherited from CommonMessaging< implements3< IService, IProperty, IStateful > >
SmartIF< IMessageSvcm_msgsvc
 Pointer to the message service;. More...
 
std::auto_ptr< MsgStreamm_msgStream
 The predefined message stream. More...
 
bool m_streamWithService
 Flag to create a new MsgStream if it was created without the message service. More...
 

Private Member Functions

 MinimalEventLoopMgr (const MinimalEventLoopMgr &)
 Fake copy constructor (never implemented). More...
 
MinimalEventLoopMgroperator= (const MinimalEventLoopMgr &)
 Fake assignment operator (never implemented). More...
 

Additional Inherited Members

- Static Public Member Functions inherited from IInterface
static const InterfaceIDinterfaceID ()
 Return an instance of InterfaceID identifying the interface. More...
 
- Protected Member Functions inherited from Service
virtual ~Service ()
 Standard Destructor. More...
 
int outputLevel () const
 get the Service's output level More...
 
- Protected Member Functions inherited from CommonMessaging< implements3< IService, IProperty, IStateful > >
void updateMsgStreamOutputLevel (int level)
 Update the output level of the cached MsgStream. More...
 

Detailed Description

This is the default processing manager of the application manager.

This object handles the minimal requirements needed by the application manager. It also is capable of handling a bunch of algorithms and output streams. However, they list may as well be empty.

Author
Markus Frank
Version
1.0

Definition at line 26 of file MinimalEventLoopMgr.h.

Member Typedef Documentation

Definition at line 29 of file MinimalEventLoopMgr.h.

Definition at line 30 of file MinimalEventLoopMgr.h.

typedef std::list<std::string> MinimalEventLoopMgr::ListName

Definition at line 31 of file MinimalEventLoopMgr.h.

typedef std::vector<std::string> MinimalEventLoopMgr::VectorName

Definition at line 32 of file MinimalEventLoopMgr.h.

Member Enumeration Documentation

Constructor & Destructor Documentation

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

Standard Constructor.

Definition at line 52 of file MinimalEventLoopMgr.cpp.

53  : base_class(nam, svcLoc), m_appMgrUI(svcLoc)
54 {
55  declareProperty("TopAlg", m_topAlgNames );
56  declareProperty("OutStream", m_outStreamNames );
57  declareProperty("OutStreamType", m_outStreamType = "OutputStream");
60  m_state = OFFLINE;
61  m_scheduledStop = false;
62  m_abortEvent = false;
63 }
bool m_scheduledStop
Scheduled stop of event processing.
void outStreamHandler(Property &p)
Output stream List handler.
extends1 base_class
Typedef to this class.
Definition: extends.h:12
State m_state
State of the object.
virtual void declareUpdateHandler(PropertyCallbackFunctor *pf)
set new callback for update
Definition: Property.cpp:141
void topAlgHandler(Property &p)
Top algorithm List handler.
std::string m_outStreamType
Out Stream type.
StringArrayProperty m_topAlgNames
List of top level algorithms names.
Property * declareProperty(const std::string &name, T &property, const std::string &doc="none") const
Declare the named property.
Definition: Service.h:211
StringArrayProperty m_outStreamNames
List of output stream names.
SmartIF< IAppMgrUI > m_appMgrUI
Reference to the IAppMgrUI interface of the application manager.
bool m_abortEvent
Flag signalling that the event being processedhas to be aborted (skip all following top algs)...
MinimalEventLoopMgr::~MinimalEventLoopMgr ( )
virtual

Standard Destructor.

Definition at line 68 of file MinimalEventLoopMgr.cpp.

68  {
69  m_state = OFFLINE;
70 }
State m_state
State of the object.
MinimalEventLoopMgr::MinimalEventLoopMgr ( const MinimalEventLoopMgr )
private

Fake copy constructor (never implemented).

Member Function Documentation

StatusCode MinimalEventLoopMgr::decodeOutStreams ( )

decodeOutStreamNameList & outStreamNameListHandler

Definition at line 542 of file MinimalEventLoopMgr.cpp.

542  {
544  if ( CONFIGURED == m_state || INITIALIZED == m_state ) {
546  if ( algMan.isValid() ) {
547  // Reset the existing Top Algorithm List
548  m_outStreamList.clear();
549  const std::vector<std::string>& algNames = m_outStreamNames.value( );
550  for (VectorName::const_iterator it = algNames.begin(); it != algNames.end(); it++) {
552  DEBMSG << "Creating " << m_outStreamType << (*it) << endmsg;
553  const bool CREATE = false;
554  SmartIF<IAlgorithm> os = algMan->algorithm( item, CREATE );
555  if (os.isValid()) {
556  DEBMSG << "Output Stream " << item.name() << " already exists" << endmsg;
557  }
558  else {
559  DEBMSG << "Creating Output Stream " << (*it) << endmsg;
560  IAlgorithm* ios = 0;
561  StatusCode sc1 = algMan->createAlgorithm( item.type(), item.name(), ios );
562  if( !sc1.isSuccess() ) {
563  error() << "Unable to create Output Stream " << (*it) << endmsg;
564  return sc1;
565  }
566  os = ios; // manage reference counting
567  }
568  m_outStreamList.push_back( os );
569  }
570  return sc;
571  }
572  sc = StatusCode::FAILURE;
573  }
574  return sc;
575 }
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:75
State m_state
State of the object.
Helper class to parse a string of format "type/name".
Definition: TypeNameString.h:9
bool isValid() const
Allow for check if smart pointer is valid.
Definition: SmartIF.h:51
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:30
The IAlgorithm is the interface implemented by the Algorithm base class.
Definition: IAlgorithm.h:20
const TYPE & value() const
explicit conversion
Definition: Property.h:355
ListAlg m_outStreamList
List of output streams.
tuple item
print s1,s2
Definition: ana.py:146
std::string m_outStreamType
Out Stream type.
#define DEBMSG
MsgStream & error() const
shortcut for the method msgStream(MSG::ERROR)
StringArrayProperty m_outStreamNames
List of output stream names.
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
SmartIF< ISvcLocator > & serviceLocator() const
Retrieve pointer to service locator.
Definition: Service.cpp:336
StatusCode MinimalEventLoopMgr::decodeTopAlgs ( )

decodeTopAlgNameList & topAlgNameListHandler

Definition at line 492 of file MinimalEventLoopMgr.cpp.

492  {
494  if ( CONFIGURED == m_state || INITIALIZED == m_state ) {
496  if ( algMan.isValid()) {
497  // Reset the existing Top Algorithm List
498  m_topAlgList.clear( );
499  const std::vector<std::string>& algNames = m_topAlgNames.value( );
500  for (VectorName::const_iterator it = algNames.begin(); it != algNames.end(); it++) {
502  // Got the type and name. Now creating the algorithm, avoiding duplicate creation.
503  std::string item_name = item.name() + getGaudiThreadIDfromName(name());
504  const bool CREATE = false;
505  SmartIF<IAlgorithm> alg = algMan->algorithm(item_name, CREATE);
506  if (alg.isValid()) {
507  DEBMSG << "Top Algorithm " << item_name << " already exists" << endmsg;
508  }
509  else {
510  DEBMSG << "Creating Top Algorithm " << item.type() << " with name " << item_name << endmsg;
511  IAlgorithm *ialg = 0;
512  StatusCode sc1 = algMan->createAlgorithm(item.type(), item_name, ialg);
513  if( !sc1.isSuccess() ) {
514  error() << "Unable to create Top Algorithm " << item.type() << " with name " << item_name << endmsg;
515  return sc1;
516  }
517  alg = ialg; // manage reference counting
518  }
519  m_topAlgList.push_back(alg);
520  }
521  return sc;
522  }
523  sc = StatusCode::FAILURE;
524  }
525  return sc;
526 }
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:75
State m_state
State of the object.
Helper class to parse a string of format "type/name".
Definition: TypeNameString.h:9
bool isValid() const
Allow for check if smart pointer is valid.
Definition: SmartIF.h:51
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:30
The IAlgorithm is the interface implemented by the Algorithm base class.
Definition: IAlgorithm.h:20
const TYPE & value() const
explicit conversion
Definition: Property.h:355
virtual const std::string & name() const
Retrieve name of the service.
Definition: Service.cpp:331
tuple item
print s1,s2
Definition: ana.py:146
StringArrayProperty m_topAlgNames
List of top level algorithms names.
#define DEBMSG
GAUDI_API std::string getGaudiThreadIDfromName(const std::string &name)
helper function to extract Gaudi Thread ID from thread copy name
Definition: ThreadGaudi.cpp:28
MsgStream & error() const
shortcut for the method msgStream(MSG::ERROR)
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
ListAlg m_topAlgList
List of top level algorithms.
SmartIF< ISvcLocator > & serviceLocator() const
Retrieve pointer to service locator.
Definition: Service.cpp:336
StatusCode MinimalEventLoopMgr::executeEvent ( void *  par)
virtual

implementation of IEventProcessor::executeEvent(void* par)

Implements IEventProcessor.

Reimplemented in EventLoopMgr.

Definition at line 391 of file MinimalEventLoopMgr.cpp.

391  {
392  bool eventfailed = false;
393 
394  // Call the resetExecuted() method of ALL "known" algorithms
395  // (before we were reseting only the topalgs)
397  if (LIKELY(algMan.isValid())) {
398  const auto& allAlgs = algMan->getAlgorithms();
399  std::for_each( std::begin(allAlgs), std::end(allAlgs),
400  [](IAlgorithm* alg) {
401  if (LIKELY(alg!=nullptr)) alg->resetExecuted();
402  } );
403  }
404 
405  // Get the IProperty interface of the ApplicationMgr to pass it to RetCodeGuard
406  const SmartIF<IProperty> appmgr(serviceLocator());
407  // Call the execute() method of all top algorithms
408  for (ListAlg::iterator ita = m_topAlgList.begin(); ita != m_topAlgList.end(); ita++ ) {
410  try {
411  if (UNLIKELY(m_abortEvent)) {
412  DEBMSG << "AbortEvent incident fired by "
414  m_abortEvent = false;
415  sc.ignore();
416  break;
417  }
418  RetCodeGuard rcg(appmgr, Gaudi::ReturnCode::UnhandledException);
419  sc = (*ita)->sysExecute();
420  rcg.ignore(); // disarm the guard
421  } catch ( const GaudiException& Exception ) {
422  fatal() << ".executeEvent(): Exception with tag=" << Exception.tag()
423  << " thrown by " << (*ita)->name() << endmsg;
424  error() << Exception << endmsg;
425  } catch ( const std::exception& Exception ) {
426  fatal() << ".executeEvent(): Standard std::exception thrown by "
427  << (*ita)->name() << endmsg;
428  error() << Exception.what() << endmsg;
429  } catch(...) {
430  fatal() << ".executeEvent(): UNKNOWN Exception thrown by "
431  << (*ita)->name() << endmsg;
432  }
433 
434  if (UNLIKELY(!sc.isSuccess())) {
435  warning() << "Execution of algorithm " << (*ita)->name() << " failed" << endmsg;
436  eventfailed = true;
437  }
438  }
439 
440  // ensure that the abortEvent flag is cleared before the next event
441  if (UNLIKELY(m_abortEvent)) {
442  DEBMSG << "AbortEvent incident fired by " << m_abortEventSource << endmsg;
443  m_abortEvent = false;
444  }
445 
446  // Call the execute() method of all output streams
447  for (ListAlg::iterator ito = m_outStreamList.begin(); ito != m_outStreamList.end(); ito++ ) {
448  (*ito)->resetExecuted();
449  StatusCode sc;
450  sc = (*ito)->sysExecute();
451  if (UNLIKELY(!sc.isSuccess())) {
452  warning() << "Execution of output stream " << (*ito)->name() << " failed" << endmsg;
453  eventfailed = true;
454  }
455  }
456 
457  // Check if there was an error processing current event
458  if (UNLIKELY(eventfailed)){
459  error() << "Error processing event loop." << endmsg;
460  return StatusCode(StatusCode::FAILURE,true);
461  }
462  return StatusCode(StatusCode::SUCCESS,true);
463 }
#define UNLIKELY(x)
Definition: Kernel.h:127
Define general base for Gaudi exception.
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:75
MsgStream & warning() const
shortcut for the method msgStream(MSG::WARNING)
virtual void resetExecuted()=0
Reset the Algorithm executed state for the current event.
const int UnhandledException
Definition: AppReturnCode.h:27
std::string m_abortEventSource
Source of the AbortEvent incident.
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:30
virtual const std::string & tag() const
name tag for the exception, or exception type
The IAlgorithm is the interface implemented by the Algorithm base class.
Definition: IAlgorithm.h:20
tuple end
Definition: IOTest.py:101
#define LIKELY(x)
Definition: Kernel.h:126
ListAlg m_outStreamList
List of output streams.
MsgStream & fatal() const
shortcut for the method msgStream(MSG::FATAL)
#define DEBMSG
MsgStream & error() const
shortcut for the method msgStream(MSG::ERROR)
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
ListAlg m_topAlgList
List of top level algorithms.
bool m_abortEvent
Flag signalling that the event being processedhas to be aborted (skip all following top algs)...
SmartIF< ISvcLocator > & serviceLocator() const
Retrieve pointer to service locator.
Definition: Service.cpp:336
StatusCode MinimalEventLoopMgr::executeRun ( int  maxevt)
virtual

implementation of IEventProcessor::executeRun( )

Implements IEventProcessor.

Reimplemented in EventLoopMgr.

Definition at line 331 of file MinimalEventLoopMgr.cpp.

331  {
332  StatusCode sc;
333  ListAlg::iterator ita;
334  bool eventfailed = false;
335 
336  // Call the beginRun() method of all top algorithms
337  for (ita = m_topAlgList.begin(); ita != m_topAlgList.end(); ita++ ) {
338  sc = (*ita)->sysBeginRun();
339  if (!sc.isSuccess()) {
340  warning() << "beginRun() of algorithm " << (*ita)->name() << " failed" << endmsg;
341  eventfailed = true;
342  }
343  }
344 
345  // Call now the nextEvent(...)
346  sc = nextEvent(maxevt);
347  if (!sc.isSuccess()) {
348  eventfailed = true;
349  }
350 
351  // Call the endRun() method of all top algorithms
352  for (ita = m_topAlgList.begin(); ita != m_topAlgList.end(); ita++ ) {
353  sc = (*ita)->sysEndRun();
354  if (!sc.isSuccess()) {
355  warning() << "endRun() of algorithm " << (*ita)->name() << " failed" << endmsg;
356  eventfailed = true;
357  }
358  }
359 
360  if (eventfailed) {
361  return StatusCode::FAILURE;
362  }
363  else {
364  return StatusCode::SUCCESS;
365  }
366 }
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:75
MsgStream & warning() const
shortcut for the method msgStream(MSG::WARNING)
virtual StatusCode nextEvent(int maxevt)
implementation of IEventProcessor::nextEvent
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:30
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
ListAlg m_topAlgList
List of top level algorithms.
StatusCode MinimalEventLoopMgr::finalize ( )
virtual

implementation of IService::finalize

Reimplemented from Service.

Reimplemented in EventLoopMgr.

Definition at line 266 of file MinimalEventLoopMgr.cpp.

266  {
269  // Call the finalize() method of all top algorithms
270  ListAlg::iterator ita;
271  for ( ita = m_topAlgList.begin(); ita != m_topAlgList.end(); ita++ ) {
272  sc = (*ita)->sysFinalize();
273  if( !sc.isSuccess() ) {
274  scRet = StatusCode::FAILURE;
275  warning() << "Finalization of algorithm " << (*ita)->name() << " failed" << endmsg;
276  }
277  }
278  // Call the finalize() method of all Output streams
279  for ( ita = m_outStreamList.begin(); ita != m_outStreamList.end(); ita++ ) {
280  sc = (*ita)->sysFinalize();
281  if( !sc.isSuccess() ) {
282  scRet = StatusCode::FAILURE;
283  warning() << "Finalization of algorithm " << (*ita)->name() << " failed" << endmsg;
284  }
285  }
286  // release all top algorithms
288  for ( ita = m_topAlgList.begin(); ita != m_topAlgList.end(); ita++ ) {
289  if (algMan->removeAlgorithm(*ita).isFailure()) {
290  scRet = StatusCode::FAILURE;
291  warning() << "Problems removing Algorithm " << (*ita)->name() << endmsg;
292  }
293  }
294  m_topAlgList.clear();
295 
296  // release all output streams
297  for ( ita = m_outStreamList.begin(); ita != m_outStreamList.end(); ita++ ) {
298  (*ita)->release();
299  }
300  m_outStreamList.clear();
301  if ( sc.isSuccess() ) m_state = FINALIZED;
302 
304  m_abortEventListener = 0; // release
305 
306  m_incidentSvc = 0; // release
307  m_appMgrUI = 0; // release
308 
309  sc = Service::finalize();
310 
311  if (sc.isFailure()) {
312  scRet = StatusCode::FAILURE;
313  error() << "Problems finalizing Service base class" << endmsg;
314  }
315 
316  return scRet;
317 }
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:75
MsgStream & warning() const
shortcut for the method msgStream(MSG::WARNING)
bool isFailure() const
Test for a status code of FAILURE.
Definition: StatusCode.h:85
const std::string AbortEvent
Stop processing the current event and pass to te next one.
Definition: Incident.h:66
State m_state
State of the object.
SmartIF< IIncidentListener > m_abortEventListener
Instance of the incident listener waiting for AbortEvent.
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:30
SmartIF< IIncidentSvc > m_incidentSvc
Reference to the incident service.
ListAlg m_outStreamList
List of output streams.
MsgStream & error() const
shortcut for the method msgStream(MSG::ERROR)
virtual StatusCode finalize()
Finalize (from INITIALIZED to CONFIGURED).
Definition: Service.cpp:199
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
SmartIF< IAppMgrUI > m_appMgrUI
Reference to the IAppMgrUI interface of the application manager.
ListAlg m_topAlgList
List of top level algorithms.
SmartIF< ISvcLocator > & serviceLocator() const
Retrieve pointer to service locator.
Definition: Service.cpp:336
StatusCode MinimalEventLoopMgr::initialize ( )
virtual

implementation of IService::initialize

Reimplemented from Service.

Reimplemented in EventLoopMgr.

Definition at line 75 of file MinimalEventLoopMgr.cpp.

75  {
76 
77  if ( !m_appMgrUI.isValid() ) {
78  return StatusCode::FAILURE;
79  }
80 
82  if ( !sc.isSuccess() ) {
83  error() << "Failed to initialize Service Base class." << endmsg;
84  return StatusCode::FAILURE;
85  }
86 
88  if ( ! prpMgr.isValid() ) {
89  error() << "Error retrieving AppMgr interface IProperty." << endmsg;
90  return StatusCode::FAILURE;
91  }
92  else {
93  if ( m_topAlgNames.value().size() == 0 ) {
94  setProperty(prpMgr->getProperty("TopAlg")).ignore();
95  }
96  if ( m_outStreamNames.value().size() == 0 ) {
97  setProperty(prpMgr->getProperty("OutStream")).ignore();
98  }
99  }
100 
101  // Get the references to the services that are needed by the ApplicationMgr itself
102  m_incidentSvc = serviceLocator()->service("IncidentSvc");
103  if( !m_incidentSvc.isValid() ) {
104  fatal() << "Error retrieving IncidentSvc." << endmsg;
105  return StatusCode::FAILURE;
106  }
107 
108  m_abortEventListener = new AbortEventListener(m_abortEvent,m_abortEventSource);
110 
111  // The state is changed at this moment to allow decodeXXXX() to do something
113 
114  //--------------------------------------------------------------------------------------------
115  // Create output streams. Do not initialize them yet.
116  // The state is updated temporarily in order to enable the handler, which
117  // is also triggered by a change to the "OutputStream" Property.
118  //--------------------------------------------------------------------------------------------
119  sc = decodeOutStreams();
120  if ( !sc.isSuccess() ) {
121  error() << "Failed to initialize Output streams." << endmsg;
123  return sc;
124  }
125  //--------------------------------------------------------------------------------------------
126  // Create all needed Top Algorithms. Do not initialize them yet.
127  // The state is updated temporarily in order to enable the handler, which
128  // is also triggered by a change to the "TopAlg" Property.
129  //--------------------------------------------------------------------------------------------
130  sc = decodeTopAlgs();
131  if ( !sc.isSuccess() ) {
132  error() << "Failed to initialize Top Algorithms streams." << endmsg;
134  return sc;
135  }
136 
137  ListAlg::iterator ita;
138  // Initialize all the new TopAlgs. In fact Algorithms are protected against getting
139  // initialized twice.
140  for (ita = m_topAlgList.begin(); ita != m_topAlgList.end(); ita++ ) {
141  sc = (*ita)->sysInitialize();
142  if( !sc.isSuccess() ) {
143  error() << "Unable to initialize Algorithm: " << (*ita)->name() << endmsg;
144  return sc;
145  }
146  }
147  for (ita = m_outStreamList.begin(); ita != m_outStreamList.end(); ita++ ) {
148  sc = (*ita)->sysInitialize();
149  if( !sc.isSuccess() ) {
150  error() << "Unable to initialize Output Stream: " << (*ita)->name() << endmsg;
151  return sc;
152  }
153  }
154 
155  return StatusCode::SUCCESS;
156 }
virtual StatusCode setProperty(const Property &p)
Set the property by property.
Definition: Service.cpp:342
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:75
StatusCode decodeTopAlgs()
decodeTopAlgNameList & topAlgNameListHandler
const std::string AbortEvent
Stop processing the current event and pass to te next one.
Definition: Incident.h:66
State m_state
State of the object.
std::string m_abortEventSource
Source of the AbortEvent incident.
SmartIF< IIncidentListener > m_abortEventListener
Instance of the incident listener waiting for AbortEvent.
bool isValid() const
Allow for check if smart pointer is valid.
Definition: SmartIF.h:51
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:30
SmartIF< IIncidentSvc > m_incidentSvc
Reference to the incident service.
const TYPE & value() const
explicit conversion
Definition: Property.h:355
virtual StatusCode initialize()
Initialization (from CONFIGURED to INITIALIZED).
Definition: Service.cpp:74
ListAlg m_outStreamList
List of output streams.
MsgStream & fatal() const
shortcut for the method msgStream(MSG::FATAL)
StringArrayProperty m_topAlgNames
List of top level algorithms names.
StatusCode decodeOutStreams()
decodeOutStreamNameList & outStreamNameListHandler
MsgStream & error() const
shortcut for the method msgStream(MSG::ERROR)
StringArrayProperty m_outStreamNames
List of output stream names.
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
SmartIF< IAppMgrUI > m_appMgrUI
Reference to the IAppMgrUI interface of the application manager.
ListAlg m_topAlgList
List of top level algorithms.
bool m_abortEvent
Flag signalling that the event being processedhas to be aborted (skip all following top algs)...
SmartIF< ISvcLocator > & serviceLocator() const
Retrieve pointer to service locator.
Definition: Service.cpp:336
StatusCode MinimalEventLoopMgr::nextEvent ( int  maxevt)
virtual

implementation of IEventProcessor::nextEvent

Implements IEventProcessor.

Reimplemented in EventLoopMgr.

Definition at line 322 of file MinimalEventLoopMgr.cpp.

322  {
323  error() << "This method cannot be called on an object of type "
324  << System::typeinfoName(typeid(*this)) << endmsg;
325  return StatusCode::FAILURE;
326 }
GAUDI_API const std::string typeinfoName(const std::type_info &)
Get platform independent information about the class type.
Definition: System.cpp:298
MsgStream & error() const
shortcut for the method msgStream(MSG::ERROR)
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
MinimalEventLoopMgr& MinimalEventLoopMgr::operator= ( const MinimalEventLoopMgr )
private

Fake assignment operator (never implemented).

void MinimalEventLoopMgr::outStreamHandler ( Property p)

Output stream List handler.

Definition at line 531 of file MinimalEventLoopMgr.cpp.

531  {
532  if ( !(decodeOutStreams( )).isSuccess() ) {
533  throw GaudiException("Failed to initialize output streams.",
534  "MinimalEventLoopMgr::outStreamHandler",
536  }
537 }
Define general base for Gaudi exception.
StatusCode decodeOutStreams()
decodeOutStreamNameList & outStreamNameListHandler
StatusCode MinimalEventLoopMgr::reinitialize ( )
virtual

implementation of IService::reinitialize

Reimplemented from Service.

Reimplemented in EventLoopMgr.

Definition at line 215 of file MinimalEventLoopMgr.cpp.

215  {
217  ListAlg::iterator ita;
218 
219  // Reinitialize all the TopAlgs.
220  for (ita = m_topAlgList.begin(); ita != m_topAlgList.end(); ita++ ) {
221  sc = (*ita)->sysReinitialize();
222  if( !sc.isSuccess() ) {
223  error() << "Unable to reinitialize Algorithm: " << (*ita)->name() << endmsg;
224  return sc;
225  }
226  }
227  for (ita = m_outStreamList.begin(); ita != m_outStreamList.end(); ita++ ) {
228  sc = (*ita)->sysReinitialize();
229  if( !sc.isSuccess() ) {
230  error() << "Unable to reinitialize Output Stream: " << (*ita)->name() << endmsg;
231  return sc;
232  }
233  }
234 
235  return sc;
236 }
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:75
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:30
ListAlg m_outStreamList
List of output streams.
MsgStream & error() const
shortcut for the method msgStream(MSG::ERROR)
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
ListAlg m_topAlgList
List of top level algorithms.
StatusCode MinimalEventLoopMgr::restart ( )
virtual

implementation of IService::restart

Reimplemented from Service.

Definition at line 240 of file MinimalEventLoopMgr.cpp.

240  {
242  ListAlg::iterator ita;
243 
244  // Restart all the TopAlgs.
245  for (ita = m_topAlgList.begin(); ita != m_topAlgList.end(); ita++ ) {
246  sc = (*ita)->sysRestart();
247  if( !sc.isSuccess() ) {
248  error() << "Unable to restart Algorithm: " << (*ita)->name() << endmsg;
249  return sc;
250  }
251  }
252  for (ita = m_outStreamList.begin(); ita != m_outStreamList.end(); ita++ ) {
253  sc = (*ita)->sysRestart();
254  if( !sc.isSuccess() ) {
255  error() << "Unable to restart Output Stream: " << (*ita)->name() << endmsg;
256  return sc;
257  }
258  }
259 
260  return sc;
261 }
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:75
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:30
ListAlg m_outStreamList
List of output streams.
MsgStream & error() const
shortcut for the method msgStream(MSG::ERROR)
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
ListAlg m_topAlgList
List of top level algorithms.
StatusCode MinimalEventLoopMgr::start ( )
virtual

implementation of IService::start

Reimplemented from Service.

Definition at line 160 of file MinimalEventLoopMgr.cpp.

160  {
161 
163  if ( ! sc.isSuccess() ) return sc;
164 
165  ListAlg::iterator ita;
166  // Start all the new TopAlgs. In fact Algorithms are protected against getting
167  // started twice.
168  for (ita = m_topAlgList.begin(); ita != m_topAlgList.end(); ita++ ) {
169  sc = (*ita)->sysStart();
170  if( !sc.isSuccess() ) {
171  error() << "Unable to start Algorithm: " << (*ita)->name() << endmsg;
172  return sc;
173  }
174  }
175  for (ita = m_outStreamList.begin(); ita != m_outStreamList.end(); ita++ ) {
176  sc = (*ita)->sysStart();
177  if( !sc.isSuccess() ) {
178  error() << "Unable to start Output Stream: " << (*ita)->name() << endmsg;
179  return sc;
180  }
181  }
182  return StatusCode::SUCCESS;
183 }
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:75
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:30
ListAlg m_outStreamList
List of output streams.
virtual StatusCode start()
Start (from INITIALIZED to RUNNING).
Definition: Service.cpp:158
MsgStream & error() const
shortcut for the method msgStream(MSG::ERROR)
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
ListAlg m_topAlgList
List of top level algorithms.
StatusCode MinimalEventLoopMgr::stop ( )
virtual

implementation of IService::stop

Reimplemented from Service.

Reimplemented in EventLoopMgr.

Definition at line 187 of file MinimalEventLoopMgr.cpp.

187  {
188 
190 
191  ListAlg::iterator ita;
192  // Stop all the TopAlgs. In fact Algorithms are protected against getting
193  // stopped twice.
194  for (ita = m_topAlgList.begin(); ita != m_topAlgList.end(); ita++ ) {
195  sc = (*ita)->sysStop();
196  if( !sc.isSuccess() ) {
197  error() << "Unable to stop Algorithm: " << (*ita)->name() << endmsg;
198  return sc;
199  }
200  }
201  for (ita = m_outStreamList.begin(); ita != m_outStreamList.end(); ita++ ) {
202  sc = (*ita)->sysStop();
203  if( !sc.isSuccess() ) {
204  error() << "Unable to stop Output Stream: " << (*ita)->name() << endmsg;
205  return sc;
206  }
207  }
208 
209  return Service::stop();
210 }
virtual StatusCode stop()
Stop (from RUNNING to INITIALIZED).
Definition: Service.cpp:152
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:75
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:30
ListAlg m_outStreamList
List of output streams.
MsgStream & error() const
shortcut for the method msgStream(MSG::ERROR)
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
ListAlg m_topAlgList
List of top level algorithms.
StatusCode MinimalEventLoopMgr::stopRun ( )
virtual

implementation of IEventProcessor::stopRun( )

Implements IEventProcessor.

Definition at line 467 of file MinimalEventLoopMgr.cpp.

467  {
468  // Set the application return code
471  error() << "Could not set return code of the application ("
473  }
474  m_scheduledStop = true;
475  return StatusCode::SUCCESS;
476 }
bool m_scheduledStop
Scheduled stop of event processing.
StatusCode setAppReturnCode(SmartIF< IProperty > &appmgr, int value, bool force=false)
Set the application return code.
Definition: AppReturnCode.h:50
const int ScheduledStop
Definition: AppReturnCode.h:25
MsgStream & error() const
shortcut for the method msgStream(MSG::ERROR)
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
SmartIF< ISvcLocator > & serviceLocator() const
Retrieve pointer to service locator.
Definition: Service.cpp:336
void MinimalEventLoopMgr::topAlgHandler ( Property p)

Top algorithm List handler.

Definition at line 481 of file MinimalEventLoopMgr.cpp.

481  {
482  if ( !(decodeTopAlgs( )).isSuccess() ) {
483  throw GaudiException("Failed to initialize Top Algorithms streams.",
484  "MinimalEventLoopMgr::topAlgHandler",
486  }
487 }
Define general base for Gaudi exception.
StatusCode decodeTopAlgs()
decodeTopAlgNameList & topAlgNameListHandler

Member Data Documentation

bool MinimalEventLoopMgr::m_abortEvent
protected

Flag signalling that the event being processedhas to be aborted (skip all following top algs).

Definition at line 59 of file MinimalEventLoopMgr.h.

SmartIF<IIncidentListener> MinimalEventLoopMgr::m_abortEventListener
protected

Instance of the incident listener waiting for AbortEvent.

Definition at line 56 of file MinimalEventLoopMgr.h.

std::string MinimalEventLoopMgr::m_abortEventSource
protected

Source of the AbortEvent incident.

Definition at line 61 of file MinimalEventLoopMgr.h.

SmartIF<IAppMgrUI> MinimalEventLoopMgr::m_appMgrUI
protected

Reference to the IAppMgrUI interface of the application manager.

Definition at line 38 of file MinimalEventLoopMgr.h.

SmartIF<IIncidentSvc> MinimalEventLoopMgr::m_incidentSvc
protected

Reference to the incident service.

Definition at line 40 of file MinimalEventLoopMgr.h.

ListAlg MinimalEventLoopMgr::m_outStreamList
protected

List of output streams.

Definition at line 44 of file MinimalEventLoopMgr.h.

StringArrayProperty MinimalEventLoopMgr::m_outStreamNames
protected

List of output stream names.

Definition at line 50 of file MinimalEventLoopMgr.h.

std::string MinimalEventLoopMgr::m_outStreamType
protected

Out Stream type.

Definition at line 46 of file MinimalEventLoopMgr.h.

bool MinimalEventLoopMgr::m_scheduledStop
protected

Scheduled stop of event processing.

Definition at line 54 of file MinimalEventLoopMgr.h.

State MinimalEventLoopMgr::m_state
protected

State of the object.

Definition at line 52 of file MinimalEventLoopMgr.h.

ListAlg MinimalEventLoopMgr::m_topAlgList
protected

List of top level algorithms.

Definition at line 42 of file MinimalEventLoopMgr.h.

StringArrayProperty MinimalEventLoopMgr::m_topAlgNames
protected

List of top level algorithms names.

Definition at line 48 of file MinimalEventLoopMgr.h.


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