The Gaudi Framework  v33r1 (b1225454)
EventCollectionSelector.h
Go to the documentation of this file.
1 /***********************************************************************************\
2 * (c) Copyright 1998-2019 CERN for the benefit of the LHCb and ATLAS collaborations *
3 * *
4 * This software is distributed under the terms of the Apache version 2 licence, *
5 * copied verbatim in the file "LICENSE". *
6 * *
7 * In applying this licence, CERN does not waive the privileges and immunities *
8 * granted to it by virtue of its status as an Intergovernmental Organization *
9 * or submit itself to any jurisdiction. *
10 \***********************************************************************************/
11 //====================================================================
12 // EventCollectionSelector.h
13 //--------------------------------------------------------------------
14 //
15 // Package : EventCollectionSelector (LHCb Event Selector Package)
16 //
17 // Author : M.Frank
18 // Created : 4/10/00
19 //
20 //====================================================================
21 #ifndef GAUDISVC_EventCollectionSelector_EventCollectionSelector_H
22 #define GAUDISVC_EventCollectionSelector_EventCollectionSelector_H 1
23 
24 // Include files
27 #include "GaudiKernel/NTuple.h"
28 #include "GaudiKernel/Service.h"
29 
30 // Forward declarations
31 class INTuple;
32 class INTupleSvc;
33 class IAddressCreator;
35 template <class TYPE>
37 
52 class EventCollectionSelector : public extends<Service, IEvtSelector> {
53 public:
55  public:
63  tuple = t;
64  item = i;
65  }
66  MyContextType( MyContextType* ctxt = nullptr ) {
69  tuple = ( ctxt ) ? ctxt->tuple : nullptr;
70  item = ( ctxt ) ? ctxt->item : nullptr;
71  }
72  MyContextType( const MyContextType& ctxt ) : IEvtSelector::Context( ctxt ) {
75  tuple = ctxt.tuple;
76  item = ctxt.item;
77  }
79  void* identifier() const override { return (void*)addressBuffer; }
80  void setAddress( IOpaqueAddress* pAddr );
81  };
82 
83 protected:
87 
88  // Properties
89  Gaudi::Property<std::string> m_tupleSvcName{this, "CnvService", "EvtTupleSvc",
90  "name of the event collection service"};
91  Gaudi::Property<std::string> m_authentication{this, "Authentication", "", "authentication string (if needed)"};
92  Gaudi::Property<std::string> m_cntName{this, "Container", "B2PiPi", "container name"};
93  Gaudi::Property<std::string> m_itemName{this, "Item", "Address", "item name"};
94  Gaudi::Property<std::string> m_criteria{this, "Criteria", "", "criteria"};
95  Gaudi::Property<std::string> m_database{this, "DB", "", "datafile name"};
96  Gaudi::Property<std::string> m_dbType{this, "DbType", "", "database type identifier"};
97  Gaudi::Property<std::string> m_dbSvc{this, "DbService", "", "database service (exclusive property with db type)"};
98  Gaudi::Property<std::string> m_statement{this, "Function", "NTuple::Selector", "selector name"};
99 
100 public:
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,
189  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 
198  using extends::extends;
199 };
200 
201 #endif // GAUDISVC_EventCollectionSelector_EventCollectionSelector_H
SmartIF< INTupleSvc > m_tupleSvc
Reference to Tuple service.
virtual StatusCode connectStatement(const std::string &typ, const std::string &crit, INTuple *tuple) const
Connect selection statement to refine data access.
Implementation of property with value of concrete type.
Definition: Property.h:370
MyContextType(MyContextType *ctxt=nullptr)
The Event Selector Interface.
Definition: IEvtSelector.h:28
MyContextType(NTuple::Tuple *t, NTuple::Item< IOpaqueAddress * > *i)
IAddressCreator interface definition.
Gaudi::Property< std::string > m_authentication
StatusCode previous(Context &refCtxt) const override
Get previous iteration item from the event loop context.
virtual StatusCode getPreviousRecord(NTuple::Tuple *tuple) const
Read next record of the N-tuple.
virtual unsigned long release()=0
release reference to object
virtual StatusCode connectCollection(MyContextType *ctxt) const
Connect collection to selector.
virtual StatusCode getNextRecord(NTuple::Tuple *tuple) const
Read next record of the N-tuple.
Generic Transient Address.
Gaudi::Property< std::string > m_cntName
Gaudi::Property< std::string > m_database
StatusCode releaseContext(Context *&refCtxt) const override
Release existing event iteration context.
Gaudi::Property< std::string > m_tupleSvcName
STL class.
NTuple interface class definition.
Definition: INTuple.h:91
StatusCode finalize() override
Service override: Finalize Service.
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:61
virtual StatusCode connectDataSource(const std::string &db, const std::string &typ) const
Connect collection's data source to selector.
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...
Gaudi::Property< std::string > m_statement
Gaudi::Property< std::string > m_dbType
void setAddress(IOpaqueAddress *pAddr)
virtual StatusCode connectTuple(const std::string &nam, const std::string &itName, NTuple::Tuple *&tup, NTuple::Item< IOpaqueAddress * > *&item) const
Connect to existing N-tuple.
Abstract base class which allows the user to interact with the actual N tuple implementation.
Definition: NTuple.h:385
Gaudi::Property< std::string > m_criteria
Gaudi::Property< std::string > m_dbSvc
Base class used to extend a class implementing other interfaces.
Definition: extends.h:20
Definition of class EventCollectionSelector.
Definition of class EventSelectorDataStream.
NTuple::Item< IOpaqueAddress * > * item
StatusCode initialize() override
Service override: Initialize service.
StatusCode createAddress(const Context &refCtxt, IOpaqueAddress *&refpAddr) const override
Create new Opaque address corresponding to the current record.
Opaque address interface definition.
StatusCode rewind(Context &refCtxt) const override
Rewind the dataset.
SmartIF< IAddressCreator > m_pAddrCreator
Gaudi::Property< std::string > m_itemName
StatusCode createContext(Context *&refpCtxt) const override
Create a new event loop context.
virtual unsigned long addRef()=0
Add reference to object.