Loading [MathJax]/extensions/tex2jax.js
The Gaudi Framework  master (d98a2936)
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
EventSelector.h
Go to the documentation of this file.
1 /***********************************************************************************\
2 * (c) Copyright 1998-2025 CERN for the benefit of the LHCb and ATLAS collaborations *
3 * *
4 * This software is distributed under the terms of the Apache version 2 licence, *
5 * copied verbatim in the file "LICENSE". *
6 * *
7 * In applying this licence, CERN does not waive the privileges and immunities *
8 * granted to it by virtue of its status as an Intergovernmental Organization *
9 * or submit itself to any jurisdiction. *
10 \***********************************************************************************/
11 #pragma once
12 
14 #include <GaudiKernel/Service.h>
15 #include <vector>
16 
17 class IIncidentSvc;
18 class IAddressCreator;
19 class IToolSvc;
21 class EvtSelectorContext;
22 class IDataStreamTool;
23 
41 class EventSelector : public extends<Service, IEvtSelector> {
42 public:
43  typedef std::vector<EventSelectorDataStream*> Streams;
44  typedef std::vector<std::string> StreamSpecs;
45  typedef std::vector<Gaudi::Property<std::string>> Properties;
46 
47  long int m_streamID;
48 
49 protected:
52 
54 
56 
58  bool m_reconfigure = false;
64  int m_streamCount = 0;
65 
66  // Properties
67  Gaudi::Property<StreamSpecs> m_streamSpecs{ this, "Input", {}, "input stream specifiers (for job options)" };
68  Gaudi::Property<int> m_firstEvent{ this, "FirstEvent", 0, "first event to be processed" };
69  Gaudi::Property<int> m_evtMax{ this, "EvtMax", INT_MAX, "maximum number of events to be processed" };
70  Gaudi::Property<int> m_evtPrintFrequency{ this, "PrintFreq", 10, "printout frequency" };
71  Gaudi::Property<std::string> m_streamManager{ this, "StreamManager", "DataStreamTool", "" };
72 
74  virtual void printEvtInfo( const EvtSelectorContext* iter ) const;
75 
76 public:
78  StatusCode initialize() override;
79 
81  StatusCode finalize() override;
82 
84  StatusCode reinitialize() override;
85 
87 
91  StatusCode createContext( Context*& refpCtxt ) const override;
92 
94 
98  StatusCode next( Context& refCtxt ) const override;
99 
101 
105  StatusCode next( Context& refCtxt, int jump ) const override;
106 
108 
113  StatusCode previous( Context& refCtxt ) const override;
114 
116 
121  StatusCode previous( Context& refCtxt, int jump ) const override;
122 
124 
128  StatusCode rewind( Context& refCtxt ) const override;
129 
131 
136  StatusCode createAddress( const Context& refCtxt, IOpaqueAddress*& refpAddr ) const override;
137 
139 
143  StatusCode releaseContext( Context*& refCtxt ) const override;
144 
153  StatusCode resetCriteria( const std::string& cr, Context& c ) const override;
154 
160  StatusCode last( Context& c ) const override;
161 
163  StatusCode firstOfNextStream( bool shutDown, EvtSelectorContext& it ) const;
165  StatusCode lastOfPreviousStream( bool shutDown, EvtSelectorContext& it ) const;
166 
168  using extends::extends;
169 };
IAddressCreator
Definition: IAddressCreator.h:33
EventSelector::firstOfNextStream
StatusCode firstOfNextStream(bool shutDown, EvtSelectorContext &it) const
Retrieve first entry of the next data stream.
Definition: EventSelector.cpp:51
EventSelector::lastOfPreviousStream
StatusCode lastOfPreviousStream(bool shutDown, EvtSelectorContext &it) const
Retrieve last entry of the previous data stream.
Definition: EventSelector.cpp:109
EventSelector::m_firstEvent
Gaudi::Property< int > m_firstEvent
Definition: EventSelector.h:68
EventSelector::m_toolSvc
SmartIF< IToolSvc > m_toolSvc
Definition: EventSelector.h:53
EventSelector::releaseContext
StatusCode releaseContext(Context *&refCtxt) const override
Release existing event iteration context.
Definition: EventSelector.cpp:299
IOpaqueAddress
Definition: IOpaqueAddress.h:28
EventSelector::StreamSpecs
std::vector< std::string > StreamSpecs
Definition: EventSelector.h:44
EventSelector::printEvtInfo
virtual void printEvtInfo(const EvtSelectorContext *iter) const
Progress report.
Definition: EventSelector.cpp:33
IEvtSelector.h
EventSelector::reinitialize
StatusCode reinitialize() override
Service override: Reinitialize service.
Definition: EventSelector.cpp:369
gaudirun.c
c
Definition: gaudirun.py:525
EventSelector::next
StatusCode next(Context &refCtxt) const override
Get next iteration item from the event loop context.
Definition: EventSelector.cpp:185
EventSelector::finalize
StatusCode finalize() override
IService implementation: Service finalization.
Definition: EventSelector.cpp:387
EventSelector::previous
StatusCode previous(Context &refCtxt) const override
Get previous iteration item from the event loop context.
Definition: EventSelector.cpp:224
EvtSelectorContext
Definition of class EventIterator.
Definition: EventIterator.h:30
EventSelector::resetCriteria
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...
Definition: EventSelector.cpp:28
EventSelector::m_streamtool
IDataStreamTool * m_streamtool
Definition: EventSelector.h:55
EventSelector::m_streamCount
int m_streamCount
Input stream counter (0..oo, monotonely increasing)
Definition: EventSelector.h:64
EventSelector::Streams
std::vector< EventSelectorDataStream * > Streams
Definition: EventSelector.h:43
EventSelector::m_evtPrintFrequency
Gaudi::Property< int > m_evtPrintFrequency
Definition: EventSelector.h:70
StatusCode
Definition: StatusCode.h:64
EventSelector::createAddress
StatusCode createAddress(const Context &refCtxt, IOpaqueAddress *&refpAddr) const override
Create new Opaque address corresponding to the current record.
Definition: EventSelector.cpp:279
EventSelector::m_incidentSvc
SmartIF< IIncidentSvc > m_incidentSvc
Reference to the indicent service.
Definition: EventSelector.h:51
SmartIF< IIncidentSvc >
extends
Base class used to extend a class implementing other interfaces.
Definition: extends.h:19
EventSelector::m_evtMax
Gaudi::Property< int > m_evtMax
Definition: EventSelector.h:69
EventSelector::initialize
StatusCode initialize() override
IService implementation: Db event selector override.
Definition: EventSelector.cpp:314
EventSelector::m_streamManager
Gaudi::Property< std::string > m_streamManager
Definition: EventSelector.h:71
EventSelector::last
StatusCode last(Context &c) const override
Access last item in the iteration.
Definition: EventSelector.cpp:256
Service.h
EventSelector::m_streams
Streams m_streams
Input streams.
Definition: EventSelector.h:62
EventSelector::m_streamID
long int m_streamID
Definition: EventSelector.h:47
EventSelector::m_streamSpecs
Gaudi::Property< StreamSpecs > m_streamSpecs
Definition: EventSelector.h:67
EventSelector::createContext
StatusCode createContext(Context *&refpCtxt) const override
Create a new event loop context.
Definition: EventSelector.cpp:159
EventSelectorDataStream
Definition of class EventSelectorDataStream.
Definition: EventSelectorDataStream.h:39
EventSelector::m_reconfigure
bool m_reconfigure
Reconfigure occurred.
Definition: EventSelector.h:58
IDataStreamTool
Definition: IDataStreamTool.h:27
EventSelector::m_streamSpecsLast
StreamSpecs m_streamSpecsLast
Input stream specifiers (last used)
Definition: EventSelector.h:60
EventSelector
Definition of class EventSelector.
Definition: EventSelector.h:41
IIncidentSvc
Definition: IIncidentSvc.h:30
IToolSvc
Definition: IToolSvc.h:28
Gaudi::Property< StreamSpecs >
EventSelector::Properties
std::vector< Gaudi::Property< std::string > > Properties
Definition: EventSelector.h:45
EventSelector::rewind
StatusCode rewind(Context &refCtxt) const override
Rewind the dataset.
Definition: EventSelector.cpp:263