| The Gaudi Framework v29r1 (5cd95fa2)

- 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/GenericAddress.h"
16 #include "GaudiKernel/IEvtSelector.h"
17 #include "GaudiKernel/NTuple.h"
18 #include "GaudiKernel/Service.h"
19
20 // Forward declarations
21 class INTuple;
22 class INTupleSvc;
23 class IAddressCreator;
24 class EventSelectorDataStream;
25 template <class TYPE>
26 class EventIterator;
27
42 class EventCollectionSelector : public extends<Service, IEvtSelector>
43 {
44 public:
45 class MyContextType : public IEvtSelector::Context
46 {
47 public:
48 std::string criteria;
49 NTuple::Tuple* tuple;
50 NTuple::Item<IOpaqueAddress*>* item;
51 IOpaqueAddress* addressBuffer;
52 MyContextType( NTuple::Tuple* t, NTuple::Item<IOpaqueAddress*>* i )
53 {
54 addressBuffer = new GenericAddress();
55 addressBuffer->addRef();
56 tuple = t;
57 item = i;
58 }
59 MyContextType( MyContextType* ctxt = nullptr )
60 {
61 addressBuffer = new GenericAddress();
62 addressBuffer->addRef();
63 tuple = ( ctxt ) ? ctxt->tuple : nullptr;
64 item = ( ctxt ) ? ctxt->item : nullptr;
65 }
66 MyContextType( const MyContextType& ctxt ) : IEvtSelector::Context( ctxt )
67 {
68 addressBuffer = new GenericAddress();
69 addressBuffer->addRef();
70 tuple = ctxt.tuple;
71 item = ctxt.item;
72 }
73 ~MyContextType() override { addressBuffer->release(); }
74 void* identifier() const override { return (void*)addressBuffer; }
75 void setAddress( IOpaqueAddress* pAddr );
76 };
77
78 protected:
80 mutable SmartIF<INTupleSvc> m_tupleSvc;
81 mutable SmartIF<IAddressCreator> m_pAddrCreator;
82
83 // Properties
84 Gaudi::Property<std::string> m_tupleSvcName{this, "CnvService", "EvtTupleSvc",
85 "name of the event collection service"};
86 Gaudi::Property<std::string> m_authentication{this, "Authentication", "", "authentication string (if needed)"};
87 Gaudi::Property<std::string> m_cntName{this, "Container", "B2PiPi", "container name"};
88 Gaudi::Property<std::string> m_itemName{this, "Item", "Address", "item name"};
89 Gaudi::Property<std::string> m_criteria{this, "Criteria", "", "criteria"};
90 Gaudi::Property<std::string> m_database{this, "DB", "", "datafile name"};
91 Gaudi::Property<std::string> m_dbType{this, "DbType", "", "database type identifier"};
92 Gaudi::Property<std::string> m_dbSvc{this, "DbService", "", "database service (exclusive property with db type)"};
93 Gaudi::Property<std::string> m_statement{this, "Function", "NTuple::Selector", "selector name"};
94
95 public:
97 StatusCode initialize() override;
99 StatusCode finalize() override;
100
102
106 StatusCode createContext( Context*& refpCtxt ) const override;
107
109
113 StatusCode next( Context& refCtxt ) const override;
114
116
120 StatusCode next( Context& refCtxt, int jump ) const override;
121
123
128 StatusCode previous( Context& refCtxt ) const override;
129
131
136 StatusCode previous( Context& refCtxt, int jump ) const override;
137
139
143 StatusCode rewind( Context& refCtxt ) const override;
144
146
151 StatusCode createAddress( const Context& refCtxt, IOpaqueAddress*& refpAddr ) const override;
152
154
158 StatusCode releaseContext( Context*& refCtxt ) const override;
159
168 StatusCode resetCriteria( const std::string& cr, Context& c ) const override;
169
175 StatusCode last( Context& refCtxt ) const override;
176
178 virtual StatusCode connectCollection( MyContextType* ctxt ) const;
179
181 virtual StatusCode connectDataSource( const std::string& db, const std::string& typ ) const;
183 virtual StatusCode connectTuple( const std::string& nam, const std::string& itName, NTuple::Tuple*& tup,
184 NTuple::Item<IOpaqueAddress*>*& item ) const;
186 virtual StatusCode connectStatement( const std::string& typ, const std::string& crit, INTuple* tuple ) const;
188 virtual StatusCode getNextRecord( NTuple::Tuple* tuple ) const;
190 virtual StatusCode getPreviousRecord( NTuple::Tuple* tuple ) const;
191
193 using extends::extends;
194
196 ~EventCollectionSelector() override = default;
197 };
198
199 #endif // GAUDISVC_EventCollectionSelector_EventCollectionSelector_H
EventCollectionSelector::m_tupleSvc
SmartIF< INTupleSvc > m_tupleSvc
Reference to Tuple service.
Definition: EventCollectionSelector.h:80
SmartIF< INTupleSvc >
EventCollectionSelector::createContext
StatusCode createContext(Context *&refpCtxt) const override
Create a new event loop context.
Definition: EventCollectionSelector.cpp:222
gaudirun.c
c
Definition: gaudirun.py:407
EventCollectionSelector::getNextRecord
virtual StatusCode getNextRecord(NTuple::Tuple *tuple) const
Read next record of the N-tuple.
Definition: EventCollectionSelector.cpp:143
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:309
Gaudi::Property
Implementation of property with value of concrete type.
Definition: Property.h:319
EventCollectionSelector::MyContextType::MyContextType
MyContextType(MyContextType *ctxt=nullptr)
Definition: EventCollectionSelector.h:59
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:52
EventCollectionSelector::connectDataSource
virtual StatusCode connectDataSource(const std::string &db, const std::string &typ) const
Connect collection&#39;s data source to selector.
Definition: EventCollectionSelector.cpp:84
EventCollectionSelector::MyContextType::~MyContextType
~MyContextType() override
Definition: EventCollectionSelector.h:73
IAddressCreator
IAddressCreator interface definition.
Definition: IAddressCreator.h:28
EventCollectionSelector::m_authentication
Gaudi::Property< std::string > m_authentication
Definition: EventCollectionSelector.h:86
IEvtSelector::Context
Definition: IEvtSelector.h:24
IOpaqueAddress::release
virtual unsigned long release()=0
release reference to object
GenericAddress
Generic Transient Address.
Definition: GenericAddress.h:20
EventCollectionSelector::m_cntName
Gaudi::Property< std::string > m_cntName
Definition: EventCollectionSelector.h:87
EventCollectionSelector::m_database
Gaudi::Property< std::string > m_database
Definition: EventCollectionSelector.h:90
EventCollectionSelector::createAddress
StatusCode createAddress(const Context &refCtxt, IOpaqueAddress *&refpAddr) const override
Create new Opaque address corresponding to the current record.
Definition: EventCollectionSelector.cpp:275
EventCollectionSelector::m_tupleSvcName
Gaudi::Property< std::string > m_tupleSvcName
Definition: EventCollectionSelector.h:84
std::string
STL class.
INTupleSvc
Definition: INTupleSvc.h:37
INTuple
NTuple interface class definition.
Definition: INTuple.h:82
Service.h
EventCollectionSelector::finalize
StatusCode finalize() override
Service override: Finalize Service.
Definition: EventCollectionSelector.cpp:213
EventCollectionSelector::MyContextType::tuple
NTuple::Tuple * tuple
Definition: EventCollectionSelector.h:49
StatusCode
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:28
EventCollectionSelector::MyContextType::criteria
std::string criteria
Definition: EventCollectionSelector.h:48
EventCollectionSelector::~EventCollectionSelector
~EventCollectionSelector() override=default
Standard Destructor.
EventCollectionSelector::m_statement
Gaudi::Property< std::string > m_statement
Definition: EventCollectionSelector.h:93
EventCollectionSelector::last
StatusCode last(Context &refCtxt) const override
Access last item in the iteration.
Definition: EventCollectionSelector.cpp:320
EventCollectionSelector::m_dbType
Gaudi::Property< std::string > m_dbType
Definition: EventCollectionSelector.h:91
EventCollectionSelector::MyContextType::identifier
void * identifier() const override
Definition: EventCollectionSelector.h:74
EventCollectionSelector::MyContextType::setAddress
void setAddress(IOpaqueAddress *pAddr)
EventCollectionSelector::MyContextType::MyContextType
MyContextType(const MyContextType &ctxt)
Definition: EventCollectionSelector.h:66
NTuple::Tuple
Abstract base class which allows the user to interact with the actual N tuple implementation.
Definition: NTuple.h:412
EventCollectionSelector::m_criteria
Gaudi::Property< std::string > m_criteria
Definition: EventCollectionSelector.h:89
EventCollectionSelector::m_dbSvc
Gaudi::Property< std::string > m_dbSvc
Definition: EventCollectionSelector.h:92
EventIterator
Definition: EventCollectionSelector.h:26
EventCollectionSelector::getPreviousRecord
virtual StatusCode getPreviousRecord(NTuple::Tuple *tuple) const
Read next record of the N-tuple.
Definition: EventCollectionSelector.cpp:162
extends
Base class used to extend a class implementing other interfaces.
Definition: extends.h:10
EventCollectionSelector
Definition of class EventCollectionSelector.
Definition: EventCollectionSelector.h:42
EventCollectionSelector::previous
StatusCode previous(Context &refCtxt) const override
Get previous iteration item from the event loop context.
Definition: EventCollectionSelector.cpp:254
EventSelectorDataStream
Definition of class EventSelectorDataStream.
Definition: EventSelectorDataStream.h:45
EventCollectionSelector::releaseContext
StatusCode releaseContext(Context *&refCtxt) const override
Release existing event iteration context.
Definition: EventCollectionSelector.cpp:296
EventCollectionSelector::MyContextType::item
NTuple::Item< IOpaqueAddress * > * item
Definition: EventCollectionSelector.h:50
EventCollectionSelector::initialize
StatusCode initialize() override
Service override: Initialize service.
Definition: EventCollectionSelector.cpp:61
IEvtSelector.h
EventCollectionSelector::MyContextType::addressBuffer
IOpaqueAddress * addressBuffer
Definition: EventCollectionSelector.h:51
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:105
IOpaqueAddress
Opaque address interface definition.
Definition: IOpaqueAddress.h:23
EventCollectionSelector::rewind
StatusCode rewind(Context &refCtxt) const override
Rewind the dataset.
Definition: EventCollectionSelector.cpp:272
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:193
GenericAddress.h
EventCollectionSelector::next
StatusCode next(Context &refCtxt) const override
Get next iteration item from the event loop context.
Definition: EventCollectionSelector.cpp:236
EventCollectionSelector::m_itemName
Gaudi::Property< std::string > m_itemName
Definition: EventCollectionSelector.h:88
EventCollectionSelector::MyContextType
Definition: EventCollectionSelector.h:45
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:125