2 #include "GaudiKernel/SmartIF.h"
3 #include "GaudiKernel/ObjectFactory.h"
4 #include "GaudiKernel/GenericAddress.h"
5 #include "GaudiKernel/MsgStream.h"
6 #include "GaudiKernel/IRegistry.h"
7 #include "GaudiKernel/INTupleSvc.h"
8 #include "GaudiKernel/ISvcLocator.h"
9 #include "GaudiKernel/IDataSourceMgr.h"
10 #include "GaudiKernel/IAddressCreator.h"
11 #include "GaudiKernel/ISelectStatement.h"
12 #include "GaudiKernel/NTuple.h"
13 #include "GaudiKernel/EventSelectorDataStream.h"
43 return m_currentInput;
52 return (
void*)m_pSelector;
58 return m_fileIterator;
61 { m_fileIterator = new_iter; }
69 : m_pSelector(pSelector)
81 declareProperty(
"Container",
m_cntName =
"B2PiPi");
82 declareProperty(
"Item",
m_itemName =
"Address");
85 declareProperty(
"DbType",
m_dbType =
"");
86 declareProperty(
"DbService",
m_dbSvc =
"");
87 declareProperty(
"Function",
m_statement=
"NTuple::Selector");
101 log <<
MSG::ERROR <<
"Unable to locate IAddressCreator interface of " <<
"EventPersistencySvc" <<
endmsg;
117 if ( svc && !db.empty() ) {
118 std::string ident =
name() +
' ';
119 ident +=
"DATAFILE='" +
m_database.substr(5) +
"' ";
121 ident +=
"SVC='" +
m_dbSvc +
"' ";
124 ident +=
"OPT='READ' ";
136 std::string
top =
"/NTUPLES/" +
name() +
'/' + nam;
140 status = tup->item(itName, *item);
141 if ( status.isSuccess() )
return status;
143 log <<
MSG::ERROR <<
"Item " << itName <<
" is not part of the collection:" << top <<
endmsg;
158 std::string seltyp = typ;
159 if ( !seltyp.empty() || !crit.empty() ) {
160 if ( !crit.empty() && seltyp.length() == 0 ) seltyp =
"NTuple::Selector";
180 bool use_it = (statement) ? (*statement)(tuple) :
true;
198 long* ip = (
long*)pAddr->
ipar();
205 bool use_it = (statement) ? (*statement)(tuple) :
true;
261 refpCtxt = ctxt.release();
269 return next(refCtxt, 1);
280 for (
int i=0;
i<jump &&
sc.isSuccess(); ++
i ) {
303 for (
int i=0;
i<jump &&
sc.isSuccess(); ++
i ) {
339 <<
":" << pA->
par()[1]
340 <<
" SvcTyp:" << long(pA->
svcType())
341 <<
" CLID:" << pA->
clID()
SmartIF< INTupleSvc > m_tupleSvc
Reference to Tuple service.
virtual const std::string * par() const =0
Retrieve String parameters.
Definition of the MsgStream class used to transmit messages.
StatusCode initialize() override
Small smart pointer class with automatic reference counting for IInterface.
The ISvcLocator is the interface implemented by the Service Factory in the Application Manager to loc...
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
virtual StatusCode getNextRecord(NTuple::Tuple *tuple) const
Read next record of the N-tuple.
StatusCode finalize() override
A select statement can either contain.
virtual StatusCode createAddress(long svc_type, const CLID &clid, const std::string *par, const unsigned long *ipar, IOpaqueAddress *&refpAddress)=0
Create a Generic address using explicit arguments to identify a single object.
EventCollectionContext(const EventCollectionSelector *pSelector)
Standard constructor.
The Event Selector Interface.
unsigned long addRef() override
Add reference to object.
bool isSuccess() const
Test for a status code of SUCCESS.
unsigned long release() override
release reference to object
virtual StatusCode connectDataSource(const std::string &db, const std::string &typ) const
Connect collection's data source to selector.
~EventCollectionContext() override
Standard destructor.
std::string m_criteria
Criteria.
StatusCode previous(Context &refCtxt) const override
Get previous iteration item from the event loop context.
Generic Transient Address.
virtual ISelectStatement * selector()=0
Access selector.
virtual long svcType() const =0
Retrieve service type.
GenericAddress * m_pAddressBuffer
IRegistry * registry() const
Get pointer to Registry.
StatusCode releaseContext(Context *&refCtxt) const override
Release existing event iteration context.
NTuple interface class definition.
StatusCode finalize() override
Service override: Finalize Service.
virtual StatusCode connect(const std::string &logon, std::string &identifier)=0
Connect data source.
std::string m_tupleSvcName
Name of the event collection service name.
std::string m_cntName
Container name.
ListName::const_iterator fileIterator()
const std::string & currentInput() const
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.
virtual const CLID & clID() const =0
Retrieve class information from link.
This class is used for returning status codes from appropriate routines.
std::string m_itemName
Item name.
#define DECLARE_COMPONENT(type)
void setFileIterator(ListName::const_iterator new_iter)
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...
The IRegistry represents the entry door to the environment any data object residing in a transient da...
virtual IOpaqueAddress * address() const =0
Retrieve opaque storage address.
std::string m_dbType
Database type identifier.
Abstract base class which allows the user to interact with the actual N tuple implementation.
void setCurrentInput(const std::string &v)
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 of class EventCollectionSelector.
virtual StatusCode readRecord(NTuple::Tuple *tuple)=0
Read single record from N tuple.
NTuple::Item< IOpaqueAddress * > * item
StatusCode initialize() override
Service override: Initialize service.
IOpaqueAddress * addressBuffer
virtual StatusCode connectTuple(const std::string &nam, const std::string &itName, NTuple::Tuple *&tup, NTuple::Item< IOpaqueAddress * > *&item) const
Connect to existing N-tuple.
std::list< std::string > ListName
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 attachSelector(ISelectStatement *sel)=0
Attach selector.
std::string m_currentInput
virtual StatusCode connectCollection(MyContextType *ctxt) const
Connect collection to selector.
ListName::const_iterator m_fileIterator
virtual void setCriteria(const std::string &crit)=0
Set the type.
A DataObject is the base class of any identifiable object on any data store.
virtual const unsigned long * ipar() const =0
Access to generic link parameters.
void setCriteria(const std::string &crit)
std::string m_statement
Selector name.
StatusCode createContext(Context *&refpCtxt) const override
Create a new event loop context.
void * identifier() const override
virtual StatusCode connectStatement(const std::string &typ, const std::string &crit, INTuple *tuple) const
Connect selection statement to refine data access.
virtual StatusCode retrieveObject(IRegistry *pDirectory, const std::string &path, DataObject *&pObject)=0
Retrieve object identified by its directory entry.