| The Gaudi Framework v28r2-patches (bc4ad17a)

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

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

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 <src/EventSelector/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< Gaudi::Property< std::string > > | Properties
Public Types inherited from extends< Service, IEvtSelector >
using | base_class = extends
| Typedef to this class. More...
using | extend_interfaces_base = extend_interfaces< Interfaces... >
| Typedef to the base of this class. More...
Public Types inherited from Service
typedef Gaudi::PluginService::Factory< IService *, const std::string &, ISvcLocator * > | Factory
Public Types inherited from PropertyHolder< CommonMessaging< implements< IService, IProperty, IStateful > > >
using | PropertyHolderImpl = PropertyHolder< CommonMessaging< implements< IService, IProperty, IStateful > > >
| Typedef used to refer to this class from derived classes, as in. More...
Public Types inherited from CommonMessaging< implements< IService, IProperty, IStateful > >
using | base_class = CommonMessaging
Public Types inherited from extend_interfaces< Interfaces... >
using | ext_iids = typename Gaudi::interface_list_cat< typename Interfaces::ext_iids... >::type
| take union of the ext_iids of all Interfaces... More...

## Public Member Functions
StatusCode | initialize () override
| IService implementation: Db event selector override. More...
StatusCode | finalize () override
| IService implementation: Service finalization. More...
StatusCode | reinitialize () override
| Service override: Reinitialize service. More...
StatusCode | createContext (Context *&refpCtxt) const override
| Create a new event loop context. More...
StatusCode | next (Context &refCtxt) const override
| Get next iteration item from the event loop context. More...
StatusCode | next (Context &refCtxt, int jump) const override
| Get next iteration item from the event loop context, but skip jump elements. More...
StatusCode | previous (Context &refCtxt) const override
| Get previous iteration item from the event loop context. More...
StatusCode | previous (Context &refCtxt, int jump) const override
| Get previous iteration item from the event loop context, but skip jump elements. More...
StatusCode | rewind (Context &refCtxt) const override
| Rewind the dataset. More...
StatusCode | createAddress (const Context &refCtxt, IOpaqueAddress *&refpAddr) const override
| Create new Opaque address corresponding to the current record. More...
StatusCode | releaseContext (Context *&refCtxt) const override
| Release existing event iteration context. More...
StatusCode | resetCriteria (const std::string &cr, Context &c) const override
| 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...
StatusCode | last (Context &c) const override
| 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 () override=default
| Standard Destructor. More...
Public Member Functions inherited from extends< Service, IEvtSelector >
void * | i_cast (const InterfaceID &tid) const override
| Implementation of IInterface::i_cast. More...
StatusCode | queryInterface (const InterfaceID &ti, void **pp) override
| Implementation of IInterface::queryInterface. More...
std::vector< std::string > | getInterfaceNames () const override
| Implementation of IInterface::getInterfaceNames. More...
| ~extends () override=default
| Virtual destructor. More...
Public Member Functions inherited from Service
const std::string & | name () const override
| Retrieve name of the service. More...
StatusCode | configure () override
StatusCode | initialize () override
StatusCode | start () override
StatusCode | stop () override
StatusCode | finalize () override
StatusCode | terminate () override
Gaudi::StateMachine::State | FSMState () const override
Gaudi::StateMachine::State | targetFSMState () const override
StatusCode | reinitialize () override
StatusCode | restart () override
StatusCode | sysInitialize () override
| Initialize Service. More...
StatusCode | sysStart () override
| Initialize Service. More...
StatusCode | sysStop () override
| Initialize Service. More...
StatusCode | sysFinalize () override
| Finalize Service. More...
StatusCode | sysReinitialize () override
| Re-initialize the Service. More...
StatusCode | sysRestart () override
| Re-initialize the Service. More...
| Service (std::string name, ISvcLocator *svcloc)
| Standard Constructor. More...
SmartIF< ISvcLocator > & | serviceLocator () const override
| 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<typename IFace = IService>
SmartIF< IFace > | service (const std::string &name, 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 >
StatusCode | declarePrivateTool (ToolHandle< T > &handle, std::string toolTypeAndName="", bool createIf=true)
| Declare used Private tool. More...
template<class T >
StatusCode | declarePublicTool (ToolHandle< T > &handle, std::string toolTypeAndName="", bool createIf=true)
| Declare used Public tool. More...
SmartIF< IAuditorSvc > & | auditorSvc () const
| The standard auditor service.May not be invoked before sysInitialize() has been invoked. More...
Public Member Functions inherited from PropertyHolder< CommonMessaging< implements< IService, IProperty, IStateful > > >
| PropertyHolder ()=default
| ~PropertyHolder () override=default
Gaudi::Details::PropertyBase & | declareProperty (Gaudi::Details::PropertyBase &prop)
| Declare a property. More...
Gaudi::Details::PropertyBase * | declareProperty (const std::string &name, TYPE &value, const std::string &doc="none")
| Helper to wrap a regular data member and use it as a regular property. More...
Gaudi::Details::PropertyBase * | declareProperty (const std::string &name, TYPE &value, const std::string &doc="none") const
Gaudi::Details::PropertyBase * | declareProperty (const std::string &name, Gaudi::Property< TYPE, VERIFIER, HANDLERS > &prop, const std::string &doc="none")
| Declare a PropertyBase instance setting name and documentation. More...
Gaudi::Details::PropertyBase * | declareRemoteProperty (const std::string &name, IProperty *rsvc, const std::string &rname="")
| Declare a remote property. More...
StatusCode | setProperty (const Gaudi::Details::PropertyBase &p) override
| set the property form another property More...
StatusCode | setProperty (const std::string &s) override
| set the property from the formatted string More...
StatusCode | setProperty (const std::string &n, const std::string &v) override
| set the property from name and the value More...
StatusCode | setProperty (const std::string &name, const TYPE &value)
| set the property form the value More...
StatusCode | getProperty (Gaudi::Details::PropertyBase *p) const override
| get the property More...
const Gaudi::Details::PropertyBase & | getProperty (const std::string &name) const override
| get the property by name More...
StatusCode | getProperty (const std::string &n, std::string &v) const override
| convert the property to the string More...
const std::vector< Gaudi::Details::PropertyBase * > & | getProperties () const override
| get all properties More...
bool | hasProperty (const std::string &name) const override
| Return true if we have a property with the given name. More...
| PropertyHolder (const PropertyHolder &)=delete
PropertyHolder & | operator= (const PropertyHolder &)=delete
Gaudi::Details::PropertyBase * | declareProperty (const std::string &name, GaudiHandleBase &ref, const std::string &doc="none")
| Specializations for various GaudiHandles. More...
Gaudi::Details::PropertyBase * | declareProperty (const std::string &name, GaudiHandleArrayBase &ref, const std::string &doc="none")
Gaudi::Details::PropertyBase * | declareProperty (const std::string &name, DataObjectHandleBase &ref, const std::string &doc="none")
Public Member Functions inherited from CommonMessagingBase
virtual | ~CommonMessagingBase ()=default
| Virtual destructor. More...
SmartIF< IMessageSvc > & | msgSvc () const
| The standard message service. More...
MsgStream & | msgStream () const
| Return an uninitialized MsgStream. More...
MsgStream & | msgStream (const MSG::Level level) const
| Predefined configurable message stream for the efficient printouts. More...
MsgStream & | always () const
| shortcut for the method msgStream(MSG::ALWAYS) More...
MsgStream & | fatal () const
| shortcut for the method msgStream(MSG::FATAL) More...
MsgStream & | err () const
| shortcut for the method msgStream(MSG::ERROR) More...
MsgStream & | error () const
| shortcut for the method msgStream(MSG::ERROR) More...
MsgStream & | warning () const
| shortcut for the method msgStream(MSG::WARNING) More...
MsgStream & | info () const
| shortcut for the method msgStream(MSG::INFO) More...
MsgStream & | debug () const
| shortcut for the method msgStream(MSG::DEBUG) More...
MsgStream & | verbose () const
| shortcut for the method msgStream(MSG::VERBOSE) More...
MsgStream & | msg () const
| shortcut for the method msgStream(MSG::INFO) More...
MSG::Level | msgLevel () const
| get the output level from the embedded MsgStream More...
MSG::Level | outputLevel () const __attribute__((deprecated))
| Backward compatibility function for getting the output level. More...
bool | msgLevel (MSG::Level lvl) const
| get the output level from the embedded MsgStream More...
Public Member Functions inherited from extend_interfaces< Interfaces... >
| ~extend_interfaces () override=default
| Virtual destructor. 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
| ~Service () override
| Standard Destructor. More...
int | outputLevel () const
| get the `Service's` output level More...
Protected Member Functions inherited from PropertyHolder< CommonMessaging< implements< IService, IProperty, IStateful > > >
Gaudi::Details::PropertyBase * | property (const std::string &name) const
Protected Member Functions inherited from CommonMessaging< implements< IService, IProperty, IStateful > >
void | updateMsgStreamOutputLevel (int level)
| Update the output level of the cached MsgStream. More...

## Protected Attributes
SmartIF< IIncidentSvc > | m_incidentSvc = nullptr
| Reference to the indicent service. More...
SmartIF< IToolSvc > | m_toolSvc = nullptr
IDataStreamTool * | m_streamtool = nullptr
bool | m_reconfigure = false
| Reconfigure occurred. More...
StreamSpecs | m_streamSpecsLast
| Input stream specifiers (last used) More...
Streams | m_streams
| Input streams. More...
int | m_streamCount = 0
| Input stream counter (0..oo, monotonely increasing) More...
Gaudi::Property< StreamSpecs > | m_streamSpecs {this, "Input", {}, "input stream specifiers (for job options)"}
Gaudi::Property< int > | m_firstEvent {this, "FirstEvent", 0, "first event to be processed"}
Gaudi::Property< int > | m_evtMax {this, "EvtMax", INT_MAX, "maximum number of events to be processed"}
Gaudi::Property< int > | m_evtPrintFrequency {this, "PrintFreq", 10, "printout frequency"}
Gaudi::Property< std::string > | m_streamManager {this, "StreamManager", "DataStreamTool", ""}
Protected Attributes inherited from Service
Gaudi::StateMachine::State | m_state = Gaudi::StateMachine::OFFLINE
| Service state. More...
Gaudi::StateMachine::State | m_targetState = Gaudi::StateMachine::OFFLINE
| Service state. More...
Gaudi::Property< int > | m_outputLevel {this, "OutputLevel", MSG::NIL, "output level"}
Gaudi::Property< bool > | m_auditInit {this, "AuditServices", false, "[[deprecated]] unused"}
Gaudi::Property< bool > | m_auditorInitialize {this, "AuditInitialize", false, "trigger auditor on initialize()"}
Gaudi::Property< bool > | m_auditorStart {this, "AuditStart", false, "trigger auditor on start()"}
Gaudi::Property< bool > | m_auditorStop {this, "AuditStop", false, "trigger auditor on stop()"}
Gaudi::Property< bool > | m_auditorFinalize {this, "AuditFinalize", false, "trigger auditor on finalize()"}
Gaudi::Property< bool > | m_auditorReinitialize {this, "AuditReinitialize", false, "trigger auditor on reinitialize()"}
Gaudi::Property< bool > | m_auditorRestart {this, "AuditRestart", false, "trigger auditor on restart()"}
SmartIF< IAuditorSvc > | m_pAuditorSvc
| Auditor Service. 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

typedef std::vector<Gaudi::Property<std::string> > EventSelector::Properties

Definition at line 58 of file EventSelector.h.

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

Definition at line 56 of file EventSelector.h.

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

Definition at line 57 of file EventSelector.h.

## Constructor & Destructor Documentation

EventSelector::~EventSelector | ( |  | ) |
| override default

Standard Destructor.

## Member Function Documentation

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

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

Definition at line 298 of file EventSelector.cpp.

300 {
301 const EvtSelectorContext *cpIt = dynamic_cast<const EvtSelectorContext*>(&refCtxt);
302 EvtSelectorContext *pIt = const_cast<EvtSelectorContext*>(cpIt);
303 refpAddr = nullptr;
304 if ( pIt ) {
305 const EventSelectorDataStream* s = m_streamtool->getStream(pIt->ID());
306 Context* it = pIt->context();
307 IEvtSelector* sel = s->selector();
308 if ( it && sel ) {
309 IOpaqueAddress* pAddr = nullptr;
310 StatusCode sc = sel->createAddress(*it, pAddr);
311 if ( sc.isSuccess() ) refpAddr = pAddr;
312 pIt->set(it, pAddr);
313 return sc;
314 }
315 }
316 return StatusCode::FAILURE;
317 }
EvtSelectorContext::context
IEvtSelector::Context * context() const
Access "real" iterator.
Definition: EventIterator.h:70
StatusCode::FAILURE
Definition: StatusCode.h:29
IEvtSelector
The Event Selector Interface.
Definition: IEvtSelector.h:18
StatusCode::isSuccess
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:74
EventSelector::m_streamtool
IDataStreamTool * m_streamtool
Definition: EventSelector.h:68
EventSelectorDataStream::selector
IEvtSelector * selector() const
Retrieve event selector object.
Definition: EventSelectorDataStream.h:103
IOTest.sel
sel
Definition: IOTest.py:84
EvtSelectorContext
Definition of class EventIterator.
Definition: EventIterator.h:32
StatusCode
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
IDataStreamTool::getStream
virtual EventSelectorDataStream * getStream(size_type)=0
EvtSelectorContext::set
void set(const IEvtSelector *sel, IDataStreamTool::size_type id, IEvtSelector::Context *it, IOpaqueAddress *pA)
Set the address of the iterator.
Definition: EventIterator.h:53
EventSelectorDataStream
Definition of class EventSelectorDataStream.
Definition: EventSelectorDataStream.h:45
EvtSelectorContext::ID
virtual IDataStreamTool::size_type ID() const
Stream identifier.
Definition: EventIterator.h:95
gaudirun.s
string s
Definition: gaudirun.py:245
IEvtSelector::createAddress
virtual StatusCode createAddress(const Context &c, IOpaqueAddress *&iop) const =0
Create an IOpaqueAddress object from the event fetched.
IOpaqueAddress
Opaque address interface definition.
Definition: IOpaqueAddress.h:23

StatusCode EventSelector::createContext | ( | Context *& | refpCtxt | ) | const
| override

Create a new event loop context.

Parameters

  refpCtxt | [IN/OUT] Reference to pointer to store the context

Returns
  StatusCode indicating success or failure

Definition at line 160 of file EventSelector.cpp.

161 {
162 // Max event is zero. Return begin = end
163 refpCtxt = nullptr;
164 if ( m_firstEvent < 0 ) {
165 error() << "First Event = " << m_firstEvent << " not valid" << endmsg;
166 error() << "It should be > 0 " << endmsg;
167 return StatusCode::FAILURE; // if failure => iterators = end();
168 }
169 EvtSelectorContext* ctxt = new EvtSelectorContext(this);
170 ctxt->set(0, -1, 0, 0);
171 firstOfNextStream(true, *ctxt).ignore();
172 refpCtxt = ctxt;
173 long nskip = m_firstEvent;
174 while( --nskip > 0 ) {
175 StatusCode sc = next(*refpCtxt);
176 if ( sc.isFailure() ) {
177 error() << " createContext() failed to start with event number "
178 << m_firstEvent << endmsg;
179 releaseContext(refpCtxt);
180 refpCtxt = nullptr;
181 return StatusCode::FAILURE;
182 }
183 }
184 return StatusCode::SUCCESS;
185 }
StatusCode::SUCCESS
Definition: StatusCode.h:30
StatusCode::FAILURE
Definition: StatusCode.h:29
EventSelector::releaseContext
StatusCode releaseContext(Context *&refCtxt) const override
Release existing event iteration context.
Definition: EventSelector.cpp:320
EventSelector::firstOfNextStream
StatusCode firstOfNextStream(bool shutDown, EvtSelectorContext &it) const
Retrieve first entry of the next data stream.
Definition: EventSelector.cpp:51
StatusCode::isFailure
bool isFailure() const
Test for a status code of FAILURE.
Definition: StatusCode.h:84
CommonMessagingBase::error
MsgStream & error() const
shortcut for the method msgStream(MSG::ERROR)
Definition: CommonMessaging.h:117
EvtSelectorContext
Definition of class EventIterator.
Definition: EventIterator.h:32
StatusCode
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
EventSelector::m_firstEvent
Gaudi::Property< int > m_firstEvent
Definition: EventSelector.h:81
EvtSelectorContext::set
void set(const IEvtSelector *sel, IDataStreamTool::size_type id, IEvtSelector::Context *it, IOpaqueAddress *pA)
Set the address of the iterator.
Definition: EventIterator.h:53
StatusCode::ignore
void ignore() const
Definition: StatusCode.h:106
endmsg
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
EventSelector::next
StatusCode next(Context &refCtxt) const override
Get next iteration item from the event loop context.
Definition: EventSelector.cpp:188

StatusCode EventSelector::finalize | ( |  | ) |
| override

IService implementation: Service finalization.

Definition at line 413 of file EventSelector.cpp.

413 {
414
415 if (msgLevel(MSG::DEBUG)) {
416 debug() << "finalize()" << endmsg;
417 }
418
419 m_incidentSvc = nullptr;
420
421 if (m_streamtool) {
422 if (m_toolSvc) {
423 m_toolSvc->releaseTool(m_streamtool).ignore();
424 } else {
425 // It should not be possible to get here
426 m_streamtool->release();
427 }
428 m_streamtool = nullptr;
429 }
430 m_toolSvc.reset();
431
432 return Service::finalize();
433 }
EventSelector::m_incidentSvc
SmartIF< IIncidentSvc > m_incidentSvc
Reference to the indicent service.
Definition: EventSelector.h:64
Service::finalize
StatusCode finalize() override
Definition: Service.cpp:174
EventSelector::m_streamtool
IDataStreamTool * m_streamtool
Definition: EventSelector.h:68
MSG::DEBUG
Definition: IMessageSvc.h:18
EventSelector::m_toolSvc
SmartIF< IToolSvc > m_toolSvc
Definition: EventSelector.h:66
IInterface::release
virtual unsigned long release()=0
Release Interface instance.
CommonMessagingBase::debug
MsgStream & debug() const
shortcut for the method msgStream(MSG::DEBUG)
Definition: CommonMessaging.h:126
IToolSvc::releaseTool
virtual StatusCode releaseTool(IAlgTool *tool)=0
Release the tool.
SmartIF::reset
void reset(TYPE *ptr=nullptr)
Set the internal pointer to the passed one disposing of the old one.
Definition: SmartIF.h:88
StatusCode::ignore
void ignore() const
Definition: StatusCode.h:106
CommonMessagingBase::msgLevel
MSG::Level msgLevel() const
get the output level from the embedded MsgStream
Definition: CommonMessaging.h:135
endmsg
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244

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

Retrieve first entry of the next data stream.

Definition at line 51 of file EventSelector.cpp.

51 {
52 StatusCode status = StatusCode::SUCCESS;
53 IDataStreamTool::size_type iter_id = (m_reconfigure) ? 0 : iter.ID()+1;
54 if ( m_reconfigure ) const_cast<EventSelector*>(this)->m_reconfigure = false;
55 if ( shutDown ) {
56 if ( iter.ID() >= 0 && iter.ID() < (long)m_streamtool->size() ) {
57 const EventSelectorDataStream* s = m_streamtool->getStream(iter.ID());
58 if ( s->isInitialized() ) {
59 EventSelector* thisPtr = const_cast<EventSelector*>(this);
60 if ( s->selector() && iter.context() ) {
61 Context* ctxt = iter.context();
62 s->selector()->releaseContext(ctxt).ignore();
63 iter.set(0,0);
64 }
65 status = thisPtr->m_streamtool->finalizeStream(const_cast<EventSelectorDataStream*>(s));
66 iter.set(0,0);
67 }
68 }
69 }
70
71 const EventSelectorDataStream* s ;
72 status = m_streamtool->getNextStream( s , iter_id );
73
74 if ( status.isSuccess() ) {
75
76 if (s) {
77 if ( !s->isInitialized() ) {
78 EventSelector* thisPtr = const_cast<EventSelector*>(this);
79 status = thisPtr->m_streamtool->initializeStream(const_cast<EventSelectorDataStream*>(s));
80 }
81
82 if ( status.isSuccess() ) {
83 const IEvtSelector* sel = s->selector();
84 if ( sel ) {
85 Context* ctxt = nullptr;
86 status = sel->createContext(ctxt);
87 if ( status.isSuccess() ) {
88 status = sel->resetCriteria(s->criteria(), *ctxt);
89 if ( status.isSuccess() ) {
90 iter.set(this, iter_id, ctxt, 0);
91 info() << *s << endmsg;
92 m_incidentSvc->fireIncident(Incident(s->dbName(),IncidentType::BeginInputFile));
93 return StatusCode::SUCCESS;
94 }
95 }
96 }
97 }
98 m_incidentSvc->fireIncident(Incident(s->dbName(),IncidentType::FailInputFile));
99 }
100 }
101
102 iter.set(this, -1, 0, 0);
103 status.setChecked();
104 //m_incidentSvc->fireIncident(Incident(s->dbName(),IncidentType::FailInputFile));
105 return StatusCode::FAILURE;
106 }
EventSelector::m_incidentSvc
SmartIF< IIncidentSvc > m_incidentSvc
Reference to the indicent service.
Definition: EventSelector.h:64
EventSelectorDataStream::isInitialized
bool isInitialized() const
Check initialization status.
Definition: EventSelectorDataStream.h:105
StatusCode::SUCCESS
Definition: StatusCode.h:30
IDataStreamTool::finalizeStream
virtual StatusCode finalizeStream(EventSelectorDataStream *)=0
StatusCode::FAILURE
Definition: StatusCode.h:29
CommonMessagingBase::info
MsgStream & info() const
shortcut for the method msgStream(MSG::INFO)
Definition: CommonMessaging.h:123
IEvtSelector
The Event Selector Interface.
Definition: IEvtSelector.h:18
StatusCode::isSuccess
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:74
EventSelector::m_streamtool
IDataStreamTool * m_streamtool
Definition: EventSelector.h:68
EventSelectorDataStream::selector
IEvtSelector * selector() const
Retrieve event selector object.
Definition: EventSelectorDataStream.h:103
IOTest.sel
sel
Definition: IOTest.py:84
IIncidentSvc::fireIncident
virtual void fireIncident(const Incident &incident)=0
Fire an Incident.
StatusCode
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
IDataStreamTool::getStream
virtual EventSelectorDataStream * getStream(size_type)=0
IEvtSelector::resetCriteria
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...
IEvtSelector::releaseContext
virtual StatusCode releaseContext(Context *&) const =0
Release the Context object.
IDataStreamTool::size_type
long size_type
Definition: IDataStreamTool.h:28
EventSelectorDataStream
Definition of class EventSelectorDataStream.
Definition: EventSelectorDataStream.h:45
Incident
Base class for all Incidents (computing events).
Definition: Incident.h:17
gaudirun.s
string s
Definition: gaudirun.py:245
IEvtSelector::createContext
virtual StatusCode createContext(Context *&c) const =0
Create and return a context object that will keep track of the state of selection.
EventSelector
Definition of class EventSelector.
Definition: EventSelector.h:53
IDataStreamTool::size
virtual size_type size()=0
IDataStreamTool::initializeStream
virtual StatusCode initializeStream(EventSelectorDataStream *)=0
EventSelectorDataStream::criteria
const std::string & criteria() const
Retrieve stream criteria.
Definition: EventSelectorDataStream.h:95
EventSelector::m_reconfigure
bool m_reconfigure
Reconfigure occurred.
Definition: EventSelector.h:71
StatusCode::ignore
void ignore() const
Definition: StatusCode.h:106
IDataStreamTool::getNextStream
virtual StatusCode getNextStream(const EventSelectorDataStream *&, size_type &)=0
EventSelectorDataStream::dbName
const std::string & dbName() const
Retrieve stream dbName.
Definition: EventSelectorDataStream.h:97
endmsg
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
StatusCode::setChecked
void setChecked() const
Ignore the checking code;.
Definition: StatusCode.h:103

StatusCode EventSelector::initialize | ( |  | ) |
| override

IService implementation: Db event selector override.

Definition at line 339 of file EventSelector.cpp.

339 {
340 // Initialize base class
341 StatusCode status = Service::initialize();
342 if ( !status.isSuccess() ) {
343 error() << "Error initializing base class Service!" << endmsg;
344 return status;
345 }
346 // Get the references to the services that are needed by the ApplicationMgr itself
347 m_incidentSvc = serviceLocator()->service("IncidentSvc");
348 if( !m_incidentSvc ) {
349 fatal() << "Error retrieving IncidentSvc." << endmsg;
350 return StatusCode::FAILURE;
351 }
352 if ( m_evtMax != INT_MAX ) {
353 error() << "EvtMax is an obsolete property of the event selector." << endmsg;
354 error() << "Please set \"ApplicationMgr.EvtMax = " << m_evtMax
355 << ";\" to process the requested number of events." << endmsg;
356 return StatusCode::FAILURE;
357 }
358
359 m_toolSvc = serviceLocator()->service("ToolSvc");
360 if ( !m_toolSvc ) {
361 error() << " Could not locate the Tool Service! " << endmsg;
362 return StatusCode::FAILURE;
363 }
364 // make sure we finalize _prior_ to ToolSvc... we are about to get a
365 // a pointer to a tool which gets finalized and released by the ToolSvc
366 // during ToolSvc::finalize, and we don't want dangling pointers...
367 SmartIF<ISvcManager> mgr(serviceLocator());
368 auto prio = mgr->getPriority("ToolSvc");
369 mgr->setPriority(name(),prio+1).ignore();
370
371 status = m_toolSvc->retrieveTool(m_streamManager, m_streamtool, this);
372
373 if( status.isFailure() ) {
374 error() << "Error initializing "
375 << m_streamManager << endmsg;
376 return status;
377 }
378
379 status = m_streamtool->clear();
380 if( status.isFailure() ) {
381 // Message already printed by the tool
382 return status;
383 }
384
385 status = m_streamtool->addStreams(m_streamSpecs);
386
387 m_streamSpecsLast = m_streamSpecs;
388
389 m_streamID = 0;
390
391 return status;
392 }
EventSelector::m_incidentSvc
SmartIF< IIncidentSvc > m_incidentSvc
Reference to the indicent service.
Definition: EventSelector.h:64
Service::initialize
StatusCode initialize() override
Definition: Service.cpp:64
SmartIF< ISvcManager >
Service::name
const std::string & name() const override
Retrieve name of the service.
Definition: Service.cpp:289
StatusCode::FAILURE
Definition: StatusCode.h:29
StatusCode::isSuccess
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:74
EventSelector::m_streamtool
IDataStreamTool * m_streamtool
Definition: EventSelector.h:68
EventSelector::m_streamID
long int m_streamID
Definition: EventSelector.h:60
StatusCode::isFailure
bool isFailure() const
Test for a status code of FAILURE.
Definition: StatusCode.h:84
IToolSvc::retrieveTool
StatusCode retrieveTool(const std::string &type, T *&tool, const IInterface *parent=nullptr, bool createIf=true)
Retrieve specified tool sub-type with tool dependent part of the name automatically assigned...
Definition: IToolSvc.h:146
EventSelector::m_streamSpecsLast
StreamSpecs m_streamSpecsLast
Input stream specifiers (last used)
Definition: EventSelector.h:73
IDataStreamTool::addStreams
virtual StatusCode addStreams(const StreamSpecs &)=0
ISvcLocator::service
StatusCode service(const Gaudi::Utils::TypeNameString &name, T *&svc, bool createIf=true)
Templated method to access a service by name.
Definition: ISvcLocator.h:78
CommonMessagingBase::error
MsgStream & error() const
shortcut for the method msgStream(MSG::ERROR)
Definition: CommonMessaging.h:117
EventSelector::m_streamManager
Gaudi::Property< std::string > m_streamManager
Definition: EventSelector.h:84
IDataStreamTool::clear
virtual StatusCode clear()=0
StatusCode
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
EventSelector::m_evtMax
Gaudi::Property< int > m_evtMax
Definition: EventSelector.h:82
EventSelector::m_streamSpecs
Gaudi::Property< StreamSpecs > m_streamSpecs
Definition: EventSelector.h:80
EventSelector::m_toolSvc
SmartIF< IToolSvc > m_toolSvc
Definition: EventSelector.h:66
CommonMessagingBase::fatal
MsgStream & fatal() const
shortcut for the method msgStream(MSG::FATAL)
Definition: CommonMessaging.h:111
Service::serviceLocator
SmartIF< ISvcLocator > & serviceLocator() const override
Retrieve pointer to service locator.
Definition: Service.cpp:292
endmsg
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244

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

Access last item in the iteration.

Parameters

  c | Reference to the Context object.

Returns
  StatusCode indicating success or failure

Definition at line 269 of file EventSelector.cpp.

269 {
270 EvtSelectorContext *pIt = dynamic_cast<EvtSelectorContext*>(&refCtxt);
271 if ( pIt ) {
272 }
273 return StatusCode::FAILURE;
274 }
StatusCode::FAILURE
Definition: StatusCode.h:29
EvtSelectorContext
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 110 of file EventSelector.cpp.

110 {
111 StatusCode status = StatusCode::SUCCESS;
112 if ( shutDown ) {
113 if ( iter.ID() >= 0 && iter.ID() < (long)m_streamtool->size() ) {
114 const EventSelectorDataStream* s = m_streamtool->getStream(iter.ID());
115 if ( s->isInitialized() ) {
116 EventSelector* thisPtr = const_cast<EventSelector*>(this);
117 if ( s->selector() && iter.context() ) {
118 Context* ctxt = iter.context();
119 s->selector()->releaseContext(ctxt);
120 iter.set(0,0);
121 }
122 status = thisPtr->m_streamtool->finalizeStream(const_cast<EventSelectorDataStream*>(s));
123 iter.set(0,0);
124 }
125 }
126 }
127
128 IDataStreamTool::size_type iter_id = iter.ID()-1;
129 const EventSelectorDataStream* s = nullptr;
130 status = m_streamtool->getPreviousStream( s , iter_id );
131
132 if ( status.isSuccess() ) {
133
134 if ( !s->isInitialized() ) {
135 EventSelector* thisPtr = const_cast<EventSelector*>(this);
136 status = thisPtr->m_streamtool->initializeStream(const_cast<EventSelectorDataStream*>(s));
137 }
138 if ( status.isSuccess() ) {
139 const IEvtSelector* sel = s->selector();
140 if ( sel ) {
141 Context* ctxt = nullptr;
142 status = sel->createContext(ctxt);
143 if ( status.isSuccess() ) {
144 status = sel->resetCriteria(s->criteria(), *ctxt);
145 if ( status.isSuccess() ) {
146 iter.set(this, iter_id, ctxt, 0);
147 info() << *s << endmsg;
148 return StatusCode::SUCCESS;
149 }
150 }
151 }
152 }
153 }
154
155 iter.set(this, -1, 0, 0);
156 return StatusCode::FAILURE;
157 }
EventSelectorDataStream::isInitialized
bool isInitialized() const
Check initialization status.
Definition: EventSelectorDataStream.h:105
StatusCode::SUCCESS
Definition: StatusCode.h:30
IDataStreamTool::finalizeStream
virtual StatusCode finalizeStream(EventSelectorDataStream *)=0
StatusCode::FAILURE
Definition: StatusCode.h:29
CommonMessagingBase::info
MsgStream & info() const
shortcut for the method msgStream(MSG::INFO)
Definition: CommonMessaging.h:123
IEvtSelector
The Event Selector Interface.
Definition: IEvtSelector.h:18
StatusCode::isSuccess
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:74
EventSelector::m_streamtool
IDataStreamTool * m_streamtool
Definition: EventSelector.h:68
EventSelectorDataStream::selector
IEvtSelector * selector() const
Retrieve event selector object.
Definition: EventSelectorDataStream.h:103
IOTest.sel
sel
Definition: IOTest.py:84
StatusCode
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
IDataStreamTool::getStream
virtual EventSelectorDataStream * getStream(size_type)=0
IEvtSelector::resetCriteria
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...
IEvtSelector::releaseContext
virtual StatusCode releaseContext(Context *&) const =0
Release the Context object.
IDataStreamTool::size_type
long size_type
Definition: IDataStreamTool.h:28
IDataStreamTool::getPreviousStream
virtual StatusCode getPreviousStream(const EventSelectorDataStream *&, size_type &)=0
EventSelectorDataStream
Definition of class EventSelectorDataStream.
Definition: EventSelectorDataStream.h:45
gaudirun.s
string s
Definition: gaudirun.py:245
IEvtSelector::createContext
virtual StatusCode createContext(Context *&c) const =0
Create and return a context object that will keep track of the state of selection.
EventSelector
Definition of class EventSelector.
Definition: EventSelector.h:53
IDataStreamTool::size
virtual size_type size()=0
IDataStreamTool::initializeStream
virtual StatusCode initializeStream(EventSelectorDataStream *)=0
EventSelectorDataStream::criteria
const std::string & criteria() const
Retrieve stream criteria.
Definition: EventSelectorDataStream.h:95
endmsg
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244

StatusCode EventSelector::next | ( | Context & | refCtxt | ) | const
| override

Get next iteration item from the event loop context.

Parameters

  refCtxt | [IN/OUT] Reference to the context

Returns
  StatusCode indicating success or failure

Definition at line 188 of file EventSelector.cpp.

188 {
189 return next(refCtxt, 1);
190 }
EventSelector::next
StatusCode next(Context &refCtxt) const override
Get next iteration item from the event loop context.
Definition: EventSelector.cpp:188

StatusCode EventSelector::next | ( | Context & | refCtxt,
|  | int | jump
| ) |  | const
| override

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

Definition at line 193 of file EventSelector.cpp.

193 {
194 EvtSelectorContext *pIt = dynamic_cast<EvtSelectorContext*>(&refCtxt);
195 if ( pIt ) {
196 if ( pIt->ID() != -1 ) {
197 const EventSelectorDataStream* s = m_streamtool->getStream(pIt->ID());
198 Context* it = pIt->context();
199 IEvtSelector* sel = s->selector();
200 if ( it && sel ) { // First exploit the current stream
201 StatusCode sc = sel->next(*it); // This stream is empty: advance to the next stream
202 if ( !sc.isSuccess() ) {
203 m_incidentSvc->fireIncident(Incident(s->dbName(),IncidentType::EndInputFile));
204 sc = firstOfNextStream(true, *pIt);
205 if (sc.isSuccess() ) sc = next(*pIt);
206 }
207 else {
208 pIt->increaseCounters(false);
209 pIt->set(it, 0);
210 printEvtInfo(pIt);
211 }
212 return sc;
213 }
214 else if ( m_reconfigure ) {
215 StatusCode sc = firstOfNextStream(false, *pIt);
216 printEvtInfo(pIt);
217 return sc;
218 }
219 }
220 else if ( m_reconfigure ) {
221 StatusCode sc = firstOfNextStream(false, *pIt);
222 printEvtInfo(pIt);
223 return sc;
224 }
225 pIt->increaseCounters(false);
226 }
227 printEvtInfo(pIt);
228 return StatusCode::FAILURE;
229 }
EventSelector::m_incidentSvc
SmartIF< IIncidentSvc > m_incidentSvc
Reference to the indicent service.
Definition: EventSelector.h:64
EvtSelectorContext::context
IEvtSelector::Context * context() const
Access "real" iterator.
Definition: EventIterator.h:70
StatusCode::FAILURE
Definition: StatusCode.h:29
IEvtSelector
The Event Selector Interface.
Definition: IEvtSelector.h:18
StatusCode::isSuccess
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:74
EventSelector::m_streamtool
IDataStreamTool * m_streamtool
Definition: EventSelector.h:68
EventSelectorDataStream::selector
IEvtSelector * selector() const
Retrieve event selector object.
Definition: EventSelectorDataStream.h:103
IOTest.sel
sel
Definition: IOTest.py:84
EventSelector::printEvtInfo
virtual void printEvtInfo(const EvtSelectorContext *iter) const
Progress report.
Definition: EventSelector.cpp:28
EventSelector::firstOfNextStream
StatusCode firstOfNextStream(bool shutDown, EvtSelectorContext &it) const
Retrieve first entry of the next data stream.
Definition: EventSelector.cpp:51
IIncidentSvc::fireIncident
virtual void fireIncident(const Incident &incident)=0
Fire an Incident.
EvtSelectorContext
Definition of class EventIterator.
Definition: EventIterator.h:32
StatusCode
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
IDataStreamTool::getStream
virtual EventSelectorDataStream * getStream(size_type)=0
EvtSelectorContext::set
void set(const IEvtSelector *sel, IDataStreamTool::size_type id, IEvtSelector::Context *it, IOpaqueAddress *pA)
Set the address of the iterator.
Definition: EventIterator.h:53
EventSelectorDataStream
Definition of class EventSelectorDataStream.
Definition: EventSelectorDataStream.h:45
Incident
Base class for all Incidents (computing events).
Definition: Incident.h:17
EvtSelectorContext::ID
virtual IDataStreamTool::size_type ID() const
Stream identifier.
Definition: EventIterator.h:95
gaudirun.s
string s
Definition: gaudirun.py:245
IEvtSelector::next
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...
EvtSelectorContext::increaseCounters
IDataStreamTool::size_type increaseCounters(bool reset=false)
Increase counters.
Definition: EventIterator.h:74
EventSelector::m_reconfigure
bool m_reconfigure
Reconfigure occurred.
Definition: EventSelector.h:71
EventSelectorDataStream::dbName
const std::string & dbName() const
Retrieve stream dbName.
Definition: EventSelectorDataStream.h:97
EventSelector::next
StatusCode next(Context &refCtxt) const override
Get next iteration item from the event loop context.
Definition: EventSelector.cpp:188

StatusCode EventSelector::previous | ( | Context & | refCtxt | ) | const
| override

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

Definition at line 232 of file EventSelector.cpp.

232 {
233 return previous(refCtxt, 1);
234 }
EventSelector::previous
StatusCode previous(Context &refCtxt) const override
Get previous iteration item from the event loop context.
Definition: EventSelector.cpp:232

StatusCode EventSelector::previous | ( | Context & | refCtxt,
|  | int | jump
| ) |  | const
| override

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

Definition at line 237 of file EventSelector.cpp.

237 {
238 EvtSelectorContext *pIt = dynamic_cast<EvtSelectorContext*>(&refCtxt);
239 if ( pIt && jump > 0 ) {
240 StatusCode sc = StatusCode::SUCCESS;
241 for ( int i = 0; i < jump && sc.isSuccess(); ++i ) {
242 const EventSelectorDataStream* s = m_streamtool->getStream(pIt->ID());
243 Context* it = pIt->context();
244 IEvtSelector* sel = s->selector();
245 if ( it && sel ) { // First exploit the current stream
246 // This stream is empty: advance to the next stream
247 sc = sel->previous(*it); // This stream is empty: advance to the next stream
248 if ( !sc.isSuccess() ) {
249 sc = lastOfPreviousStream(true, *pIt);
250 }
251 else {
252 pIt->increaseCounters(false);
253 pIt->set(it, 0);
254 }
255 printEvtInfo(pIt);
256 if ( !sc.isSuccess() ) {
257 return sc;
258 }
259 }
260 pIt->increaseCounters(false);
261 }
262 return sc;
263 }
264 printEvtInfo(pIt);
265 return StatusCode::FAILURE;
266 }
EventSelector::lastOfPreviousStream
StatusCode lastOfPreviousStream(bool shutDown, EvtSelectorContext &it) const
Retrieve last entry of the previous data stream.
Definition: EventSelector.cpp:110
StatusCode::SUCCESS
Definition: StatusCode.h:30
EvtSelectorContext::context
IEvtSelector::Context * context() const
Access "real" iterator.
Definition: EventIterator.h:70
StatusCode::FAILURE
Definition: StatusCode.h:29
IEvtSelector
The Event Selector Interface.
Definition: IEvtSelector.h:18
StatusCode::isSuccess
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:74
EventSelector::m_streamtool
IDataStreamTool * m_streamtool
Definition: EventSelector.h:68
EventSelectorDataStream::selector
IEvtSelector * selector() const
Retrieve event selector object.
Definition: EventSelectorDataStream.h:103
IOTest.sel
sel
Definition: IOTest.py:84
EventSelector::printEvtInfo
virtual void printEvtInfo(const EvtSelectorContext *iter) const
Progress report.
Definition: EventSelector.cpp:28
IEvtSelector::previous
virtual StatusCode previous(Context &c) const =0
Fetch the previous event.
EvtSelectorContext
Definition of class EventIterator.
Definition: EventIterator.h:32
StatusCode
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
IDataStreamTool::getStream
virtual EventSelectorDataStream * getStream(size_type)=0
EvtSelectorContext::set
void set(const IEvtSelector *sel, IDataStreamTool::size_type id, IEvtSelector::Context *it, IOpaqueAddress *pA)
Set the address of the iterator.
Definition: EventIterator.h:53
EventSelectorDataStream
Definition of class EventSelectorDataStream.
Definition: EventSelectorDataStream.h:45
EvtSelectorContext::ID
virtual IDataStreamTool::size_type ID() const
Stream identifier.
Definition: EventIterator.h:95
gaudirun.s
string s
Definition: gaudirun.py:245
EvtSelectorContext::increaseCounters
IDataStreamTool::size_type increaseCounters(bool reset=false)
Increase counters.
Definition: EventIterator.h:74

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

Progress report.

Definition at line 28 of file EventSelector.cpp.

28 {
29 if ( iter ) {
30 long count = iter->numEvent();
31 // Print an message every m_evtPrintFrequency events
32 if ( 0 == iter->context() ) {
33 info() << "End of event input reached." << endmsg;
34 }
35 else if( iter->numStreamEvent() == -1 ) {
36 // Intial value for this stream
37 }
38 else if( m_evtPrintFrequency != -1 && (count % m_evtPrintFrequency == 0)) {
39 always() << "Reading Event record " << count+1
40 << ". Record number within stream " << iter->ID()+1
41 << ": " << iter->numStreamEvent()+1 << endmsg;
42 }
43 }
44 else {
45 info() << "End of event input reached." << endmsg;
46 }
47 }
EvtSelectorContext::context
IEvtSelector::Context * context() const
Access "real" iterator.
Definition: EventIterator.h:70
CommonMessagingBase::info
MsgStream & info() const
shortcut for the method msgStream(MSG::INFO)
Definition: CommonMessaging.h:123
EventSelector::m_evtPrintFrequency
Gaudi::Property< int > m_evtPrintFrequency
Definition: EventSelector.h:83
EvtSelectorContext::numStreamEvent
long numStreamEvent() const
Access counter within stream.
Definition: EventIterator.h:103
std::count
T count(T...args)
EvtSelectorContext::ID
virtual IDataStreamTool::size_type ID() const
Stream identifier.
Definition: EventIterator.h:95
EvtSelectorContext::numEvent
long numEvent() const
Access counter.
Definition: EventIterator.h:99
CommonMessagingBase::always
MsgStream & always() const
shortcut for the method msgStream(MSG::ALWAYS)
Definition: CommonMessaging.h:108
endmsg
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244

StatusCode EventSelector::reinitialize | ( |  | ) |
| override

Service override: Reinitialize service.

Definition at line 395 of file EventSelector.cpp.

395 {
396 if ( FSMState() != Gaudi::StateMachine::INITIALIZED ) {
397 error() << "Cannot reinitialize: service not in state initialized" << endmsg;
398 return StatusCode::FAILURE;
399 }
400
401 if( m_streamSpecsLast != m_streamSpecs ) {
402 StatusCode status = m_streamtool->clear();
403 if ( status.isFailure() ) return status;
404 m_streamSpecsLast = m_streamSpecs;
405 m_reconfigure = true;
406 return m_streamtool->addStreams(m_streamSpecs);
407 }
408
409 return StatusCode::SUCCESS;
410 }
Gaudi::StateMachine::INITIALIZED
Definition: StateMachine.h:15
StatusCode::SUCCESS
Definition: StatusCode.h:30
StatusCode::FAILURE
Definition: StatusCode.h:29
EventSelector::m_streamtool
IDataStreamTool * m_streamtool
Definition: EventSelector.h:68
StatusCode::isFailure
bool isFailure() const
Test for a status code of FAILURE.
Definition: StatusCode.h:84
EventSelector::m_streamSpecsLast
StreamSpecs m_streamSpecsLast
Input stream specifiers (last used)
Definition: EventSelector.h:73
IDataStreamTool::addStreams
virtual StatusCode addStreams(const StreamSpecs &)=0
CommonMessagingBase::error
MsgStream & error() const
shortcut for the method msgStream(MSG::ERROR)
Definition: CommonMessaging.h:117
IDataStreamTool::clear
virtual StatusCode clear()=0
StatusCode
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
EventSelector::m_streamSpecs
Gaudi::Property< StreamSpecs > m_streamSpecs
Definition: EventSelector.h:80
Service::FSMState
Gaudi::StateMachine::State FSMState() const override
Definition: Service.h:54
EventSelector::m_reconfigure
bool m_reconfigure
Reconfigure occurred.
Definition: EventSelector.h:71
endmsg
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244

StatusCode EventSelector::releaseContext | ( | Context *& | refCtxt | ) | const
| override

Release existing event iteration context.

Parameters

  refCtxt | [IN/OUT] Reference to the context

Returns
  StatusCode indicating success or failure

Definition at line 320 of file EventSelector.cpp.

320 {
321 const EvtSelectorContext *cpIt = dynamic_cast<const EvtSelectorContext*>(refCtxt);
322 std::unique_ptr<EvtSelectorContext> pIt{ const_cast<EvtSelectorContext*>(cpIt) };
323 if ( pIt && pIt->ID() >= 0 && pIt->ID() < (long)m_streamtool->size() ) {
324 const EventSelectorDataStream* s = m_streamtool->getStream(pIt->ID());
325 Context* it = pIt->context();
326 IEvtSelector* sel = s->selector();
327 if ( it && sel ) {
328 StatusCode sc = sel->releaseContext(it);
329 if ( sc.isSuccess() ) {
330 refCtxt = nullptr;
331 return sc;
332 }
333 }
334 }
335 return StatusCode::SUCCESS;
336 }
StatusCode::SUCCESS
Definition: StatusCode.h:30
IEvtSelector
The Event Selector Interface.
Definition: IEvtSelector.h:18
StatusCode::isSuccess
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:74
EventSelector::m_streamtool
IDataStreamTool * m_streamtool
Definition: EventSelector.h:68
EventSelectorDataStream::selector
IEvtSelector * selector() const
Retrieve event selector object.
Definition: EventSelectorDataStream.h:103
IOTest.sel
sel
Definition: IOTest.py:84
EvtSelectorContext
Definition of class EventIterator.
Definition: EventIterator.h:32
StatusCode
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
IDataStreamTool::getStream
virtual EventSelectorDataStream * getStream(size_type)=0
IEvtSelector::releaseContext
virtual StatusCode releaseContext(Context *&) const =0
Release the Context object.
std::unique_ptr
STL class.
EventSelectorDataStream
Definition of class EventSelectorDataStream.
Definition: EventSelectorDataStream.h:45
gaudirun.s
string s
Definition: gaudirun.py:245
IDataStreamTool::size
virtual size_type size()=0

StatusCode EventSelector::resetCriteria | ( | const std::string & | cr,
|  | Context & | c
| ) |  | const
| override

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

Definition at line 21 of file EventSelector.cpp.

23 {
24 return StatusCode::FAILURE;
25 }
StatusCode::FAILURE
Definition: StatusCode.h:29

StatusCode EventSelector::rewind | ( | Context & | refCtxt | ) | const
| override

Rewind the dataset.

Parameters

  refCtxt | [IN/OUT] Reference to the context

Returns
  StatusCode indicating success or failure

Definition at line 277 of file EventSelector.cpp.

277 {
278 EvtSelectorContext *ctxt = dynamic_cast<EvtSelectorContext*>(&refCtxt);
279 if ( ctxt ) {
280 ctxt->set(0, -1, 0, 0);
281 firstOfNextStream(true, *ctxt);
282 long nskip = m_firstEvent;
283 while( --nskip > 0 ) {
284 StatusCode sc = next(*ctxt);
285 if ( sc.isFailure() ) {
286 error() << "rewind() failed to start with event number "
287 << m_firstEvent << endmsg;
288 return StatusCode::FAILURE;
289 }
290 }
291 return StatusCode::SUCCESS;
292 }
293 return StatusCode::FAILURE;
294 }
StatusCode::SUCCESS
Definition: StatusCode.h:30
StatusCode::FAILURE
Definition: StatusCode.h:29
EventSelector::firstOfNextStream
StatusCode firstOfNextStream(bool shutDown, EvtSelectorContext &it) const
Retrieve first entry of the next data stream.
Definition: EventSelector.cpp:51
StatusCode::isFailure
bool isFailure() const
Test for a status code of FAILURE.
Definition: StatusCode.h:84
CommonMessagingBase::error
MsgStream & error() const
shortcut for the method msgStream(MSG::ERROR)
Definition: CommonMessaging.h:117
EvtSelectorContext
Definition of class EventIterator.
Definition: EventIterator.h:32
StatusCode
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
EventSelector::m_firstEvent
Gaudi::Property< int > m_firstEvent
Definition: EventSelector.h:81
EvtSelectorContext::set
void set(const IEvtSelector *sel, IDataStreamTool::size_type id, IEvtSelector::Context *it, IOpaqueAddress *pA)
Set the address of the iterator.
Definition: EventIterator.h:53
endmsg
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
EventSelector::next
StatusCode next(Context &refCtxt) const override
Get next iteration item from the event loop context.
Definition: EventSelector.cpp:188

## Member Data Documentation

Gaudi::Property<int> EventSelector::m_evtMax {this, "EvtMax", INT_MAX, "maximum number of events to be processed"}
| protected

Definition at line 82 of file EventSelector.h.

Gaudi::Property<int> EventSelector::m_evtPrintFrequency {this, "PrintFreq", 10, "printout frequency"}
| protected

Definition at line 83 of file EventSelector.h.

Gaudi::Property<int> EventSelector::m_firstEvent {this, "FirstEvent", 0, "first event to be processed"}
| protected

Definition at line 81 of file EventSelector.h.

SmartIF<IIncidentSvc> EventSelector::m_incidentSvc = nullptr
| protected

Reference to the indicent service.

Definition at line 64 of file EventSelector.h.

bool EventSelector::m_reconfigure = false
| protected

Reconfigure occurred.

Definition at line 71 of file EventSelector.h.

int EventSelector::m_streamCount = 0
| protected

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

Definition at line 77 of file EventSelector.h.

long int EventSelector::m_streamID

Definition at line 60 of file EventSelector.h.

Gaudi::Property<std::string> EventSelector::m_streamManager {this, "StreamManager", "DataStreamTool", ""}
| protected

Definition at line 84 of file EventSelector.h.

Streams EventSelector::m_streams
| protected

Input streams.

Definition at line 75 of file EventSelector.h.

Gaudi::Property<StreamSpecs> EventSelector::m_streamSpecs {this, "Input", {}, "input stream specifiers (for job options)"}
| protected

Definition at line 80 of file EventSelector.h.

StreamSpecs EventSelector::m_streamSpecsLast
| protected

Input stream specifiers (last used)

Definition at line 73 of file EventSelector.h.

IDataStreamTool* EventSelector::m_streamtool = nullptr
| protected

Definition at line 68 of file EventSelector.h.

SmartIF<IToolSvc> EventSelector::m_toolSvc = nullptr
| protected

Definition at line 66 of file EventSelector.h.

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

- GaudiCoreSvc/src/EventSelector/EventSelector.h
- GaudiCoreSvc/src/EventSelector/EventSelector.cpp