| The Gaudi Framework v27r1

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

- File List
- File Members

EventCollectionSelector.h
Go to the documentation of this file.
1 //====================================================================
2 // EventCollectionSelector.h
3 //--------------------------------------------------------------------
4 //
5 // Package : EventCollectionSelector (LHCb Event Selector Package)
6 //
7 // Author : M.Frank
8 // Created : 4/10/00
9 //
10 //====================================================================
11 #ifndef GAUDISVC_EventCollectionSelector_EventCollectionSelector_H
12 #define GAUDISVC_EventCollectionSelector_EventCollectionSelector_H 1
13
14 // Include files
15 #include "GaudiKernel/Service.h"
16 #include "GaudiKernel/GenericAddress.h"
17 #include "GaudiKernel/IEvtSelector.h"
18 #include "GaudiKernel/NTuple.h"
19
20 // Forward declarations
21 class INTuple;
22 class INTupleSvc;
23 class IAddressCreator;
24 class EventSelectorDataStream;
25 template <class TYPE> class EventIterator;
26
41 class EventCollectionSelector : public extends<Service,
42 IEvtSelector> {
43 public:
44 class MyContextType : public IEvtSelector::Context {
45 public:
46 std::string criteria;
47 NTuple::Tuple* tuple;
48 NTuple::Item<IOpaqueAddress*>* item;
49 IOpaqueAddress* addressBuffer;
50 MyContextType(NTuple::Tuple* t, NTuple::Item<IOpaqueAddress*>* i) {
51 addressBuffer = new GenericAddress();
52 addressBuffer->addRef();
53 tuple = t;
54 item = i;
55 }
56 MyContextType(MyContextType* ctxt=nullptr) {
57 addressBuffer = new GenericAddress();
58 addressBuffer->addRef();
59 tuple = (ctxt) ? ctxt->tuple : nullptr;
60 item = (ctxt) ? ctxt->item : nullptr;
61 }
62 MyContextType(const MyContextType& ctxt)
63 : IEvtSelector::Context(ctxt)
64 {
65 addressBuffer = new GenericAddress();
66 addressBuffer->addRef();
67 tuple = ctxt.tuple;
68 item = ctxt.item;
69 }
70 ~MyContextType() override {
71 addressBuffer->release();
72 }
73 void* identifier() const override {
74 return (void*)addressBuffer;
75 }
76 void setAddress(IOpaqueAddress* pAddr);
77 };
78 protected:
80 mutable SmartIF<INTupleSvc> m_tupleSvc;
81 mutable SmartIF<IAddressCreator> m_pAddrCreator;
83 std::string m_tupleSvcName;
85 std::string m_authentication;
87 std::string m_cntName;
89 std::string m_itemName;
91 std::string m_criteria;
93 std::string m_database;
95 std::string m_dbType;
97 std::string m_dbSvc;
99 std::string m_statement;
100 public:
101
103 StatusCode initialize() override;
105 StatusCode finalize() override;
106
108
112 StatusCode createContext(Context*& refpCtxt) const override;
113
115
119 StatusCode next(Context& refCtxt) const override;
120
122
126 StatusCode next(Context& refCtxt,int jump) const override;
127
129
134 StatusCode previous(Context& refCtxt) const override;
135
137
142 StatusCode previous(Context& refCtxt,int jump) const override;
143
145
149 StatusCode rewind(Context& refCtxt) const override;
150
152
157 StatusCode createAddress(const Context& refCtxt, IOpaqueAddress*& refpAddr) const override;
158
160
164 StatusCode releaseContext(Context*& refCtxt) const override;
165
174 StatusCode resetCriteria(const std::string& cr,Context& c) const override;
175
181 StatusCode last(Context& refCtxt) const override;
182
184 virtual StatusCode connectCollection(MyContextType* ctxt) const;
185
187 virtual StatusCode connectDataSource(const std::string& db, const std::string& typ) const;
189 virtual StatusCode connectTuple(const std::string& nam, const std::string& itName, NTuple::Tuple*& tup, NTuple::Item<IOpaqueAddress*>*& item) const;
191 virtual StatusCode connectStatement(const std::string& typ, const std::string& crit, INTuple* tuple) const;
193 virtual StatusCode getNextRecord(NTuple::Tuple* tuple) const;
195 virtual StatusCode getPreviousRecord(NTuple::Tuple* tuple) const;
196
198 EventCollectionSelector( const std::string& name, ISvcLocator* svcloc );
200 ~EventCollectionSelector() override = default;
201 };
202
203 #endif // GAUDISVC_EventCollectionSelector_EventCollectionSelector_H
EventCollectionSelector::m_tupleSvc
SmartIF< INTupleSvc > m_tupleSvc
Reference to Tuple service.
Definition: EventCollectionSelector.h:80
SmartIF< INTupleSvc >
ISvcLocator
The ISvcLocator is the interface implemented by the Service Factory in the Application Manager to loc...
Definition: ISvcLocator.h:25
EventCollectionSelector::MyContextType::identifier
void * identifier() const override
Definition: EventCollectionSelector.h:73
EventCollectionSelector::getNextRecord
virtual StatusCode getNextRecord(NTuple::Tuple *tuple) const
Read next record of the N-tuple.
Definition: EventCollectionSelector.cpp:169
EventCollectionSelector::MyContextType::MyContextType
MyContextType(MyContextType *ctxt=nullptr)
Definition: EventCollectionSelector.h:56
IEvtSelector
The Event Selector Interface.
Definition: IEvtSelector.h:18
NTuple.h
EventCollectionSelector::MyContextType::MyContextType
MyContextType(NTuple::Tuple *t, NTuple::Item< IOpaqueAddress * > *i)
Definition: EventCollectionSelector.h:50
gaudirun.c
tuple c
Definition: gaudirun.py:391
EventCollectionSelector::connectDataSource
virtual StatusCode connectDataSource(const std::string &db, const std::string &typ) const
Connect collection's data source to selector.
Definition: EventCollectionSelector.cpp:112
EventCollectionSelector::MyContextType::~MyContextType
~MyContextType() override
Definition: EventCollectionSelector.h:70
IAddressCreator
IAddressCreator interface definition.
Definition: IAddressCreator.h:28
EventCollectionSelector::m_criteria
std::string m_criteria
Criteria.
Definition: EventCollectionSelector.h:91
EventCollectionSelector::previous
StatusCode previous(Context &refCtxt) const override
Get previous iteration item from the event loop context.
Definition: EventCollectionSelector.cpp:285
IEvtSelector::Context
Definition: IEvtSelector.h:23
IOpaqueAddress::release
virtual unsigned long release()=0
release reference to object
GenericAddress
Generic Transient Address.
Definition: GenericAddress.h:20
EventCollectionSelector::releaseContext
StatusCode releaseContext(Context *&refCtxt) const override
Release existing event iteration context.
Definition: EventCollectionSelector.cpp:345
std::string
STL class.
INTupleSvc
Definition: INTupleSvc.h:37
INTuple
NTuple interface class definition.
Definition: INTuple.h:79
Service.h
EventCollectionSelector::finalize
StatusCode finalize() override
Service override: Finalize Service.
Definition: EventCollectionSelector.cpp:238
EventCollectionSelector::m_tupleSvcName
std::string m_tupleSvcName
Name of the event collection service name.
Definition: EventCollectionSelector.h:83
EventCollectionSelector::m_cntName
std::string m_cntName
Container name.
Definition: EventCollectionSelector.h:87
Service::name
const std::string & name() const override
Retrieve name of the service.
Definition: Service.cpp:319
EventCollectionSelector::MyContextType::tuple
NTuple::Tuple * tuple
Definition: EventCollectionSelector.h:47
EventCollectionSelector::last
StatusCode last(Context &refCtxt) const override
Access last item in the iteration.
Definition: EventCollectionSelector.cpp:371
EventCollectionSelector::next
StatusCode next(Context &refCtxt) const override
Get next iteration item from the event loop context.
Definition: EventCollectionSelector.cpp:262
StatusCode
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
EventCollectionSelector::MyContextType::criteria
std::string criteria
Definition: EventCollectionSelector.h:46
EventCollectionSelector::~EventCollectionSelector
~EventCollectionSelector() override=default
Standard Destructor.
EventCollectionSelector::m_itemName
std::string m_itemName
Item name.
Definition: EventCollectionSelector.h:89
EventCollectionSelector::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: EventCollectionSelector.cpp:359
EventCollectionSelector::MyContextType::setAddress
void setAddress(IOpaqueAddress *pAddr)
EventCollectionSelector::m_dbType
std::string m_dbType
Database type identifier.
Definition: EventCollectionSelector.h:95
EventCollectionSelector::MyContextType::MyContextType
MyContextType(const MyContextType &ctxt)
Definition: EventCollectionSelector.h:62
NTuple::Tuple
Abstract base class which allows the user to interact with the actual N tuple implementation.
Definition: NTuple.h:370
EventCollectionSelector::m_dbSvc
std::string m_dbSvc
Database service (exclusive property with db type)
Definition: EventCollectionSelector.h:97
EventIterator
Definition: EventCollectionSelector.h:25
EventCollectionSelector::m_database
std::string m_database
Datafile name.
Definition: EventCollectionSelector.h:93
EventCollectionSelector::getPreviousRecord
virtual StatusCode getPreviousRecord(NTuple::Tuple *tuple) const
Read next record of the N-tuple.
Definition: EventCollectionSelector.cpp:187
extends
Base class used to extend a class implementing other interfaces.
Definition: extends.h:10
EventCollectionSelector
Definition of class EventCollectionSelector.
Definition: EventCollectionSelector.h:41
EventSelectorDataStream
Definition of class EventSelectorDataStream.
Definition: EventSelectorDataStream.h:45
ana.item
tuple item
print s1,s2
Definition: ana.py:146
EventCollectionSelector::MyContextType::item
NTuple::Item< IOpaqueAddress * > * item
Definition: EventCollectionSelector.h:48
EventCollectionSelector::initialize
StatusCode initialize() override
Service override: Initialize service.
Definition: EventCollectionSelector.cpp:90
IEvtSelector.h
EventCollectionSelector::MyContextType::addressBuffer
IOpaqueAddress * addressBuffer
Definition: EventCollectionSelector.h:49
EventCollectionSelector::connectTuple
virtual StatusCode connectTuple(const std::string &nam, const std::string &itName, NTuple::Tuple *&tup, NTuple::Item< IOpaqueAddress * > *&item) const
Connect to existing N-tuple.
Definition: EventCollectionSelector.cpp:133
EventCollectionSelector::createAddress
StatusCode createAddress(const Context &refCtxt, IOpaqueAddress *&refpAddr) const override
Create new Opaque address corresponding to the current record.
Definition: EventCollectionSelector.cpp:315
EventCollectionSelector::m_authentication
std::string m_authentication
Authentication string (if needed)
Definition: EventCollectionSelector.h:85
EventCollectionSelector::EventCollectionSelector
EventCollectionSelector(const std::string &name, ISvcLocator *svcloc)
Standard Constructor.
Definition: EventCollectionSelector.cpp:75
IOpaqueAddress
Opaque address interface definition.
Definition: IOpaqueAddress.h:23
EventCollectionSelector::rewind
StatusCode rewind(Context &refCtxt) const override
Rewind the dataset.
Definition: EventCollectionSelector.cpp:308
EventCollectionSelector::m_pAddrCreator
SmartIF< IAddressCreator > m_pAddrCreator
Definition: EventCollectionSelector.h:81
NTuple::Item< IOpaqueAddress * >
EventCollectionSelector::connectCollection
virtual StatusCode connectCollection(MyContextType *ctxt) const
Connect collection to selector.
Definition: EventCollectionSelector.cpp:218
ana.i
list i
Definition: ana.py:128
GenericAddress.h
EventCollectionSelector::MyContextType
Definition: EventCollectionSelector.h:44
EventCollectionSelector::m_statement
std::string m_statement
Selector name.
Definition: EventCollectionSelector.h:99
EventCollectionSelector::createContext
StatusCode createContext(Context *&refpCtxt) const override
Create a new event loop context.
Definition: EventCollectionSelector.cpp:247
IOpaqueAddress::addRef
virtual unsigned long addRef()=0
Add reference to object.
EventCollectionSelector::connectStatement
virtual StatusCode connectStatement(const std::string &typ, const std::string &crit, INTuple *tuple) const
Connect selection statement to refine data access.
Definition: EventCollectionSelector.cpp:153