| # Gaudi Framework, version v25r0 |

Home |  | Generated: Mon Feb 17 2014

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Public Types | Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | List of all members
EventSelector Class Reference

Definition of class EventSelector. More...

`#include <EventSelector.h>`

Inheritance diagram for EventSelector:
[legend]
Collaboration diagram for EventSelector:
[legend]

## Public Types
typedef std::vector < EventSelectorDataStream * > | Streams
typedef std::vector< std::string > | StreamSpecs
typedef std::vector < StringProperty > | Properties
Public Types inherited from extends1< Service, IEvtSelector >
typedef extends1 | base_class
| Typedef to this class.
typedef extend_interfaces1 < IEvtSelector > | extend_interfaces_base
| Typedef to the base of this class.
typedef extend_interfaces_base::ext_iids | interfaces
| MPL set of all the implemented interfaces.
Public Types inherited from Service
typedef Gaudi::PluginService::Factory2 < 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.
typedef extend_interfaces3 < IService, IProperty, IStateful > | extend_interfaces_base
| Typedef to the base of this class.
typedef extend_interfaces_base::ext_iids | interfaces
| MPL set of all the implemented interfaces.
Public Types inherited from extend_interfaces3< I1, I2, I3 >
typedef mpl::fold< typename I1::iid::iids::type, typename mpl::fold< typename I2::iid::iids::type, typename I3::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.
Public Types inherited from extend_interfaces1< IEvtSelector >
typedef IEvtSelector::iid::iids::type | ext_iids
| MPL set of interfaces extended by this one.

## Public Member Functions
virtual StatusCode | initialize ()
| IService implementation: Db event selector override.
virtual StatusCode | finalize ()
| IService implementation: Service finalization.
virtual StatusCode | reinitialize ()
| Service override: Reinitialize service.
virtual StatusCode | createContext (Context *&refpCtxt) const
| Create a new event loop context.
virtual StatusCode | next (Context &refCtxt) const
| Get next iteration item from the event loop context.
virtual StatusCode | next (Context &refCtxt, int jump) const
| Get next iteration item from the event loop context, but skip jump elements.
virtual StatusCode | previous (Context &refCtxt) const
| Get previous iteration item from the event loop context.
virtual StatusCode | previous (Context &refCtxt, int jump) const
| Get previous iteration item from the event loop context, but skip jump elements.
virtual StatusCode | rewind (Context &refCtxt) const
| Rewind the dataset.
virtual StatusCode | createAddress (const Context &refCtxt, IOpaqueAddress *&refpAddr) const
| Create new Opaque address corresponding to the current record.
virtual StatusCode | releaseContext (Context *&refCtxt) const
| Release existing event iteration context.
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.
virtual StatusCode | last (Context &c) const
| Access last item in the iteration.
StatusCode | firstOfNextStream (bool shutDown, EvtSelectorContext &it) const
| Retrieve first entry of the next data stream.
StatusCode | lastOfPreviousStream (bool shutDown, EvtSelectorContext &it) const
| Retrieve last entry of the previous data stream.
| EventSelector (const std::string &name, ISvcLocator *svcloc)
| Standard Constructor.
virtual | ~EventSelector ()
| Standard Destructor.
Public Member Functions inherited from extends1< Service, IEvtSelector >
| extends1 (A1 a1, A2 a2, A3 a3)
| Templated constructor with 3 arguments.
| extends1 (A1 a1, A2 a2)
| Templated constructor with 2 arguments.
| extends1 (A1 a1)
| Templated constructor with 1 argument.
| extends1 ()
| Default constructor.
virtual void * | i_cast (const InterfaceID &tid) const
| Implementation of IInterface::i_cast.
virtual StatusCode | queryInterface (const InterfaceID &ti, void **pp)
| Implementation of IInterface::queryInterface.
virtual std::vector< std::string > | getInterfaceNames () const
| Implementation of IInterface::getInterfaceNames.
virtual | ~extends1 ()
| Virtual destructor.
Public Member Functions inherited from Service
virtual unsigned long | release ()
| Release Interface instance.
virtual const std::string & | name () const
| Retrieve name of the service.
virtual StatusCode | configure ()
virtual StatusCode | start ()
virtual StatusCode | stop ()
virtual StatusCode | terminate ()
virtual Gaudi::StateMachine::State | FSMState () const
virtual Gaudi::StateMachine::State | targetFSMState () const
virtual StatusCode | restart ()
virtual StatusCode | sysInitialize ()
| Initialize Service.
virtual StatusCode | sysStart ()
| Initialize Service.
virtual StatusCode | sysStop ()
| Initialize Service.
virtual StatusCode | sysFinalize ()
| Finalize Service.
virtual StatusCode | sysReinitialize ()
| Re-initialize the Service.
virtual StatusCode | sysRestart ()
| Re-initialize the Service.
virtual StatusCode | setProperty (const Property &p)
virtual StatusCode | setProperty (const std::string &s)
virtual StatusCode | setProperty (const std::string &n, const std::string &v)
virtual StatusCode | getProperty (Property *p) const
virtual const Property & | getProperty (const std::string &name) const
virtual StatusCode | getProperty (const std::string &n, std::string &v) const
virtual const std::vector < Property * > & | getProperties () const
template<class TYPE >
StatusCode | setProperty (const std::string &name, const TYPE &value)
| set the property form the value
| Service (const std::string &name, ISvcLocator *svcloc)
| Standard Constructor.
SmartIF< ISvcLocator > & | serviceLocator () const
| Retrieve pointer to service locator.
StatusCode | setProperties ()
| Method for setting declared properties to the values specified for the job.
template<class T >
StatusCode | service (const std::string &name, const T *&psvc, bool createIf=true) const
| Access a service by name, creating it if it doesn't already exist.
template<class T >
StatusCode | service (const std::string &name, T *&psvc, bool createIf=true) const
template<class T >
StatusCode | service (const std::string &svcType, const std::string &svcName, T *&psvc) const
| Access a service by name and type, creating it if it doesn't already exist.
template<class T >
Property * | declareProperty (const std::string &name, T &property, const std::string &doc="none") const
| Declare the named property.
Property * | declareRemoteProperty (const std::string &name, IProperty *rsvc, const std::string &rname="") const
| Declare remote named properties.
SmartIF< IAuditorSvc > & | auditorSvc () const
| The standard auditor service.May not be invoked before sysInitialize() has been invoked.
Public Member Functions inherited from CommonMessaging< implements3< IService, IProperty, IStateful > >
| CommonMessaging (const A1 &a1, const A2 &a2, const A3 &a3)
| Templated constructor with 3 arguments.
| CommonMessaging (const A1 &a1, const A2 &a2)
| Templated constructor with 2 arguments.
| CommonMessaging (const A1 &a1)
| Templated constructor with 1 argument.
| CommonMessaging ()
| Default constructor.
virtual | ~CommonMessaging ()
| Virtual destructor.
SmartIF< IMessageSvc > & | msgSvc () const
| The standard message service.
MsgStream & | msgStream () const
| Return an uninitialized MsgStream.
MsgStream & | msgStream (const MSG::Level level) const
| Predefined configurable message stream for the efficient printouts.
MsgStream & | always () const
| shortcut for the method msgStream(MSG::ALWAYS)
MsgStream & | fatal () const
| shortcut for the method msgStream(MSG::FATAL)
MsgStream & | err () const
| shortcut for the method msgStream(MSG::ERROR)
MsgStream & | error () const
| shortcut for the method msgStream(MSG::ERROR)
MsgStream & | warning () const
| shortcut for the method msgStream(MSG::WARNING)
MsgStream & | info () const
| shortcut for the method msgStream(MSG::INFO)
MsgStream & | debug () const
| shortcut for the method msgStream(MSG::DEBUG)
MsgStream & | verbose () const
| shortcut for the method msgStream(MSG::VERBOSE)
MsgStream & | msg () const
| shortcut for the method msgStream(MSG::INFO)
MSG::Level | msgLevel () const
| get the output level from the embedded MsgStream
bool | msgLevel (MSG::Level lvl) const
| get the output level from the embedded MsgStream
Public Member Functions inherited from extend_interfaces1< IEvtSelector >
virtual | ~extend_interfaces1 ()
| Virtual destructor.
Public Member Functions inherited from IEvtSelector
| DeclareInterfaceID (IEvtSelector, 2, 0)
| InterfaceID.
Public Member Functions inherited from IInterface
virtual unsigned long | addRef ()=0
| Increment the reference count of Interface instance.
virtual unsigned long | release ()=0
| Release Interface instance.
virtual unsigned long | refCount () const =0
| Current reference count.
virtual | ~IInterface ()
| Virtual destructor.

## Public Attributes
long int | m_streamID

## Protected Member Functions
virtual void | printEvtInfo (const EvtSelectorContext *iter) const
| Progress report.

## Protected Attributes
SmartIF< IIncidentSvc > | m_incidentSvc
| Reference to the indicent service.
SmartIF< IToolSvc > | m_toolSvc
IDataStreamTool * | m_streamtool
bool | m_reconfigure
| Reconfigure occurred.
StreamSpecs | m_streamSpecs
| Input stream specifiers (for job options)
StreamSpecs | m_streamSpecsLast
| Input stream specifiers (last used)
Streams | m_streams
| Input streams.
int | m_streamCount
| Input stream counter (0..oo, monotonely increasing)
int | m_firstEvent
| First event to be processed.
int | m_evtMax
| Maximum number of events to be processed.
int | m_evtPrintFrequency
| Printout frequency.
std::string | m_streamManager

## Additional Inherited Members
Static Public Member Functions inherited from IInterface
static const InterfaceID & | interfaceID ()
| Return an instance of InterfaceID identifying the interface.

## 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

typedef std::vector<StringProperty> EventSelector::Properties

Definition at line 57 of file EventSelector.h.

typedef std::vector<EventSelectorDataStream*> EventSelector::Streams

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 24 of file EventSelector.cpp.

: base_class( name, svcloc)
{
m_incidentSvc = 0;
m_toolSvc = 0;
m_streamCount = 0;
m_firstEvent = 0;
m_evtPrintFrequency = 10;
m_evtMax = INT_MAX;
declareProperty( "Input", m_streamSpecs);
declareProperty( "FirstEvent", m_firstEvent);
declareProperty( "EvtMax", m_evtMax);
declareProperty( "PrintFreq", m_evtPrintFrequency);
declareProperty( "StreamManager", m_streamManager="DataStreamTool");
m_reconfigure = false;
}

EventSelector::~EventSelector | ( |  | ) |
| virtual

Standard Destructor.

Definition at line 42 of file EventSelector.cpp.

{
}

## 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 332 of file EventSelector.cpp.

{
const EvtSelectorContext *cpIt = dynamic_cast<const EvtSelectorContext*>(&refCtxt);
EvtSelectorContext *pIt = const_cast<EvtSelectorContext*>(cpIt);
refpAddr = 0;
if ( pIt ) {
const EventSelectorDataStream* s = m_streamtool->getStream(pIt->ID());
Context* it = pIt->context();
IEvtSelector* sel = s->selector();
if ( it && sel ) {
IOpaqueAddress* pAddr = 0;
StatusCode sc = sel->createAddress(*it, pAddr);
if ( sc.isSuccess() ) {
refpAddr = pAddr;
}
pIt->set(it, pAddr);
return sc;
}
}
return StatusCode::FAILURE;
}

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 191 of file EventSelector.cpp.

{
// Max event is zero. Return begin = end
refpCtxt = 0;
if ( m_firstEvent < 0 ) {
MsgStream log(msgSvc(), name());
log << MSG::ERROR << "First Event = " << m_firstEvent << " not valid" << endmsg;
log << MSG::ERROR << "It should be > 0 " << endmsg;
return StatusCode::FAILURE; // if failure => iterators = end();
}
EvtSelectorContext* ctxt = new EvtSelectorContext(this);
ctxt->set(0, -1, 0, 0);
firstOfNextStream(true, *ctxt).ignore();
refpCtxt = ctxt;
long nskip = m_firstEvent;
while( --nskip > 0 ) {
StatusCode sc = next(*refpCtxt);
if ( sc.isFailure() ) {
MsgStream log(msgSvc(), name());
log << MSG::ERROR << " createContext() failed to start with event number "
<< m_firstEvent << endmsg;
releaseContext(refpCtxt);
refpCtxt = 0;
return StatusCode::FAILURE;
}
}
return StatusCode::SUCCESS;
}

StatusCode EventSelector::finalize | ( |  | ) |
| virtual

IService implementation: Service finalization.

Reimplemented from Service.

Definition at line 449 of file EventSelector.cpp.

{
if (msgLevel(MSG::DEBUG)) {
MsgStream log(msgSvc(), name());
log << MSG::DEBUG << "finalize()" << endmsg;
}
m_incidentSvc = 0;
if (m_streamtool) {
if (m_toolSvc.isValid()) {
m_toolSvc->releaseTool(m_streamtool).ignore();
} else {
// It should not be possible to get here
m_streamtool->release();
}
m_streamtool = 0;
}
m_toolSvc = 0;
return Service::finalize();
}

StatusCode EventSelector::firstOfNextStream | ( | bool | shutDown,
|  | EvtSelectorContext & | it
| ) |  | const

Retrieve first entry of the next data stream.

Definition at line 80 of file EventSelector.cpp.

{
StatusCode status = StatusCode::SUCCESS;
IDataStreamTool::size_type iter_id = (m_reconfigure) ? 0 : iter.ID()+1;
if ( m_reconfigure ) const_cast<EventSelector*>(this)->m_reconfigure = false;
if ( shutDown ) {
if ( iter.ID() >= 0 && iter.ID() < (long)m_streamtool->size() ) {
const EventSelectorDataStream* s = m_streamtool->getStream(iter.ID());
if ( s->isInitialized() ) {
EventSelector* thisPtr = const_cast<EventSelector*>(this);
if ( s->selector() && iter.context() ) {
Context* ctxt = iter.context();
s->selector()->releaseContext(ctxt).ignore();
iter.set(0,0);
}
status = thisPtr->m_streamtool->finalizeStream(const_cast<EventSelectorDataStream*>(s));
iter.set(0,0);
}
}
}
const EventSelectorDataStream* s ;
status = m_streamtool->getNextStream( s , iter_id );
if ( status.isSuccess() ) {
if(s!=NULL) {
if ( !s->isInitialized() ) {
EventSelector* thisPtr = const_cast<EventSelector*>(this);
status = thisPtr->m_streamtool->initializeStream(const_cast<EventSelectorDataStream*>(s));
}
if ( status.isSuccess() ) {
const IEvtSelector* sel = s->selector();
if ( sel ) {
Context* ctxt = 0;
status = sel->createContext(ctxt);
if ( status.isSuccess() ) {
status = sel->resetCriteria(s->criteria(), *ctxt);
if ( status.isSuccess() ) {
MsgStream log(msgSvc(), name());
iter.set(this, iter_id, ctxt, 0);
log << MSG::INFO << *s << endmsg;
m_incidentSvc->fireIncident(Incident(s->dbName(),IncidentType::BeginInputFile));
return StatusCode::SUCCESS;
}
}
}
}
m_incidentSvc->fireIncident(Incident(s->dbName(),IncidentType::FailInputFile));
}
}
iter.set(this, -1, 0, 0);
status.setChecked();
//m_incidentSvc->fireIncident(Incident(s->dbName(),IncidentType::FailInputFile));
return StatusCode::FAILURE;
}

StatusCode EventSelector::initialize | ( |  | ) |
| virtual

IService implementation: Db event selector override.

Reimplemented from Service.

Definition at line 379 of file EventSelector.cpp.

{
// Initialize base class
StatusCode status = Service::initialize();
MsgStream logger(msgSvc(), name());
if ( !status.isSuccess() ) {
logger << MSG::ERROR << "Error initializing base class Service!" << endmsg;
return status;
}
// Get the references to the services that are needed by the ApplicationMgr itself
m_incidentSvc = serviceLocator()->service("IncidentSvc");
if( !m_incidentSvc.isValid() ) {
logger << MSG::FATAL << "Error retrieving IncidentSvc." << endmsg;
return StatusCode::FAILURE;
}
if ( m_evtMax != INT_MAX ) {
logger << MSG::ERROR << "EvtMax is an obsolete property of the event selector." << endmsg;
logger << MSG::ERROR << "Please set \"ApplicationMgr.EvtMax = " << m_evtMax
<< ";\" to process the requested number of events." << endmsg;
return StatusCode::FAILURE;
}
m_toolSvc = serviceLocator()->service("ToolSvc");
if ( !m_toolSvc.isValid() ) {
logger << MSG::ERROR << " Could not locate the Tool Service! " << endmsg;
return StatusCode::FAILURE;
}
status = m_toolSvc->retrieveTool(m_streamManager.c_str(), m_streamtool, this);
if( status.isFailure() ) {
logger << MSG::ERROR << "Error initializing "
<< m_streamManager << endmsg;
return status;
}
status = m_streamtool->clear();
if( status.isFailure() ) {
// Message already printed by the tool
return status;
}
status = m_streamtool->addStreams(m_streamSpecs);
m_streamSpecsLast = m_streamSpecs;
m_streamID = 0;
return status;
}

StatusCode EventSelector::last | ( | Context & | c | ) | const
| virtual

Access last item in the iteration.

Parameters

  c | Reference to the Context object.

Returns
  StatusCode indicating success or failure

Implements IEvtSelector.

Definition at line 302 of file EventSelector.cpp.

{
EvtSelectorContext *pIt = dynamic_cast<EvtSelectorContext*>(&refCtxt);
if ( pIt ) {
}
return StatusCode::FAILURE;
}

StatusCode EventSelector::lastOfPreviousStream | ( | bool | shutDown,
|  | EvtSelectorContext & | it
| ) |  | const

Retrieve last entry of the previous data stream.

Definition at line 140 of file EventSelector.cpp.

{
StatusCode status = StatusCode::SUCCESS;
if ( shutDown ) {
if ( iter.ID() >= 0 && iter.ID() < (long)m_streamtool->size() ) {
const EventSelectorDataStream* s = m_streamtool->getStream(iter.ID());
if ( s->isInitialized() ) {
EventSelector* thisPtr = const_cast<EventSelector*>(this);
if ( s->selector() && iter.context() ) {
Context* ctxt = iter.context();
s->selector()->releaseContext(ctxt);
iter.set(0,0);
}
status = thisPtr->m_streamtool->finalizeStream(const_cast<EventSelectorDataStream*>(s));
iter.set(0,0);
}
}
}
IDataStreamTool::size_type iter_id = iter.ID()-1;
const EventSelectorDataStream* s ;
status = m_streamtool->getPreviousStream( s , iter_id );
if ( status.isSuccess() ) {
if ( !s->isInitialized() ) {
EventSelector* thisPtr = const_cast<EventSelector*>(this);
status = thisPtr->m_streamtool->initializeStream(const_cast<EventSelectorDataStream*>(s));
}
if ( status.isSuccess() ) {
const IEvtSelector* sel = s->selector();
if ( sel ) {
Context* ctxt = 0;
status = sel->createContext(ctxt);
if ( status.isSuccess() ) {
status = sel->resetCriteria(s->criteria(), *ctxt);
if ( status.isSuccess() ) {
MsgStream log(msgSvc(), name());
iter.set(this, iter_id, ctxt, 0);
log << MSG::INFO << *s << endmsg;
return StatusCode::SUCCESS;
}
}
}
}
}
iter.set(this, -1, 0, 0);
return StatusCode::FAILURE;
}

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 221 of file EventSelector.cpp.

{
return next(refCtxt, 1);
}

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 226 of file EventSelector.cpp.

{
EvtSelectorContext *pIt = dynamic_cast<EvtSelectorContext*>(&refCtxt);
if ( pIt ) {
if ( pIt->ID() != -1 ) {
const EventSelectorDataStream* s = m_streamtool->getStream(pIt->ID());
Context* it = pIt->context();
IEvtSelector* sel = s->selector();
if ( it && sel ) { // First exploit the current stream
StatusCode sc = sel->next(*it); // This stream is empty: advance to the next stream
if ( !sc.isSuccess() ) {
m_incidentSvc->fireIncident(Incident(s->dbName(),IncidentType::EndInputFile));
sc = firstOfNextStream(true, *pIt);
if (sc.isSuccess() ) sc = next(*pIt);
}
else {
pIt->increaseCounters(false);
pIt->set(it, 0);
printEvtInfo(pIt);
}
return sc;
}
else if ( m_reconfigure ) {
StatusCode sc = firstOfNextStream(false, *pIt);
printEvtInfo(pIt);
return sc;
}
}
else if ( m_reconfigure ) {
StatusCode sc = firstOfNextStream(false, *pIt);
printEvtInfo(pIt);
return sc;
}
pIt->increaseCounters(false);
}
printEvtInfo(pIt);
return StatusCode::FAILURE;
}

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 265 of file EventSelector.cpp.

{
return previous(refCtxt, 1);
}

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 270 of file EventSelector.cpp.

{
EvtSelectorContext *pIt = dynamic_cast<EvtSelectorContext*>(&refCtxt);
if ( pIt && jump > 0 ) {
StatusCode sc = StatusCode::SUCCESS;
for ( int i = 0; i < jump && sc.isSuccess(); ++i ) {
const EventSelectorDataStream* s = m_streamtool->getStream(pIt->ID());
Context* it = pIt->context();
IEvtSelector* sel = s->selector();
if ( it && sel ) { // First exploit the current stream
// This stream is empty: advance to the next stream
sc = sel->previous(*it); // This stream is empty: advance to the next stream
if ( !sc.isSuccess() ) {
sc = lastOfPreviousStream(true, *pIt);
}
else {
pIt->increaseCounters(false);
pIt->set(it, 0);
}
printEvtInfo(pIt);
if ( !sc.isSuccess() ) {
return sc;
}
}
pIt->increaseCounters(false);
}
return sc;
}
printEvtInfo(pIt);
return StatusCode::FAILURE;
}

void EventSelector::printEvtInfo | ( | const EvtSelectorContext * | iter | ) | const
| protected virtual

Progress report.

Definition at line 54 of file EventSelector.cpp.

{
if ( 0 != iter ) {
long count = iter->numEvent();
// Print an message every m_evtPrintFrequency events
if ( 0 == iter->context() ) {
MsgStream log(msgSvc(), name());
log << MSG::INFO << "End of event input reached." << endmsg;
}
else if( iter->numStreamEvent() == -1 ) {
// Intial value for this stream
}
else if( m_evtPrintFrequency != -1 && (count % m_evtPrintFrequency == 0)) {
MsgStream log(msgSvc(), name());
log << MSG::ALWAYS << "Reading Event record " << count+1
<< ". Record number within stream " << iter->ID()+1
<< ": " << iter->numStreamEvent()+1 << endmsg;
}
}
else {
MsgStream log(msgSvc(), name());
log << MSG::INFO << "End of event input reached." << endmsg;
}
}

StatusCode EventSelector::reinitialize | ( |  | ) |
| virtual

Service override: Reinitialize service.

Reimplemented from Service.

Definition at line 430 of file EventSelector.cpp.

{
if ( FSMState() != Gaudi::StateMachine::INITIALIZED ) {
MsgStream logger(msgSvc(), name());
logger << MSG::ERROR << "Cannot reinitialize: service not in state initialized" << endmsg;
return StatusCode::FAILURE;
}
if( m_streamSpecsLast != m_streamSpecs ) {
StatusCode status = m_streamtool->clear();
if ( status.isFailure() ) return status;
m_streamSpecsLast = m_streamSpecs;
m_reconfigure = true;
return m_streamtool->addStreams(m_streamSpecs);
}
return StatusCode::SUCCESS;
}

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 356 of file EventSelector.cpp.

{
const EvtSelectorContext *cpIt = dynamic_cast<const EvtSelectorContext*>(refCtxt);
EvtSelectorContext *pIt = const_cast<EvtSelectorContext*>(cpIt);
if ( pIt && pIt->ID() >= 0 && pIt->ID() < (long)m_streamtool->size() ) {
const EventSelectorDataStream* s = m_streamtool->getStream(pIt->ID());
Context* it = pIt->context();
IEvtSelector* sel = s->selector();
if ( it && sel ) {
StatusCode sc = sel->releaseContext(it);
if ( sc.isSuccess() ) {
refCtxt = 0;
delete pIt;
return sc;
}
}
}
if ( pIt ) {
delete pIt;
}
return StatusCode::SUCCESS;
}

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

  cr | The new criteria string.
  c | Reference pointer to the Context object.

Returns
  StatusCode indicating success or failure

Implements IEvtSelector.

Definition at line 47 of file EventSelector.cpp.

{
return StatusCode::FAILURE;
}

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 310 of file EventSelector.cpp.

{
EvtSelectorContext *ctxt = dynamic_cast<EvtSelectorContext*>(&refCtxt);
if ( ctxt ) {
ctxt->set(0, -1, 0, 0);
firstOfNextStream(true, *ctxt);
long nskip = m_firstEvent;
while( --nskip > 0 ) {
StatusCode sc = next(*ctxt);
if ( sc.isFailure() ) {
MsgStream log(msgSvc(), name());
log << MSG::ERROR << "rewind() failed to start with event number "
<< m_firstEvent << endmsg;
return StatusCode::FAILURE;
}
}
return StatusCode::SUCCESS;
}
return StatusCode::FAILURE;
}

## 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:

- /afs/cern.ch/sw/Gaudi/releases/GAUDI/GAUDI_v25r0/GaudiCoreSvc/src/EventSelector/EventSelector.h
- /afs/cern.ch/sw/Gaudi/releases/GAUDI/GAUDI_v25r0/GaudiCoreSvc/src/EventSelector/EventSelector.cpp