EventSelector Class Reference

Definition of class EventSelector. More...

#include <src/EventSelector/EventSelector.h>

Inheritance diagram for EventSelector:
Collaboration diagram for EventSelector:

Public Types

typedef std::vector< EventSelectorDataStream * > Streams
 
typedef std::vector< std::string > StreamSpecs
 
typedef std::vector< StringPropertyProperties
 
- Public Types inherited from extends1< Service, IEvtSelector >
typedef extends1 base_class
 Typedef to this class. More...
 
typedef extends1 base_class
 Typedef to this class. More...
 
typedef extend_interfaces1< IEvtSelectorextend_interfaces_base
 Typedef to the base of this class. More...
 
typedef extend_interfaces1< IEvtSelectorextend_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...
 
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
 
typedef Gaudi::PluginService::Factory< IService *, const std::string &, ISvcLocator * > Factory
 
- Public Types inherited from CommonMessaging< implements3< IService, IProperty, IStateful > >
typedef CommonMessaging base_class
 
typedef CommonMessaging base_class
 
- Public Types inherited from implements3< IService, IProperty, IStateful >
typedef implements3 base_class
 Typedef to this class. More...
 
typedef implements3 base_class
 Typedef to this class. More...
 
typedef extend_interfaces3< IService, IProperty, IStatefulextend_interfaces_base
 Typedef to the base of this class. More...
 
typedef extend_interfaces3< IService, IProperty, IStatefulextend_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...
 
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...
 
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,
  SUCCESS = 1, NO_INTERFACE, VERSMISMATCH, LAST_ERROR
}
 Return status. More...
 
enum  Status {
  SUCCESS = 1, NO_INTERFACE, VERSMISMATCH, LAST_ERROR,
  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...
 
typedef Gaudi::InterfaceId< IInterface, 0, 0 > iid
 Interface ID. More...
 
typedef mpl::set1< iidext_iids
 Extra interfaces. More...
 
- Public Types inherited from extend_interfaces1< IEvtSelector >
typedef IEvtSelector::iid::iids::type ext_iids
 MPL set of interfaces extended by this one. More...
 
typedef IEvtSelector::iid::iids::type ext_iids
 MPL set of interfaces extended by this one. More...
 

Public Member Functions

virtual StatusCode initialize ()
 IService implementation: Db event selector override. More...
 
virtual StatusCode finalize ()
 IService implementation: Service finalization. More...
 
virtual StatusCode reinitialize ()
 Service override: Reinitialize service. More...
 
virtual StatusCode createContext (Context *&refpCtxt) const
 Create a new event loop context. More...
 
virtual StatusCode next (Context &refCtxt) const
 Get next iteration item from the event loop context. More...
 
virtual StatusCode next (Context &refCtxt, int jump) const
 Get next iteration item from the event loop context, but skip jump elements. More...
 
virtual StatusCode previous (Context &refCtxt) const
 Get previous iteration item from the event loop context. More...
 
virtual StatusCode previous (Context &refCtxt, int jump) const
 Get previous iteration item from the event loop context, but skip jump elements. More...
 
virtual StatusCode rewind (Context &refCtxt) const
 Rewind the dataset. More...
 
virtual StatusCode createAddress (const Context &refCtxt, IOpaqueAddress *&refpAddr) const
 Create new Opaque address corresponding to the current record. More...
 
virtual StatusCode releaseContext (Context *&refCtxt) const
 Release existing event iteration context. More...
 
virtual StatusCode resetCriteria (const std::string &cr, Context &c) const
 Will set a new criteria for the selection of the next list of events and will change the state of the context in a way to point to the new list. More...
 
virtual StatusCode last (Context &c) const
 Access last item in the iteration. More...
 
StatusCode firstOfNextStream (bool shutDown, EvtSelectorContext &it) const
 Retrieve first entry of the next data stream. More...
 
StatusCode lastOfPreviousStream (bool shutDown, EvtSelectorContext &it) const
 Retrieve last entry of the previous data stream. More...
 
 EventSelector (const std::string &name, ISvcLocator *svcloc)
 Standard Constructor. More...
 
virtual ~EventSelector ()
 Standard Destructor. More...
 
- Public Member Functions inherited from extends1< Service, IEvtSelector >
 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...
 
 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 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 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 std::vector< std::string > getInterfaceNames () const
 Implementation of IInterface::getInterfaceNames. More...
 
virtual ~extends1 ()
 Virtual destructor. 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 start ()
 Start (from INITIALIZED to RUNNING). More...
 
virtual StatusCode stop ()
 Stop (from RUNNING to INITIALIZED). 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 restart ()
 Initialization (from RUNNING to RUNNING, via INITIALIZED). 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...
 
virtual bool hasProperty (const std::string &name) const
 Return true if we have a property with the given name. 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...
 
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 start ()
 Start (from INITIALIZED to RUNNING). More...
 
virtual StatusCode stop ()
 Stop (from RUNNING to INITIALIZED). 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 restart ()
 Initialization (from RUNNING to RUNNING, via INITIALIZED). 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...
 
virtual bool hasProperty (const std::string &name) const
 Return true if we have a property with the given name. 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...
 
 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...
 
virtual ~CommonMessaging ()
 Virtual destructor. More...
 
SmartIF< IMessageSvc > & msgSvc () const
 The standard message service. 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...
 
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...
 
MsgStreamalways () const
 shortcut for the method msgStream(MSG::ALWAYS) More...
 
MsgStreamfatal () const
 shortcut for the method msgStream(MSG::FATAL) More...
 
MsgStreamfatal () const
 shortcut for the method msgStream(MSG::FATAL) More...
 
MsgStreamerr () const
 shortcut for the method msgStream(MSG::ERROR) More...
 
MsgStreamerr () const
 shortcut for the method msgStream(MSG::ERROR) More...
 
MsgStreamerror () 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...
 
MsgStreamwarning () const
 shortcut for the method msgStream(MSG::WARNING) More...
 
MsgStreaminfo () const
 shortcut for the method msgStream(MSG::INFO) More...
 
MsgStreaminfo () const
 shortcut for the method msgStream(MSG::INFO) More...
 
MsgStreamdebug () const
 shortcut for the method msgStream(MSG::DEBUG) More...
 
MsgStreamdebug () const
 shortcut for the method msgStream(MSG::DEBUG) More...
 
MsgStreamverbose () const
 shortcut for the method msgStream(MSG::VERBOSE) More...
 
MsgStreamverbose () const
 shortcut for the method msgStream(MSG::VERBOSE) More...
 
MsgStreammsg () const
 shortcut for the method msgStream(MSG::INFO) 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...
 
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...
 
virtual ~extend_interfaces3 ()
 Virtual destructor. More...
 
- Public Member Functions inherited from IService
 DeclareInterfaceID (IService, 3, 0)
 InterfaceID. More...
 
virtual ~IService ()
 virtual destructor More...
 
 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...
 
 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...
 
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, 1)
 InterfaceID. More...
 
 DeclareInterfaceID (IProperty, 2, 1)
 InterfaceID. More...
 
- Public Member Functions inherited from IStateful
 DeclareInterfaceID (IStateful, 1, 0)
 InterfaceID. More...
 
virtual ~IStateful ()
 
 DeclareInterfaceID (IStateful, 1, 0)
 InterfaceID. More...
 
virtual ~IStateful ()
 
- Public Member Functions inherited from extend_interfaces1< IEvtSelector >
virtual ~extend_interfaces1 ()
 Virtual destructor. More...
 
virtual ~extend_interfaces1 ()
 Virtual destructor. More...
 
- Public Member Functions inherited from IEvtSelector
 DeclareInterfaceID (IEvtSelector, 2, 0)
 InterfaceID. More...
 
 DeclareInterfaceID (IEvtSelector, 2, 0)
 InterfaceID. More...
 

Public Attributes

long int m_streamID
 

Protected Member Functions

virtual void printEvtInfo (const EvtSelectorContext *iter) const
 Progress report. More...
 
- Protected Member Functions inherited from Service
virtual ~Service ()
 Standard Destructor. More...
 
int outputLevel () const
 get the Service's output level More...
 
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...
 
void updateMsgStreamOutputLevel (int level)
 Update the output level of the cached MsgStream. More...
 

Protected Attributes

SmartIF< IIncidentSvcm_incidentSvc
 Reference to the indicent service. More...
 
SmartIF< IToolSvcm_toolSvc
 
IDataStreamToolm_streamtool
 
bool m_reconfigure
 Reconfigure occurred. More...
 
StreamSpecs m_streamSpecs
 Input stream specifiers (for job options) More...
 
StreamSpecs m_streamSpecsLast
 Input stream specifiers (last used) More...
 
Streams m_streams
 Input streams. More...
 
int m_streamCount
 Input stream counter (0..oo, monotonely increasing) More...
 
int m_firstEvent
 First event to be processed. More...
 
int m_evtMax
 Maximum number of events to be processed. More...
 
int m_evtPrintFrequency
 Printout frequency. More...
 
std::string m_streamManager
 
- 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

- Static Public Member Functions inherited from IInterface
static const InterfaceIDinterfaceID ()
 Return an instance of InterfaceID identifying the interface. More...
 
static const InterfaceIDinterfaceID ()
 Return an instance of InterfaceID identifying the interface. More...
 

Detailed Description

Definition of class EventSelector.

Basic event selector service. The event selector service itself is able to connect other services to attached streams.

History: +------—+-------------------------------------------—+---------—+ | Date | Comment | Who | +------—+-------------------------------------------—+---------—+ | 3/10/00 | Initial version | M.Frank | +------—+-------------------------------------------—+---------—+ | 4/09/09 | Added firing incident on opening/ending file | R. Lambert | +------—+-------------------------------------------—+---------—+

Author
Markus Frank
R. Lambert
Version
1.0

Definition at line 53 of file EventSelector.h.

Member Typedef Documentation

Definition at line 57 of file EventSelector.h.

Definition at line 55 of file EventSelector.h.

typedef std::vector<std::string> EventSelector::StreamSpecs

Definition at line 56 of file EventSelector.h.

Constructor & Destructor Documentation

EventSelector::EventSelector ( const std::string &  name,
ISvcLocator svcloc 
)

Standard Constructor.

Definition at line 23 of file EventSelector.cpp.

24  : base_class( name, svcloc)
25 {
26  m_incidentSvc = 0;
27  m_toolSvc = 0;
28  m_streamCount = 0;
29  m_firstEvent = 0;
31  m_evtMax = INT_MAX;
32  declareProperty( "Input", m_streamSpecs);
33  declareProperty( "FirstEvent", m_firstEvent);
34  declareProperty( "EvtMax", m_evtMax);
35  declareProperty( "PrintFreq", m_evtPrintFrequency);
36  declareProperty( "StreamManager", m_streamManager="DataStreamTool");
37  m_reconfigure = false;
38 }
SmartIF< IIncidentSvc > m_incidentSvc
Reference to the indicent service.
Definition: EventSelector.h:63
int m_evtPrintFrequency
Printout frequency.
Definition: EventSelector.h:84
int m_firstEvent
First event to be processed.
Definition: EventSelector.h:80
int m_evtMax
Maximum number of events to be processed.
Definition: EventSelector.h:82
extends1 base_class
Typedef to this class.
Definition: extends.h:12
StreamSpecs m_streamSpecs
Input stream specifiers (for job options)
Definition: EventSelector.h:72
virtual const std::string & name() const
Retrieve name of the service.
Definition: Service.cpp:329
SmartIF< IToolSvc > m_toolSvc
Definition: EventSelector.h:65
int m_streamCount
Input stream counter (0..oo, monotonely increasing)
Definition: EventSelector.h:78
bool m_reconfigure
Reconfigure occurred.
Definition: EventSelector.h:70
Property * declareProperty(const std::string &name, T &property, const std::string &doc="none") const
Declare the named property.
Definition: Service.h:212
std::string m_streamManager
Definition: EventSelector.h:86
EventSelector::~EventSelector ( )
virtual

Standard Destructor.

Definition at line 41 of file EventSelector.cpp.

42 {
43 }

Member Function Documentation

StatusCode EventSelector::createAddress ( const Context refCtxt,
IOpaqueAddress *&  refpAddr 
) const
virtual

Create new Opaque address corresponding to the current record.

Parameters
refCtxt[IN/OUT] Reference to the context
refpAddr[OUT] Reference to address pointer
Returns
StatusCode indicating success or failure

Implements IEvtSelector.

Definition at line 331 of file EventSelector.cpp.

333 {
334  const EvtSelectorContext *cpIt = dynamic_cast<const EvtSelectorContext*>(&refCtxt);
335  EvtSelectorContext *pIt = const_cast<EvtSelectorContext*>(cpIt);
336  refpAddr = 0;
337  if ( pIt ) {
339  Context* it = pIt->context();
340  IEvtSelector* sel = s->selector();
341  if ( it && sel ) {
342  IOpaqueAddress* pAddr = 0;
343  StatusCode sc = sel->createAddress(*it, pAddr);
344  if ( sc.isSuccess() ) {
345  refpAddr = pAddr;
346  }
347  pIt->set(it, pAddr);
348  return sc;
349  }
350  }
351  return StatusCode::FAILURE;
352 }
IEvtSelector::Context * context() const
Access "real" iterator.
Definition: EventIterator.h:78
The Event Selector Interface.
Definition: IEvtSelector.h:19
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:75
IDataStreamTool * m_streamtool
Definition: EventSelector.h:67
IEvtSelector * selector() const
Retrieve event selector object.
Definition of class EventIterator.
Definition: EventIterator.h:32
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:30
virtual EventSelectorDataStream * getStream(size_type)=0
void set(const IEvtSelector *sel, IDataStreamTool::size_type id, IEvtSelector::Context *it, IOpaqueAddress *pA)
Set the address of the iterator.
Definition: EventIterator.h:61
Definition of class EventSelectorDataStream.
virtual IDataStreamTool::size_type ID() const
Stream identifier.
string s
Definition: gaudirun.py:244
Opaque address interface definition.
virtual StatusCode createAddress(const Context &c, IOpaqueAddress *&iop) const =0
Create an IOpaqueAddress object from the event fetched.
StatusCode EventSelector::createContext ( Context *&  refpCtxt) const
virtual

Create a new event loop context.

Parameters
refpCtxt[IN/OUT] Reference to pointer to store the context
Returns
StatusCode indicating success or failure

Implements IEvtSelector.

Definition at line 190 of file EventSelector.cpp.

191 {
192  // Max event is zero. Return begin = end
193  refpCtxt = 0;
194  if ( m_firstEvent < 0 ) {
195  MsgStream log(msgSvc(), name());
196  log << MSG::ERROR << "First Event = " << m_firstEvent << " not valid" << endmsg;
197  log << MSG::ERROR << "It should be > 0 " << endmsg;
198  return StatusCode::FAILURE; // if failure => iterators = end();
199  }
200  EvtSelectorContext* ctxt = new EvtSelectorContext(this);
201  ctxt->set(0, -1, 0, 0);
202  firstOfNextStream(true, *ctxt).ignore();
203  refpCtxt = ctxt;
204  long nskip = m_firstEvent;
205  while( --nskip > 0 ) {
206  StatusCode sc = next(*refpCtxt);
207  if ( sc.isFailure() ) {
208  MsgStream log(msgSvc(), name());
209  log << MSG::ERROR << " createContext() failed to start with event number "
210  << m_firstEvent << endmsg;
211  releaseContext(refpCtxt);
212  refpCtxt = 0;
213  return StatusCode::FAILURE;
214  }
215  }
216  return StatusCode::SUCCESS;
217 }
Definition of the MsgStream class used to transmit messages.
Definition: MsgStream.h:24
int m_firstEvent
First event to be processed.
Definition: EventSelector.h:80
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
SmartIF< IMessageSvc > & msgSvc() const
The standard message service.
StatusCode firstOfNextStream(bool shutDown, EvtSelectorContext &it) const
Retrieve first entry of the next data stream.
bool isFailure() const
Test for a status code of FAILURE.
Definition: StatusCode.h:85
Definition of class EventIterator.
Definition: EventIterator.h:32
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:30
virtual StatusCode next(Context &refCtxt) const
Get next iteration item from the event loop context.
virtual StatusCode releaseContext(Context *&refCtxt) const
Release existing event iteration context.
virtual const std::string & name() const
Retrieve name of the service.
Definition: Service.cpp:329
void set(const IEvtSelector *sel, IDataStreamTool::size_type id, IEvtSelector::Context *it, IOpaqueAddress *pA)
Set the address of the iterator.
Definition: EventIterator.h:61
void ignore() const
Definition: StatusCode.h:107
StatusCode EventSelector::finalize ( )
virtual

IService implementation: Service finalization.

Reimplemented from Service.

Definition at line 448 of file EventSelector.cpp.

448  {
449 
450  if (msgLevel(MSG::DEBUG)) {
451  MsgStream log(msgSvc(), name());
452  log << MSG::DEBUG << "finalize()" << endmsg;
453  }
454 
455  m_incidentSvc = 0;
456 
457  if (m_streamtool) {
458  if (m_toolSvc.isValid()) {
460  } else {
461  // It should not be possible to get here
463  }
464  m_streamtool = 0;
465  }
466 
467  m_toolSvc = 0;
468 
469  return Service::finalize();
470 }
SmartIF< IIncidentSvc > m_incidentSvc
Reference to the indicent service.
Definition: EventSelector.h:63
Definition of the MsgStream class used to transmit messages.
Definition: MsgStream.h:24
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
SmartIF< IMessageSvc > & msgSvc() const
The standard message service.
IDataStreamTool * m_streamtool
Definition: EventSelector.h:67
virtual const std::string & name() const
Retrieve name of the service.
Definition: Service.cpp:329
SmartIF< IToolSvc > m_toolSvc
Definition: EventSelector.h:65
virtual unsigned long release()=0
Release Interface instance.
bool isValid() const
Allow for check if smart pointer is valid.
Definition: SmartIF.h:51
virtual StatusCode releaseTool(IAlgTool *tool)=0
Release the tool.
void ignore() const
Definition: StatusCode.h:107
virtual StatusCode finalize()
Finalize (from INITIALIZED to CONFIGURED).
Definition: Service.cpp:197
MSG::Level msgLevel() const
get the output level from the embedded MsgStream
StatusCode EventSelector::firstOfNextStream ( bool  shutDown,
EvtSelectorContext it 
) const

Retrieve first entry of the next data stream.

Definition at line 79 of file EventSelector.cpp.

79  {
81  IDataStreamTool::size_type iter_id = (m_reconfigure) ? 0 : iter.ID()+1;
82  if ( m_reconfigure ) const_cast<EventSelector*>(this)->m_reconfigure = false;
83  if ( shutDown ) {
84  if ( iter.ID() >= 0 && iter.ID() < (long)m_streamtool->size() ) {
85  const EventSelectorDataStream* s = m_streamtool->getStream(iter.ID());
86  if ( s->isInitialized() ) {
87  EventSelector* thisPtr = const_cast<EventSelector*>(this);
88  if ( s->selector() && iter.context() ) {
89  Context* ctxt = iter.context();
90  s->selector()->releaseContext(ctxt).ignore();
91  iter.set(0,0);
92  }
93  status = thisPtr->m_streamtool->finalizeStream(const_cast<EventSelectorDataStream*>(s));
94  iter.set(0,0);
95  }
96  }
97  }
98 
99  const EventSelectorDataStream* s ;
100  status = m_streamtool->getNextStream( s , iter_id );
101 
102  if ( status.isSuccess() ) {
103 
104  if(s!=NULL) {
105  if ( !s->isInitialized() ) {
106  EventSelector* thisPtr = const_cast<EventSelector*>(this);
107  status = thisPtr->m_streamtool->initializeStream(const_cast<EventSelectorDataStream*>(s));
108  }
109 
110  if ( status.isSuccess() ) {
111  const IEvtSelector* sel = s->selector();
112  if ( sel ) {
113  Context* ctxt = 0;
114  status = sel->createContext(ctxt);
115  if ( status.isSuccess() ) {
116  status = sel->resetCriteria(s->criteria(), *ctxt);
117  if ( status.isSuccess() ) {
118  MsgStream log(msgSvc(), name());
119  iter.set(this, iter_id, ctxt, 0);
120  log << MSG::INFO << *s << endmsg;
122  return StatusCode::SUCCESS;
123  }
124  }
125  }
126  }
128  }
129  }
130 
131  iter.set(this, -1, 0, 0);
132  status.setChecked();
133  //m_incidentSvc->fireIncident(Incident(s->dbName(),IncidentType::FailInputFile));
134  return StatusCode::FAILURE;
135 }
SmartIF< IIncidentSvc > m_incidentSvc
Reference to the indicent service.
Definition: EventSelector.h:63
bool isInitialized() const
Check initialization status.
Definition of the MsgStream class used to transmit messages.
Definition: MsgStream.h:24
virtual StatusCode finalizeStream(EventSelectorDataStream *)=0
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
SmartIF< IMessageSvc > & msgSvc() const
The standard message service.
The Event Selector Interface.
Definition: IEvtSelector.h:19
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:75
IDataStreamTool * m_streamtool
Definition: EventSelector.h:67
IEvtSelector * selector() const
Retrieve event selector object.
virtual StatusCode resetCriteria(const std::string &cr, Context &c) const =0
Will set a new criteria for the selection of the next list of events and will change the state of the...
const std::string FailInputFile
could not open or read from this file
Definition: Incident.h:78
virtual void fireIncident(const Incident &incident)=0
Fire an Incident.
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:30
virtual StatusCode createContext(Context *&c) const =0
Create and return a context object that will keep track of the state of selection.
virtual EventSelectorDataStream * getStream(size_type)=0
virtual StatusCode releaseContext(Context *&) const =0
Release the Context object.
virtual const std::string & name() const
Retrieve name of the service.
Definition: Service.cpp:329
Definition of class EventSelectorDataStream.
Base class for all Incidents (computing events).
Definition: Incident.h:16
string s
Definition: gaudirun.py:244
Definition of class EventSelector.
Definition: EventSelector.h:53
virtual size_type size()=0
virtual StatusCode initializeStream(EventSelectorDataStream *)=0
const std::string & criteria() const
Retrieve stream criteria.
bool m_reconfigure
Reconfigure occurred.
Definition: EventSelector.h:70
void ignore() const
Definition: StatusCode.h:107
virtual StatusCode getNextStream(const EventSelectorDataStream *&, size_type &)=0
const std::string & dbName() const
Retrieve stream dbName.
void setChecked() const
Ignore the checking code;.
Definition: StatusCode.h:104
const std::string BeginInputFile
a new input file has been started
Definition: Incident.h:77
StatusCode EventSelector::initialize ( )
virtual

IService implementation: Db event selector override.

Reimplemented from Service.

Definition at line 378 of file EventSelector.cpp.

378  {
379  // Initialize base class
380  StatusCode status = Service::initialize();
381  MsgStream logger(msgSvc(), name());
382  if ( !status.isSuccess() ) {
383  logger << MSG::ERROR << "Error initializing base class Service!" << endmsg;
384  return status;
385  }
386  // Get the references to the services that are needed by the ApplicationMgr itself
387  m_incidentSvc = serviceLocator()->service("IncidentSvc");
388  if( !m_incidentSvc.isValid() ) {
389  logger << MSG::FATAL << "Error retrieving IncidentSvc." << endmsg;
390  return StatusCode::FAILURE;
391  }
392  if ( m_evtMax != INT_MAX ) {
393  logger << MSG::ERROR << "EvtMax is an obsolete property of the event selector." << endmsg;
394  logger << MSG::ERROR << "Please set \"ApplicationMgr.EvtMax = " << m_evtMax
395  << ";\" to process the requested number of events." << endmsg;
396  return StatusCode::FAILURE;
397  }
398 
399  m_toolSvc = serviceLocator()->service("ToolSvc");
400  if ( !m_toolSvc.isValid() ) {
401  logger << MSG::ERROR << " Could not locate the Tool Service! " << endmsg;
402  return StatusCode::FAILURE;
403  }
404 
405  status = m_toolSvc->retrieveTool(m_streamManager.c_str(), m_streamtool, this);
406 
407  if( status.isFailure() ) {
408  logger << MSG::ERROR << "Error initializing "
409  << m_streamManager << endmsg;
410  return status;
411  }
412 
413  status = m_streamtool->clear();
414  if( status.isFailure() ) {
415  // Message already printed by the tool
416  return status;
417  }
418 
420 
422 
423  m_streamID = 0;
424 
425  return status;
426 }
SmartIF< IIncidentSvc > m_incidentSvc
Reference to the indicent service.
Definition: EventSelector.h:63
Definition of the MsgStream class used to transmit messages.
Definition: MsgStream.h:24
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
int m_evtMax
Maximum number of events to be processed.
Definition: EventSelector.h:82
SmartIF< IMessageSvc > & msgSvc() const
The standard message service.
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:75
IDataStreamTool * m_streamtool
Definition: EventSelector.h:67
long int m_streamID
Definition: EventSelector.h:59
GAUDIPS_API Logger & logger()
Return the current logger instance.
bool isFailure() const
Test for a status code of FAILURE.
Definition: StatusCode.h:85
StreamSpecs m_streamSpecsLast
Input stream specifiers (last used)
Definition: EventSelector.h:74
virtual StatusCode addStreams(const StreamSpecs &)=0
StatusCode service(const Gaudi::Utils::TypeNameString &name, T *&svc, bool createIf=true)
Templated method to access a service by name.
Definition: ISvcLocator.h:82
virtual StatusCode clear()=0
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:30
StreamSpecs m_streamSpecs
Input stream specifiers (for job options)
Definition: EventSelector.h:72
virtual const std::string & name() const
Retrieve name of the service.
Definition: Service.cpp:329
SmartIF< IToolSvc > m_toolSvc
Definition: EventSelector.h:65
virtual StatusCode initialize()
Initialization (from CONFIGURED to INITIALIZED).
Definition: Service.cpp:72
bool isValid() const
Allow for check if smart pointer is valid.
Definition: SmartIF.h:51
std::string m_streamManager
Definition: EventSelector.h:86
StatusCode retrieveTool(const std::string &type, T *&tool, const IInterface *parent=0, bool createIf=true)
Retrieve specified tool sub-type with tool dependent part of the name automatically assigned...
Definition: IToolSvc.h:141
SmartIF< ISvcLocator > & serviceLocator() const
Retrieve pointer to service locator.
Definition: Service.cpp:334
StatusCode EventSelector::last ( Context c) const
virtual

Access last item in the iteration.

Parameters
cReference to the Context object.
Returns
StatusCode indicating success or failure

Implements IEvtSelector.

Definition at line 301 of file EventSelector.cpp.

301  {
302  EvtSelectorContext *pIt = dynamic_cast<EvtSelectorContext*>(&refCtxt);
303  if ( pIt ) {
304  }
305  return StatusCode::FAILURE;
306 }
Definition of class EventIterator.
Definition: EventIterator.h:32
StatusCode EventSelector::lastOfPreviousStream ( bool  shutDown,
EvtSelectorContext it 
) const

Retrieve last entry of the previous data stream.

Definition at line 139 of file EventSelector.cpp.

139  {
141  if ( shutDown ) {
142  if ( iter.ID() >= 0 && iter.ID() < (long)m_streamtool->size() ) {
143  const EventSelectorDataStream* s = m_streamtool->getStream(iter.ID());
144  if ( s->isInitialized() ) {
145  EventSelector* thisPtr = const_cast<EventSelector*>(this);
146  if ( s->selector() && iter.context() ) {
147  Context* ctxt = iter.context();
148  s->selector()->releaseContext(ctxt);
149  iter.set(0,0);
150  }
151  status = thisPtr->m_streamtool->finalizeStream(const_cast<EventSelectorDataStream*>(s));
152  iter.set(0,0);
153  }
154  }
155  }
156 
157  IDataStreamTool::size_type iter_id = iter.ID()-1;
158  const EventSelectorDataStream* s ;
159  status = m_streamtool->getPreviousStream( s , iter_id );
160 
161  if ( status.isSuccess() ) {
162 
163  if ( !s->isInitialized() ) {
164  EventSelector* thisPtr = const_cast<EventSelector*>(this);
165  status = thisPtr->m_streamtool->initializeStream(const_cast<EventSelectorDataStream*>(s));
166  }
167  if ( status.isSuccess() ) {
168  const IEvtSelector* sel = s->selector();
169  if ( sel ) {
170  Context* ctxt = 0;
171  status = sel->createContext(ctxt);
172  if ( status.isSuccess() ) {
173  status = sel->resetCriteria(s->criteria(), *ctxt);
174  if ( status.isSuccess() ) {
175  MsgStream log(msgSvc(), name());
176  iter.set(this, iter_id, ctxt, 0);
177  log << MSG::INFO << *s << endmsg;
178  return StatusCode::SUCCESS;
179  }
180  }
181  }
182  }
183  }
184 
185  iter.set(this, -1, 0, 0);
186  return StatusCode::FAILURE;
187 }
bool isInitialized() const
Check initialization status.
Definition of the MsgStream class used to transmit messages.
Definition: MsgStream.h:24
virtual StatusCode finalizeStream(EventSelectorDataStream *)=0
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
SmartIF< IMessageSvc > & msgSvc() const
The standard message service.
The Event Selector Interface.
Definition: IEvtSelector.h:19
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:75
IDataStreamTool * m_streamtool
Definition: EventSelector.h:67
IEvtSelector * selector() const
Retrieve event selector object.
virtual StatusCode resetCriteria(const std::string &cr, Context &c) const =0
Will set a new criteria for the selection of the next list of events and will change the state of the...
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:30
virtual StatusCode createContext(Context *&c) const =0
Create and return a context object that will keep track of the state of selection.
virtual EventSelectorDataStream * getStream(size_type)=0
virtual StatusCode releaseContext(Context *&) const =0
Release the Context object.
virtual StatusCode getPreviousStream(const EventSelectorDataStream *&, size_type &)=0
virtual const std::string & name() const
Retrieve name of the service.
Definition: Service.cpp:329
Definition of class EventSelectorDataStream.
string s
Definition: gaudirun.py:244
Definition of class EventSelector.
Definition: EventSelector.h:53
virtual size_type size()=0
virtual StatusCode initializeStream(EventSelectorDataStream *)=0
const std::string & criteria() const
Retrieve stream criteria.
StatusCode EventSelector::next ( Context refCtxt) const
virtual

Get next iteration item from the event loop context.

Parameters
refCtxt[IN/OUT] Reference to the context
Returns
StatusCode indicating success or failure

Implements IEvtSelector.

Definition at line 220 of file EventSelector.cpp.

220  {
221  return next(refCtxt, 1);
222 }
virtual StatusCode next(Context &refCtxt) const
Get next iteration item from the event loop context.
StatusCode EventSelector::next ( Context refCtxt,
int  jump 
) const
virtual

Get next iteration item from the event loop context, but skip jump elements.

Parameters
refCtxt[IN/OUT] Reference to the context
Returns
StatusCode indicating success or failure

Implements IEvtSelector.

Definition at line 225 of file EventSelector.cpp.

225  {
226  EvtSelectorContext *pIt = dynamic_cast<EvtSelectorContext*>(&refCtxt);
227  if ( pIt ) {
228  if ( pIt->ID() != -1 ) {
230  Context* it = pIt->context();
231  IEvtSelector* sel = s->selector();
232  if ( it && sel ) { // First exploit the current stream
233  StatusCode sc = sel->next(*it); // This stream is empty: advance to the next stream
234  if ( !sc.isSuccess() ) {
236  sc = firstOfNextStream(true, *pIt);
237  if (sc.isSuccess() ) sc = next(*pIt);
238  }
239  else {
240  pIt->increaseCounters(false);
241  pIt->set(it, 0);
242  printEvtInfo(pIt);
243  }
244  return sc;
245  }
246  else if ( m_reconfigure ) {
247  StatusCode sc = firstOfNextStream(false, *pIt);
248  printEvtInfo(pIt);
249  return sc;
250  }
251  }
252  else if ( m_reconfigure ) {
253  StatusCode sc = firstOfNextStream(false, *pIt);
254  printEvtInfo(pIt);
255  return sc;
256  }
257  pIt->increaseCounters(false);
258  }
259  printEvtInfo(pIt);
260  return StatusCode::FAILURE;
261 }
SmartIF< IIncidentSvc > m_incidentSvc
Reference to the indicent service.
Definition: EventSelector.h:63
IEvtSelector::Context * context() const
Access "real" iterator.
Definition: EventIterator.h:78
The Event Selector Interface.
Definition: IEvtSelector.h:19
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:75
IDataStreamTool * m_streamtool
Definition: EventSelector.h:67
IEvtSelector * selector() const
Retrieve event selector object.
virtual void printEvtInfo(const EvtSelectorContext *iter) const
Progress report.
StatusCode firstOfNextStream(bool shutDown, EvtSelectorContext &it) const
Retrieve first entry of the next data stream.
virtual void fireIncident(const Incident &incident)=0
Fire an Incident.
Definition of class EventIterator.
Definition: EventIterator.h:32
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:30
virtual StatusCode next(Context &c) const =0
Fetch the next event or the first event if it will be use soon after the creation of the context...
const std::string EndInputFile
an input file has been finished
Definition: Incident.h:79
virtual EventSelectorDataStream * getStream(size_type)=0
virtual StatusCode next(Context &refCtxt) const
Get next iteration item from the event loop context.
void set(const IEvtSelector *sel, IDataStreamTool::size_type id, IEvtSelector::Context *it, IOpaqueAddress *pA)
Set the address of the iterator.
Definition: EventIterator.h:61
Definition of class EventSelectorDataStream.
Base class for all Incidents (computing events).
Definition: Incident.h:16
virtual IDataStreamTool::size_type ID() const
Stream identifier.
string s
Definition: gaudirun.py:244
IDataStreamTool::size_type increaseCounters(bool reset=false)
Increase counters.
Definition: EventIterator.h:82
bool m_reconfigure
Reconfigure occurred.
Definition: EventSelector.h:70
const std::string & dbName() const
Retrieve stream dbName.
StatusCode EventSelector::previous ( Context refCtxt) const
virtual

Get previous iteration item from the event loop context.

Parameters
refCtxt[IN/OUT] Reference to the context
jump[IN] Number of events to be skipped
Returns
StatusCode indicating success or failure

Implements IEvtSelector.

Definition at line 264 of file EventSelector.cpp.

264  {
265  return previous(refCtxt, 1);
266 }
virtual StatusCode previous(Context &refCtxt) const
Get previous iteration item from the event loop context.
StatusCode EventSelector::previous ( Context refCtxt,
int  jump 
) const
virtual

Get previous iteration item from the event loop context, but skip jump elements.

Parameters
refCtxt[IN/OUT] Reference to the context
jump[IN] Number of events to be skipped
Returns
StatusCode indicating success or failure

Implements IEvtSelector.

Definition at line 269 of file EventSelector.cpp.

269  {
270  EvtSelectorContext *pIt = dynamic_cast<EvtSelectorContext*>(&refCtxt);
271  if ( pIt && jump > 0 ) {
273  for ( int i = 0; i < jump && sc.isSuccess(); ++i ) {
275  Context* it = pIt->context();
276  IEvtSelector* sel = s->selector();
277  if ( it && sel ) { // First exploit the current stream
278  // This stream is empty: advance to the next stream
279  sc = sel->previous(*it); // This stream is empty: advance to the next stream
280  if ( !sc.isSuccess() ) {
281  sc = lastOfPreviousStream(true, *pIt);
282  }
283  else {
284  pIt->increaseCounters(false);
285  pIt->set(it, 0);
286  }
287  printEvtInfo(pIt);
288  if ( !sc.isSuccess() ) {
289  return sc;
290  }
291  }
292  pIt->increaseCounters(false);
293  }
294  return sc;
295  }
296  printEvtInfo(pIt);
297  return StatusCode::FAILURE;
298 }
StatusCode lastOfPreviousStream(bool shutDown, EvtSelectorContext &it) const
Retrieve last entry of the previous data stream.
IEvtSelector::Context * context() const
Access "real" iterator.
Definition: EventIterator.h:78
The Event Selector Interface.
Definition: IEvtSelector.h:19
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:75
IDataStreamTool * m_streamtool
Definition: EventSelector.h:67
IEvtSelector * selector() const
Retrieve event selector object.
virtual void printEvtInfo(const EvtSelectorContext *iter) const
Progress report.
Definition of class EventIterator.
Definition: EventIterator.h:32
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:30
virtual EventSelectorDataStream * getStream(size_type)=0
void set(const IEvtSelector *sel, IDataStreamTool::size_type id, IEvtSelector::Context *it, IOpaqueAddress *pA)
Set the address of the iterator.
Definition: EventIterator.h:61
Definition of class EventSelectorDataStream.
virtual IDataStreamTool::size_type ID() const
Stream identifier.
string s
Definition: gaudirun.py:244
IDataStreamTool::size_type increaseCounters(bool reset=false)
Increase counters.
Definition: EventIterator.h:82
virtual StatusCode previous(Context &c) const =0
Fetch the previous event.
list i
Definition: ana.py:128
void EventSelector::printEvtInfo ( const EvtSelectorContext iter) const
protectedvirtual

Progress report.

Definition at line 53 of file EventSelector.cpp.

53  {
54  if ( 0 != iter ) {
55  long count = iter->numEvent();
56  // Print an message every m_evtPrintFrequency events
57  if ( 0 == iter->context() ) {
58  MsgStream log(msgSvc(), name());
59  log << MSG::INFO << "End of event input reached." << endmsg;
60  }
61  else if( iter->numStreamEvent() == -1 ) {
62  // Intial value for this stream
63  }
64  else if( m_evtPrintFrequency != -1 && (count % m_evtPrintFrequency == 0)) {
65  MsgStream log(msgSvc(), name());
66  log << MSG::ALWAYS << "Reading Event record " << count+1
67  << ". Record number within stream " << iter->ID()+1
68  << ": " << iter->numStreamEvent()+1 << endmsg;
69  }
70  }
71  else {
72  MsgStream log(msgSvc(), name());
73  log << MSG::INFO << "End of event input reached." << endmsg;
74  }
75 }
Definition of the MsgStream class used to transmit messages.
Definition: MsgStream.h:24
IEvtSelector::Context * context() const
Access "real" iterator.
Definition: EventIterator.h:78
int m_evtPrintFrequency
Printout frequency.
Definition: EventSelector.h:84
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
SmartIF< IMessageSvc > & msgSvc() const
The standard message service.
long numStreamEvent() const
Access counter within stream.
virtual const std::string & name() const
Retrieve name of the service.
Definition: Service.cpp:329
virtual IDataStreamTool::size_type ID() const
Stream identifier.
long numEvent() const
Access counter.
StatusCode EventSelector::reinitialize ( )
virtual

Service override: Reinitialize service.

Reimplemented from Service.

Definition at line 429 of file EventSelector.cpp.

429  {
431  MsgStream logger(msgSvc(), name());
432  logger << MSG::ERROR << "Cannot reinitialize: service not in state initialized" << endmsg;
433  return StatusCode::FAILURE;
434  }
435 
437  StatusCode status = m_streamtool->clear();
438  if ( status.isFailure() ) return status;
440  m_reconfigure = true;
442  }
443 
444  return StatusCode::SUCCESS;
445 }
Definition of the MsgStream class used to transmit messages.
Definition: MsgStream.h:24
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
SmartIF< IMessageSvc > & msgSvc() const
The standard message service.
IDataStreamTool * m_streamtool
Definition: EventSelector.h:67
GAUDIPS_API Logger & logger()
Return the current logger instance.
bool isFailure() const
Test for a status code of FAILURE.
Definition: StatusCode.h:85
StreamSpecs m_streamSpecsLast
Input stream specifiers (last used)
Definition: EventSelector.h:74
virtual StatusCode addStreams(const StreamSpecs &)=0
virtual StatusCode clear()=0
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:30
StreamSpecs m_streamSpecs
Input stream specifiers (for job options)
Definition: EventSelector.h:72
virtual Gaudi::StateMachine::State FSMState() const
Get the current state.
Definition: Service.h:56
virtual const std::string & name() const
Retrieve name of the service.
Definition: Service.cpp:329
bool m_reconfigure
Reconfigure occurred.
Definition: EventSelector.h:70
StatusCode EventSelector::releaseContext ( Context *&  refCtxt) const
virtual

Release existing event iteration context.

Parameters
refCtxt[IN/OUT] Reference to the context
Returns
StatusCode indicating success or failure

Implements IEvtSelector.

Definition at line 355 of file EventSelector.cpp.

355  {
356  const EvtSelectorContext *cpIt = dynamic_cast<const EvtSelectorContext*>(refCtxt);
357  EvtSelectorContext *pIt = const_cast<EvtSelectorContext*>(cpIt);
358  if ( pIt && pIt->ID() >= 0 && pIt->ID() < (long)m_streamtool->size() ) {
360  Context* it = pIt->context();
361  IEvtSelector* sel = s->selector();
362  if ( it && sel ) {
363  StatusCode sc = sel->releaseContext(it);
364  if ( sc.isSuccess() ) {
365  refCtxt = 0;
366  delete pIt;
367  return sc;
368  }
369  }
370  }
371  if ( pIt ) {
372  delete pIt;
373  }
374  return StatusCode::SUCCESS;
375 }
IEvtSelector::Context * context() const
Access "real" iterator.
Definition: EventIterator.h:78
The Event Selector Interface.
Definition: IEvtSelector.h:19
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:75
IDataStreamTool * m_streamtool
Definition: EventSelector.h:67
IEvtSelector * selector() const
Retrieve event selector object.
Definition of class EventIterator.
Definition: EventIterator.h:32
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:30
virtual EventSelectorDataStream * getStream(size_type)=0
virtual StatusCode releaseContext(Context *&) const =0
Release the Context object.
Definition of class EventSelectorDataStream.
virtual IDataStreamTool::size_type ID() const
Stream identifier.
string s
Definition: gaudirun.py:244
virtual size_type size()=0
StatusCode EventSelector::resetCriteria ( const std::string &  cr,
Context c 
) const
virtual

Will set a new criteria for the selection of the next list of events and will change the state of the context in a way to point to the new list.

Parameters
crThe new criteria string.
cReference pointer to the Context object.
Returns
StatusCode indicating success or failure

Implements IEvtSelector.

Definition at line 46 of file EventSelector.cpp.

48 {
49  return StatusCode::FAILURE;
50 }
StatusCode EventSelector::rewind ( Context refCtxt) const
virtual

Rewind the dataset.

Parameters
refCtxt[IN/OUT] Reference to the context
Returns
StatusCode indicating success or failure

Implements IEvtSelector.

Definition at line 309 of file EventSelector.cpp.

309  {
310  EvtSelectorContext *ctxt = dynamic_cast<EvtSelectorContext*>(&refCtxt);
311  if ( ctxt ) {
312  ctxt->set(0, -1, 0, 0);
313  firstOfNextStream(true, *ctxt);
314  long nskip = m_firstEvent;
315  while( --nskip > 0 ) {
316  StatusCode sc = next(*ctxt);
317  if ( sc.isFailure() ) {
318  MsgStream log(msgSvc(), name());
319  log << MSG::ERROR << "rewind() failed to start with event number "
320  << m_firstEvent << endmsg;
321  return StatusCode::FAILURE;
322  }
323  }
324  return StatusCode::SUCCESS;
325  }
326  return StatusCode::FAILURE;
327 }
Definition of the MsgStream class used to transmit messages.
Definition: MsgStream.h:24
int m_firstEvent
First event to be processed.
Definition: EventSelector.h:80
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
SmartIF< IMessageSvc > & msgSvc() const
The standard message service.
StatusCode firstOfNextStream(bool shutDown, EvtSelectorContext &it) const
Retrieve first entry of the next data stream.
bool isFailure() const
Test for a status code of FAILURE.
Definition: StatusCode.h:85
Definition of class EventIterator.
Definition: EventIterator.h:32
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:30
virtual StatusCode next(Context &refCtxt) const
Get next iteration item from the event loop context.
virtual const std::string & name() const
Retrieve name of the service.
Definition: Service.cpp:329
void set(const IEvtSelector *sel, IDataStreamTool::size_type id, IEvtSelector::Context *it, IOpaqueAddress *pA)
Set the address of the iterator.
Definition: EventIterator.h:61

Member Data Documentation

int EventSelector::m_evtMax
protected

Maximum number of events to be processed.

Definition at line 82 of file EventSelector.h.

int EventSelector::m_evtPrintFrequency
protected

Printout frequency.

Definition at line 84 of file EventSelector.h.

int EventSelector::m_firstEvent
protected

First event to be processed.

Definition at line 80 of file EventSelector.h.

SmartIF<IIncidentSvc> EventSelector::m_incidentSvc
protected

Reference to the indicent service.

Definition at line 63 of file EventSelector.h.

bool EventSelector::m_reconfigure
protected

Reconfigure occurred.

Definition at line 70 of file EventSelector.h.

int EventSelector::m_streamCount
protected

Input stream counter (0..oo, monotonely increasing)

Definition at line 78 of file EventSelector.h.

long int EventSelector::m_streamID

Definition at line 59 of file EventSelector.h.

std::string EventSelector::m_streamManager
protected

Definition at line 86 of file EventSelector.h.

Streams EventSelector::m_streams
protected

Input streams.

Definition at line 76 of file EventSelector.h.

StreamSpecs EventSelector::m_streamSpecs
protected

Input stream specifiers (for job options)

Definition at line 72 of file EventSelector.h.

StreamSpecs EventSelector::m_streamSpecsLast
protected

Input stream specifiers (last used)

Definition at line 74 of file EventSelector.h.

IDataStreamTool* EventSelector::m_streamtool
protected

Definition at line 67 of file EventSelector.h.

SmartIF<IToolSvc> EventSelector::m_toolSvc
protected

Definition at line 65 of file EventSelector.h.


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