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"
18 #include "GaudiKernel/NTuple.h"
19 
20 // Forward declarations
21 class INTuple;
22 class INTupleSvc;
23 class IAddressCreator;
25 template <class TYPE> class EventIterator;
26 
41 class EventCollectionSelector : public extends<Service,
42  IEvtSelector> {
43 public:
45  public:
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  }
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:
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 
200  ~EventCollectionSelector() override = default;
201 };
202 
203 #endif // GAUDISVC_EventCollectionSelector_EventCollectionSelector_H
SmartIF< INTupleSvc > m_tupleSvc
Reference to Tuple service.
The ISvcLocator is the interface implemented by the Service Factory in the Application Manager to loc...
Definition: ISvcLocator.h:25
virtual StatusCode getNextRecord(NTuple::Tuple *tuple) const
Read next record of the N-tuple.
MyContextType(MyContextType *ctxt=nullptr)
The Event Selector Interface.
Definition: IEvtSelector.h:18
MyContextType(NTuple::Tuple *t, NTuple::Item< IOpaqueAddress * > *i)
tuple c
Definition: gaudirun.py:391
virtual StatusCode connectDataSource(const std::string &db, const std::string &typ) const
Connect collection's data source to selector.
IAddressCreator interface definition.
std::string m_criteria
Criteria.
StatusCode previous(Context &refCtxt) const override
Get previous iteration item from the event loop context.
virtual unsigned long release()=0
release reference to object
Generic Transient Address.
StatusCode releaseContext(Context *&refCtxt) const override
Release existing event iteration context.
STL class.
NTuple interface class definition.
Definition: INTuple.h:79
StatusCode finalize() override
Service override: Finalize Service.
std::string m_tupleSvcName
Name of the event collection service name.
std::string m_cntName
Container name.
const std::string & name() const override
Retrieve name of the service.
Definition: Service.cpp:319
StatusCode last(Context &refCtxt) const override
Access last item in the iteration.
StatusCode next(Context &refCtxt) const override
Get next iteration item from the event loop context.
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
~EventCollectionSelector() override=default
Standard Destructor.
std::string m_itemName
Item name.
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...
void setAddress(IOpaqueAddress *pAddr)
std::string m_dbType
Database type identifier.
Abstract base class which allows the user to interact with the actual N tuple implementation.
Definition: NTuple.h:370
std::string m_dbSvc
Database service (exclusive property with db type)
std::string m_database
Datafile name.
virtual StatusCode getPreviousRecord(NTuple::Tuple *tuple) const
Read next record of the N-tuple.
Base class used to extend a class implementing other interfaces.
Definition: extends.h:10
Definition of class EventCollectionSelector.
Definition of class EventSelectorDataStream.
tuple item
print s1,s2
Definition: ana.py:146
NTuple::Item< IOpaqueAddress * > * item
StatusCode initialize() override
Service override: Initialize service.
virtual StatusCode connectTuple(const std::string &nam, const std::string &itName, NTuple::Tuple *&tup, NTuple::Item< IOpaqueAddress * > *&item) const
Connect to existing N-tuple.
StatusCode createAddress(const Context &refCtxt, IOpaqueAddress *&refpAddr) const override
Create new Opaque address corresponding to the current record.
std::string m_authentication
Authentication string (if needed)
EventCollectionSelector(const std::string &name, ISvcLocator *svcloc)
Standard Constructor.
Opaque address interface definition.
StatusCode rewind(Context &refCtxt) const override
Rewind the dataset.
SmartIF< IAddressCreator > m_pAddrCreator
virtual StatusCode connectCollection(MyContextType *ctxt) const
Connect collection to selector.
list i
Definition: ana.py:128
std::string m_statement
Selector name.
StatusCode createContext(Context *&refpCtxt) const override
Create a new event loop context.
virtual unsigned long addRef()=0
Add reference to object.
virtual StatusCode connectStatement(const std::string &typ, const std::string &crit, INTuple *tuple) const
Connect selection statement to refine data access.