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 50 of file MinimalEventLoopMgr.cpp.

51  : base_class(nam, svcLoc), m_appMgrUI(svcLoc)
52 {
53  declareProperty("TopAlg", m_topAlgNames );
54  declareProperty("OutStream", m_outStreamNames );
55  declareProperty("OutStreamType", m_outStreamType = "OutputStream");
58  m_state = OFFLINE;
59  m_scheduledStop = false;
60  m_abortEvent = false;
61 }
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 66 of file MinimalEventLoopMgr.cpp.

66  {
67  m_state = OFFLINE;
68 }
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 539 of file MinimalEventLoopMgr.cpp.

539  {
541  if ( CONFIGURED == m_state || INITIALIZED == m_state ) {
543  if ( algMan.isValid() ) {
544  // Reset the existing Top Algorithm List
545  m_outStreamList.clear();
546  const std::vector<std::string>& algNames = m_outStreamNames.value( );
547  for (VectorName::const_iterator it = algNames.begin(); it != algNames.end(); it++) {
549  DEBMSG << "Creating " << m_outStreamType << (*it) << endmsg;
550  const bool CREATE = false;
551  SmartIF<IAlgorithm> os = algMan->algorithm( item, CREATE );
552  if (os.isValid()) {
553  DEBMSG << "Output Stream " << item.name() << " already exists" << endmsg;
554  }
555  else {
556  DEBMSG << "Creating Output Stream " << (*it) << endmsg;
557  IAlgorithm* ios = 0;
558  StatusCode sc1 = algMan->createAlgorithm( item.type(), item.name(), ios );
559  if( !sc1.isSuccess() ) {
560  error() << "Unable to create Output Stream " << (*it) << endmsg;
561  return sc1;
562  }
563  os = ios; // manage reference counting
564  }
565  m_outStreamList.push_back( os );
566  }
567  return sc;
568  }
569  sc = StatusCode::FAILURE;
570  }
571  return sc;
572 }
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:62
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 489 of file MinimalEventLoopMgr.cpp.

489  {
491  if ( CONFIGURED == m_state || INITIALIZED == m_state ) {
493  if ( algMan.isValid()) {
494  // Reset the existing Top Algorithm List
495  m_topAlgList.clear( );
496  const std::vector<std::string>& algNames = m_topAlgNames.value( );
497  for (VectorName::const_iterator it = algNames.begin(); it != algNames.end(); it++) {
499  // Got the type and name. Now creating the algorithm, avoiding duplicate creation.
500  std::string item_name = item.name() + getGaudiThreadIDfromName(name());
501  const bool CREATE = false;
502  SmartIF<IAlgorithm> alg = algMan->algorithm(item_name, CREATE);
503  if (alg.isValid()) {
504  DEBMSG << "Top Algorithm " << item_name << " already exists" << endmsg;
505  }
506  else {
507  DEBMSG << "Creating Top Algorithm " << item.type() << " with name " << item_name << endmsg;
508  IAlgorithm *ialg = 0;
509  StatusCode sc1 = algMan->createAlgorithm(item.type(), item_name, ialg);
510  if( !sc1.isSuccess() ) {
511  error() << "Unable to create Top Algorithm " << item.type() << " with name " << item_name << endmsg;
512  return sc1;
513  }
514  alg = ialg; // manage reference counting
515  }
516  m_topAlgList.push_back(alg);
517  }
518  return sc;
519  }
520  sc = StatusCode::FAILURE;
521  }
522  return sc;
523 }
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:62
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 389 of file MinimalEventLoopMgr.cpp.

389  {
390  bool eventfailed = false;
391 
392  // Call the resetExecuted() method of ALL "known" algorithms
393  // (before we were reseting only the topalgs)
395  if (LIKELY(algMan.isValid())) {
396  const ListAlgPtrs& allAlgs = algMan->getAlgorithms() ;
397  for( ListAlgPtrs::const_iterator ialg = allAlgs.begin() ; allAlgs.end() != ialg ; ++ialg ) {
398  if (LIKELY(0 != *ialg)) (*ialg)->resetExecuted();
399  }
400  }
401 
402  // Get the IProperty interface of the ApplicationMgr to pass it to RetCodeGuard
403  const SmartIF<IProperty> appmgr(serviceLocator());
404  // Call the execute() method of all top algorithms
405  for (ListAlg::iterator ita = m_topAlgList.begin(); ita != m_topAlgList.end(); ita++ ) {
407  try {
408  if (UNLIKELY(m_abortEvent)) {
409  DEBMSG << "AbortEvent incident fired by "
411  m_abortEvent = false;
412  sc.ignore();
413  break;
414  }
415  RetCodeGuard rcg(appmgr, Gaudi::ReturnCode::UnhandledException);
416  sc = (*ita)->sysExecute();
417  rcg.ignore(); // disarm the guard
418  } catch ( const GaudiException& Exception ) {
419  fatal() << ".executeEvent(): Exception with tag=" << Exception.tag()
420  << " thrown by " << (*ita)->name() << endmsg;
421  error() << Exception << endmsg;
422  } catch ( const std::exception& Exception ) {
423  fatal() << ".executeEvent(): Standard std::exception thrown by "
424  << (*ita)->name() << endmsg;
425  error() << Exception.what() << endmsg;
426  } catch(...) {
427  fatal() << ".executeEvent(): UNKNOWN Exception thrown by "
428  << (*ita)->name() << endmsg;
429  }
430 
431  if (UNLIKELY(!sc.isSuccess())) {
432  warning() << "Execution of algorithm " << (*ita)->name() << " failed" << endmsg;
433  eventfailed = true;
434  }
435  }
436 
437  // ensure that the abortEvent flag is cleared before the next event
438  if (UNLIKELY(m_abortEvent)) {
439  DEBMSG << "AbortEvent incident fired by " << m_abortEventSource << endmsg;
440  m_abortEvent = false;
441  }
442 
443  // Call the execute() method of all output streams
444  for (ListAlg::iterator ito = m_outStreamList.begin(); ito != m_outStreamList.end(); ito++ ) {
445  (*ito)->resetExecuted();
446  StatusCode sc;
447  sc = (*ito)->sysExecute();
448  if (UNLIKELY(!sc.isSuccess())) {
449  warning() << "Execution of output stream " << (*ito)->name() << " failed" << endmsg;
450  eventfailed = true;
451  }
452  }
453 
454  // Check if there was an error processing current event
455  if (UNLIKELY(eventfailed)){
456  error() << "Error processing event loop." << endmsg;
457  return StatusCode(StatusCode::FAILURE,true);
458  }
459  return StatusCode(StatusCode::SUCCESS,true);
460 }
#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:62
std::list< IAlgorithm * > ListAlgPtrs
MsgStream & warning() const
shortcut for the method msgStream(MSG::WARNING)
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
#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 329 of file MinimalEventLoopMgr.cpp.

329  {
330  StatusCode sc;
331  ListAlg::iterator ita;
332  bool eventfailed = false;
333 
334  // Call the beginRun() method of all top algorithms
335  for (ita = m_topAlgList.begin(); ita != m_topAlgList.end(); ita++ ) {
336  sc = (*ita)->sysBeginRun();
337  if (!sc.isSuccess()) {
338  warning() << "beginRun() of algorithm " << (*ita)->name() << " failed" << endmsg;
339  eventfailed = true;
340  }
341  }
342 
343  // Call now the nextEvent(...)
344  sc = nextEvent(maxevt);
345  if (!sc.isSuccess()) {
346  eventfailed = true;
347  }
348 
349  // Call the endRun() method of all top algorithms
350  for (ita = m_topAlgList.begin(); ita != m_topAlgList.end(); ita++ ) {
351  sc = (*ita)->sysEndRun();
352  if (!sc.isSuccess()) {
353  warning() << "endRun() of algorithm " << (*ita)->name() << " failed" << endmsg;
354  eventfailed = true;
355  }
356  }
357 
358  if (eventfailed) {
359  return StatusCode::FAILURE;
360  }
361  else {
362  return StatusCode::SUCCESS;
363  }
364 }
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:62
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 264 of file MinimalEventLoopMgr.cpp.

264  {
267  // Call the finalize() method of all top algorithms
268  ListAlg::iterator ita;
269  for ( ita = m_topAlgList.begin(); ita != m_topAlgList.end(); ita++ ) {
270  sc = (*ita)->sysFinalize();
271  if( !sc.isSuccess() ) {
272  scRet = StatusCode::FAILURE;
273  warning() << "Finalization of algorithm " << (*ita)->name() << " failed" << endmsg;
274  }
275  }
276  // Call the finalize() method of all Output streams
277  for ( ita = m_outStreamList.begin(); ita != m_outStreamList.end(); ita++ ) {
278  sc = (*ita)->sysFinalize();
279  if( !sc.isSuccess() ) {
280  scRet = StatusCode::FAILURE;
281  warning() << "Finalization of algorithm " << (*ita)->name() << " failed" << endmsg;
282  }
283  }
284  // release all top algorithms
286  for ( ita = m_topAlgList.begin(); ita != m_topAlgList.end(); ita++ ) {
287  if (algMan->removeAlgorithm(*ita).isFailure()) {
288  scRet = StatusCode::FAILURE;
289  warning() << "Problems removing Algorithm " << (*ita)->name() << endmsg;
290  }
291  }
292  m_topAlgList.clear();
293 
294  // release all output streams
295  for ( ita = m_outStreamList.begin(); ita != m_outStreamList.end(); ita++ ) {
296  (*ita)->release();
297  }
298  m_outStreamList.clear();
299  if ( sc.isSuccess() ) m_state = FINALIZED;
300 
302  m_abortEventListener = 0; // release
303 
304  m_incidentSvc = 0; // release
305  m_appMgrUI = 0; // release
306 
307  sc = Service::finalize();
308 
309  if (sc.isFailure()) {
310  scRet = StatusCode::FAILURE;
311  error() << "Problems finalizing Service base class" << endmsg;
312  }
313 
314  return scRet;
315 }
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:62
MsgStream & warning() const
shortcut for the method msgStream(MSG::WARNING)
bool isFailure() const
Test for a status code of FAILURE.
Definition: StatusCode.h:72
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 73 of file MinimalEventLoopMgr.cpp.

73  {
74 
75  if ( !m_appMgrUI.isValid() ) {
76  return StatusCode::FAILURE;
77  }
78 
80  if ( !sc.isSuccess() ) {
81  error() << "Failed to initialize Service Base class." << endmsg;
82  return StatusCode::FAILURE;
83  }
84 
86  if ( ! prpMgr.isValid() ) {
87  error() << "Error retrieving AppMgr interface IProperty." << endmsg;
88  return StatusCode::FAILURE;
89  }
90  else {
91  if ( m_topAlgNames.value().size() == 0 ) {
92  setProperty(prpMgr->getProperty("TopAlg")).ignore();
93  }
94  if ( m_outStreamNames.value().size() == 0 ) {
95  setProperty(prpMgr->getProperty("OutStream")).ignore();
96  }
97  }
98 
99  // Get the references to the services that are needed by the ApplicationMgr itself
100  m_incidentSvc = serviceLocator()->service("IncidentSvc");
101  if( !m_incidentSvc.isValid() ) {
102  fatal() << "Error retrieving IncidentSvc." << endmsg;
103  return StatusCode::FAILURE;
104  }
105 
106  m_abortEventListener = new AbortEventListener(m_abortEvent,m_abortEventSource);
108 
109  // The state is changed at this moment to allow decodeXXXX() to do something
111 
112  //--------------------------------------------------------------------------------------------
113  // Create output streams. Do not initialize them yet.
114  // The state is updated temporarily in order to enable the handler, which
115  // is also triggered by a change to the "OutputStream" Property.
116  //--------------------------------------------------------------------------------------------
117  sc = decodeOutStreams();
118  if ( !sc.isSuccess() ) {
119  error() << "Failed to initialize Output streams." << endmsg;
121  return sc;
122  }
123  //--------------------------------------------------------------------------------------------
124  // Create all needed Top Algorithms. Do not initialize them yet.
125  // The state is updated temporarily in order to enable the handler, which
126  // is also triggered by a change to the "TopAlg" Property.
127  //--------------------------------------------------------------------------------------------
128  sc = decodeTopAlgs();
129  if ( !sc.isSuccess() ) {
130  error() << "Failed to initialize Top Algorithms streams." << endmsg;
132  return sc;
133  }
134 
135  ListAlg::iterator ita;
136  // Initialize all the new TopAlgs. In fact Algorithms are protected against getting
137  // initialized twice.
138  for (ita = m_topAlgList.begin(); ita != m_topAlgList.end(); ita++ ) {
139  sc = (*ita)->sysInitialize();
140  if( !sc.isSuccess() ) {
141  error() << "Unable to initialize Algorithm: " << (*ita)->name() << endmsg;
142  return sc;
143  }
144  }
145  for (ita = m_outStreamList.begin(); ita != m_outStreamList.end(); ita++ ) {
146  sc = (*ita)->sysInitialize();
147  if( !sc.isSuccess() ) {
148  error() << "Unable to initialize Output Stream: " << (*ita)->name() << endmsg;
149  return sc;
150  }
151  }
152 
153  return StatusCode::SUCCESS;
154 }
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:62
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 320 of file MinimalEventLoopMgr.cpp.

320  {
321  error() << "This method cannot be called on an object of type "
322  << System::typeinfoName(typeid(*this)) << endmsg;
323  return StatusCode::FAILURE;
324 }
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 528 of file MinimalEventLoopMgr.cpp.

528  {
529  if ( !(decodeOutStreams( )).isSuccess() ) {
530  throw GaudiException("Failed to initialize output streams.",
531  "MinimalEventLoopMgr::outStreamHandler",
533  }
534 }
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 213 of file MinimalEventLoopMgr.cpp.

213  {
215  ListAlg::iterator ita;
216 
217  // Reinitialize all the TopAlgs.
218  for (ita = m_topAlgList.begin(); ita != m_topAlgList.end(); ita++ ) {
219  sc = (*ita)->sysReinitialize();
220  if( !sc.isSuccess() ) {
221  error() << "Unable to reinitialize Algorithm: " << (*ita)->name() << endmsg;
222  return sc;
223  }
224  }
225  for (ita = m_outStreamList.begin(); ita != m_outStreamList.end(); ita++ ) {
226  sc = (*ita)->sysReinitialize();
227  if( !sc.isSuccess() ) {
228  error() << "Unable to reinitialize Output Stream: " << (*ita)->name() << endmsg;
229  return sc;
230  }
231  }
232 
233  return sc;
234 }
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:62
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 238 of file MinimalEventLoopMgr.cpp.

238  {
240  ListAlg::iterator ita;
241 
242  // Restart all the TopAlgs.
243  for (ita = m_topAlgList.begin(); ita != m_topAlgList.end(); ita++ ) {
244  sc = (*ita)->sysRestart();
245  if( !sc.isSuccess() ) {
246  error() << "Unable to restart Algorithm: " << (*ita)->name() << endmsg;
247  return sc;
248  }
249  }
250  for (ita = m_outStreamList.begin(); ita != m_outStreamList.end(); ita++ ) {
251  sc = (*ita)->sysRestart();
252  if( !sc.isSuccess() ) {
253  error() << "Unable to restart Output Stream: " << (*ita)->name() << endmsg;
254  return sc;
255  }
256  }
257 
258  return sc;
259 }
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:62
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 158 of file MinimalEventLoopMgr.cpp.

158  {
159 
161  if ( ! sc.isSuccess() ) return sc;
162 
163  ListAlg::iterator ita;
164  // Start all the new TopAlgs. In fact Algorithms are protected against getting
165  // started twice.
166  for (ita = m_topAlgList.begin(); ita != m_topAlgList.end(); ita++ ) {
167  sc = (*ita)->sysStart();
168  if( !sc.isSuccess() ) {
169  error() << "Unable to start Algorithm: " << (*ita)->name() << endmsg;
170  return sc;
171  }
172  }
173  for (ita = m_outStreamList.begin(); ita != m_outStreamList.end(); ita++ ) {
174  sc = (*ita)->sysStart();
175  if( !sc.isSuccess() ) {
176  error() << "Unable to start Output Stream: " << (*ita)->name() << endmsg;
177  return sc;
178  }
179  }
180  return StatusCode::SUCCESS;
181 }
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:62
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 185 of file MinimalEventLoopMgr.cpp.

185  {
186 
188 
189  ListAlg::iterator ita;
190  // Stop all the TopAlgs. In fact Algorithms are protected against getting
191  // stopped twice.
192  for (ita = m_topAlgList.begin(); ita != m_topAlgList.end(); ita++ ) {
193  sc = (*ita)->sysStop();
194  if( !sc.isSuccess() ) {
195  error() << "Unable to stop Algorithm: " << (*ita)->name() << endmsg;
196  return sc;
197  }
198  }
199  for (ita = m_outStreamList.begin(); ita != m_outStreamList.end(); ita++ ) {
200  sc = (*ita)->sysStop();
201  if( !sc.isSuccess() ) {
202  error() << "Unable to stop Output Stream: " << (*ita)->name() << endmsg;
203  return sc;
204  }
205  }
206 
207  return Service::stop();
208 }
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:62
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 464 of file MinimalEventLoopMgr.cpp.

464  {
465  // Set the application return code
468  error() << "Could not set return code of the application ("
470  }
471  m_scheduledStop = true;
472  return StatusCode::SUCCESS;
473 }
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 478 of file MinimalEventLoopMgr.cpp.

478  {
479  if ( !(decodeTopAlgs( )).isSuccess() ) {
480  throw GaudiException("Failed to initialize Top Algorithms streams.",
481  "MinimalEventLoopMgr::topAlgHandler",
483  }
484 }
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: