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

Class definition of EventLoopMgr. More...

#include <src/ApplicationMgr/EventLoopMgr.h>

Inheritance diagram for EventLoopMgr:
Collaboration diagram for EventLoopMgr:

Public Member Functions

 EventLoopMgr (const std::string &nam, ISvcLocator *svcLoc)
 Standard Constructor. More...
 
virtual ~EventLoopMgr ()
 Standard Destructor. More...
 
StatusCode getEventRoot (IOpaqueAddress *&refpAddr)
 Create event address using event selector. More...
 
virtual StatusCode initialize ()
 implementation of IService::initialize More...
 
virtual StatusCode reinitialize ()
 implementation of IService::reinitialize More...
 
virtual StatusCode stop ()
 implementation of IService::stop More...
 
virtual StatusCode finalize ()
 implementation of IService::finalize More...
 
virtual StatusCode nextEvent (int maxevt)
 implementation of IService::nextEvent More...
 
virtual StatusCode executeEvent (void *par)
 implementation of IEventProcessor::executeEvent(void* par) More...
 
virtual StatusCode executeRun (int maxevt)
 implementation of IEventProcessor::executeRun() More...
 
- Public Member Functions inherited from MinimalEventLoopMgr
 MinimalEventLoopMgr (const std::string &nam, ISvcLocator *svcLoc)
 Standard Constructor. More...
 
virtual ~MinimalEventLoopMgr ()
 Standard Destructor. More...
 
virtual StatusCode start ()
 implementation of IService::start More...
 
virtual StatusCode restart ()
 implementation of IService::restart 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 Attributes

SmartIF< IDataManagerSvcm_evtDataMgrSvc
 Reference to the Event Data Service's IDataManagerSvc interface. More...
 
SmartIF< IDataProviderSvcm_evtDataSvc
 Reference to the Event Data Service's IDataProviderSvc interface. More...
 
SmartIF< IEvtSelectorm_evtSelector
 Reference to the Event Selector. More...
 
IEvtSelector::Contextm_evtContext
 Event Iterator. More...
 
std::string m_evtsel
 Event selector. More...
 
SmartIF< IDataManagerSvcm_histoDataMgrSvc
 Reference to the Histogram Data Service. More...
 
SmartIF< IConversionSvcm_histoPersSvc
 Reference to the Histogram Persistency Service. More...
 
std::string m_histPersName
 Name of the Hist Pers type. More...
 
SmartIF< IPropertym_appMgrProperty
 Property interface of ApplicationMgr. More...
 
bool m_endEventFired
 Flag to avoid to fire the EnvEvent incident twice in a row (and also not before the first event) More...
 
bool m_warnings
 Flag to disable warning messages when using external input. More...
 
- Protected Attributes inherited from MinimalEventLoopMgr
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...
 

Additional Inherited Members

- Public Types inherited from MinimalEventLoopMgr
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...
 
- Static Public Member Functions inherited from IInterface
static const InterfaceIDinterfaceID ()
 Return an instance of InterfaceID identifying the interface. More...
 
- Protected Types inherited from MinimalEventLoopMgr
enum  State { OFFLINE, CONFIGURED, FINALIZED, INITIALIZED }
 
- 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

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.

  • handling of the incidents when starting event processing
  • handling of the event loop

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 31 of file EventLoopMgr.cpp.

32 : MinimalEventLoopMgr(nam, svcLoc)
33 {
35  m_histoPersSvc = 0;
36  m_evtDataMgrSvc = 0;
37  m_evtDataSvc = 0;
38  m_evtSelector = 0;
39  m_evtContext = 0;
40  m_endEventFired = true;
41 
42  // Declare properties
43  declareProperty("HistogramPersistency", m_histPersName = "");
44  declareProperty("EvtSel", m_evtsel );
45  declareProperty("Warnings",m_warnings=true,
46  "Set this property to false to suppress warning messages");
47 }
SmartIF< IConversionSvc > m_histoPersSvc
Reference to the Histogram Persistency Service.
Definition: EventLoopMgr.h:56
std::string m_histPersName
Name of the Hist Pers type.
Definition: EventLoopMgr.h:58
bool m_warnings
Flag to disable warning messages when using external input.
Definition: EventLoopMgr.h:65
SmartIF< IDataManagerSvc > m_evtDataMgrSvc
Reference to the Event Data Service's IDataManagerSvc interface.
Definition: EventLoopMgr.h:44
IEvtSelector::Context * m_evtContext
Event Iterator.
Definition: EventLoopMgr.h:50
SmartIF< IEvtSelector > m_evtSelector
Reference to the Event Selector.
Definition: EventLoopMgr.h:48
bool m_endEventFired
Flag to avoid to fire the EnvEvent incident twice in a row (and also not before the first event) ...
Definition: EventLoopMgr.h:63
SmartIF< IDataProviderSvc > m_evtDataSvc
Reference to the Event Data Service's IDataProviderSvc interface.
Definition: EventLoopMgr.h:46
Property * declareProperty(const std::string &name, T &property, const std::string &doc="none") const
Declare the named property.
Definition: Service.h:211
std::string m_evtsel
Event selector.
Definition: EventLoopMgr.h:52
MinimalEventLoopMgr(const std::string &nam, ISvcLocator *svcLoc)
Standard Constructor.
SmartIF< IDataManagerSvc > m_histoDataMgrSvc
Reference to the Histogram Data Service.
Definition: EventLoopMgr.h:54
EventLoopMgr::~EventLoopMgr ( )
virtual

Standard Destructor.

Definition at line 52 of file EventLoopMgr.cpp.

52  {
53  if( m_histoDataMgrSvc ) m_histoDataMgrSvc->release();
54  if( m_histoPersSvc ) m_histoPersSvc->release();
55  if( m_evtDataMgrSvc ) m_evtDataMgrSvc->release();
56  if( m_evtDataSvc ) m_evtDataSvc->release();
57  if( m_evtSelector ) m_evtSelector->release();
58  if( m_evtContext ) delete m_evtContext;
59 }
SmartIF< IConversionSvc > m_histoPersSvc
Reference to the Histogram Persistency Service.
Definition: EventLoopMgr.h:56
SmartIF< IDataManagerSvc > m_evtDataMgrSvc
Reference to the Event Data Service's IDataManagerSvc interface.
Definition: EventLoopMgr.h:44
IEvtSelector::Context * m_evtContext
Event Iterator.
Definition: EventLoopMgr.h:50
SmartIF< IEvtSelector > m_evtSelector
Reference to the Event Selector.
Definition: EventLoopMgr.h:48
SmartIF< IDataProviderSvc > m_evtDataSvc
Reference to the Event Data Service's IDataProviderSvc interface.
Definition: EventLoopMgr.h:46
SmartIF< IDataManagerSvc > m_histoDataMgrSvc
Reference to the Histogram Data Service.
Definition: EventLoopMgr.h:54

Member Function Documentation

StatusCode EventLoopMgr::executeEvent ( void *  par)
virtual

implementation of IEventProcessor::executeEvent(void* par)

Reimplemented from MinimalEventLoopMgr.

Definition at line 287 of file EventLoopMgr.cpp.

287  {
288 
289  // Fire BeginEvent "Incident"
291  // An incident may schedule a stop, in which case is better to exit before the actual execution.
292  if ( m_scheduledStop ) {
293  always() << "Terminating event processing loop due to a stop scheduled by an incident listener" << endmsg;
294  return StatusCode::SUCCESS;
295  }
296 
297  // Execute Algorithms
301 
302  // Check if there was an error processing current event
303  if( UNLIKELY(!sc.isSuccess()) ){
304  error() << "Terminating event processing loop due to errors" << endmsg;
305  }
306  return sc;
307 }
const std::string BeginEvent
Processing of a new event has started.
Definition: Incident.h:60
#define UNLIKELY(x)
Definition: Kernel.h:127
bool m_scheduledStop
Scheduled stop of event processing.
const std::string BeginProcessing
Incident raised just before entering loop over the algorithms.
Definition: Incident.h:84
const std::string EndProcessing
Incident raised just after the loop over the algorithms (note: before the execution of OutputStreams)...
Definition: Incident.h:86
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:62
MsgStream & always() const
shortcut for the method msgStream(MSG::ALWAYS)
virtual StatusCode executeEvent(void *par)
implementation of IEventProcessor::executeEvent(void* par)
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:30
SmartIF< IIncidentSvc > m_incidentSvc
Reference to the incident service.
virtual const std::string & name() const
Retrieve name of the service.
Definition: Service.cpp:331
Base class for all Incidents (computing events).
Definition: Incident.h:16
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
StatusCode EventLoopMgr::executeRun ( int  maxevt)
virtual

implementation of IEventProcessor::executeRun()

Reimplemented from MinimalEventLoopMgr.

Definition at line 312 of file EventLoopMgr.cpp.

312  {
313  StatusCode sc;
314  // initialize the base class
315  sc = MinimalEventLoopMgr::executeRun(maxevt);
316  return sc;
317 }
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:30
virtual StatusCode executeRun(int maxevt)
implementation of IEventProcessor::executeRun( )
StatusCode EventLoopMgr::finalize ( )
virtual

implementation of IService::finalize

Reimplemented from MinimalEventLoopMgr.

Definition at line 218 of file EventLoopMgr.cpp.

218  {
219  StatusCode sc;
220 
221  // Finalize base class
223  if (! sc.isSuccess()) {
224  error() << "Error finalizing base class" << endmsg;
225  return sc;
226  }
227 
228  // Save Histograms Now
229  if ( m_histoPersSvc != 0 ) {
230  HistogramAgent agent;
231  sc = m_histoDataMgrSvc->traverseTree( &agent );
232  if( sc.isSuccess() ) {
233  IDataSelector* objects = agent.selectedObjects();
234  // skip /stat entry!
235  if ( objects->size() > 0 ) {
236  IDataSelector::iterator i;
237  for ( i = objects->begin(); i != objects->end(); i++ ) {
238  IOpaqueAddress* pAddr = 0;
239  StatusCode iret = m_histoPersSvc->createRep(*i, pAddr);
240  if ( iret.isSuccess() ) {
241  (*i)->registry()->setAddress(pAddr);
242  }
243  else {
244  sc = iret;
245  }
246  }
247  for ( i = objects->begin(); i != objects->end(); i++ ) {
248  IRegistry* reg = (*i)->registry();
249  StatusCode iret = m_histoPersSvc->fillRepRefs(reg->address(), *i);
250  if ( !iret.isSuccess() ) {
251  sc = iret;
252  }
253  }
254  }
255  if ( sc.isSuccess() ) {
256  info() << "Histograms converted successfully according to request." << endmsg;
257  }
258  else {
259  error() << "Error while saving Histograms." << endmsg;
260  }
261  }
262  else {
263  error() << "Error while traversing Histogram data store" << endmsg;
264  }
265  }
266 
267  // Release event selector context
268  if ( m_evtSelector && m_evtContext ) {
269  m_evtSelector->releaseContext(m_evtContext).ignore();
270  m_evtContext = 0;
271  }
272 
273  // Release all interfaces...
274  m_histoDataMgrSvc = 0;
275  m_histoPersSvc = 0;
276 
277  m_evtSelector = 0;
278  m_evtDataSvc = 0;
279  m_evtDataMgrSvc = 0;
280 
281  return StatusCode::SUCCESS;
282 }
SmartIF< IConversionSvc > m_histoPersSvc
Reference to the Histogram Persistency Service.
Definition: EventLoopMgr.h:56
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:62
HistogramAgent base in charge of collecting all the refereces to DataObjects in a transient store tha...
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:30
The IRegistry represents the entry door to the environment any data object residing in a transient da...
Definition: IRegistry.h:22
IDataSelector * selectedObjects()
Return the set of selected DataObjects.
virtual IOpaqueAddress * address() const =0
Retrieve opaque storage address.
SmartIF< IDataManagerSvc > m_evtDataMgrSvc
Reference to the Event Data Service's IDataManagerSvc interface.
Definition: EventLoopMgr.h:44
IEvtSelector::Context * m_evtContext
Event Iterator.
Definition: EventLoopMgr.h:50
SmartIF< IEvtSelector > m_evtSelector
Reference to the Event Selector.
Definition: EventLoopMgr.h:48
virtual StatusCode finalize()
implementation of IService::finalize
SmartIF< IDataProviderSvc > m_evtDataSvc
Reference to the Event Data Service's IDataProviderSvc interface.
Definition: EventLoopMgr.h:46
Opaque address interface definition.
MsgStream & info() const
shortcut for the method msgStream(MSG::INFO)
list i
Definition: ana.py:128
std::vector< DataObject * > IDataSelector
This is only a placeholder to allow me compiling until the responsible guy does his work! M...
Definition: IDataSelector.h:8
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< IDataManagerSvc > m_histoDataMgrSvc
Reference to the Histogram Data Service.
Definition: EventLoopMgr.h:54
StatusCode EventLoopMgr::getEventRoot ( IOpaqueAddress *&  refpAddr)

Create event address using event selector.

Definition at line 391 of file EventLoopMgr.cpp.

391  {
392  refpAddr = 0;
394  if ( !sc.isSuccess() ) {
395  return sc;
396  }
397  // Create root address and assign address to data service
398  sc = m_evtSelector->createAddress(*m_evtContext,refpAddr);
399  if( !sc.isSuccess() ) {
400  sc = m_evtSelector->next(*m_evtContext);
401  if ( sc.isSuccess() ) {
402  sc = m_evtSelector->createAddress(*m_evtContext,refpAddr);
403  if ( !sc.isSuccess() ) {
404  warning() << "Error creating IOpaqueAddress." << endmsg;
405  }
406  }
407  }
408  return sc;
409 }
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:62
MsgStream & warning() const
shortcut for the method msgStream(MSG::WARNING)
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:30
IEvtSelector::Context * m_evtContext
Event Iterator.
Definition: EventLoopMgr.h:50
SmartIF< IEvtSelector > m_evtSelector
Reference to the Event Selector.
Definition: EventLoopMgr.h:48
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
StatusCode EventLoopMgr::initialize ( )
virtual

implementation of IService::initialize

Reimplemented from MinimalEventLoopMgr.

Definition at line 64 of file EventLoopMgr.cpp.

64  {
65  // Initialize the base class
67  if( !sc.isSuccess() ) {
68  DEBMSG << "Error Initializing base class MinimalEventLoopMgr." << endmsg;
69  return sc;
70  }
71 
72  // Setup access to event data services
73  m_evtDataMgrSvc = serviceLocator()->service("EventDataSvc");
74  if( !m_evtDataMgrSvc.isValid() ) {
75  fatal() << "Error retrieving EventDataSvc interface IDataManagerSvc." << endmsg;
76  return StatusCode::FAILURE;
77  }
78  m_evtDataSvc = serviceLocator()->service("EventDataSvc");
79  if( !m_evtDataSvc.isValid() ) {
80  fatal() << "Error retrieving EventDataSvc interface IDataProviderSvc." << endmsg;
81  return StatusCode::FAILURE;
82  }
83 
84  // Obtain the IProperty of the ApplicationMgr
86  if ( ! m_appMgrProperty.isValid() ) {
87  fatal() << "IProperty interface not found in ApplicationMgr." << endmsg;
88  return StatusCode::FAILURE;
89  }
90 
91  // We do not expect a Event Selector necessarily being declared
92  setProperty(m_appMgrProperty->getProperty("EvtSel")).ignore();
93 
94  if( m_evtsel != "NONE" || m_evtsel.length() == 0) {
95  m_evtSelector = serviceLocator()->service("EventSelector");
96  if( m_evtSelector.isValid() ) {
97  // Setup Event Selector
98  sc=m_evtSelector->createContext(m_evtContext);
99  if( !sc.isSuccess() ) {
100  fatal() << "Can not create the event selector Context." << endmsg;
101  return sc;
102  }
103  }
104  else {
105  fatal() << "EventSelector not found." << endmsg;
106  return sc;
107  }
108  }
109  else {
110  m_evtSelector = 0;
111  m_evtContext = 0;
112  if ( m_warnings ) {
113  warning() << "Unable to locate service \"EventSelector\" " << endmsg;
114  warning() << "No events will be processed from external input." << endmsg;
115  }
116  }
117 
118  // Setup access to histogramming services
119  m_histoDataMgrSvc = serviceLocator()->service("HistogramDataSvc");
120  if( !m_histoDataMgrSvc.isValid() ) {
121  fatal() << "Error retrieving HistogramDataSvc." << endmsg;
122  return sc;
123  }
124  // Setup histogram persistency
125  m_histoPersSvc = serviceLocator()->service("HistogramPersistencySvc");
126  if( !m_histoPersSvc.isValid() ) {
127  warning() << "Histograms cannot not be saved - though required." << endmsg;
128  return sc;
129  }
130 
131  return StatusCode::SUCCESS;
132 }
SmartIF< IConversionSvc > m_histoPersSvc
Reference to the Histogram Persistency Service.
Definition: EventLoopMgr.h:56
virtual StatusCode setProperty(const Property &p)
Set the property by property.
Definition: Service.cpp:342
virtual StatusCode initialize()
implementation of IService::initialize
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 isValid() const
Allow for check if smart pointer is valid.
Definition: SmartIF.h:51
bool m_warnings
Flag to disable warning messages when using external input.
Definition: EventLoopMgr.h:65
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:30
SmartIF< IDataManagerSvc > m_evtDataMgrSvc
Reference to the Event Data Service's IDataManagerSvc interface.
Definition: EventLoopMgr.h:44
SmartIF< IProperty > m_appMgrProperty
Property interface of ApplicationMgr.
Definition: EventLoopMgr.h:60
IEvtSelector::Context * m_evtContext
Event Iterator.
Definition: EventLoopMgr.h:50
SmartIF< IEvtSelector > m_evtSelector
Reference to the Event Selector.
Definition: EventLoopMgr.h:48
#define DEBMSG
SmartIF< IDataProviderSvc > m_evtDataSvc
Reference to the Event Data Service's IDataProviderSvc interface.
Definition: EventLoopMgr.h:46
MsgStream & fatal() const
shortcut for the method msgStream(MSG::FATAL)
std::string m_evtsel
Event selector.
Definition: EventLoopMgr.h:52
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
SmartIF< IDataManagerSvc > m_histoDataMgrSvc
Reference to the Histogram Data Service.
Definition: EventLoopMgr.h:54
SmartIF< ISvcLocator > & serviceLocator() const
Retrieve pointer to service locator.
Definition: Service.cpp:336
StatusCode EventLoopMgr::nextEvent ( int  maxevt)
virtual

implementation of IService::nextEvent

Reimplemented from MinimalEventLoopMgr.

Definition at line 322 of file EventLoopMgr.cpp.

322  {
323  static int total_nevt = 0;
324  DataObject* pObject = 0;
326 
327  // loop over events if the maxevt (received as input) if different from -1.
328  // if evtmax is -1 it means infinite loop
329  for( int nevt = 0; (maxevt == -1 ? true : nevt < maxevt); nevt++, total_nevt++) {
330 
331  // Check if there is a scheduled stop issued by some algorithm/service
332  if ( m_scheduledStop ) {
333  m_scheduledStop = false;
334  always() << "Terminating event processing loop due to scheduled stop" << endmsg;
335  break;
336  }
337  // Clear the event store, if used in the event loop
338  if( 0 != total_nevt ) {
339 
340  if ( ! m_endEventFired ) {
341  // Fire EndEvent "Incident" (it is considered part of the clearing of the TS)
343  m_endEventFired = true;
344  }
345  sc = m_evtDataMgrSvc->clearStore();
346  if( !sc.isSuccess() ) {
347  DEBMSG << "Clear of Event data store failed" << endmsg;
348  }
349  }
350 
351  // Setup event in the event store
352  if( m_evtContext ) {
353  IOpaqueAddress* addr = 0;
354  // Only if there is a EventSelector
355  sc = getEventRoot(addr);
356  if( !sc.isSuccess() ) {
357  info() << "No more events in event selection " << endmsg;
358  break;
359  }
360  // Set root clears the event data store first
361  sc = m_evtDataMgrSvc->setRoot ("/Event", addr);
362  if( !sc.isSuccess() ) {
363  warning() << "Error declaring event root address." << endmsg;
364  continue;
365  }
366  sc = m_evtDataSvc->retrieveObject("/Event", pObject);
367  if( !sc.isSuccess() ) {
368  warning() << "Unable to retrieve Event root object" << endmsg;
369  break;
370  }
371  }
372  else {
373  sc = m_evtDataMgrSvc->setRoot ("/Event", new DataObject());
374  if( !sc.isSuccess() ) {
375  warning() << "Error declaring event root DataObject" << endmsg;
376  }
377  }
378  // Execute event for all required algorithms
379  sc = executeEvent(NULL);
380  m_endEventFired = false;
381  if( !sc.isSuccess() ){
382  error() << "Terminating event processing loop due to errors" << endmsg;
384  return sc;
385  }
386  }
387  return StatusCode::SUCCESS;
388 }
virtual StatusCode executeEvent(void *par)
implementation of IEventProcessor::executeEvent(void* par)
bool m_scheduledStop
Scheduled stop of event processing.
MsgStream & warning() const
shortcut for the method msgStream(MSG::WARNING)
MsgStream & always() const
shortcut for the method msgStream(MSG::ALWAYS)
const std::string EndEvent
Processing of the last event has finished.
Definition: Incident.h:61
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:30
StatusCode getEventRoot(IOpaqueAddress *&refpAddr)
Create event address using event selector.
list nevt
Definition: ana.py:134
SmartIF< IIncidentSvc > m_incidentSvc
Reference to the incident service.
StatusCode setAppReturnCode(SmartIF< IProperty > &appmgr, int value, bool force=false)
Set the application return code.
Definition: AppReturnCode.h:50
virtual const std::string & name() const
Retrieve name of the service.
Definition: Service.cpp:331
SmartIF< IDataManagerSvc > m_evtDataMgrSvc
Reference to the Event Data Service's IDataManagerSvc interface.
Definition: EventLoopMgr.h:44
SmartIF< IProperty > m_appMgrProperty
Property interface of ApplicationMgr.
Definition: EventLoopMgr.h:60
IEvtSelector::Context * m_evtContext
Event Iterator.
Definition: EventLoopMgr.h:50
#define DEBMSG
Base class for all Incidents (computing events).
Definition: Incident.h:16
bool m_endEventFired
Flag to avoid to fire the EnvEvent incident twice in a row (and also not before the first event) ...
Definition: EventLoopMgr.h:63
SmartIF< IDataProviderSvc > m_evtDataSvc
Reference to the Event Data Service's IDataProviderSvc interface.
Definition: EventLoopMgr.h:46
Opaque address interface definition.
void ignore() const
Definition: StatusCode.h:94
MsgStream & info() const
shortcut for the method msgStream(MSG::INFO)
const int AlgorithmFailure
Definition: AppReturnCode.h:24
A DataObject is the base class of any identifiable object on any data store.
Definition: DataObject.h:31
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
StatusCode EventLoopMgr::reinitialize ( )
virtual

implementation of IService::reinitialize

Reimplemented from MinimalEventLoopMgr.

Definition at line 136 of file EventLoopMgr.cpp.

136  {
137 
138  // Initialize the base class
140  if( !sc.isSuccess() ) {
141  DEBMSG << "Error Initializing base class MinimalEventLoopMgr." << endmsg;
142  return sc;
143  }
144 
145  // Check to see whether a new Event Selector has been specified
146  setProperty(m_appMgrProperty->getProperty("EvtSel"));
147  if( m_evtsel != "NONE" || m_evtsel.length() == 0) {
148  SmartIF<IService> theSvc(serviceLocator()->service("EventSelector"));
149  SmartIF<IEvtSelector> theEvtSel(theSvc);
150  if( theEvtSel.isValid() && ( theEvtSel.get() != m_evtSelector.get() ) ) {
151  // Setup Event Selector
152  if ( m_evtSelector.get() && m_evtContext ) {
153  // Need to release context before switching to new event selector
154  m_evtSelector->releaseContext(m_evtContext);
155  m_evtContext = 0;
156  }
157  m_evtSelector = theEvtSel;
158  if (theSvc->FSMState() == Gaudi::StateMachine::INITIALIZED) {
159  sc = theSvc->reinitialize();
160  if( !sc.isSuccess() ) {
161  error() << "Failure Reinitializing EventSelector "
162  << theSvc->name( ) << endmsg;
163  return sc;
164  }
165  }
166  else {
167  sc = theSvc->sysInitialize();
168  if( !sc.isSuccess() ) {
169  error() << "Failure Initializing EventSelector "
170  << theSvc->name( ) << endmsg;
171  return sc;
172  }
173  }
174  sc = m_evtSelector->createContext(m_evtContext);
175  if( !sc.isSuccess() ) {
176  error() << "Can not create Context " << theSvc->name( ) << endmsg;
177  return sc;
178  }
179  info() << "EventSelector service changed to "
180  << theSvc->name( ) << endmsg;
181  }
182  else if ( m_evtSelector.isValid() ) {
183  if ( m_evtContext ) {
184  m_evtSelector->releaseContext(m_evtContext);
185  m_evtContext = 0;
186  }
187  sc = m_evtSelector->createContext(m_evtContext);
188  if( !sc.isSuccess() ) {
189  error() << "Can not create Context " << theSvc->name( ) << endmsg;
190  return sc;
191  }
192  }
193  }
194  else if ( m_evtSelector.isValid() && m_evtContext ) {
195  m_evtSelector->releaseContext(m_evtContext);
196  m_evtSelector = 0;
197  m_evtContext = 0;
198  }
199  return StatusCode::SUCCESS;
200 }
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
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
TYPE * get() const
Get interface pointer.
Definition: SmartIF.h:62
virtual StatusCode reinitialize()
implementation of IService::reinitialize
SmartIF< IProperty > m_appMgrProperty
Property interface of ApplicationMgr.
Definition: EventLoopMgr.h:60
IEvtSelector::Context * m_evtContext
Event Iterator.
Definition: EventLoopMgr.h:50
SmartIF< IEvtSelector > m_evtSelector
Reference to the Event Selector.
Definition: EventLoopMgr.h:48
#define DEBMSG
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.
Definition: Service.h:142
std::string m_evtsel
Event selector.
Definition: EventLoopMgr.h:52
MsgStream & info() const
shortcut for the method msgStream(MSG::INFO)
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
StatusCode EventLoopMgr::stop ( )
virtual

implementation of IService::stop

Reimplemented from MinimalEventLoopMgr.

Definition at line 206 of file EventLoopMgr.cpp.

206  {
207  if ( ! m_endEventFired ) {
208  // Fire pending EndEvent incident
210  m_endEventFired = true;
211  }
212  return MinimalEventLoopMgr::stop();
213 }
const std::string EndEvent
Processing of the last event has finished.
Definition: Incident.h:61
SmartIF< IIncidentSvc > m_incidentSvc
Reference to the incident service.
virtual const std::string & name() const
Retrieve name of the service.
Definition: Service.cpp:331
virtual StatusCode stop()
implementation of IService::stop
Base class for all Incidents (computing events).
Definition: Incident.h:16
bool m_endEventFired
Flag to avoid to fire the EnvEvent incident twice in a row (and also not before the first event) ...
Definition: EventLoopMgr.h:63

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: