Loading [MathJax]/extensions/tex2jax.js
The Gaudi Framework  v38r0 (2143aa4c)
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 * (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
EventCollectionSelector::resetCriteria
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...
Definition: EventCollectionSelector.cpp:306
EventCollectionSelector::finalize
StatusCode finalize() override
Service override: Finalize Service.
Definition: EventCollectionSelector.cpp:208
EventCollectionSelector::m_dbType
Gaudi::Property< std::string > m_dbType
Definition: EventCollectionSelector.h:96
IAddressCreator
Definition: IAddressCreator.h:38
std::string
STL class.
EventCollectionSelector::connectDataSource
virtual StatusCode connectDataSource(const std::string &db, const std::string &typ) const
Connect collection's data source to selector.
Definition: EventCollectionSelector.cpp:91
EventCollectionSelector::MyContextType::criteria
std::string criteria
Definition: EventCollectionSelector.h:56
EventCollectionSelector::m_tupleSvc
SmartIF< INTupleSvc > m_tupleSvc
Reference to Tuple service.
Definition: EventCollectionSelector.h:85
IOpaqueAddress::addRef
virtual unsigned long addRef()=0
Add reference to object.
EventCollectionSelector::MyContextType::addressBuffer
IOpaqueAddress * addressBuffer
Definition: EventCollectionSelector.h:59
EventCollectionSelector::MyContextType
Definition: EventCollectionSelector.h:54
IOpaqueAddress
Definition: IOpaqueAddress.h:33
IEvtSelector
Definition: IEvtSelector.h:28
IOpaqueAddress::release
virtual unsigned long release()=0
release reference to object
EventCollectionSelector::m_database
Gaudi::Property< std::string > m_database
Definition: EventCollectionSelector.h:95
IEvtSelector.h
EventCollectionSelector::MyContextType::~MyContextType
~MyContextType() override
Definition: EventCollectionSelector.h:78
EventCollectionSelector::m_itemName
Gaudi::Property< std::string > m_itemName
Definition: EventCollectionSelector.h:93
gaudirun.c
c
Definition: gaudirun.py:525
IEvtSelector::Context
Definition: IEvtSelector.h:33
EventCollectionSelector::MyContextType::tuple
NTuple::Tuple * tuple
Definition: EventCollectionSelector.h:57
EventCollectionSelector::next
StatusCode next(Context &refCtxt) const override
Get next iteration item from the event loop context.
Definition: EventCollectionSelector.cpp:241
EventCollectionSelector::createAddress
StatusCode createAddress(const Context &refCtxt, IOpaqueAddress *&refpAddr) const override
Create new Opaque address corresponding to the current record.
Definition: EventCollectionSelector.cpp:274
EventCollectionSelector::initialize
StatusCode initialize() override
Service override: Initialize service.
Definition: EventCollectionSelector.cpp:69
GenericAddress.h
bug_34121.t
t
Definition: bug_34121.py:30
GenericAddress
Definition: GenericAddress.h:30
EventCollectionSelector::rewind
StatusCode rewind(Context &refCtxt) const override
Rewind the dataset.
Definition: EventCollectionSelector.cpp:271
EventCollectionSelector::m_pAddrCreator
SmartIF< IAddressCreator > m_pAddrCreator
Definition: EventCollectionSelector.h:86
StatusCode
Definition: StatusCode.h:65
NTuple.h
EventCollectionSelector::MyContextType::item
NTuple::Item< IOpaqueAddress * > * item
Definition: EventCollectionSelector.h:58
EventCollectionSelector::previous
StatusCode previous(Context &refCtxt) const override
Get previous iteration item from the event loop context.
Definition: EventCollectionSelector.cpp:256
EventCollectionSelector::MyContextType::MyContextType
MyContextType(NTuple::Tuple *t, NTuple::Item< IOpaqueAddress * > *i)
Definition: EventCollectionSelector.h:60
INTuple
Definition: INTuple.h:91
SmartIF< INTupleSvc >
EventCollectionSelector::getNextRecord
virtual StatusCode getNextRecord(NTuple::Tuple *tuple) const
Read next record of the N-tuple.
Definition: EventCollectionSelector.cpp:145
EventCollectionSelector::createContext
StatusCode createContext(Context *&refpCtxt) const override
Create a new event loop context.
Definition: EventCollectionSelector.cpp:228
EventCollectionSelector::MyContextType::setAddress
void setAddress(IOpaqueAddress *pAddr)
extends
Base class used to extend a class implementing other interfaces.
Definition: extends.h:20
EventCollectionSelector::connectStatement
virtual StatusCode connectStatement(const std::string &typ, const std::string &crit, INTuple *tuple) const
Connect selection statement to refine data access.
Definition: EventCollectionSelector.cpp:128
EventCollectionSelector::connectCollection
virtual StatusCode connectCollection(MyContextType *ctxt) const
Connect collection to selector.
Definition: EventCollectionSelector.cpp:189
EventCollectionSelector::MyContextType::MyContextType
MyContextType(const MyContextType &ctxt)
Definition: EventCollectionSelector.h:72
Service.h
EventIterator
Definition: EventCollectionSelector.h:36
EventCollectionSelector::getPreviousRecord
virtual StatusCode getPreviousRecord(NTuple::Tuple *tuple) const
Read next record of the N-tuple.
Definition: EventCollectionSelector.cpp:161
NTuple::Tuple
Abstract base class which allows the user to interact with the actual N tuple implementation.
Definition: NTuple.h:387
EventCollectionSelector::m_cntName
Gaudi::Property< std::string > m_cntName
Definition: EventCollectionSelector.h:92
EventCollectionSelector
Definition of class EventCollectionSelector.
Definition: EventCollectionSelector.h:52
EventCollectionSelector::m_dbSvc
Gaudi::Property< std::string > m_dbSvc
Definition: EventCollectionSelector.h:97
EventSelectorDataStream
Definition of class EventSelectorDataStream.
Definition: EventSelectorDataStream.h:55
EventCollectionSelector::MyContextType::MyContextType
MyContextType(MyContextType *ctxt=nullptr)
Definition: EventCollectionSelector.h:66
EventCollectionSelector::m_tupleSvcName
Gaudi::Property< std::string > m_tupleSvcName
Definition: EventCollectionSelector.h:89
INTupleSvc
Definition: INTupleSvc.h:46
EventCollectionSelector::connectTuple
virtual StatusCode connectTuple(const std::string &nam, const std::string &itName, NTuple::Tuple *&tup, NTuple::Item< IOpaqueAddress * > *&item) const
Connect to existing N-tuple.
Definition: EventCollectionSelector.cpp:109
EventCollectionSelector::m_criteria
Gaudi::Property< std::string > m_criteria
Definition: EventCollectionSelector.h:94
EventCollectionSelector::releaseContext
StatusCode releaseContext(Context *&refCtxt) const override
Release existing event iteration context.
Definition: EventCollectionSelector.cpp:294
EventCollectionSelector::last
StatusCode last(Context &refCtxt) const override
Access last item in the iteration.
Definition: EventCollectionSelector.cpp:316
EventCollectionSelector::MyContextType::identifier
void * identifier() const override
Definition: EventCollectionSelector.h:79
Gaudi::Property< std::string >
EventCollectionSelector::m_statement
Gaudi::Property< std::string > m_statement
Definition: EventCollectionSelector.h:98
EventCollectionSelector::m_authentication
Gaudi::Property< std::string > m_authentication
Definition: EventCollectionSelector.h:91
NTuple::Item< IOpaqueAddress * >