| The Gaudi Framework v27r1

- 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 (const std::string &name, ISvcLocator *svcloc)
| Standard Constructor. 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...
StatusCode | setProperty (const Property &p) override
StatusCode | setProperty (const std::string &s) override
StatusCode | setProperty (const std::string &n, const std::string &v) override
StatusCode | getProperty (Property *p) const override
const Property & | getProperty (const std::string &name) const override
StatusCode | getProperty (const std::string &n, std::string &v) const override
const std::vector< Property * > & | getProperties () const override
bool | hasProperty (const std::string &name) const override
template<class TYPE >
StatusCode | setProperty (const std::string &name, const TYPE &value)
| set the property form the value 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 >
Property * | declareProperty (const std::string &name, T &property, const std::string &doc="none") const
| Declare the named property. More...
Property * | declareRemoteProperty (const std::string &name, IProperty *rsvc, const std::string &rname="") const
| Declare remote named properties. 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 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
std::string | m_tupleSvcName
| Name of the event collection service name. More...
std::string | m_authentication
| Authentication string (if needed) More...
std::string | m_cntName
| Container name. More...
std::string | m_itemName
| Item name. More...
std::string | m_criteria
| Criteria. More...
std::string | m_database
| Datafile name. More...
std::string | m_dbType
| Database type identifier. More...
std::string | m_dbSvc
| Database service (exclusive property with db type) More...
std::string | m_statement
| Selector name. More...
Protected Attributes inherited from Service
IntegerProperty | m_outputLevel = MSG::NIL
| Service output level. More...
Gaudi::StateMachine::State | m_state = Gaudi::StateMachine::OFFLINE
| Service state. More...
Gaudi::StateMachine::State | m_targetState = Gaudi::StateMachine::OFFLINE
| Service state. 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 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 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 41 of file EventCollectionSelector.h.

## Constructor & Destructor Documentation

EventCollectionSelector::EventCollectionSelector | ( | const std::string & | name,
|  | ISvcLocator * | svcloc
| ) |  |

Standard Constructor.

Definition at line 75 of file EventCollectionSelector.cpp.

76 : base_class(name, svcloc)
77 {
78 declareProperty("CnvService", m_tupleSvcName = "EvtTupleSvc");
79 declareProperty("Authentication",m_authentication= "");
80 declareProperty("Container", m_cntName = "B2PiPi");
81 declareProperty("Item", m_itemName = "Address");
82 declareProperty("Criteria", m_criteria = "");
83 declareProperty("DB", m_database = "");
84 declareProperty("DbType", m_dbType = "");
85 declareProperty("DbService", m_dbSvc = "");
86 declareProperty("Function", m_statement= "NTuple::Selector");
87 }
EventCollectionSelector::m_criteria
std::string m_criteria
Criteria.
Definition: EventCollectionSelector.h:91
extends< Service, IEvtSelector >::base_class
extends base_class
Typedef to this class.
Definition: extends.h:14
EventCollectionSelector::m_tupleSvcName
std::string m_tupleSvcName
Name of the event collection service name.
Definition: EventCollectionSelector.h:83
EventCollectionSelector::m_cntName
std::string m_cntName
Container name.
Definition: EventCollectionSelector.h:87
EventCollectionSelector::m_itemName
std::string m_itemName
Item name.
Definition: EventCollectionSelector.h:89
EventCollectionSelector::m_dbType
std::string m_dbType
Database type identifier.
Definition: EventCollectionSelector.h:95
EventCollectionSelector::m_dbSvc
std::string m_dbSvc
Database service (exclusive property with db type)
Definition: EventCollectionSelector.h:97
EventCollectionSelector::m_database
std::string m_database
Datafile name.
Definition: EventCollectionSelector.h:93
EventCollectionSelector::m_authentication
std::string m_authentication
Authentication string (if needed)
Definition: EventCollectionSelector.h:85
Service::declareProperty
Property * declareProperty(const std::string &name, T &property, const std::string &doc="none") const
Declare the named property.
Definition: Service.h:215
EventCollectionSelector::m_statement
std::string m_statement
Selector name.
Definition: EventCollectionSelector.h:99

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

Standard Destructor.

## Member Function Documentation

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

Connect collection to selector.

Definition at line 218 of file EventCollectionSelector.cpp.

219 {
220 if ( ctxt ) {
221 StatusCode status = connectDataSource(m_database, m_dbType);
222 if ( status.isSuccess() ) {
223 status = connectTuple(m_cntName, m_itemName, ctxt->tuple, ctxt->item);
224 if ( status.isSuccess() ) {
225 status = connectStatement(m_statement, m_criteria, ctxt->tuple);
226 if ( status.isSuccess() ) {
227 *(ctxt->item) = 0;
228 return status;
229 }
230 }
231 }
232 return status;
233 }
234 return StatusCode::FAILURE;
235 }
StatusCode::isSuccess
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:76
EventCollectionSelector::connectDataSource
virtual StatusCode connectDataSource(const std::string &db, const std::string &typ) const
Connect collection's data source to selector.
Definition: EventCollectionSelector.cpp:112
EventCollectionSelector::m_criteria
std::string m_criteria
Criteria.
Definition: EventCollectionSelector.h:91
EventCollectionSelector::m_cntName
std::string m_cntName
Container name.
Definition: EventCollectionSelector.h:87
StatusCode::FAILURE
Definition: StatusCode.h:29
StatusCode
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
EventCollectionSelector::m_itemName
std::string m_itemName
Item name.
Definition: EventCollectionSelector.h:89
EventCollectionSelector::m_dbType
std::string m_dbType
Database type identifier.
Definition: EventCollectionSelector.h:95
EventCollectionSelector::m_database
std::string m_database
Datafile name.
Definition: EventCollectionSelector.h:93
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:133
EventCollectionSelector::m_statement
std::string m_statement
Selector name.
Definition: EventCollectionSelector.h:99
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:153

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

Connect collection's data source to selector.

Definition at line 112 of file EventCollectionSelector.cpp.

112 {
113 StatusCode status = StatusCode::FAILURE;
114 SmartIF<IDataSourceMgr> svc(m_tupleSvc);
115 if ( svc && !db.empty() ) {
116 std::string ident = name() + ' ';
117 ident += "DATAFILE='" + m_database.substr(5) + "' ";
118 if ( !m_dbSvc.empty() )
119 ident += "SVC='" + m_dbSvc + "' ";
120 else
121 ident += "TYP='" + m_dbType + "' ";
122 ident += "OPT='READ' ";
123 if ( m_authentication.length() > 0 ) {
124 ident += "AUTH='" + m_authentication + "' ";
125 }
126 status = svc->connect(ident);
127 }
128 return status;
129 }
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)
std::string
STL class.
Service::name
const std::string & name() const override
Retrieve name of the service.
Definition: Service.cpp:319
StatusCode::FAILURE
Definition: StatusCode.h:29
StatusCode
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
EventCollectionSelector::m_dbType
std::string m_dbType
Database type identifier.
Definition: EventCollectionSelector.h:95
EventCollectionSelector::m_dbSvc
std::string m_dbSvc
Database service (exclusive property with db type)
Definition: EventCollectionSelector.h:97
std::string::length
T length(T...args)
EventCollectionSelector::m_database
std::string m_database
Datafile name.
Definition: EventCollectionSelector.h:93
std::string::substr
T substr(T...args)
EventCollectionSelector::m_authentication
std::string m_authentication
Authentication string (if needed)
Definition: EventCollectionSelector.h:85

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 153 of file EventCollectionSelector.cpp.

153 {
154 std::string seltyp = typ;
155 if ( !seltyp.empty() || !crit.empty() ) {
156 if ( !crit.empty() && seltyp.length() == 0 ) seltyp = "NTuple::Selector";
157 SmartIF<ISelectStatement> stmt(ObjFactory::create(seltyp, serviceLocator()));
158 if ( stmt ) {
159 if ( !crit.empty() ) stmt->setCriteria(crit);
160 tuple->attachSelector(stmt).ignore();
161 return StatusCode::SUCCESS;
162 }
163 return StatusCode::FAILURE;
164 }
165 return StatusCode::SUCCESS;
166 }
SmartIF< ISelectStatement >
Service::serviceLocator
SmartIF< ISvcLocator > & serviceLocator() const override
Retrieve pointer to service locator.
Definition: Service.cpp:324
std::string::empty
T empty(T...args)
std::string
STL class.
StatusCode::FAILURE
Definition: StatusCode.h:29
StatusCode::SUCCESS
Definition: StatusCode.h:30
std::string::length
T length(T...args)
StatusCode::ignore
void ignore() const
Definition: StatusCode.h:108
INTuple::attachSelector
virtual StatusCode attachSelector(ISelectStatement *sel)=0
Attach selector.

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 133 of file EventCollectionSelector.cpp.

133 {
134 std::string top = "/NTUPLES/" + name() + '/' + nam;
135 StatusCode status = m_tupleSvc->retrieveObject(top, (DataObject*&)tup);
136 if ( status.isSuccess() ) {
137 item = new NTuple::Item<IOpaqueAddress*>();
138 status = tup->item(itName, *item);
139 if ( status.isSuccess() ) return status;
140 error() << "Item " << itName << " is not part of the collection:" << top << endmsg;
141 delete item;
142 item = nullptr;
143 }
144 else {
145 error() << "Cannot connect to collection:" << top << endmsg;
146 }
147 tup = nullptr;
148 return status;
149 }
EventCollectionSelector::m_tupleSvc
SmartIF< INTupleSvc > m_tupleSvc
Reference to Tuple service.
Definition: EventCollectionSelector.h:80
StatusCode::isSuccess
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:76
std::string
STL class.
Service::name
const std::string & name() const override
Retrieve name of the service.
Definition: Service.cpp:319
CommonMessagingBase::error
MsgStream & error() const
shortcut for the method msgStream(MSG::ERROR)
Definition: CommonMessaging.h:118
StatusCode
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
HiveAlgSequencer.top
tuple top
Definition: HiveAlgSequencer.py:29
ana.item
tuple item
print s1,s2
Definition: ana.py:146
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 315 of file EventCollectionSelector.cpp.

316 {
317 const MyContextType* ctxt = dynamic_cast<const MyContextType*>(&refCtxt);
318 if ( ctxt ) {
319 IOpaqueAddress* pA = *(ctxt->item);
320 if ( pA ) {
321 IOpaqueAddress* pAddress = nullptr;
322 StatusCode status = m_pAddrCreator->createAddress(pA->svcType(),
323 pA->clID(),
324 pA->par(),
325 pA->ipar(),
326 pAddress);
327 if ( status.isSuccess() ) {
328 refpAddr = pAddress;
329 return StatusCode::SUCCESS;
330 }
331 else {
332 error() << "Failed to access " << pA->par()[0]
333 << ":" << pA->par()[1]
334 << " SvcTyp:" << long(pA->svcType())
335 << " CLID:" << pA->clID()
336 << endmsg;
337 }
338 }
339 }
340 return StatusCode::FAILURE;
341 }
IOpaqueAddress::par
virtual const std::string * par() const =0
Retrieve String parameters.
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:76
IOpaqueAddress::svcType
virtual long svcType() const =0
Retrieve service type.
CommonMessagingBase::error
MsgStream & error() const
shortcut for the method msgStream(MSG::ERROR)
Definition: CommonMessaging.h:118
IOpaqueAddress::clID
virtual const CLID & clID() const =0
Retrieve class information from link.
StatusCode::FAILURE
Definition: StatusCode.h:29
StatusCode::SUCCESS
Definition: StatusCode.h:30
StatusCode
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
IOpaqueAddress
Opaque address interface definition.
Definition: IOpaqueAddress.h:23
EventCollectionSelector::m_pAddrCreator
SmartIF< IAddressCreator > m_pAddrCreator
Definition: EventCollectionSelector.h:81
IOpaqueAddress::ipar
virtual const unsigned long * ipar() const =0
Access to generic link parameters.
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 247 of file EventCollectionSelector.cpp.

248 {
249 refpCtxt = nullptr;
250 std::unique_ptr<MyContextType> ctxt(new MyContextType());
251 StatusCode status = connectCollection(ctxt.get());
252 if( !status.isSuccess() ) {
253 error() << "Unable to connect Collection file \"" << m_database << "\"" << endmsg;
254 return status;
255 }
256 refpCtxt = ctxt.release();
257 return StatusCode::SUCCESS;
258 }
StatusCode::isSuccess
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:76
CommonMessagingBase::error
MsgStream & error() const
shortcut for the method msgStream(MSG::ERROR)
Definition: CommonMessaging.h:118
StatusCode::SUCCESS
Definition: StatusCode.h:30
StatusCode
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
std::unique_ptr
STL class.
EventCollectionSelector::m_database
std::string m_database
Datafile name.
Definition: EventCollectionSelector.h:93
EventCollectionSelector::connectCollection
virtual StatusCode connectCollection(MyContextType *ctxt) const
Connect collection to selector.
Definition: EventCollectionSelector.cpp:218
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 238 of file EventCollectionSelector.cpp.

238 {
239 // release services
240 m_pAddrCreator = nullptr;
241 m_tupleSvc = nullptr;
242 return Service::finalize();
243 }
EventCollectionSelector::m_tupleSvc
SmartIF< INTupleSvc > m_tupleSvc
Reference to Tuple service.
Definition: EventCollectionSelector.h:80
Service::finalize
StatusCode finalize() override
Definition: Service.cpp:193
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 169 of file EventCollectionSelector.cpp.

169 {
170 StatusCode status = StatusCode::FAILURE;
171 if ( tuple ) {
172 do {
173 status = m_tupleSvc->readRecord(tuple);
174 if ( status.isSuccess() ) {
175 ISelectStatement* statement = tuple->selector();
176 bool use_it = (statement) ? (*statement)(tuple) : true;
177 if ( use_it ) {
178 return status;
179 }
180 }
181 } while ( status.isSuccess() );
182 }
183 return status;
184 }
EventCollectionSelector::m_tupleSvc
SmartIF< INTupleSvc > m_tupleSvc
Reference to Tuple service.
Definition: EventCollectionSelector.h:80
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:76
INTuple::selector
virtual ISelectStatement * selector()=0
Access selector.
StatusCode::FAILURE
Definition: StatusCode.h:29
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 187 of file EventCollectionSelector.cpp.

187 {
188 StatusCode status = StatusCode::FAILURE;
189 if ( tuple ) {
190 IRegistry* pReg = tuple->registry();
191 if ( pReg ) {
192 IOpaqueAddress* pAddr = pReg->address();
193 if ( pAddr ) {
194 long* ip = (long*)pAddr->ipar();
195 do {
196 if ( ip[1] > 1 ) {
197 ip[1] -= 2;
198 status = m_tupleSvc->readRecord(tuple);
199 if ( status.isSuccess() ) {
200 ISelectStatement* statement = tuple->selector();
201 bool use_it = (statement) ? (*statement)(tuple) : true;
202 if ( use_it ) {
203 return status;
204 }
205 }
206 }
207 else {
208 return StatusCode::FAILURE;
209 }
210 } while ( status.isSuccess() );
211 }
212 }
213 }
214 return StatusCode::FAILURE;
215 }
EventCollectionSelector::m_tupleSvc
SmartIF< INTupleSvc > m_tupleSvc
Reference to Tuple service.
Definition: EventCollectionSelector.h:80
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:76
INTuple::selector
virtual ISelectStatement * selector()=0
Access selector.
DataObject::registry
IRegistry * registry() const
Get pointer to Registry.
Definition: DataObject.h:74
StatusCode::FAILURE
Definition: StatusCode.h:29
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
IRegistry::address
virtual IOpaqueAddress * address() const =0
Retrieve opaque storage address.
INTupleSvc::readRecord
virtual StatusCode readRecord(NTuple::Tuple *tuple)=0
Read single record from N tuple.
IOpaqueAddress
Opaque address interface definition.
Definition: IOpaqueAddress.h:23
IOpaqueAddress::ipar
virtual const unsigned long * ipar() const =0
Access to generic link parameters.

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

Service override: Initialize service.

Definition at line 90 of file EventCollectionSelector.cpp.

90 {
91 // Initialize base class
92 StatusCode status = Service::initialize();
93 if ( !status.isSuccess() ) {
94 error() << "Error initializing base class Service!" << endmsg;
95 return status;
96 }
97 m_pAddrCreator = serviceLocator()->service("EventPersistencySvc");
98 if(!m_pAddrCreator) {
99 error() << "Unable to locate IAddressCreator interface of " << "EventPersistencySvc" << endmsg;
100 return status;
101 }
102 m_tupleSvc = serviceLocator()->service(m_tupleSvcName);
103 if( !m_tupleSvc ) {
104 error() << "Unable to locate INTupleSvc interface of " << m_tupleSvcName << endmsg;
105 return status;
106 }
107 return status;
108 }
EventCollectionSelector::m_tupleSvc
SmartIF< INTupleSvc > m_tupleSvc
Reference to Tuple service.
Definition: EventCollectionSelector.h:80
Service::initialize
StatusCode initialize() override
Definition: Service.cpp:68
Service::serviceLocator
SmartIF< ISvcLocator > & serviceLocator() const override
Retrieve pointer to service locator.
Definition: Service.cpp:324
StatusCode::isSuccess
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:76
EventCollectionSelector::m_tupleSvcName
std::string m_tupleSvcName
Name of the event collection service name.
Definition: EventCollectionSelector.h:83
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:118
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
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 371 of file EventCollectionSelector.cpp.

372 {
373 return StatusCode::FAILURE;
374 }
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 262 of file EventCollectionSelector.cpp.

263 {
264 return next(refCtxt, 1);
265 }
EventCollectionSelector::next
StatusCode next(Context &refCtxt) const override
Get next iteration item from the event loop context.
Definition: EventCollectionSelector.cpp:262

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 269 of file EventCollectionSelector.cpp.

270 {
271 MyContextType *ctxt = dynamic_cast<MyContextType*>(&refCtxt);
272 if ( ctxt ) {
273 *(ctxt->item) = ctxt->addressBuffer;
274 StatusCode sc = StatusCode::SUCCESS;
275 for ( int i=0; i<jump && sc.isSuccess(); ++i ) {
276 sc = getNextRecord(ctxt->tuple);
277 }
278 return sc;
279 }
280 return StatusCode::FAILURE;
281 }
EventCollectionSelector::getNextRecord
virtual StatusCode getNextRecord(NTuple::Tuple *tuple) const
Read next record of the N-tuple.
Definition: EventCollectionSelector.cpp:169
merge_files.sc
int sc
Definition: merge_files.py:167
StatusCode::FAILURE
Definition: StatusCode.h:29
StatusCode::SUCCESS
Definition: StatusCode.h:30
StatusCode
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
ana.i
list i
Definition: ana.py:128

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 285 of file EventCollectionSelector.cpp.

286 {
287 return previous(refCtxt, 1);
288 }
EventCollectionSelector::previous
StatusCode previous(Context &refCtxt) const override
Get previous iteration item from the event loop context.
Definition: EventCollectionSelector.cpp:285

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 292 of file EventCollectionSelector.cpp.

293 {
294 MyContextType *ctxt = dynamic_cast<MyContextType*>(&refCtxt);
295 if ( ctxt ) {
296 *(ctxt->item) = ctxt->addressBuffer;
297 StatusCode sc = StatusCode::SUCCESS;
298 for ( int i=0; i<jump && sc.isSuccess(); ++i ) {
299 sc = getPreviousRecord(ctxt->tuple);
300 }
301 return sc;
302 }
303 return StatusCode::FAILURE;
304 }
merge_files.sc
int sc
Definition: merge_files.py:167
StatusCode::FAILURE
Definition: StatusCode.h:29
StatusCode::SUCCESS
Definition: StatusCode.h:30
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:187
ana.i
list i
Definition: ana.py:128

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 345 of file EventCollectionSelector.cpp.

346 {
347 MyContextType *ctxt = dynamic_cast<MyContextType*>(refCtxt);
348 if ( ctxt ) {
349 delete ctxt;
350 ctxt = nullptr;
351 return StatusCode::SUCCESS;
352 }
353 return StatusCode::FAILURE;
354 }
StatusCode::FAILURE
Definition: StatusCode.h:29
StatusCode::SUCCESS
Definition: StatusCode.h:30

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 359 of file EventCollectionSelector.cpp.

360 {
361 MyContextType *ctxt = dynamic_cast<MyContextType*>(&refCtxt);
362 if ( ctxt ) {
363 ctxt->criteria = cr;
364 return StatusCode::SUCCESS;
365 }
366 return StatusCode::FAILURE;
367 }
StatusCode::FAILURE
Definition: StatusCode.h:29
StatusCode::SUCCESS
Definition: StatusCode.h:30

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 308 of file EventCollectionSelector.cpp.

309 {
310 return StatusCode::FAILURE;
311 }
StatusCode::FAILURE
Definition: StatusCode.h:29

## Member Data Documentation

std::string EventCollectionSelector::m_authentication
| protected

Authentication string (if needed)

Definition at line 85 of file EventCollectionSelector.h.

std::string EventCollectionSelector::m_cntName
| protected

Container name.

Definition at line 87 of file EventCollectionSelector.h.

std::string EventCollectionSelector::m_criteria
| protected

Criteria.

Definition at line 91 of file EventCollectionSelector.h.

std::string EventCollectionSelector::m_database
| protected

Datafile name.

Definition at line 93 of file EventCollectionSelector.h.

std::string EventCollectionSelector::m_dbSvc
| protected

Database service (exclusive property with db type)

Definition at line 97 of file EventCollectionSelector.h.

std::string EventCollectionSelector::m_dbType
| protected

Database type identifier.

Definition at line 95 of file EventCollectionSelector.h.

std::string EventCollectionSelector::m_itemName
| protected

Item name.

Definition at line 89 of file EventCollectionSelector.h.

SmartIF<IAddressCreator> EventCollectionSelector::m_pAddrCreator
| mutable protected

Definition at line 81 of file EventCollectionSelector.h.

std::string EventCollectionSelector::m_statement
| protected

Selector name.

Definition at line 99 of file EventCollectionSelector.h.

SmartIF<INTupleSvc> EventCollectionSelector::m_tupleSvc
| mutable protected

Reference to Tuple service.

Definition at line 80 of file EventCollectionSelector.h.

std::string EventCollectionSelector::m_tupleSvcName
| protected

Name of the event collection service name.

Definition at line 83 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