| The Gaudi Framework v28r2-patches (bc4ad17a)

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

Classes | Public Member Functions | Protected Attributes | List of all members
EventCollectionSelector Class Reference

Definition of class EventCollectionSelector. More...

`#include <src/EventSelector/EventCollectionSelector.h>`

Inheritance diagram for EventCollectionSelector:
[legend]
Collaboration diagram for EventCollectionSelector:
[legend]

## Classes
class | MyContextType

## Public Member Functions
StatusCode | initialize () override
| Service override: Initialize service. More...
StatusCode | finalize () override
| Service override: Finalize Service. More...
StatusCode | createContext (Context *&refpCtxt) const override
| Create a new event loop context. More...
StatusCode | next (Context &refCtxt) const override
| Get next iteration item from the event loop context. More...
StatusCode | next (Context &refCtxt, int jump) const override
| Get next iteration item from the event loop context, but skip jump elements. More...
StatusCode | previous (Context &refCtxt) const override
| Get previous iteration item from the event loop context. More...
StatusCode | previous (Context &refCtxt, int jump) const override
| Get previous iteration item from the event loop context, but skip jump elements. More...
StatusCode | rewind (Context &refCtxt) const override
| Rewind the dataset. More...
StatusCode | createAddress (const Context &refCtxt, IOpaqueAddress *&refpAddr) const override
| Create new Opaque address corresponding to the current record. More...
StatusCode | releaseContext (Context *&refCtxt) const override
| Release existing event iteration context. More...
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 context in a way to point to the new list. More...
StatusCode | last (Context &refCtxt) const override
| Access last item in the iteration. More...
virtual StatusCode | connectCollection (MyContextType *ctxt) const
| Connect collection to selector. More...
virtual StatusCode | connectDataSource (const std::string &db, const std::string &typ) const
| Connect collection's data source to selector. More...
virtual StatusCode | connectTuple (const std::string &nam, const std::string &itName, NTuple::Tuple *&tup, NTuple::Item< IOpaqueAddress * > *&item) const
| Connect to existing N-tuple. More...
virtual StatusCode | connectStatement (const std::string &typ, const std::string &crit, INTuple *tuple) const
| Connect selection statement to refine data access. More...
virtual StatusCode | getNextRecord (NTuple::Tuple *tuple) const
| Read next record of the N-tuple. More...
virtual StatusCode | getPreviousRecord (NTuple::Tuple *tuple) const
| Read next record of the N-tuple. More...
| ~EventCollectionSelector () override=default
| Standard Destructor. More...
Public Member Functions inherited from extends< Service, IEvtSelector >
void * | i_cast (const InterfaceID &tid) const override
| Implementation of IInterface::i_cast. More...
StatusCode | queryInterface (const InterfaceID &ti, void **pp) override
| Implementation of IInterface::queryInterface. More...
std::vector< std::string > | getInterfaceNames () const override
| Implementation of IInterface::getInterfaceNames. More...
| ~extends () override=default
| Virtual destructor. More...
Public Member Functions inherited from Service
const std::string & | name () const override
| Retrieve name of the service. More...
StatusCode | configure () override
StatusCode | initialize () override
StatusCode | start () override
StatusCode | stop () override
StatusCode | finalize () override
StatusCode | terminate () override
Gaudi::StateMachine::State | FSMState () const override
Gaudi::StateMachine::State | targetFSMState () const override
StatusCode | reinitialize () override
StatusCode | restart () override
StatusCode | sysInitialize () override
| Initialize Service. More...
StatusCode | sysStart () override
| Initialize Service. More...
StatusCode | sysStop () override
| Initialize Service. More...
StatusCode | sysFinalize () override
| Finalize Service. More...
StatusCode | sysReinitialize () override
| Re-initialize the Service. More...
StatusCode | sysRestart () override
| Re-initialize the Service. More...
| Service (std::string name, ISvcLocator *svcloc)
| Standard Constructor. More...
SmartIF< ISvcLocator > & | serviceLocator () const override
| Retrieve pointer to service locator. More...
StatusCode | setProperties ()
| Method for setting declared properties to the values specified for the job. More...
template<class T >
StatusCode | service (const std::string &name, const T *&psvc, bool createIf=true) const
| Access a service by name, creating it if it doesn't already exist. More...
template<class T >
StatusCode | service (const std::string &name, T *&psvc, bool createIf=true) const
template<typename IFace = IService>
SmartIF< IFace > | service (const std::string &name, bool createIf=true) const
template<class T >
StatusCode | service (const std::string &svcType, const std::string &svcName, T *&psvc) const
| Access a service by name and type, creating it if it doesn't already exist. More...
template<class T >
StatusCode | declarePrivateTool (ToolHandle< T > &handle, std::string toolTypeAndName="", bool createIf=true)
| Declare used Private tool. More...
template<class T >
StatusCode | declarePublicTool (ToolHandle< T > &handle, std::string toolTypeAndName="", bool createIf=true)
| Declare used Public tool. More...
SmartIF< IAuditorSvc > & | auditorSvc () const
| The standard auditor service.May not be invoked before sysInitialize() has been invoked. More...
Public Member Functions inherited from PropertyHolder< CommonMessaging< implements< IService, IProperty, IStateful > > >
| PropertyHolder ()=default
| ~PropertyHolder () override=default
Gaudi::Details::PropertyBase & | declareProperty (Gaudi::Details::PropertyBase &prop)
| Declare a property. More...
Gaudi::Details::PropertyBase * | declareProperty (const std::string &name, TYPE &value, const std::string &doc="none")
| Helper to wrap a regular data member and use it as a regular property. More...
Gaudi::Details::PropertyBase * | declareProperty (const std::string &name, TYPE &value, const std::string &doc="none") const
Gaudi::Details::PropertyBase * | declareProperty (const std::string &name, Gaudi::Property< TYPE, VERIFIER, HANDLERS > &prop, const std::string &doc="none")
| Declare a PropertyBase instance setting name and documentation. More...
Gaudi::Details::PropertyBase * | declareRemoteProperty (const std::string &name, IProperty *rsvc, const std::string &rname="")
| Declare a remote property. More...
StatusCode | setProperty (const Gaudi::Details::PropertyBase &p) override
| set the property form another property More...
StatusCode | setProperty (const std::string &s) override
| set the property from the formatted string More...
StatusCode | setProperty (const std::string &n, const std::string &v) override
| set the property from name and the value More...
StatusCode | setProperty (const std::string &name, const TYPE &value)
| set the property form the value More...
StatusCode | getProperty (Gaudi::Details::PropertyBase *p) const override
| get the property More...
const Gaudi::Details::PropertyBase & | getProperty (const std::string &name) const override
| get the property by name More...
StatusCode | getProperty (const std::string &n, std::string &v) const override
| convert the property to the string More...
const std::vector< Gaudi::Details::PropertyBase * > & | getProperties () const override
| get all properties More...
bool | hasProperty (const std::string &name) const override
| Return true if we have a property with the given name. More...
| PropertyHolder (const PropertyHolder &)=delete
PropertyHolder & | operator= (const PropertyHolder &)=delete
Gaudi::Details::PropertyBase * | declareProperty (const std::string &name, GaudiHandleBase &ref, const std::string &doc="none")
| Specializations for various GaudiHandles. More...
Gaudi::Details::PropertyBase * | declareProperty (const std::string &name, GaudiHandleArrayBase &ref, const std::string &doc="none")
Gaudi::Details::PropertyBase * | declareProperty (const std::string &name, DataObjectHandleBase &ref, const std::string &doc="none")
Public Member Functions inherited from CommonMessagingBase
virtual | ~CommonMessagingBase ()=default
| Virtual destructor. More...
SmartIF< IMessageSvc > & | msgSvc () const
| The standard message service. More...
MsgStream & | msgStream () const
| Return an uninitialized MsgStream. More...
MsgStream & | msgStream (const MSG::Level level) const
| Predefined configurable message stream for the efficient printouts. More...
MsgStream & | always () const
| shortcut for the method msgStream(MSG::ALWAYS) More...
MsgStream & | fatal () const
| shortcut for the method msgStream(MSG::FATAL) More...
MsgStream & | err () const
| shortcut for the method msgStream(MSG::ERROR) More...
MsgStream & | error () const
| shortcut for the method msgStream(MSG::ERROR) More...
MsgStream & | warning () const
| shortcut for the method msgStream(MSG::WARNING) More...
MsgStream & | info () const
| shortcut for the method msgStream(MSG::INFO) More...
MsgStream & | debug () const
| shortcut for the method msgStream(MSG::DEBUG) More...
MsgStream & | verbose () const
| shortcut for the method msgStream(MSG::VERBOSE) More...
MsgStream & | msg () const
| shortcut for the method msgStream(MSG::INFO) More...
MSG::Level | msgLevel () const
| get the output level from the embedded MsgStream More...
MSG::Level | outputLevel () const __attribute__((deprecated))
| Backward compatibility function for getting the output level. More...
bool | msgLevel (MSG::Level lvl) const
| get the output level from the embedded MsgStream More...
Public Member Functions inherited from extend_interfaces< Interfaces... >
| ~extend_interfaces () override=default
| Virtual destructor. More...

## Protected Attributes
SmartIF< INTupleSvc > | m_tupleSvc
| Reference to Tuple service. More...
SmartIF< IAddressCreator > | m_pAddrCreator
Gaudi::Property< std::string > | m_tupleSvcName
Gaudi::Property< std::string > | m_authentication {this, "Authentication", "", "authentication string (if needed)"}
Gaudi::Property< std::string > | m_cntName {this, "Container", "B2PiPi", "container name"}
Gaudi::Property< std::string > | m_itemName {this, "Item", "Address", "item name"}
Gaudi::Property< std::string > | m_criteria {this, "Criteria", "", "criteria"}
Gaudi::Property< std::string > | m_database {this, "DB", "", "datafile name"}
Gaudi::Property< std::string > | m_dbType {this, "DbType", "", "database type identifier"}
Gaudi::Property< std::string > | m_dbSvc {this, "DbService", "", "database service (exclusive property with db type)"}
Gaudi::Property< std::string > | m_statement {this, "Function", "NTuple::Selector", "selector name"}
Protected Attributes inherited from Service
Gaudi::StateMachine::State | m_state = Gaudi::StateMachine::OFFLINE
| Service state. More...
Gaudi::StateMachine::State | m_targetState = Gaudi::StateMachine::OFFLINE
| Service state. More...
Gaudi::Property< int > | m_outputLevel {this, "OutputLevel", MSG::NIL, "output level"}
Gaudi::Property< bool > | m_auditInit {this, "AuditServices", false, "[[deprecated]] unused"}
Gaudi::Property< bool > | m_auditorInitialize {this, "AuditInitialize", false, "trigger auditor on initialize()"}
Gaudi::Property< bool > | m_auditorStart {this, "AuditStart", false, "trigger auditor on start()"}
Gaudi::Property< bool > | m_auditorStop {this, "AuditStop", false, "trigger auditor on stop()"}
Gaudi::Property< bool > | m_auditorFinalize {this, "AuditFinalize", false, "trigger auditor on finalize()"}
Gaudi::Property< bool > | m_auditorReinitialize {this, "AuditReinitialize", false, "trigger auditor on reinitialize()"}
Gaudi::Property< bool > | m_auditorRestart {this, "AuditRestart", false, "trigger auditor on restart()"}
SmartIF< IAuditorSvc > | m_pAuditorSvc
| Auditor Service. More...

## Additional Inherited Members
Public Types inherited from extends< Service, IEvtSelector >
using | base_class = extends
| Typedef to this class. More...
using | extend_interfaces_base = extend_interfaces< Interfaces... >
| Typedef to the base of this class. More...
Public Types inherited from Service
typedef Gaudi::PluginService::Factory< IService *, const std::string &, ISvcLocator * > | Factory
Public Types inherited from PropertyHolder< CommonMessaging< implements< IService, IProperty, IStateful > > >
using | PropertyHolderImpl = PropertyHolder< CommonMessaging< implements< IService, IProperty, IStateful > > >
| Typedef used to refer to this class from derived classes, as in. More...
Public Types inherited from CommonMessaging< implements< IService, IProperty, IStateful > >
using | base_class = CommonMessaging
Public Types inherited from extend_interfaces< Interfaces... >
using | ext_iids = typename Gaudi::interface_list_cat< typename Interfaces::ext_iids... >::type
| take union of the ext_iids of all Interfaces... More...
Protected Member Functions inherited from Service
| ~Service () override
| Standard Destructor. More...
int | outputLevel () const
| get the `Service's` output level More...
Protected Member Functions inherited from PropertyHolder< CommonMessaging< implements< IService, IProperty, IStateful > > >
Gaudi::Details::PropertyBase * | property (const std::string &name) const
Protected Member Functions inherited from CommonMessaging< implements< IService, IProperty, IStateful > >
void | updateMsgStreamOutputLevel (int level)
| Update the output level of the cached MsgStream. More...

## Detailed Description

Definition of class EventCollectionSelector.

Basic event selector service. The event selector service itself is able to connect other services to attached streams.

History: +------—+-------------------------------------------—+------—+ | Date | Comment | Who | +------—+-------------------------------------------—+------—+ | 3/10/00 | Initial version | M.Frank | +------—+-------------------------------------------—+------—+

Author
  Markus Frank

Version
  1.0

Definition at line 42 of file EventCollectionSelector.h.

## Constructor & Destructor Documentation

EventCollectionSelector::~EventCollectionSelector | ( |  | ) |
| override default

Standard Destructor.

## Member Function Documentation

StatusCode EventCollectionSelector::connectCollection | ( | MyContextType * | ctxt | ) | const
| virtual

Connect collection to selector.

Definition at line 203 of file EventCollectionSelector.cpp.

204 {
205 if ( ctxt ) {
206 StatusCode status = connectDataSource(m_database, m_dbType);
207 if ( status.isSuccess() ) {
208 status = connectTuple(m_cntName, m_itemName, ctxt->tuple, ctxt->item);
209 if ( status.isSuccess() ) {
210 status = connectStatement(m_statement, m_criteria, ctxt->tuple);
211 if ( status.isSuccess() ) {
212 *(ctxt->item) = 0;
213 return status;
214 }
215 }
216 }
217 return status;
218 }
219 return StatusCode::FAILURE;
220 }
StatusCode::FAILURE
Definition: StatusCode.h:29
StatusCode::isSuccess
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:74
EventCollectionSelector::connectDataSource
virtual StatusCode connectDataSource(const std::string &db, const std::string &typ) const
Connect collection&#39;s data source to selector.
Definition: EventCollectionSelector.cpp:97
EventCollectionSelector::m_cntName
Gaudi::Property< std::string > m_cntName
Definition: EventCollectionSelector.h:87
EventCollectionSelector::m_database
Gaudi::Property< std::string > m_database
Definition: EventCollectionSelector.h:90
StatusCode
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
EventCollectionSelector::m_statement
Gaudi::Property< std::string > m_statement
Definition: EventCollectionSelector.h:93
EventCollectionSelector::m_dbType
Gaudi::Property< std::string > m_dbType
Definition: EventCollectionSelector.h:91
EventCollectionSelector::m_criteria
Gaudi::Property< std::string > m_criteria
Definition: EventCollectionSelector.h:89
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:118
EventCollectionSelector::m_itemName
Gaudi::Property< std::string > m_itemName
Definition: EventCollectionSelector.h:88
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:138

StatusCode EventCollectionSelector::connectDataSource | ( | const std::string & | db,
|  | const std::string & | typ
| ) |  | const
| virtual

Connect collection's data source to selector.

Definition at line 97 of file EventCollectionSelector.cpp.

97 {
98 StatusCode status = StatusCode::FAILURE;
99 SmartIF<IDataSourceMgr> svc(m_tupleSvc);
100 if ( svc && !db.empty() ) {
101 std::string ident = name() + ' ';
102 ident += "DATAFILE='" + m_database.value().substr(5) + "' ";
103 if ( !m_dbSvc.empty() )
104 ident += "SVC='" + m_dbSvc + "' ";
105 else
106 ident += "TYP='" + m_dbType + "' ";
107 ident += "OPT='READ' ";
108 if ( m_authentication.length() > 0 ) {
109 ident += "AUTH='" + m_authentication + "' ";
110 }
111 status = svc->connect(ident);
112 }
113 return status;
114 }
EventCollectionSelector::m_tupleSvc
SmartIF< INTupleSvc > m_tupleSvc
Reference to Tuple service.
Definition: EventCollectionSelector.h:80
SmartIF
Small smart pointer class with automatic reference counting for IInterface.
Definition: IConverter.h:14
std::string::empty
T empty(T...args)
Service::name
const std::string & name() const override
Retrieve name of the service.
Definition: Service.cpp:289
StatusCode::FAILURE
Definition: StatusCode.h:29
EventCollectionSelector::m_authentication
Gaudi::Property< std::string > m_authentication
Definition: EventCollectionSelector.h:86
EventCollectionSelector::m_database
Gaudi::Property< std::string > m_database
Definition: EventCollectionSelector.h:90
std::string
STL class.
StatusCode
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
EventCollectionSelector::m_dbType
Gaudi::Property< std::string > m_dbType
Definition: EventCollectionSelector.h:91
EventCollectionSelector::m_dbSvc
Gaudi::Property< std::string > m_dbSvc
Definition: EventCollectionSelector.h:92

StatusCode EventCollectionSelector::connectStatement | ( | const std::string & | typ,
|  | const std::string & | crit,
|  | INTuple * | tuple
| ) |  | const
| virtual

Connect selection statement to refine data access.

Definition at line 138 of file EventCollectionSelector.cpp.

138 {
139 std::string seltyp = typ;
140 if ( !seltyp.empty() || !crit.empty() ) {
141 if ( !crit.empty() && seltyp.length() == 0 ) seltyp = "NTuple::Selector";
142 SmartIF<ISelectStatement> stmt(ObjFactory::create(seltyp, serviceLocator()));
143 if ( stmt ) {
144 if ( !crit.empty() ) stmt->setCriteria(crit);
145 tuple->attachSelector(stmt).ignore();
146 return StatusCode::SUCCESS;
147 }
148 return StatusCode::FAILURE;
149 }
150 return StatusCode::SUCCESS;
151 }
StatusCode::SUCCESS
Definition: StatusCode.h:30
SmartIF< ISelectStatement >
std::string::empty
T empty(T...args)
StatusCode::FAILURE
Definition: StatusCode.h:29
std::string
STL class.
std::string::length
T length(T...args)
StatusCode::ignore
void ignore() const
Definition: StatusCode.h:106
INTuple::attachSelector
virtual StatusCode attachSelector(ISelectStatement *sel)=0
Attach selector.
Service::serviceLocator
SmartIF< ISvcLocator > & serviceLocator() const override
Retrieve pointer to service locator.
Definition: Service.cpp:292

StatusCode EventCollectionSelector::connectTuple | ( | const std::string & | nam,
|  | const std::string & | itName,
|  | NTuple::Tuple *& | tup,
|  | NTuple::Item< IOpaqueAddress * > *& | item
| ) |  | const
| virtual

Connect to existing N-tuple.

Definition at line 118 of file EventCollectionSelector.cpp.

118 {
119 std::string top = "/NTUPLES/" + name() + '/' + nam;
120 StatusCode status = m_tupleSvc->retrieveObject(top, (DataObject*&)tup);
121 if ( status.isSuccess() ) {
122 item = new NTuple::Item<IOpaqueAddress*>();
123 status = tup->item(itName, *item);
124 if ( status.isSuccess() ) return status;
125 error() << "Item " << itName << " is not part of the collection:" << top << endmsg;
126 delete item;
127 item = nullptr;
128 }
129 else {
130 error() << "Cannot connect to collection:" << top << endmsg;
131 }
132 tup = nullptr;
133 return status;
134 }
EventCollectionSelector::m_tupleSvc
SmartIF< INTupleSvc > m_tupleSvc
Reference to Tuple service.
Definition: EventCollectionSelector.h:80
Service::name
const std::string & name() const override
Retrieve name of the service.
Definition: Service.cpp:289
StatusCode::isSuccess
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:74
std::string
STL class.
CommonMessagingBase::error
MsgStream & error() const
shortcut for the method msgStream(MSG::ERROR)
Definition: CommonMessaging.h:117
StatusCode
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
HiveAlgSequencer.top
top
Definition: HiveAlgSequencer.py:29
NTuple::Item< IOpaqueAddress * >
DataObject
A DataObject is the base class of any identifiable object on any data store.
Definition: DataObject.h:30
endmsg
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
IDataProviderSvc::retrieveObject
virtual StatusCode retrieveObject(IRegistry *pDirectory, const std::string &path, DataObject *&pObject)=0
Retrieve object identified by its directory entry.

StatusCode EventCollectionSelector::createAddress | ( | const Context & | refCtxt,
|  | IOpaqueAddress *& | refpAddr
| ) |  | const
| override

Create new Opaque address corresponding to the current record.

Parameters

  refCtxt | [IN/OUT] Reference to the context
  refpAddr | [OUT] Reference to address pointer

Returns
  StatusCode indicating success or failure

Definition at line 300 of file EventCollectionSelector.cpp.

301 {
302 const MyContextType* ctxt = dynamic_cast<const MyContextType*>(&refCtxt);
303 if ( ctxt ) {
304 IOpaqueAddress* pA = *(ctxt->item);
305 if ( pA ) {
306 IOpaqueAddress* pAddress = nullptr;
307 StatusCode status = m_pAddrCreator->createAddress(pA->svcType(),
308 pA->clID(),
309 pA->par(),
310 pA->ipar(),
311 pAddress);
312 if ( status.isSuccess() ) {
313 refpAddr = pAddress;
314 return StatusCode::SUCCESS;
315 }
316 else {
317 error() << "Failed to access " << pA->par()[0]
318 << ":" << pA->par()[1]
319 << " SvcTyp:" << long(pA->svcType())
320 << " CLID:" << pA->clID()
321 << endmsg;
322 }
323 }
324 }
325 return StatusCode::FAILURE;
326 }
StatusCode::SUCCESS
Definition: StatusCode.h:30
IOpaqueAddress::clID
virtual const CLID & clID() const =0
Retrieve class information from link.
StatusCode::FAILURE
Definition: StatusCode.h:29
IAddressCreator::createAddress
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.
StatusCode::isSuccess
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:74
IOpaqueAddress::par
virtual const std::string * par() const =0
Retrieve String parameters.
CommonMessagingBase::error
MsgStream & error() const
shortcut for the method msgStream(MSG::ERROR)
Definition: CommonMessaging.h:117
IOpaqueAddress::ipar
virtual const unsigned long * ipar() const =0
Access to generic link parameters.
StatusCode
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
IOpaqueAddress::svcType
virtual long svcType() const =0
Retrieve service type.
IOpaqueAddress
Opaque address interface definition.
Definition: IOpaqueAddress.h:23
EventCollectionSelector::m_pAddrCreator
SmartIF< IAddressCreator > m_pAddrCreator
Definition: EventCollectionSelector.h:81
endmsg
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244

StatusCode EventCollectionSelector::createContext | ( | Context *& | refpCtxt | ) | const
| override

Create a new event loop context.

Parameters

  refpCtxt | [IN/OUT] Reference to pointer to store the context

Returns
  StatusCode indicating success or failure

Definition at line 232 of file EventCollectionSelector.cpp.

233 {
234 refpCtxt = nullptr;
235 std::unique_ptr<MyContextType> ctxt(new MyContextType());
236 StatusCode status = connectCollection(ctxt.get());
237 if( !status.isSuccess() ) {
238 error() << "Unable to connect Collection file \"" << m_database << "\"" << endmsg;
239 return status;
240 }
241 refpCtxt = ctxt.release();
242 return StatusCode::SUCCESS;
243 }
StatusCode::SUCCESS
Definition: StatusCode.h:30
StatusCode::isSuccess
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:74
EventCollectionSelector::m_database
Gaudi::Property< std::string > m_database
Definition: EventCollectionSelector.h:90
CommonMessagingBase::error
MsgStream & error() const
shortcut for the method msgStream(MSG::ERROR)
Definition: CommonMessaging.h:117
StatusCode
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
std::unique_ptr
STL class.
EventCollectionSelector::connectCollection
virtual StatusCode connectCollection(MyContextType *ctxt) const
Connect collection to selector.
Definition: EventCollectionSelector.cpp:203
endmsg
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244

StatusCode EventCollectionSelector::finalize | ( |  | ) |
| override

Service override: Finalize Service.

Definition at line 223 of file EventCollectionSelector.cpp.

223 {
224 // release services
225 m_pAddrCreator = nullptr;
226 m_tupleSvc = nullptr;
227 return Service::finalize();
228 }
EventCollectionSelector::m_tupleSvc
SmartIF< INTupleSvc > m_tupleSvc
Reference to Tuple service.
Definition: EventCollectionSelector.h:80
Service::finalize
StatusCode finalize() override
Definition: Service.cpp:174
EventCollectionSelector::m_pAddrCreator
SmartIF< IAddressCreator > m_pAddrCreator
Definition: EventCollectionSelector.h:81

StatusCode EventCollectionSelector::getNextRecord | ( | NTuple::Tuple * | tuple | ) | const
| virtual

Read next record of the N-tuple.

Definition at line 154 of file EventCollectionSelector.cpp.

154 {
155 StatusCode status = StatusCode::FAILURE;
156 if ( tuple ) {
157 do {
158 status = m_tupleSvc->readRecord(tuple);
159 if ( status.isSuccess() ) {
160 ISelectStatement* statement = tuple->selector();
161 bool use_it = (statement) ? (*statement)(tuple) : true;
162 if ( use_it ) {
163 return status;
164 }
165 }
166 } while ( status.isSuccess() );
167 }
168 return status;
169 }
EventCollectionSelector::m_tupleSvc
SmartIF< INTupleSvc > m_tupleSvc
Reference to Tuple service.
Definition: EventCollectionSelector.h:80
StatusCode::FAILURE
Definition: StatusCode.h:29
ISelectStatement
A select statement can either contain.
Definition: ISelectStatement.h:32
StatusCode::isSuccess
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:74
INTuple::selector
virtual ISelectStatement * selector()=0
Access selector.
StatusCode
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
INTupleSvc::readRecord
virtual StatusCode readRecord(NTuple::Tuple *tuple)=0
Read single record from N tuple.

StatusCode EventCollectionSelector::getPreviousRecord | ( | NTuple::Tuple * | tuple | ) | const
| virtual

Read next record of the N-tuple.

Read previous record of the N-tuple.

Definition at line 172 of file EventCollectionSelector.cpp.

172 {
173 StatusCode status = StatusCode::FAILURE;
174 if ( tuple ) {
175 IRegistry* pReg = tuple->registry();
176 if ( pReg ) {
177 IOpaqueAddress* pAddr = pReg->address();
178 if ( pAddr ) {
179 long* ip = (long*)pAddr->ipar();
180 do {
181 if ( ip[1] > 1 ) {
182 ip[1] -= 2;
183 status = m_tupleSvc->readRecord(tuple);
184 if ( status.isSuccess() ) {
185 ISelectStatement* statement = tuple->selector();
186 bool use_it = (statement) ? (*statement)(tuple) : true;
187 if ( use_it ) {
188 return status;
189 }
190 }
191 }
192 else {
193 return StatusCode::FAILURE;
194 }
195 } while ( status.isSuccess() );
196 }
197 }
198 }
199 return StatusCode::FAILURE;
200 }
EventCollectionSelector::m_tupleSvc
SmartIF< INTupleSvc > m_tupleSvc
Reference to Tuple service.
Definition: EventCollectionSelector.h:80
StatusCode::FAILURE
Definition: StatusCode.h:29
ISelectStatement
A select statement can either contain.
Definition: ISelectStatement.h:32
StatusCode::isSuccess
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:74
INTuple::selector
virtual ISelectStatement * selector()=0
Access selector.
DataObject::registry
IRegistry * registry() const
Get pointer to Registry.
Definition: DataObject.h:74
IOpaqueAddress::ipar
virtual const unsigned long * ipar() const =0
Access to generic link parameters.
StatusCode
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
IRegistry
The IRegistry represents the entry door to the environment any data object residing in a transient da...
Definition: IRegistry.h:22
INTupleSvc::readRecord
virtual StatusCode readRecord(NTuple::Tuple *tuple)=0
Read single record from N tuple.
IOpaqueAddress
Opaque address interface definition.
Definition: IOpaqueAddress.h:23
IRegistry::address
virtual IOpaqueAddress * address() const =0
Retrieve opaque storage address.

StatusCode EventCollectionSelector::initialize | ( |  | ) |
| override

Service override: Initialize service.

Definition at line 75 of file EventCollectionSelector.cpp.

75 {
76 // Initialize base class
77 StatusCode status = Service::initialize();
78 if ( !status.isSuccess() ) {
79 error() << "Error initializing base class Service!" << endmsg;
80 return status;
81 }
82 m_pAddrCreator = serviceLocator()->service("EventPersistencySvc");
83 if(!m_pAddrCreator) {
84 error() << "Unable to locate IAddressCreator interface of " << "EventPersistencySvc" << endmsg;
85 return status;
86 }
87 m_tupleSvc = serviceLocator()->service(m_tupleSvcName);
88 if( !m_tupleSvc ) {
89 error() << "Unable to locate INTupleSvc interface of " << m_tupleSvcName << endmsg;
90 return status;
91 }
92 return status;
93 }
EventCollectionSelector::m_tupleSvc
SmartIF< INTupleSvc > m_tupleSvc
Reference to Tuple service.
Definition: EventCollectionSelector.h:80
Service::initialize
StatusCode initialize() override
Definition: Service.cpp:64
StatusCode::isSuccess
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:74
EventCollectionSelector::m_tupleSvcName
Gaudi::Property< std::string > m_tupleSvcName
Definition: EventCollectionSelector.h:84
ISvcLocator::service
StatusCode service(const Gaudi::Utils::TypeNameString &name, T *&svc, bool createIf=true)
Templated method to access a service by name.
Definition: ISvcLocator.h:78
CommonMessagingBase::error
MsgStream & error() const
shortcut for the method msgStream(MSG::ERROR)
Definition: CommonMessaging.h:117
StatusCode
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
EventCollectionSelector::m_pAddrCreator
SmartIF< IAddressCreator > m_pAddrCreator
Definition: EventCollectionSelector.h:81
Service::serviceLocator
SmartIF< ISvcLocator > & serviceLocator() const override
Retrieve pointer to service locator.
Definition: Service.cpp:292
endmsg
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244

StatusCode EventCollectionSelector::last | ( | Context & | refCtxt | ) | const
| override

Access last item in the iteration.

Parameters

  refCtxt | [IN/OUT] Reference to the Context object.

Returns
  StatusCode indicating success or failure

Definition at line 356 of file EventCollectionSelector.cpp.

357 {
358 return StatusCode::FAILURE;
359 }
StatusCode::FAILURE
Definition: StatusCode.h:29

StatusCode EventCollectionSelector::next | ( | Context & | refCtxt | ) | const
| override

Get next iteration item from the event loop context.

Parameters

  refCtxt | [IN/OUT] Reference to the context

Returns
  StatusCode indicating success or failure

Definition at line 247 of file EventCollectionSelector.cpp.

248 {
249 return next(refCtxt, 1);
250 }
EventCollectionSelector::next
StatusCode next(Context &refCtxt) const override
Get next iteration item from the event loop context.
Definition: EventCollectionSelector.cpp:247

StatusCode EventCollectionSelector::next | ( | Context & | refCtxt,
|  | int | jump
| ) |  | const
| override

Get next iteration item from the event loop context, but skip jump elements.

Parameters

  refCtxt | [IN/OUT] Reference to the context

Returns
  StatusCode indicating success or failure

Definition at line 254 of file EventCollectionSelector.cpp.

255 {
256 MyContextType *ctxt = dynamic_cast<MyContextType*>(&refCtxt);
257 if ( ctxt ) {
258 *(ctxt->item) = ctxt->addressBuffer;
259 StatusCode sc = StatusCode::SUCCESS;
260 for ( int i=0; i<jump && sc.isSuccess(); ++i ) {
261 sc = getNextRecord(ctxt->tuple);
262 }
263 return sc;
264 }
265 return StatusCode::FAILURE;
266 }
StatusCode::SUCCESS
Definition: StatusCode.h:30
EventCollectionSelector::getNextRecord
virtual StatusCode getNextRecord(NTuple::Tuple *tuple) const
Read next record of the N-tuple.
Definition: EventCollectionSelector.cpp:154
StatusCode::FAILURE
Definition: StatusCode.h:29
StatusCode
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26

StatusCode EventCollectionSelector::previous | ( | Context & | refCtxt | ) | const
| override

Get previous iteration item from the event loop context.

Parameters

  refCtxt | [IN/OUT] Reference to the context
  jump | [IN] Number of events to be skipped

Returns
  StatusCode indicating success or failure

Definition at line 270 of file EventCollectionSelector.cpp.

271 {
272 return previous(refCtxt, 1);
273 }
EventCollectionSelector::previous
StatusCode previous(Context &refCtxt) const override
Get previous iteration item from the event loop context.
Definition: EventCollectionSelector.cpp:270

StatusCode EventCollectionSelector::previous | ( | Context & | refCtxt,
|  | int | jump
| ) |  | const
| override

Get previous iteration item from the event loop context, but skip jump elements.

Parameters

  refCtxt | [IN/OUT] Reference to the context
  jump | [IN] Number of events to be skipped

Returns
  StatusCode indicating success or failure

Definition at line 277 of file EventCollectionSelector.cpp.

278 {
279 MyContextType *ctxt = dynamic_cast<MyContextType*>(&refCtxt);
280 if ( ctxt ) {
281 *(ctxt->item) = ctxt->addressBuffer;
282 StatusCode sc = StatusCode::SUCCESS;
283 for ( int i=0; i<jump && sc.isSuccess(); ++i ) {
284 sc = getPreviousRecord(ctxt->tuple);
285 }
286 return sc;
287 }
288 return StatusCode::FAILURE;
289 }
StatusCode::SUCCESS
Definition: StatusCode.h:30
StatusCode::FAILURE
Definition: StatusCode.h:29
StatusCode
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
EventCollectionSelector::getPreviousRecord
virtual StatusCode getPreviousRecord(NTuple::Tuple *tuple) const
Read next record of the N-tuple.
Definition: EventCollectionSelector.cpp:172

StatusCode EventCollectionSelector::releaseContext | ( | Context *& | refCtxt | ) | const
| override

Release existing event iteration context.

Parameters

  refCtxt | [IN/OUT] Reference to the context

Returns
  StatusCode indicating success or failure

Definition at line 330 of file EventCollectionSelector.cpp.

331 {
332 MyContextType *ctxt = dynamic_cast<MyContextType*>(refCtxt);
333 if ( ctxt ) {
334 delete ctxt;
335 ctxt = nullptr;
336 return StatusCode::SUCCESS;
337 }
338 return StatusCode::FAILURE;
339 }
StatusCode::SUCCESS
Definition: StatusCode.h:30
StatusCode::FAILURE
Definition: StatusCode.h:29

StatusCode EventCollectionSelector::resetCriteria | ( | const std::string & | cr,
|  | Context & | refCtxt
| ) |  | const
| override

Will set a new criteria for the selection of the next list of events and will change the state of the context in a way to point to the new list.

Parameters

  cr | The new criteria string.
  c | Reference pointer to the Context object.

Returns
  StatusCode indicating success or failure

Definition at line 344 of file EventCollectionSelector.cpp.

345 {
346 MyContextType *ctxt = dynamic_cast<MyContextType*>(&refCtxt);
347 if ( ctxt ) {
348 ctxt->criteria = cr;
349 return StatusCode::SUCCESS;
350 }
351 return StatusCode::FAILURE;
352 }
StatusCode::SUCCESS
Definition: StatusCode.h:30
StatusCode::FAILURE
Definition: StatusCode.h:29

StatusCode EventCollectionSelector::rewind | ( | Context & | refCtxt | ) | const
| override

Rewind the dataset.

Parameters

  refCtxt | [IN/OUT] Reference to the context

Returns
  StatusCode indicating success or failure

Definition at line 293 of file EventCollectionSelector.cpp.

294 {
295 return StatusCode::FAILURE;
296 }
StatusCode::FAILURE
Definition: StatusCode.h:29

## Member Data Documentation

Gaudi::Property<std::string> EventCollectionSelector::m_authentication {this, "Authentication", "", "authentication string (if needed)"}
| protected

Definition at line 86 of file EventCollectionSelector.h.

Gaudi::Property<std::string> EventCollectionSelector::m_cntName {this, "Container", "B2PiPi", "container name"}
| protected

Definition at line 87 of file EventCollectionSelector.h.

Gaudi::Property<std::string> EventCollectionSelector::m_criteria {this, "Criteria", "", "criteria"}
| protected

Definition at line 89 of file EventCollectionSelector.h.

Gaudi::Property<std::string> EventCollectionSelector::m_database {this, "DB", "", "datafile name"}
| protected

Definition at line 90 of file EventCollectionSelector.h.

Gaudi::Property<std::string> EventCollectionSelector::m_dbSvc {this, "DbService", "", "database service (exclusive property with db type)"}
| protected

Definition at line 92 of file EventCollectionSelector.h.

Gaudi::Property<std::string> EventCollectionSelector::m_dbType {this, "DbType", "", "database type identifier"}
| protected

Definition at line 91 of file EventCollectionSelector.h.

Gaudi::Property<std::string> EventCollectionSelector::m_itemName {this, "Item", "Address", "item name"}
| protected

Definition at line 88 of file EventCollectionSelector.h.

SmartIF<IAddressCreator> EventCollectionSelector::m_pAddrCreator
| mutable protected

Definition at line 81 of file EventCollectionSelector.h.

Gaudi::Property<std::string> EventCollectionSelector::m_statement {this, "Function", "NTuple::Selector", "selector name"}
| protected

Definition at line 93 of file EventCollectionSelector.h.

SmartIF<INTupleSvc> EventCollectionSelector::m_tupleSvc
| mutable protected

Reference to Tuple service.

Definition at line 80 of file EventCollectionSelector.h.

Gaudi::Property<std::string> EventCollectionSelector::m_tupleSvcName
| protected

Initial value:
{this, "CnvService", "EvtTupleSvc",
"name of the event collection service"}

Definition at line 84 of file EventCollectionSelector.h.

The documentation for this class was generated from the following files:

- GaudiCoreSvc/src/EventSelector/EventCollectionSelector.h
- GaudiCoreSvc/src/EventSelector/EventCollectionSelector.cpp