| The Gaudi Framework v27r1

- 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< StringProperty > | 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 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 (const std::string &name, ISvcLocator *svcloc)
| Standard Constructor. 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...
StatusCode | setProperty (const Property &p) override
StatusCode | setProperty (const std::string &s) override
StatusCode | setProperty (const std::string &n, const std::string &v) override
StatusCode | getProperty (Property *p) const override
const Property & | getProperty (const std::string &name) const override
StatusCode | getProperty (const std::string &n, std::string &v) const override
const std::vector< Property * > & | getProperties () const override
bool | hasProperty (const std::string &name) const override
template<class TYPE >
StatusCode | setProperty (const std::string &name, const TYPE &value)
| set the property form the value 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 >
Property * | declareProperty (const std::string &name, T &property, const std::string &doc="none") const
| Declare the named property. More...
Property * | declareRemoteProperty (const std::string &name, IProperty *rsvc, const std::string &rname="") const
| Declare remote named properties. 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 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 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_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 = 0
| Input stream counter (0..oo, monotonely increasing) More...
int | m_firstEvent = 0
| First event to be processed. More...
int | m_evtMax = INT_MAX
| Maximum number of events to be processed. More...
int | m_evtPrintFrequency = 10
| Printout frequency. More...
std::string | m_streamManager ="DataStreamTool"
Protected Attributes inherited from Service
IntegerProperty | m_outputLevel = MSG::NIL
| Service output level. More...
Gaudi::StateMachine::State | m_state = Gaudi::StateMachine::OFFLINE
| Service state. More...
Gaudi::StateMachine::State | m_targetState = Gaudi::StateMachine::OFFLINE
| Service state. 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<StringProperty> 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 | ( | const std::string & | name,
|  | ISvcLocator * | svcloc
| ) |  |

Standard Constructor.

Definition at line 21 of file EventSelector.cpp.

22 : base_class( name, svcloc)
23 {
24 declareProperty( "Input", m_streamSpecs);
25 declareProperty( "FirstEvent", m_firstEvent);
26 declareProperty( "EvtMax", m_evtMax);
27 declareProperty( "PrintFreq", m_evtPrintFrequency);
28 declareProperty( "StreamManager", m_streamManager);
29 }
EventSelector::m_evtPrintFrequency
int m_evtPrintFrequency
Printout frequency.
Definition: EventSelector.h:85
EventSelector::m_firstEvent
int m_firstEvent
First event to be processed.
Definition: EventSelector.h:81
EventSelector::m_evtMax
int m_evtMax
Maximum number of events to be processed.
Definition: EventSelector.h:83
extends< Service, IEvtSelector >::base_class
extends base_class
Typedef to this class.
Definition: extends.h:14
EventSelector::m_streamSpecs
StreamSpecs m_streamSpecs
Input stream specifiers (for job options)
Definition: EventSelector.h:73
Service::declareProperty
Property * declareProperty(const std::string &name, T &property, const std::string &doc="none") const
Declare the named property.
Definition: Service.h:215
EventSelector::m_streamManager
std::string m_streamManager
Definition: EventSelector.h:87

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

311 {
312 const EvtSelectorContext *cpIt = dynamic_cast<const EvtSelectorContext*>(&refCtxt);
313 EvtSelectorContext *pIt = const_cast<EvtSelectorContext*>(cpIt);
314 refpAddr = nullptr;
315 if ( pIt ) {
316 const EventSelectorDataStream* s = m_streamtool->getStream(pIt->ID());
317 Context* it = pIt->context();
318 IEvtSelector* sel = s->selector();
319 if ( it && sel ) {
320 IOpaqueAddress* pAddr = nullptr;
321 StatusCode sc = sel->createAddress(*it, pAddr);
322 if ( sc.isSuccess() ) refpAddr = pAddr;
323 pIt->set(it, pAddr);
324 return sc;
325 }
326 }
327 return StatusCode::FAILURE;
328 }
EvtSelectorContext::context
IEvtSelector::Context * context() const
Access "real" iterator.
Definition: EventIterator.h:70
IEvtSelector
The Event Selector Interface.
Definition: IEvtSelector.h:18
StatusCode::isSuccess
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:76
EventSelector::m_streamtool
IDataStreamTool * m_streamtool
Definition: EventSelector.h:68
EventSelectorDataStream::selector
IEvtSelector * selector() const
Retrieve event selector object.
Definition: EventSelectorDataStream.h:111
merge_files.sc
int sc
Definition: merge_files.py:167
read_lhcb_event_file.sel
tuple sel
Definition: read_lhcb_event_file.py:10
StatusCode::FAILURE
Definition: StatusCode.h:29
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
IOpaqueAddress
Opaque address interface definition.
Definition: IOpaqueAddress.h:23
IEvtSelector::createAddress
virtual StatusCode createAddress(const Context &c, IOpaqueAddress *&iop) const =0
Create an IOpaqueAddress object from the event fetched.

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

172 {
173 // Max event is zero. Return begin = end
174 refpCtxt = nullptr;
175 if ( m_firstEvent < 0 ) {
176 error() << "First Event = " << m_firstEvent << " not valid" << endmsg;
177 error() << "It should be > 0 " << endmsg;
178 return StatusCode::FAILURE; // if failure => iterators = end();
179 }
180 EvtSelectorContext* ctxt = new EvtSelectorContext(this);
181 ctxt->set(0, -1, 0, 0);
182 firstOfNextStream(true, *ctxt).ignore();
183 refpCtxt = ctxt;
184 long nskip = m_firstEvent;
185 while( --nskip > 0 ) {
186 StatusCode sc = next(*refpCtxt);
187 if ( sc.isFailure() ) {
188 error() << " createContext() failed to start with event number "
189 << m_firstEvent << endmsg;
190 releaseContext(refpCtxt);
191 refpCtxt = nullptr;
192 return StatusCode::FAILURE;
193 }
194 }
195 return StatusCode::SUCCESS;
196 }
EventSelector::m_firstEvent
int m_firstEvent
First event to be processed.
Definition: EventSelector.h:81
EventSelector::releaseContext
StatusCode releaseContext(Context *&refCtxt) const override
Release existing event iteration context.
Definition: EventSelector.cpp:331
EventSelector::firstOfNextStream
StatusCode firstOfNextStream(bool shutDown, EvtSelectorContext &it) const
Retrieve first entry of the next data stream.
Definition: EventSelector.cpp:62
merge_files.sc
int sc
Definition: merge_files.py:167
StatusCode::isFailure
bool isFailure() const
Test for a status code of FAILURE.
Definition: StatusCode.h:86
EventSelector::next
StatusCode next(Context &refCtxt) const override
Get next iteration item from the event loop context.
Definition: EventSelector.cpp:199
CommonMessagingBase::error
MsgStream & error() const
shortcut for the method msgStream(MSG::ERROR)
Definition: CommonMessaging.h:118
StatusCode::FAILURE
Definition: StatusCode.h:29
EvtSelectorContext
Definition of class EventIterator.
Definition: EventIterator.h:32
StatusCode::SUCCESS
Definition: StatusCode.h:30
StatusCode
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
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:108
endmsg
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244

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

IService implementation: Service finalization.

Definition at line 424 of file EventSelector.cpp.

424 {
425
426 if (msgLevel(MSG::DEBUG)) {
427 debug() << "finalize()" << endmsg;
428 }
429
430 m_incidentSvc = nullptr;
431
432 if (m_streamtool) {
433 if (m_toolSvc) {
434 m_toolSvc->releaseTool(m_streamtool).ignore();
435 } else {
436 // It should not be possible to get here
437 m_streamtool->release();
438 }
439 m_streamtool = nullptr;
440 }
441 m_toolSvc.reset();
442
443 return Service::finalize();
444 }
EventSelector::m_incidentSvc
SmartIF< IIncidentSvc > m_incidentSvc
Reference to the indicent service.
Definition: EventSelector.h:64
Service::finalize
StatusCode finalize() override
Definition: Service.cpp:193
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:127
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:108
CommonMessagingBase::msgLevel
MSG::Level msgLevel() const
get the output level from the embedded MsgStream
Definition: CommonMessaging.h:136
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 62 of file EventSelector.cpp.

62 {
63 StatusCode status = StatusCode::SUCCESS;
64 IDataStreamTool::size_type iter_id = (m_reconfigure) ? 0 : iter.ID()+1;
65 if ( m_reconfigure ) const_cast<EventSelector*>(this)->m_reconfigure = false;
66 if ( shutDown ) {
67 if ( iter.ID() >= 0 && iter.ID() < (long)m_streamtool->size() ) {
68 const EventSelectorDataStream* s = m_streamtool->getStream(iter.ID());
69 if ( s->isInitialized() ) {
70 EventSelector* thisPtr = const_cast<EventSelector*>(this);
71 if ( s->selector() && iter.context() ) {
72 Context* ctxt = iter.context();
73 s->selector()->releaseContext(ctxt).ignore();
74 iter.set(0,0);
75 }
76 status = thisPtr->m_streamtool->finalizeStream(const_cast<EventSelectorDataStream*>(s));
77 iter.set(0,0);
78 }
79 }
80 }
81
82 const EventSelectorDataStream* s ;
83 status = m_streamtool->getNextStream( s , iter_id );
84
85 if ( status.isSuccess() ) {
86
87 if (s) {
88 if ( !s->isInitialized() ) {
89 EventSelector* thisPtr = const_cast<EventSelector*>(this);
90 status = thisPtr->m_streamtool->initializeStream(const_cast<EventSelectorDataStream*>(s));
91 }
92
93 if ( status.isSuccess() ) {
94 const IEvtSelector* sel = s->selector();
95 if ( sel ) {
96 Context* ctxt = nullptr;
97 status = sel->createContext(ctxt);
98 if ( status.isSuccess() ) {
99 status = sel->resetCriteria(s->criteria(), *ctxt);
100 if ( status.isSuccess() ) {
101 iter.set(this, iter_id, ctxt, 0);
102 info() << *s << endmsg;
103 m_incidentSvc->fireIncident(Incident(s->dbName(),IncidentType::BeginInputFile));
104 return StatusCode::SUCCESS;
105 }
106 }
107 }
108 }
109 m_incidentSvc->fireIncident(Incident(s->dbName(),IncidentType::FailInputFile));
110 }
111 }
112
113 iter.set(this, -1, 0, 0);
114 status.setChecked();
115 //m_incidentSvc->fireIncident(Incident(s->dbName(),IncidentType::FailInputFile));
116 return StatusCode::FAILURE;
117 }
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:115
IDataStreamTool::finalizeStream
virtual StatusCode finalizeStream(EventSelectorDataStream *)=0
CommonMessagingBase::info
MsgStream & info() const
shortcut for the method msgStream(MSG::INFO)
Definition: CommonMessaging.h:124
IEvtSelector
The Event Selector Interface.
Definition: IEvtSelector.h:18
StatusCode::isSuccess
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:76
EventSelector::m_streamtool
IDataStreamTool * m_streamtool
Definition: EventSelector.h:68
EventSelectorDataStream::selector
IEvtSelector * selector() const
Retrieve event selector object.
Definition: EventSelectorDataStream.h:111
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...
IIncidentSvc::fireIncident
virtual void fireIncident(const Incident &incident)=0
Fire an Incident.
read_lhcb_event_file.sel
tuple sel
Definition: read_lhcb_event_file.py:10
StatusCode::FAILURE
Definition: StatusCode.h:29
StatusCode::SUCCESS
Definition: StatusCode.h:30
StatusCode
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
IEvtSelector::createContext
virtual StatusCode createContext(Context *&c) const =0
Create and return a context object that will keep track of the state of selection.
IDataStreamTool::getStream
virtual EventSelectorDataStream * getStream(size_type)=0
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
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:108
IDataStreamTool::getNextStream
virtual StatusCode getNextStream(const EventSelectorDataStream *&, size_type &)=0
EventSelectorDataStream::dbName
const std::string & dbName() const
Retrieve stream dbName.
Definition: EventSelectorDataStream.h:99
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:105

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

IService implementation: Db event selector override.

Definition at line 350 of file EventSelector.cpp.

350 {
351 // Initialize base class
352 StatusCode status = Service::initialize();
353 if ( !status.isSuccess() ) {
354 error() << "Error initializing base class Service!" << endmsg;
355 return status;
356 }
357 // Get the references to the services that are needed by the ApplicationMgr itself
358 m_incidentSvc = serviceLocator()->service("IncidentSvc");
359 if( !m_incidentSvc ) {
360 fatal() << "Error retrieving IncidentSvc." << endmsg;
361 return StatusCode::FAILURE;
362 }
363 if ( m_evtMax != INT_MAX ) {
364 error() << "EvtMax is an obsolete property of the event selector." << endmsg;
365 error() << "Please set \"ApplicationMgr.EvtMax = " << m_evtMax
366 << ";\" to process the requested number of events." << endmsg;
367 return StatusCode::FAILURE;
368 }
369
370 m_toolSvc = serviceLocator()->service("ToolSvc");
371 if ( !m_toolSvc ) {
372 error() << " Could not locate the Tool Service! " << endmsg;
373 return StatusCode::FAILURE;
374 }
375 // make sure we finalize _prior_ to ToolSvc... we are about to get a
376 // a pointer to a tool which gets finalized and released by the ToolSvc
377 // during ToolSvc::finalize, and we don't want dangling pointers...
378 SmartIF<ISvcManager> mgr(serviceLocator());
379 auto prio = mgr->getPriority("ToolSvc");
380 mgr->setPriority(name(),prio+1).ignore();
381
382 status = m_toolSvc->retrieveTool(m_streamManager.c_str(), m_streamtool, this);
383
384 if( status.isFailure() ) {
385 error() << "Error initializing "
386 << m_streamManager << endmsg;
387 return status;
388 }
389
390 status = m_streamtool->clear();
391 if( status.isFailure() ) {
392 // Message already printed by the tool
393 return status;
394 }
395
396 status = m_streamtool->addStreams(m_streamSpecs);
397
398 m_streamSpecsLast = m_streamSpecs;
399
400 m_streamID = 0;
401
402 return status;
403 }
EventSelector::m_incidentSvc
SmartIF< IIncidentSvc > m_incidentSvc
Reference to the indicent service.
Definition: EventSelector.h:64
Service::initialize
StatusCode initialize() override
Definition: Service.cpp:68
SmartIF< ISvcManager >
Service::serviceLocator
SmartIF< ISvcLocator > & serviceLocator() const override
Retrieve pointer to service locator.
Definition: Service.cpp:324
EventSelector::m_evtMax
int m_evtMax
Maximum number of events to be processed.
Definition: EventSelector.h:83
StatusCode::isSuccess
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:76
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:86
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:145
EventSelector::m_streamSpecsLast
StreamSpecs m_streamSpecsLast
Input stream specifiers (last used)
Definition: EventSelector.h:75
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
Service::name
const std::string & name() const override
Retrieve name of the service.
Definition: Service.cpp:319
CommonMessagingBase::error
MsgStream & error() const
shortcut for the method msgStream(MSG::ERROR)
Definition: CommonMessaging.h:118
StatusCode::FAILURE
Definition: StatusCode.h:29
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
StreamSpecs m_streamSpecs
Input stream specifiers (for job options)
Definition: EventSelector.h:73
EventSelector::m_toolSvc
SmartIF< IToolSvc > m_toolSvc
Definition: EventSelector.h:66
std::string::c_str
T c_str(T...args)
CommonMessagingBase::fatal
MsgStream & fatal() const
shortcut for the method msgStream(MSG::FATAL)
Definition: CommonMessaging.h:112
EventSelector::m_streamManager
std::string m_streamManager
Definition: EventSelector.h:87
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 280 of file EventSelector.cpp.

280 {
281 EvtSelectorContext *pIt = dynamic_cast<EvtSelectorContext*>(&refCtxt);
282 if ( pIt ) {
283 }
284 return StatusCode::FAILURE;
285 }
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 121 of file EventSelector.cpp.

121 {
122 StatusCode status = StatusCode::SUCCESS;
123 if ( shutDown ) {
124 if ( iter.ID() >= 0 && iter.ID() < (long)m_streamtool->size() ) {
125 const EventSelectorDataStream* s = m_streamtool->getStream(iter.ID());
126 if ( s->isInitialized() ) {
127 EventSelector* thisPtr = const_cast<EventSelector*>(this);
128 if ( s->selector() && iter.context() ) {
129 Context* ctxt = iter.context();
130 s->selector()->releaseContext(ctxt);
131 iter.set(0,0);
132 }
133 status = thisPtr->m_streamtool->finalizeStream(const_cast<EventSelectorDataStream*>(s));
134 iter.set(0,0);
135 }
136 }
137 }
138
139 IDataStreamTool::size_type iter_id = iter.ID()-1;
140 const EventSelectorDataStream* s = nullptr;
141 status = m_streamtool->getPreviousStream( s , iter_id );
142
143 if ( status.isSuccess() ) {
144
145 if ( !s->isInitialized() ) {
146 EventSelector* thisPtr = const_cast<EventSelector*>(this);
147 status = thisPtr->m_streamtool->initializeStream(const_cast<EventSelectorDataStream*>(s));
148 }
149 if ( status.isSuccess() ) {
150 const IEvtSelector* sel = s->selector();
151 if ( sel ) {
152 Context* ctxt = nullptr;
153 status = sel->createContext(ctxt);
154 if ( status.isSuccess() ) {
155 status = sel->resetCriteria(s->criteria(), *ctxt);
156 if ( status.isSuccess() ) {
157 iter.set(this, iter_id, ctxt, 0);
158 info() << *s << endmsg;
159 return StatusCode::SUCCESS;
160 }
161 }
162 }
163 }
164 }
165
166 iter.set(this, -1, 0, 0);
167 return StatusCode::FAILURE;
168 }
EventSelectorDataStream::isInitialized
bool isInitialized() const
Check initialization status.
Definition: EventSelectorDataStream.h:115
IDataStreamTool::finalizeStream
virtual StatusCode finalizeStream(EventSelectorDataStream *)=0
CommonMessagingBase::info
MsgStream & info() const
shortcut for the method msgStream(MSG::INFO)
Definition: CommonMessaging.h:124
IEvtSelector
The Event Selector Interface.
Definition: IEvtSelector.h:18
StatusCode::isSuccess
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:76
EventSelector::m_streamtool
IDataStreamTool * m_streamtool
Definition: EventSelector.h:68
EventSelectorDataStream::selector
IEvtSelector * selector() const
Retrieve event selector object.
Definition: EventSelectorDataStream.h:111
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...
read_lhcb_event_file.sel
tuple sel
Definition: read_lhcb_event_file.py:10
StatusCode::FAILURE
Definition: StatusCode.h:29
StatusCode::SUCCESS
Definition: StatusCode.h:30
StatusCode
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
IEvtSelector::createContext
virtual StatusCode createContext(Context *&c) const =0
Create and return a context object that will keep track of the state of selection.
IDataStreamTool::getStream
virtual EventSelectorDataStream * getStream(size_type)=0
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
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 199 of file EventSelector.cpp.

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

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

204 {
205 EvtSelectorContext *pIt = dynamic_cast<EvtSelectorContext*>(&refCtxt);
206 if ( pIt ) {
207 if ( pIt->ID() != -1 ) {
208 const EventSelectorDataStream* s = m_streamtool->getStream(pIt->ID());
209 Context* it = pIt->context();
210 IEvtSelector* sel = s->selector();
211 if ( it && sel ) { // First exploit the current stream
212 StatusCode sc = sel->next(*it); // This stream is empty: advance to the next stream
213 if ( !sc.isSuccess() ) {
214 m_incidentSvc->fireIncident(Incident(s->dbName(),IncidentType::EndInputFile));
215 sc = firstOfNextStream(true, *pIt);
216 if (sc.isSuccess() ) sc = next(*pIt);
217 }
218 else {
219 pIt->increaseCounters(false);
220 pIt->set(it, 0);
221 printEvtInfo(pIt);
222 }
223 return sc;
224 }
225 else if ( m_reconfigure ) {
226 StatusCode sc = firstOfNextStream(false, *pIt);
227 printEvtInfo(pIt);
228 return sc;
229 }
230 }
231 else if ( m_reconfigure ) {
232 StatusCode sc = firstOfNextStream(false, *pIt);
233 printEvtInfo(pIt);
234 return sc;
235 }
236 pIt->increaseCounters(false);
237 }
238 printEvtInfo(pIt);
239 return StatusCode::FAILURE;
240 }
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
IEvtSelector
The Event Selector Interface.
Definition: IEvtSelector.h:18
StatusCode::isSuccess
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:76
EventSelector::m_streamtool
IDataStreamTool * m_streamtool
Definition: EventSelector.h:68
EventSelectorDataStream::selector
IEvtSelector * selector() const
Retrieve event selector object.
Definition: EventSelectorDataStream.h:111
EventSelector::printEvtInfo
virtual void printEvtInfo(const EvtSelectorContext *iter) const
Progress report.
Definition: EventSelector.cpp:39
EventSelector::firstOfNextStream
StatusCode firstOfNextStream(bool shutDown, EvtSelectorContext &it) const
Retrieve first entry of the next data stream.
Definition: EventSelector.cpp:62
merge_files.sc
int sc
Definition: merge_files.py:167
EventSelector::next
StatusCode next(Context &refCtxt) const override
Get next iteration item from the event loop context.
Definition: EventSelector.cpp:199
IIncidentSvc::fireIncident
virtual void fireIncident(const Incident &incident)=0
Fire an Incident.
read_lhcb_event_file.sel
tuple sel
Definition: read_lhcb_event_file.py:10
StatusCode::FAILURE
Definition: StatusCode.h:29
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
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...
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
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:99

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

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

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

248 {
249 EvtSelectorContext *pIt = dynamic_cast<EvtSelectorContext*>(&refCtxt);
250 if ( pIt && jump > 0 ) {
251 StatusCode sc = StatusCode::SUCCESS;
252 for ( int i = 0; i < jump && sc.isSuccess(); ++i ) {
253 const EventSelectorDataStream* s = m_streamtool->getStream(pIt->ID());
254 Context* it = pIt->context();
255 IEvtSelector* sel = s->selector();
256 if ( it && sel ) { // First exploit the current stream
257 // This stream is empty: advance to the next stream
258 sc = sel->previous(*it); // This stream is empty: advance to the next stream
259 if ( !sc.isSuccess() ) {
260 sc = lastOfPreviousStream(true, *pIt);
261 }
262 else {
263 pIt->increaseCounters(false);
264 pIt->set(it, 0);
265 }
266 printEvtInfo(pIt);
267 if ( !sc.isSuccess() ) {
268 return sc;
269 }
270 }
271 pIt->increaseCounters(false);
272 }
273 return sc;
274 }
275 printEvtInfo(pIt);
276 return StatusCode::FAILURE;
277 }
EventSelector::lastOfPreviousStream
StatusCode lastOfPreviousStream(bool shutDown, EvtSelectorContext &it) const
Retrieve last entry of the previous data stream.
Definition: EventSelector.cpp:121
EvtSelectorContext::context
IEvtSelector::Context * context() const
Access "real" iterator.
Definition: EventIterator.h:70
IEvtSelector
The Event Selector Interface.
Definition: IEvtSelector.h:18
StatusCode::isSuccess
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:76
EventSelector::m_streamtool
IDataStreamTool * m_streamtool
Definition: EventSelector.h:68
EventSelectorDataStream::selector
IEvtSelector * selector() const
Retrieve event selector object.
Definition: EventSelectorDataStream.h:111
EventSelector::printEvtInfo
virtual void printEvtInfo(const EvtSelectorContext *iter) const
Progress report.
Definition: EventSelector.cpp:39
merge_files.sc
int sc
Definition: merge_files.py:167
read_lhcb_event_file.sel
tuple sel
Definition: read_lhcb_event_file.py:10
StatusCode::FAILURE
Definition: StatusCode.h:29
EvtSelectorContext
Definition of class EventIterator.
Definition: EventIterator.h:32
StatusCode::SUCCESS
Definition: StatusCode.h:30
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
IEvtSelector::previous
virtual StatusCode previous(Context &c) const =0
Fetch the previous event.
ana.i
list i
Definition: ana.py:128

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

Progress report.

Definition at line 39 of file EventSelector.cpp.

39 {
40 if ( iter ) {
41 long count = iter->numEvent();
42 // Print an message every m_evtPrintFrequency events
43 if ( 0 == iter->context() ) {
44 info() << "End of event input reached." << endmsg;
45 }
46 else if( iter->numStreamEvent() == -1 ) {
47 // Intial value for this stream
48 }
49 else if( m_evtPrintFrequency != -1 && (count % m_evtPrintFrequency == 0)) {
50 always() << "Reading Event record " << count+1
51 << ". Record number within stream " << iter->ID()+1
52 << ": " << iter->numStreamEvent()+1 << endmsg;
53 }
54 }
55 else {
56 info() << "End of event input reached." << endmsg;
57 }
58 }
EvtSelectorContext::context
IEvtSelector::Context * context() const
Access "real" iterator.
Definition: EventIterator.h:70
EventSelector::m_evtPrintFrequency
int m_evtPrintFrequency
Printout frequency.
Definition: EventSelector.h:85
CommonMessagingBase::info
MsgStream & info() const
shortcut for the method msgStream(MSG::INFO)
Definition: CommonMessaging.h:124
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:109
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 406 of file EventSelector.cpp.

406 {
407 if ( FSMState() != Gaudi::StateMachine::INITIALIZED ) {
408 error() << "Cannot reinitialize: service not in state initialized" << endmsg;
409 return StatusCode::FAILURE;
410 }
411
412 if( m_streamSpecsLast != m_streamSpecs ) {
413 StatusCode status = m_streamtool->clear();
414 if ( status.isFailure() ) return status;
415 m_streamSpecsLast = m_streamSpecs;
416 m_reconfigure = true;
417 return m_streamtool->addStreams(m_streamSpecs);
418 }
419
420 return StatusCode::SUCCESS;
421 }
Gaudi::StateMachine::INITIALIZED
Definition: StateMachine.h:15
Service::FSMState
Gaudi::StateMachine::State FSMState() const override
Definition: Service.h:57
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:86
EventSelector::m_streamSpecsLast
StreamSpecs m_streamSpecsLast
Input stream specifiers (last used)
Definition: EventSelector.h:75
IDataStreamTool::addStreams
virtual StatusCode addStreams(const StreamSpecs &)=0
CommonMessagingBase::error
MsgStream & error() const
shortcut for the method msgStream(MSG::ERROR)
Definition: CommonMessaging.h:118
StatusCode::FAILURE
Definition: StatusCode.h:29
IDataStreamTool::clear
virtual StatusCode clear()=0
StatusCode::SUCCESS
Definition: StatusCode.h:30
StatusCode
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
EventSelector::m_streamSpecs
StreamSpecs m_streamSpecs
Input stream specifiers (for job options)
Definition: EventSelector.h:73
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 331 of file EventSelector.cpp.

331 {
332 const EvtSelectorContext *cpIt = dynamic_cast<const EvtSelectorContext*>(refCtxt);
333 std::unique_ptr<EvtSelectorContext> pIt{ const_cast<EvtSelectorContext*>(cpIt) };
334 if ( pIt && pIt->ID() >= 0 && pIt->ID() < (long)m_streamtool->size() ) {
335 const EventSelectorDataStream* s = m_streamtool->getStream(pIt->ID());
336 Context* it = pIt->context();
337 IEvtSelector* sel = s->selector();
338 if ( it && sel ) {
339 StatusCode sc = sel->releaseContext(it);
340 if ( sc.isSuccess() ) {
341 refCtxt = nullptr;
342 return sc;
343 }
344 }
345 }
346 return StatusCode::SUCCESS;
347 }
IEvtSelector
The Event Selector Interface.
Definition: IEvtSelector.h:18
StatusCode::isSuccess
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:76
EventSelector::m_streamtool
IDataStreamTool * m_streamtool
Definition: EventSelector.h:68
EventSelectorDataStream::selector
IEvtSelector * selector() const
Retrieve event selector object.
Definition: EventSelectorDataStream.h:111
merge_files.sc
int sc
Definition: merge_files.py:167
read_lhcb_event_file.sel
tuple sel
Definition: read_lhcb_event_file.py:10
EvtSelectorContext
Definition of class EventIterator.
Definition: EventIterator.h:32
StatusCode::SUCCESS
Definition: StatusCode.h:30
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 32 of file EventSelector.cpp.

34 {
35 return StatusCode::FAILURE;
36 }
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 288 of file EventSelector.cpp.

288 {
289 EvtSelectorContext *ctxt = dynamic_cast<EvtSelectorContext*>(&refCtxt);
290 if ( ctxt ) {
291 ctxt->set(0, -1, 0, 0);
292 firstOfNextStream(true, *ctxt);
293 long nskip = m_firstEvent;
294 while( --nskip > 0 ) {
295 StatusCode sc = next(*ctxt);
296 if ( sc.isFailure() ) {
297 error() << "rewind() failed to start with event number "
298 << m_firstEvent << endmsg;
299 return StatusCode::FAILURE;
300 }
301 }
302 return StatusCode::SUCCESS;
303 }
304 return StatusCode::FAILURE;
305 }
EventSelector::m_firstEvent
int m_firstEvent
First event to be processed.
Definition: EventSelector.h:81
EventSelector::firstOfNextStream
StatusCode firstOfNextStream(bool shutDown, EvtSelectorContext &it) const
Retrieve first entry of the next data stream.
Definition: EventSelector.cpp:62
merge_files.sc
int sc
Definition: merge_files.py:167
StatusCode::isFailure
bool isFailure() const
Test for a status code of FAILURE.
Definition: StatusCode.h:86
EventSelector::next
StatusCode next(Context &refCtxt) const override
Get next iteration item from the event loop context.
Definition: EventSelector.cpp:199
CommonMessagingBase::error
MsgStream & error() const
shortcut for the method msgStream(MSG::ERROR)
Definition: CommonMessaging.h:118
StatusCode::FAILURE
Definition: StatusCode.h:29
EvtSelectorContext
Definition of class EventIterator.
Definition: EventIterator.h:32
StatusCode::SUCCESS
Definition: StatusCode.h:30
StatusCode
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
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

## Member Data Documentation

int EventSelector::m_evtMax = INT_MAX
| protected

Maximum number of events to be processed.

Definition at line 83 of file EventSelector.h.

int EventSelector::m_evtPrintFrequency = 10
| protected

Printout frequency.

Definition at line 85 of file EventSelector.h.

int EventSelector::m_firstEvent = 0
| protected

First event to be processed.

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 79 of file EventSelector.h.

long int EventSelector::m_streamID

Definition at line 60 of file EventSelector.h.

std::string EventSelector::m_streamManager ="DataStreamTool"
| protected

Definition at line 87 of file EventSelector.h.

Streams EventSelector::m_streams
| protected

Input streams.

Definition at line 77 of file EventSelector.h.

StreamSpecs EventSelector::m_streamSpecs
| protected

Input stream specifiers (for job options)

Definition at line 73 of file EventSelector.h.

StreamSpecs EventSelector::m_streamSpecsLast
| protected

Input stream specifiers (last used)

Definition at line 75 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