| The Gaudi Framework v32r1 (f65d50dc)

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 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 ) : IEvtSelector::Context( ctxt ) {
63 addressBuffer = new GenericAddress();
64 addressBuffer->addRef();
65 tuple = ctxt.tuple;
66 item = ctxt.item;
67 }
68 ~MyContextType() override { addressBuffer->release(); }
69 void* identifier() const override { return (void*)addressBuffer; }
70 void setAddress( IOpaqueAddress* pAddr );
71 };
72
73 protected:
75 mutable SmartIF<INTupleSvc> m_tupleSvc;
76 mutable SmartIF<IAddressCreator> m_pAddrCreator;
77
78 // Properties
79 Gaudi::Property<std::string> m_tupleSvcName{this, "CnvService", "EvtTupleSvc",
80 "name of the event collection service"};
81 Gaudi::Property<std::string> m_authentication{this, "Authentication", "", "authentication string (if needed)"};
82 Gaudi::Property<std::string> m_cntName{this, "Container", "B2PiPi", "container name"};
83 Gaudi::Property<std::string> m_itemName{this, "Item", "Address", "item name"};
84 Gaudi::Property<std::string> m_criteria{this, "Criteria", "", "criteria"};
85 Gaudi::Property<std::string> m_database{this, "DB", "", "datafile name"};
86 Gaudi::Property<std::string> m_dbType{this, "DbType", "", "database type identifier"};
87 Gaudi::Property<std::string> m_dbSvc{this, "DbService", "", "database service (exclusive property with db type)"};
88 Gaudi::Property<std::string> m_statement{this, "Function", "NTuple::Selector", "selector name"};
89
90 public:
92 StatusCode initialize() override;
94 StatusCode finalize() override;
95
97
101 StatusCode createContext( Context*& refpCtxt ) const override;
102
104
108 StatusCode next( Context& refCtxt ) const override;
109
111
115 StatusCode next( Context& refCtxt, int jump ) const override;
116
118
123 StatusCode previous( Context& refCtxt ) const override;
124
126
131 StatusCode previous( Context& refCtxt, int jump ) const override;
132
134
138 StatusCode rewind( Context& refCtxt ) const override;
139
141
146 StatusCode createAddress( const Context& refCtxt, IOpaqueAddress*& refpAddr ) const override;
147
149
153 StatusCode releaseContext( Context*& refCtxt ) const override;
154
163 StatusCode resetCriteria( const std::string& cr, Context& c ) const override;
164
170 StatusCode last( Context& refCtxt ) const override;
171
173 virtual StatusCode connectCollection( MyContextType* ctxt ) const;
174
176 virtual StatusCode connectDataSource( const std::string& db, const std::string& typ ) const;
178 virtual StatusCode connectTuple( const std::string& nam, const std::string& itName, NTuple::Tuple*& tup,
179 NTuple::Item<IOpaqueAddress*>*& item ) const;
181 virtual StatusCode connectStatement( const std::string& typ, const std::string& crit, INTuple* tuple ) const;
183 virtual StatusCode getNextRecord( NTuple::Tuple* tuple ) const;
185 virtual StatusCode getPreviousRecord( NTuple::Tuple* tuple ) const;
186
188 using extends::extends;
189 };
190
191 #endif // GAUDISVC_EventCollectionSelector_EventCollectionSelector_H
EventCollectionSelector::m_tupleSvc
SmartIF< INTupleSvc > m_tupleSvc
Reference to Tuple service.
Definition: EventCollectionSelector.h:75
SmartIF< INTupleSvc >
EventCollectionSelector::MyContextType::identifier
void * identifier() const override
Definition: EventCollectionSelector.h:69
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:118
gaudirun.c
c
Definition: gaudirun.py:487
Gaudi::Property
Implementation of property with value of concrete type.
Definition: Property.h:352
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
EventCollectionSelector::MyContextType::~MyContextType
~MyContextType() override
Definition: EventCollectionSelector.h:68
IAddressCreator
IAddressCreator interface definition.
Definition: IAddressCreator.h:28
EventCollectionSelector::m_authentication
Gaudi::Property< std::string > m_authentication
Definition: EventCollectionSelector.h:81
EventCollectionSelector::previous
StatusCode previous(Context &refCtxt) const override
Get previous iteration item from the event loop context.
Definition: EventCollectionSelector.cpp:234
IEvtSelector::Context
Definition: IEvtSelector.h:23
EventCollectionSelector::getPreviousRecord
virtual StatusCode getPreviousRecord(NTuple::Tuple *tuple) const
Read next record of the N-tuple.
Definition: EventCollectionSelector.cpp:151
IOpaqueAddress::release
virtual unsigned long release()=0
release reference to object
EventCollectionSelector::connectCollection
virtual StatusCode connectCollection(MyContextType *ctxt) const
Connect collection to selector.
Definition: EventCollectionSelector.cpp:179
EventCollectionSelector::getNextRecord
virtual StatusCode getNextRecord(NTuple::Tuple *tuple) const
Read next record of the N-tuple.
Definition: EventCollectionSelector.cpp:135
GenericAddress
Generic Transient Address.
Definition: GenericAddress.h:20
EventCollectionSelector::m_cntName
Gaudi::Property< std::string > m_cntName
Definition: EventCollectionSelector.h:82
EventCollectionSelector::m_database
Gaudi::Property< std::string > m_database
Definition: EventCollectionSelector.h:85
EventCollectionSelector::releaseContext
StatusCode releaseContext(Context *&refCtxt) const override
Release existing event iteration context.
Definition: EventCollectionSelector.cpp:272
EventCollectionSelector::m_tupleSvcName
Gaudi::Property< std::string > m_tupleSvcName
Definition: EventCollectionSelector.h:79
std::string
STL class.
INTupleSvc
Definition: INTupleSvc.h:36
INTuple
NTuple interface class definition.
Definition: INTuple.h:81
Service.h
EventCollectionSelector::finalize
StatusCode finalize() override
Service override: Finalize Service.
Definition: EventCollectionSelector.cpp:198
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:294
EventCollectionSelector::next
StatusCode next(Context &refCtxt) const override
Get next iteration item from the event loop context.
Definition: EventCollectionSelector.cpp:219
StatusCode
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:50
EventCollectionSelector::MyContextType::criteria
std::string criteria
Definition: EventCollectionSelector.h:46
EventCollectionSelector::connectDataSource
virtual StatusCode connectDataSource(const std::string &db, const std::string &typ) const
Connect collection's data source to selector.
Definition: EventCollectionSelector.cpp:81
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:284
EventCollectionSelector::m_statement
Gaudi::Property< std::string > m_statement
Definition: EventCollectionSelector.h:88
EventCollectionSelector::m_dbType
Gaudi::Property< std::string > m_dbType
Definition: EventCollectionSelector.h:86
EventCollectionSelector::MyContextType::setAddress
void setAddress(IOpaqueAddress *pAddr)
EventCollectionSelector::MyContextType::MyContextType
MyContextType(const MyContextType &ctxt)
Definition: EventCollectionSelector.h:62
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:99
NTuple::Tuple
Abstract base class which allows the user to interact with the actual N tuple implementation.
Definition: NTuple.h:375
EventCollectionSelector::m_criteria
Gaudi::Property< std::string > m_criteria
Definition: EventCollectionSelector.h:84
EventCollectionSelector::m_dbSvc
Gaudi::Property< std::string > m_dbSvc
Definition: EventCollectionSelector.h:87
EventIterator
Definition: EventCollectionSelector.h:26
extends
Base class used to extend a class implementing other interfaces.
Definition: extends.h:10
EventCollectionSelector
Definition of class EventCollectionSelector.
Definition: EventCollectionSelector.h:42
EventSelectorDataStream
Definition of class EventSelectorDataStream.
Definition: EventSelectorDataStream.h:45
EventCollectionSelector::MyContextType::item
NTuple::Item< IOpaqueAddress * > * item
Definition: EventCollectionSelector.h:48
EventCollectionSelector::initialize
StatusCode initialize() override
Service override: Initialize service.
Definition: EventCollectionSelector.cpp:59
IEvtSelector.h
EventCollectionSelector::MyContextType::addressBuffer
IOpaqueAddress * addressBuffer
Definition: EventCollectionSelector.h:49
EventCollectionSelector::createAddress
StatusCode createAddress(const Context &refCtxt, IOpaqueAddress *&refpAddr) const override
Create new Opaque address corresponding to the current record.
Definition: EventCollectionSelector.cpp:252
IOpaqueAddress
Opaque address interface definition.
Definition: IOpaqueAddress.h:23
EventCollectionSelector::rewind
StatusCode rewind(Context &refCtxt) const override
Rewind the dataset.
Definition: EventCollectionSelector.cpp:249
EventCollectionSelector::m_pAddrCreator
SmartIF< IAddressCreator > m_pAddrCreator
Definition: EventCollectionSelector.h:76
NTuple::Item< IOpaqueAddress * >
GenericAddress.h
EventCollectionSelector::m_itemName
Gaudi::Property< std::string > m_itemName
Definition: EventCollectionSelector.h:83
EventCollectionSelector::MyContextType
Definition: EventCollectionSelector.h:44
EventCollectionSelector::createContext
StatusCode createContext(Context *&refpCtxt) const override
Create a new event loop context.
Definition: EventCollectionSelector.cpp:206
IOpaqueAddress::addRef
virtual unsigned long addRef()=0
Add reference to object.