The Gaudi Framework  v29r0 (ff2e7097)
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
17 #include "GaudiKernel/NTuple.h"
18 #include "GaudiKernel/Service.h"
19 
20 // Forward declarations
21 class INTuple;
22 class INTupleSvc;
23 class IAddressCreator;
25 template <class TYPE>
27 
42 class EventCollectionSelector : public extends<Service, IEvtSelector>
43 {
44 public:
46  {
47  public:
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:
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,
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
SmartIF< INTupleSvc > m_tupleSvc
Reference to Tuple service.
StatusCode createContext(Context *&refpCtxt) const override
Create a new event loop context.
virtual StatusCode getNextRecord(NTuple::Tuple *tuple) const
Read next record of the N-tuple.
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...
Implementation of property with value of concrete type.
Definition: Property.h:319
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&#39;s data source to selector.
IAddressCreator interface definition.
Gaudi::Property< std::string > m_authentication
virtual unsigned long release()=0
release reference to object
Generic Transient Address.
Gaudi::Property< std::string > m_cntName
Gaudi::Property< std::string > m_database
StatusCode createAddress(const Context &refCtxt, IOpaqueAddress *&refpAddr) const override
Create new Opaque address corresponding to the current record.
Gaudi::Property< std::string > m_tupleSvcName
STL class.
NTuple interface class definition.
Definition: INTuple.h:82
StatusCode finalize() override
Service override: Finalize Service.
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:28
~EventCollectionSelector() override=default
Standard Destructor.
Gaudi::Property< std::string > m_statement
StatusCode last(Context &refCtxt) const override
Access last item in the iteration.
Gaudi::Property< std::string > m_dbType
void setAddress(IOpaqueAddress *pAddr)
Abstract base class which allows the user to interact with the actual N tuple implementation.
Definition: NTuple.h:412
Gaudi::Property< std::string > m_criteria
Gaudi::Property< std::string > m_dbSvc
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.
StatusCode previous(Context &refCtxt) const override
Get previous iteration item from the event loop context.
Definition of class EventSelectorDataStream.
StatusCode releaseContext(Context *&refCtxt) const override
Release existing event iteration context.
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.
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.
StatusCode next(Context &refCtxt) const override
Get next iteration item from the event loop context.
Gaudi::Property< std::string > m_itemName
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.