Loading [MathJax]/extensions/tex2jax.js
The Gaudi Framework  v31r0 (aeb156f0)
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
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 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  }
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:
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,
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
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:352
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:81
StatusCode finalize() override
Service override: Finalize Service.
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:50
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:375
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.