All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
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;
25 template <class TYPE> class EventIterator;
26 
41 class EventCollectionSelector : public extends1<Service, IEvtSelector> {
42 public:
44  public:
45  std::string criteria;
50  addressBuffer = new GenericAddress();
51  addressBuffer->addRef();
52  tuple = t;
53  item = i;
54  }
55  MyContextType(MyContextType* ctxt=nullptr) {
56  addressBuffer = new GenericAddress();
57  addressBuffer->addRef();
58  tuple = (ctxt) ? ctxt->tuple : nullptr;
59  item = (ctxt) ? ctxt->item : nullptr;
60  }
62  : IEvtSelector::Context(ctxt)
63  {
64  addressBuffer = new GenericAddress();
65  addressBuffer->addRef();
66  tuple = ctxt.tuple;
67  item = ctxt.item;
68  }
69  ~MyContextType() override {
70  addressBuffer->release();
71  }
72  void* identifier() const override {
73  return (void*)addressBuffer;
74  }
75  void setAddress(IOpaqueAddress* pAddr);
76  };
77 protected:
82  std::string m_tupleSvcName;
84  std::string m_authentication;
86  std::string m_cntName;
88  std::string m_itemName;
90  std::string m_criteria;
92  std::string m_database;
94  std::string m_dbType;
96  std::string m_dbSvc;
98  std::string m_statement;
99 public:
100 
102  StatusCode initialize() override;
104  StatusCode finalize() override;
105 
107 
111  StatusCode createContext(Context*& refpCtxt) const override;
112 
114 
118  StatusCode next(Context& refCtxt) const override;
119 
121 
125  StatusCode next(Context& refCtxt,int jump) const override;
126 
128 
133  StatusCode previous(Context& refCtxt) const override;
134 
136 
141  StatusCode previous(Context& refCtxt,int jump) const override;
142 
144 
148  StatusCode rewind(Context& refCtxt) const override;
149 
151 
156  StatusCode createAddress(const Context& refCtxt, IOpaqueAddress*& refpAddr) const override;
157 
159 
163  StatusCode releaseContext(Context*& refCtxt) const override;
164 
173  StatusCode resetCriteria(const std::string& cr,Context& c) const override;
174 
180  StatusCode last(Context& refCtxt) const override;
181 
183  virtual StatusCode connectCollection(MyContextType* ctxt) const;
184 
186  virtual StatusCode connectDataSource(const std::string& db, const std::string& typ) const;
188  virtual StatusCode connectTuple(const std::string& nam, const std::string& itName, NTuple::Tuple*& tup, NTuple::Item<IOpaqueAddress*>*& item) const;
190  virtual StatusCode connectStatement(const std::string& typ, const std::string& crit, INTuple* tuple) const;
192  virtual StatusCode getNextRecord(NTuple::Tuple* tuple) const;
194  virtual StatusCode getPreviousRecord(NTuple::Tuple* tuple) const;
195 
197  EventCollectionSelector( const std::string& name, ISvcLocator* svcloc );
199  ~EventCollectionSelector() override = default;
200 };
201 
202 #endif // GAUDISVC_EventCollectionSelector_EventCollectionSelector_H
SmartIF< INTupleSvc > m_tupleSvc
Reference to Tuple service.
tuple c
Definition: gaudirun.py:391
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)
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.
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.
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.