Gaudi Framework, version v23r7

Home   Generated: Wed Mar 20 2013
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Public Member Functions | Protected Attributes | List of all members
EventLoopMgr Class Reference

Class definition of EventLoopMgr. More...

#include <EventLoopMgr.h>

Inheritance diagram for EventLoopMgr:
Inheritance graph
[legend]
Collaboration diagram for EventLoopMgr:
Collaboration graph
[legend]

Public Member Functions

 EventLoopMgr (const std::string &nam, ISvcLocator *svcLoc)
 Standard Constructor.
 
virtual ~EventLoopMgr ()
 Standard Destructor.
 
StatusCode getEventRoot (IOpaqueAddress *&refpAddr)
 Create event address using event selector.
 
virtual StatusCode initialize ()
 implementation of IService::initialize
 
virtual StatusCode reinitialize ()
 implementation of IService::reinitialize
 
virtual StatusCode stop ()
 implementation of IService::stop
 
virtual StatusCode finalize ()
 implementation of IService::finalize
 
virtual StatusCode nextEvent (int maxevt)
 implementation of IService::nextEvent
 
virtual StatusCode executeEvent (void *par)
 implementation of IEventProcessor::executeEvent(void* par)
 
virtual StatusCode executeRun (int maxevt)
 implementation of IEventProcessor::executeRun()
 
- Public Member Functions inherited from MinimalEventLoopMgr
 MinimalEventLoopMgr (const std::string &nam, ISvcLocator *svcLoc)
 Standard Constructor.
 
virtual ~MinimalEventLoopMgr ()
 Standard Destructor.
 
virtual StatusCode start ()
 implementation of IService::start
 
virtual StatusCode restart ()
 implementation of IService::restart
 
virtual StatusCode stopRun ()
 implementation of IEventProcessor::stopRun( )
 
void topAlgHandler (Property &p)
 Top algorithm List handler.
 
StatusCode decodeTopAlgs ()
 decodeTopAlgNameList & topAlgNameListHandler
 
void outStreamHandler (Property &p)
 Output stream List handler.
 
StatusCode decodeOutStreams ()
 decodeOutStreamNameList & outStreamNameListHandler
 
- Public Member Functions inherited from extends1< Service, IEventProcessor >
 extends1 (A1 a1, A2 a2, A3 a3)
 Templated constructor with 3 arguments.
 
 extends1 (A1 a1, A2 a2)
 Templated constructor with 2 arguments.
 
 extends1 (A1 a1)
 Templated constructor with 1 argument.
 
 extends1 ()
 Default constructor.
 
virtual void * i_cast (const InterfaceID &tid) const
 Implementation of IInterface::i_cast.
 
virtual StatusCode queryInterface (const InterfaceID &ti, void **pp)
 Implementation of IInterface::queryInterface.
 
virtual std::vector< std::stringgetInterfaceNames () const
 Implementation of IInterface::getInterfaceNames.
 
virtual ~extends1 ()
 Virtual destructor.
 
- Public Member Functions inherited from Service
virtual unsigned long release ()
 Release Interface instance.
 
virtual const std::stringname () const
 Retrieve name of the service.
 
virtual StatusCode configure ()
 
virtual StatusCode terminate ()
 
virtual Gaudi::StateMachine::State FSMState () const
 
virtual Gaudi::StateMachine::State targetFSMState () const
 
virtual StatusCode sysInitialize ()
 Initialize Service.
 
virtual StatusCode sysStart ()
 Initialize Service.
 
virtual StatusCode sysStop ()
 Initialize Service.
 
virtual StatusCode sysFinalize ()
 Finalize Service.
 
virtual StatusCode sysReinitialize ()
 Re-initialize the Service.
 
virtual StatusCode sysRestart ()
 Re-initialize the Service.
 
virtual StatusCode setProperty (const Property &p)
 
virtual StatusCode setProperty (const std::string &s)
 
virtual StatusCode setProperty (const std::string &n, const std::string &v)
 
virtual StatusCode getProperty (Property *p) const
 
virtual const PropertygetProperty (const std::string &name) const
 
virtual StatusCode getProperty (const std::string &n, std::string &v) const
 
virtual const std::vector
< Property * > & 
getProperties () const
 
template<class TYPE >
StatusCode setProperty (const std::string &name, const TYPE &value)
 set the property form the value
 
 Service (const std::string &name, ISvcLocator *svcloc)
 Standard Constructor.
 
SmartIF< ISvcLocator > & serviceLocator () const
 Retrieve pointer to service locator.
 
StatusCode setProperties ()
 Method for setting declared properties to the values specified for the job.
 
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.
 
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.
 
template<class T >
PropertydeclareProperty (const std::string &name, T &property, const std::string &doc="none") const
 Declare the named property.
 
PropertydeclareRemoteProperty (const std::string &name, IProperty *rsvc, const std::string &rname="") const
 Declare remote named properties.
 
SmartIF< IAuditorSvc > & auditorSvc () const
 The standard auditor service.May not be invoked before sysInitialize() has been invoked.
 
- 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.
 
 CommonMessaging (const A1 &a1, const A2 &a2)
 Templated constructor with 2 arguments.
 
 CommonMessaging (const A1 &a1)
 Templated constructor with 1 argument.
 
 CommonMessaging ()
 Default constructor.
 
virtual ~CommonMessaging ()
 Virtual destructor.
 
SmartIF< IMessageSvc > & msgSvc () const
 The standard message service.
 
MsgStreammsgStream () const
 Return an uninitialized MsgStream.
 
MsgStreammsgStream (const MSG::Level level) const
 Predefined configurable message stream for the efficient printouts.
 
MsgStreamalways () const
 shortcut for the method msgStream(MSG::ALWAYS)
 
MsgStreamfatal () const
 shortcut for the method msgStream(MSG::FATAL)
 
MsgStreamerr () const
 shortcut for the method msgStream(MSG::ERROR)
 
MsgStreamerror () const
 shortcut for the method msgStream(MSG::ERROR)
 
MsgStreamwarning () const
 shortcut for the method msgStream(MSG::WARNING)
 
MsgStreaminfo () const
 shortcut for the method msgStream(MSG::INFO)
 
MsgStreamdebug () const
 shortcut for the method msgStream(MSG::DEBUG)
 
MsgStreamverbose () const
 shortcut for the method msgStream(MSG::VERBOSE)
 
MsgStreammsg () const
 shortcut for the method msgStream(MSG::INFO)
 
MSG::Level msgLevel () const
 get the output level from the embedded MsgStream
 
bool msgLevel (MSG::Level lvl) const
 get the output level from the embedded MsgStream
 
- Public Member Functions inherited from extend_interfaces1< IEventProcessor >
virtual ~extend_interfaces1 ()
 Virtual destructor.
 
- Public Member Functions inherited from IEventProcessor
 DeclareInterfaceID (IEventProcessor, 3, 0)
 InterfaceID.
 
- Public Member Functions inherited from IInterface
virtual unsigned long addRef ()=0
 Increment the reference count of Interface instance.
 
virtual unsigned long release ()=0
 Release Interface instance.
 
virtual unsigned long refCount () const =0
 Current reference count.
 
virtual ~IInterface ()
 Virtual destructor.
 

Protected Attributes

SmartIF< IDataManagerSvcm_evtDataMgrSvc
 Reference to the Event Data Service's IDataManagerSvc interface.
 
SmartIF< IDataProviderSvcm_evtDataSvc
 Reference to the Event Data Service's IDataProviderSvc interface.
 
SmartIF< IEvtSelectorm_evtSelector
 Reference to the Event Selector.
 
IEvtSelector::Contextm_evtContext
 Event Iterator.
 
std::string m_evtsel
 Event selector.
 
SmartIF< IDataManagerSvcm_histoDataMgrSvc
 Reference to the Histogram Data Service.
 
SmartIF< IConversionSvcm_histoPersSvc
 Reference to the Histogram Persistency Service.
 
std::string m_histPersName
 Name of the Hist Pers type.
 
SmartIF< IPropertym_appMgrProperty
 Property interface of ApplicationMgr.
 
bool m_endEventFired
 Flag to avoid to fire the EnvEvent incident twice in a row (and also not before the first event)
 
bool m_warnings
 Flag to disable warning messages when using external input.
 
- Protected Attributes inherited from MinimalEventLoopMgr
SmartIF< IAppMgrUIm_appMgrUI
 Reference to the IAppMgrUI interface of the application manager.
 
SmartIF< IIncidentSvcm_incidentSvc
 Reference to the incident service.
 
ListAlg m_topAlgList
 List of top level algorithms.
 
ListAlg m_outStreamList
 List of output streams.
 
std::string m_outStreamType
 Out Stream type.
 
StringArrayProperty m_topAlgNames
 List of top level algorithms names.
 
StringArrayProperty m_outStreamNames
 List of output stream names.
 
State m_state
 State of the object.
 
bool m_scheduledStop
 Scheduled stop of event processing.
 
SmartIF< IIncidentListenerm_abortEventListener
 Instance of the incident listener waiting for AbortEvent.
 
bool m_abortEvent
 Flag signalling that the event being processedhas to be aborted (skip all following top algs).
 
std::string m_abortEventSource
 Source of the AbortEvent incident.
 

Additional Inherited Members

- Public Types inherited from MinimalEventLoopMgr
typedef std::list< SmartIF
< IAlgorithm > > 
ListAlg
 Creator friend class.
 
typedef std::list< IAlgorithm * > ListAlgPtrs
 
typedef std::list< std::stringListName
 
typedef std::vector< std::stringVectorName
 
- Static Public Member Functions inherited from IInterface
static const InterfaceIDinterfaceID ()
 Return an instance of InterfaceID identifying the interface.
 
- Protected Types inherited from MinimalEventLoopMgr
enum  State { OFFLINE, CONFIGURED, FINALIZED, INITIALIZED }
 
- Protected Member Functions inherited from Service
virtual ~Service ()
 Standard Destructor.
 
int outputLevel () const
 get the Service's output level
 

Detailed Description

Class definition of EventLoopMgr.

This is the default processing manager of the application manager. This object handles the minimal requirements needed by the application manager. It also handles the default user configuration setup for standard event processing.

History:

 +---------+----------------------------------------------+---------+
 |    Date |                 Comment                      | Who     |
 +---------+----------------------------------------------+---------+
 |13/12/00 | Initial version                              | M.Frank |
 +---------+----------------------------------------------+---------+
 
Author
Markus Frank
Version
1.0

Definition at line 39 of file EventLoopMgr.h.

Constructor & Destructor Documentation

EventLoopMgr::EventLoopMgr ( const std::string nam,
ISvcLocator svcLoc 
)

Standard Constructor.

Definition at line 32 of file EventLoopMgr.cpp.

: MinimalEventLoopMgr(nam, svcLoc)
{
// Declare properties
declareProperty("HistogramPersistency", m_histPersName = "");
declareProperty("Warnings",m_warnings=true,
"Set this property to false to suppress warning messages");
}
EventLoopMgr::~EventLoopMgr ( )
virtual

Standard Destructor.

Definition at line 53 of file EventLoopMgr.cpp.

{
if( m_histoPersSvc ) m_histoPersSvc->release();
if( m_evtDataMgrSvc ) m_evtDataMgrSvc->release();
if( m_evtDataSvc ) m_evtDataSvc->release();
if( m_evtSelector ) m_evtSelector->release();
if( m_evtContext ) delete m_evtContext;
}

Member Function Documentation

StatusCode EventLoopMgr::executeEvent ( void *  par)
virtual

implementation of IEventProcessor::executeEvent(void* par)

Reimplemented from MinimalEventLoopMgr.

Definition at line 288 of file EventLoopMgr.cpp.

{
// Fire BeginEvent "Incident"
// An incident may schedule a stop, in which case is better to exit before the actual execution.
if ( m_scheduledStop ) {
always() << "Terminating event processing loop due to a stop scheduled by an incident listener" << endmsg;
}
// Execute Algorithms
// Check if there was an error processing current event
if( UNLIKELY(!sc.isSuccess()) ){
error() << "Terminating event processing loop due to errors" << endmsg;
}
return sc;
}
StatusCode EventLoopMgr::executeRun ( int  maxevt)
virtual

implementation of IEventProcessor::executeRun()

Reimplemented from MinimalEventLoopMgr.

Definition at line 313 of file EventLoopMgr.cpp.

{
// initialize the base class
return sc;
}
StatusCode EventLoopMgr::finalize ( )
virtual

implementation of IService::finalize

Reimplemented from MinimalEventLoopMgr.

Definition at line 219 of file EventLoopMgr.cpp.

{
// Finalize base class
if (! sc.isSuccess()) {
error() << "Error finalizing base class" << endmsg;
return sc;
}
// Save Histograms Now
if ( m_histoPersSvc != 0 ) {
sc = m_histoDataMgrSvc->traverseTree( &agent );
if( sc.isSuccess() ) {
IDataSelector* objects = agent.selectedObjects();
// skip /stat entry!
if ( objects->size() > 0 ) {
for ( i = objects->begin(); i != objects->end(); i++ ) {
IOpaqueAddress* pAddr = 0;
StatusCode iret = m_histoPersSvc->createRep(*i, pAddr);
if ( iret.isSuccess() ) {
(*i)->registry()->setAddress(pAddr);
}
else {
sc = iret;
}
}
for ( i = objects->begin(); i != objects->end(); i++ ) {
IRegistry* reg = (*i)->registry();
StatusCode iret = m_histoPersSvc->fillRepRefs(reg->address(), *i);
if ( !iret.isSuccess() ) {
sc = iret;
}
}
}
if ( sc.isSuccess() ) {
info() << "Histograms converted successfully according to request." << endmsg;
}
else {
error() << "Error while saving Histograms." << endmsg;
}
}
else {
error() << "Error while traversing Histogram data store" << endmsg;
}
}
// Release event selector context
m_evtSelector->releaseContext(m_evtContext).ignore();
}
// Release all interfaces...
}
StatusCode EventLoopMgr::getEventRoot ( IOpaqueAddress *&  refpAddr)

Create event address using event selector.

Definition at line 392 of file EventLoopMgr.cpp.

{
refpAddr = 0;
if ( !sc.isSuccess() ) {
return sc;
}
// Create root address and assign address to data service
sc = m_evtSelector->createAddress(*m_evtContext,refpAddr);
if( !sc.isSuccess() ) {
if ( sc.isSuccess() ) {
sc = m_evtSelector->createAddress(*m_evtContext,refpAddr);
if ( !sc.isSuccess() ) {
warning() << "Error creating IOpaqueAddress." << endmsg;
}
}
}
return sc;
}
StatusCode EventLoopMgr::initialize ( )
virtual

implementation of IService::initialize

Reimplemented from MinimalEventLoopMgr.

Definition at line 65 of file EventLoopMgr.cpp.

{
// Initialize the base class
if( !sc.isSuccess() ) {
DEBMSG << "Error Initializing base class MinimalEventLoopMgr." << endmsg;
return sc;
}
// Setup access to event data services
m_evtDataMgrSvc = serviceLocator()->service("EventDataSvc");
fatal() << "Error retrieving EventDataSvc interface IDataManagerSvc." << endmsg;
}
m_evtDataSvc = serviceLocator()->service("EventDataSvc");
if( !m_evtDataSvc.isValid() ) {
fatal() << "Error retrieving EventDataSvc interface IDataProviderSvc." << endmsg;
}
// Obtain the IProperty of the ApplicationMgr
fatal() << "IProperty interface not found in ApplicationMgr." << endmsg;
}
// We do not expect a Event Selector necessarily being declared
setProperty(m_appMgrProperty->getProperty("EvtSel")).ignore();
if( m_evtsel != "NONE" || m_evtsel.length() == 0) {
m_evtSelector = serviceLocator()->service("EventSelector");
// Setup Event Selector
sc=m_evtSelector->createContext(m_evtContext);
if( !sc.isSuccess() ) {
fatal() << "Can not create the event selector Context." << endmsg;
return sc;
}
}
else {
fatal() << "EventSelector not found." << endmsg;
return sc;
}
}
else {
if ( m_warnings ) {
warning() << "Unable to locate service \"EventSelector\" " << endmsg;
warning() << "No events will be processed from external input." << endmsg;
}
}
// Setup access to histogramming services
m_histoDataMgrSvc = serviceLocator()->service("HistogramDataSvc");
fatal() << "Error retrieving HistogramDataSvc." << endmsg;
return sc;
}
// Setup histogram persistency
m_histoPersSvc = serviceLocator()->service("HistogramPersistencySvc");
warning() << "Histograms cannot not be saved - though required." << endmsg;
return sc;
}
}
StatusCode EventLoopMgr::nextEvent ( int  maxevt)
virtual

implementation of IService::nextEvent

Reimplemented from MinimalEventLoopMgr.

Definition at line 323 of file EventLoopMgr.cpp.

{
static int total_nevt = 0;
DataObject* pObject = 0;
// loop over events if the maxevt (received as input) if different from -1.
// if evtmax is -1 it means infinite loop
for( int nevt = 0; (maxevt == -1 ? true : nevt < maxevt); nevt++, total_nevt++) {
// Check if there is a scheduled stop issued by some algorithm/service
if ( m_scheduledStop ) {
m_scheduledStop = false;
always() << "Terminating event processing loop due to scheduled stop" << endmsg;
break;
}
// Clear the event store, if used in the event loop
if( 0 != total_nevt ) {
if ( ! m_endEventFired ) {
// Fire EndEvent "Incident" (it is considered part of the clearing of the TS)
}
sc = m_evtDataMgrSvc->clearStore();
if( !sc.isSuccess() ) {
DEBMSG << "Clear of Event data store failed" << endmsg;
}
}
// Setup event in the event store
if( m_evtContext ) {
IOpaqueAddress* addr = 0;
// Only if there is a EventSelector
sc = getEventRoot(addr);
if( !sc.isSuccess() ) {
info() << "No more events in event selection " << endmsg;
break;
}
// Set root clears the event data store first
sc = m_evtDataMgrSvc->setRoot ("/Event", addr);
if( !sc.isSuccess() ) {
warning() << "Error declaring event root address." << endmsg;
continue;
}
sc = m_evtDataSvc->retrieveObject("/Event", pObject);
if( !sc.isSuccess() ) {
warning() << "Unable to retrieve Event root object" << endmsg;
break;
}
}
else {
sc = m_evtDataMgrSvc->setRoot ("/Event", new DataObject());
if( !sc.isSuccess() ) {
warning() << "Error declaring event root DataObject" << endmsg;
}
}
// Execute event for all required algorithms
sc = executeEvent(NULL);
m_endEventFired = false;
if( !sc.isSuccess() ){
error() << "Terminating event processing loop due to errors" << endmsg;
return sc;
}
}
}
StatusCode EventLoopMgr::reinitialize ( )
virtual

implementation of IService::reinitialize

Reimplemented from MinimalEventLoopMgr.

Definition at line 137 of file EventLoopMgr.cpp.

{
// Initialize the base class
if( !sc.isSuccess() ) {
DEBMSG << "Error Initializing base class MinimalEventLoopMgr." << endmsg;
return sc;
}
// Check to see whether a new Event Selector has been specified
setProperty(m_appMgrProperty->getProperty("EvtSel"));
if( m_evtsel != "NONE" || m_evtsel.length() == 0) {
SmartIF<IService> theSvc(serviceLocator()->service("EventSelector"));
SmartIF<IEvtSelector> theEvtSel(theSvc);
if( theEvtSel.isValid() && ( theEvtSel.get() != m_evtSelector.get() ) ) {
// Setup Event Selector
// Need to release context before switching to new event selector
m_evtSelector->releaseContext(m_evtContext);
}
m_evtSelector = theEvtSel;
if (theSvc->FSMState() == Gaudi::StateMachine::INITIALIZED) {
sc = theSvc->reinitialize();
if( !sc.isSuccess() ) {
error() << "Failure Reinitializing EventSelector "
<< theSvc->name( ) << endmsg;
return sc;
}
}
else {
sc = theSvc->sysInitialize();
if( !sc.isSuccess() ) {
error() << "Failure Initializing EventSelector "
<< theSvc->name( ) << endmsg;
return sc;
}
}
sc = m_evtSelector->createContext(m_evtContext);
if( !sc.isSuccess() ) {
error() << "Can not create Context " << theSvc->name( ) << endmsg;
return sc;
}
info() << "EventSelector service changed to "
<< theSvc->name( ) << endmsg;
}
else if ( m_evtSelector.isValid() ) {
if ( m_evtContext ) {
m_evtSelector->releaseContext(m_evtContext);
}
sc = m_evtSelector->createContext(m_evtContext);
if( !sc.isSuccess() ) {
error() << "Can not create Context " << theSvc->name( ) << endmsg;
return sc;
}
}
}
else if ( m_evtSelector.isValid() && m_evtContext ) {
m_evtSelector->releaseContext(m_evtContext);
}
}
StatusCode EventLoopMgr::stop ( )
virtual

implementation of IService::stop

Reimplemented from MinimalEventLoopMgr.

Definition at line 207 of file EventLoopMgr.cpp.

{
if ( ! m_endEventFired ) {
// Fire pending EndEvent incident
}
}

Member Data Documentation

SmartIF<IProperty> EventLoopMgr::m_appMgrProperty
protected

Property interface of ApplicationMgr.

Definition at line 60 of file EventLoopMgr.h.

bool EventLoopMgr::m_endEventFired
protected

Flag to avoid to fire the EnvEvent incident twice in a row (and also not before the first event)

Definition at line 63 of file EventLoopMgr.h.

IEvtSelector::Context* EventLoopMgr::m_evtContext
protected

Event Iterator.

Definition at line 50 of file EventLoopMgr.h.

SmartIF<IDataManagerSvc> EventLoopMgr::m_evtDataMgrSvc
protected

Reference to the Event Data Service's IDataManagerSvc interface.

Definition at line 44 of file EventLoopMgr.h.

SmartIF<IDataProviderSvc> EventLoopMgr::m_evtDataSvc
protected

Reference to the Event Data Service's IDataProviderSvc interface.

Definition at line 46 of file EventLoopMgr.h.

std::string EventLoopMgr::m_evtsel
protected

Event selector.

Definition at line 52 of file EventLoopMgr.h.

SmartIF<IEvtSelector> EventLoopMgr::m_evtSelector
protected

Reference to the Event Selector.

Definition at line 48 of file EventLoopMgr.h.

SmartIF<IDataManagerSvc> EventLoopMgr::m_histoDataMgrSvc
protected

Reference to the Histogram Data Service.

Definition at line 54 of file EventLoopMgr.h.

SmartIF<IConversionSvc> EventLoopMgr::m_histoPersSvc
protected

Reference to the Histogram Persistency Service.

Definition at line 56 of file EventLoopMgr.h.

std::string EventLoopMgr::m_histPersName
protected

Name of the Hist Pers type.

Definition at line 58 of file EventLoopMgr.h.

bool EventLoopMgr::m_warnings
protected

Flag to disable warning messages when using external input.

Definition at line 65 of file EventLoopMgr.h.


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

Generated at Wed Mar 20 2013 17:59:44 for Gaudi Framework, version v23r7 by Doxygen version 1.8.2 written by Dimitri van Heesch, © 1997-2004