The Gaudi Framework  master (ff829712)
Loading...
Searching...
No Matches
EventCollectionSelector Class Reference

Definition of class EventCollectionSelector. More...

#include </builds/gaudi/Gaudi/GaudiCoreSvc/src/EventSelector/EventCollectionSelector.h>

Inheritance diagram for EventCollectionSelector:
Collaboration diagram for EventCollectionSelector:

Classes

class  MyContextType
 

Public Member Functions

StatusCode initialize () override
 Service override: Initialize service.
 
StatusCode finalize () override
 Service override: Finalize Service.
 
StatusCode createContext (Context *&refpCtxt) const override
 Create a new event loop context.
 
StatusCode next (Context &refCtxt) const override
 Get next iteration item from the event loop context.
 
StatusCode next (Context &refCtxt, int jump) const override
 Get next iteration item from the event loop context, but skip jump elements.
 
StatusCode previous (Context &refCtxt) const override
 Get previous iteration item from the event loop context.
 
StatusCode previous (Context &refCtxt, int jump) const override
 Get previous iteration item from the event loop context, but skip jump elements.
 
StatusCode rewind (Context &refCtxt) const override
 Rewind the dataset.
 
StatusCode createAddress (const Context &refCtxt, IOpaqueAddress *&refpAddr) const override
 Create new Opaque address corresponding to the current record.
 
StatusCode releaseContext (Context *&refCtxt) const override
 Release existing event iteration context.
 
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.
 
StatusCode last (Context &refCtxt) const override
 Access last item in the iteration.
 
virtual StatusCode connectCollection (MyContextType *ctxt) const
 Connect collection to selector.
 
virtual StatusCode connectDataSource (const std::string &db, const std::string &typ) const
 Connect collection's data source to selector.
 
virtual StatusCode connectTuple (const std::string &nam, const std::string &itName, NTuple::Tuple *&tup, std::optional< NTuple::Item< IOpaqueAddress * > > &item) const
 Connect to existing N-tuple.
 
virtual StatusCode connectStatement (const std::string &typ, const std::string &crit, INTuple *tuple) const
 Connect selection statement to refine data access.
 
virtual StatusCode getNextRecord (NTuple::Tuple *tuple) const
 Read next record of the N-tuple.
 
virtual StatusCode getPreviousRecord (NTuple::Tuple *tuple) const
 Read next record of the N-tuple.
 
- Public Member Functions inherited from extends< Service, IEvtSelector >
void const * i_cast (const InterfaceID &tid) const override
 Implementation of IInterface::i_cast.
 
StatusCode queryInterface (const InterfaceID &ti, void **pp) override
 Implementation of IInterface::queryInterface.
 
std::vector< std::string > getInterfaceNames () const override
 Implementation of IInterface::getInterfaceNames.
 
- Public Member Functions inherited from Service
const std::string & name () const override
 Retrieve name of the service.
 
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.
 
StatusCode sysStart () override
 Initialize Service.
 
StatusCode sysStop () override
 Initialize Service.
 
StatusCode sysFinalize () override
 Finalize Service.
 
StatusCode sysReinitialize () override
 Re-initialize the Service.
 
StatusCode sysRestart () override
 Re-initialize the Service.
 
 Service (std::string name, ISvcLocator *svcloc)
 Standard Constructor.
 
SmartIF< ISvcLocator > & serviceLocator () const override
 Retrieve pointer to service locator.
 
template<typename IFace = IService>
SmartIF< IFace > service (const std::string &name, bool createIf=true) const
 
template<class T>
Gaudi::Details::PropertyBasedeclareProperty (const std::string &name, ToolHandle< T > &hndl, const std::string &doc="none")
 
template<class T>
StatusCode declareTool (ToolHandle< T > &handle, bool createIf=true)
 
template<class T>
StatusCode declareTool (ToolHandle< T > &handle, const std::string &toolTypeAndName, bool createIf=true)
 Declare used tool.
 
template<class T>
Gaudi::Details::PropertyBasedeclareProperty (const std::string &name, ToolHandleArray< T > &hndlArr, const std::string &doc="none")
 
template<class T>
void addToolsArray (ToolHandleArray< T > &hndlArr)
 
const std::vector< IAlgTool * > & tools () const
 
SmartIF< IAuditorSvc > & auditorSvc () const
 The standard auditor service.May not be invoked before sysInitialize() has been invoked.
 
- Public Member Functions inherited from PropertyHolder< CommonMessaging< implements< IService, IProperty, IStateful > > >
StatusCode setProperty (const Gaudi::Details::PropertyBase &p)
 Set the property from a property.
 
StatusCode setProperty (const std::string &name, const char *v)
 Special case for string literals.
 
StatusCode setProperty (const std::string &name, const std::string &v)
 Special case for std::string.
 
StatusCode setProperty (const std::string &name, const TYPE &value)
 set the property form the value
 
 PropertyHolder ()=default
 
Gaudi::Details::PropertyBasedeclareProperty (Gaudi::Details::PropertyBase &prop)
 Declare a property.
 
Gaudi::Details::PropertyBasedeclareProperty (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.
 
Gaudi::Details::PropertyBasedeclareProperty (const std::string &name, Gaudi::Property< TYPE, VERIFIER, HANDLERS > &prop, const std::string &doc="none")
 Declare a PropertyBase instance setting name and documentation.
 
Gaudi::Details::PropertyBasedeclareRemoteProperty (const std::string &name, IProperty *rsvc, const std::string &rname="")
 Declare a remote property.
 
StatusCode setProperty (const std::string &name, const Gaudi::Details::PropertyBase &p) override
 set the property from another property with a different name
 
StatusCode setProperty (const std::string &s) override
 set the property from the formatted string
 
StatusCode setProperty (const Gaudi::Details::PropertyBase &p)
 Set the property from a property.
 
StatusCode setProperty (const std::string &name, const char *v)
 Special case for string literals.
 
StatusCode setProperty (const std::string &name, const std::string &v)
 Special case for std::string.
 
StatusCode setProperty (const std::string &name, const TYPE &value)
 set the property form the value
 
StatusCode setPropertyRepr (const std::string &n, const std::string &r) override
 set the property from name and value string representation
 
StatusCode getProperty (Gaudi::Details::PropertyBase *p) const override
 get the property
 
const Gaudi::Details::PropertyBasegetProperty (std::string_view name) const override
 get the property by name
 
StatusCode getProperty (std::string_view n, std::string &v) const override
 convert the property to the string
 
const std::vector< Gaudi::Details::PropertyBase * > & getProperties () const override
 get all properties
 
bool hasProperty (std::string_view name) const override
 Return true if we have a property with the given name.
 
Gaudi::Details::PropertyBaseproperty (std::string_view name) const
 \fixme property and bindPropertiesTo should be protected
 
void bindPropertiesTo (Gaudi::Interfaces::IOptionsSvc &optsSvc)
 
 PropertyHolder (const PropertyHolder &)=delete
 
PropertyHolderoperator= (const PropertyHolder &)=delete
 
- Public Member Functions inherited from CommonMessaging< implements< IService, IProperty, IStateful > >
MSG::Level msgLevel () const
 get the cached level (originally extracted from the embedded MsgStream)
 
bool msgLevel (MSG::Level lvl) const
 get the output level from the embedded MsgStream
 
- Public Member Functions inherited from CommonMessagingBase
virtual ~CommonMessagingBase ()=default
 Virtual destructor.
 
const SmartIF< IMessageSvc > & msgSvc () const
 The standard message service.
 
MsgStreammsgStream () const
 Return an uninitialized MsgStream.
 
MsgStreammsgStream (const MSG::Level level) const
 Predefined configurable message stream for the efficient printouts.
 
MsgStreamalways () const
 shortcut for the method msgStream(MSG::ALWAYS)
 
MsgStreamfatal () const
 shortcut for the method msgStream(MSG::FATAL)
 
MsgStreamerr () const
 shortcut for the method msgStream(MSG::ERROR)
 
MsgStreamerror () const
 shortcut for the method msgStream(MSG::ERROR)
 
MsgStreamwarning () const
 shortcut for the method msgStream(MSG::WARNING)
 
MsgStreaminfo () const
 shortcut for the method msgStream(MSG::INFO)
 
MsgStreamdebug () const
 shortcut for the method msgStream(MSG::DEBUG)
 
MsgStreamverbose () const
 shortcut for the method msgStream(MSG::VERBOSE)
 
MsgStreammsg () const
 shortcut for the method msgStream(MSG::INFO)
 

Protected Attributes

SmartIF< INTupleSvcm_tupleSvc
 Reference to Tuple service.
 
SmartIF< IAddressCreatorm_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.
 
Gaudi::StateMachine::State m_targetState = Gaudi::StateMachine::OFFLINE
 Service state.
 
Gaudi::Property< int > m_outputLevel { this, "OutputLevel", MSG::NIL, "output level" }
 flag indicating whether ToolHandle tools have been added to m_tools
 
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()" }
 
Gaudi::Property< bool > m_autoRetrieveTools
 
Gaudi::Property< bool > m_checkToolDeps
 
SmartIF< IAuditorSvcm_pAuditorSvc
 Auditor Service.
 

Additional Inherited Members

- Public Types inherited from extends< Service, IEvtSelector >
using base_class
 Typedef to this class.
 
using extend_interfaces_base
 Typedef to the base of this class.
 
- Public Types inherited from Service
using Factory = Gaudi::PluginService::Factory<IService*( const std::string&, ISvcLocator* )>
 
- Public Types inherited from PropertyHolder< CommonMessaging< implements< IService, IProperty, IStateful > > >
using PropertyHolderImpl
 Typedef used to refer to this class from derived classes, as in.
 
- Public Types inherited from CommonMessaging< implements< IService, IProperty, IStateful > >
using base_class
 
- Public Types inherited from extend_interfaces< Interfaces... >
using ext_iids
 take union of the ext_iids of all Interfaces...
 
- Protected Member Functions inherited from Service
std::vector< IAlgTool * > & tools ()
 
 ~Service () override
 
int outputLevel () const
 get the Service's output level
 
- Protected Member Functions inherited from CommonMessaging< implements< IService, IProperty, IStateful > >
MSG::Level setUpMessaging () const
 Set up local caches.
 
MSG::Level resetMessaging ()
 Reinitialize internal states.
 
void updateMsgStreamOutputLevel (int level)
 Update the output level of the cached MsgStream.
 

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.

Member Function Documentation

◆ connectCollection()

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

Connect collection to selector.

Definition at line 190 of file EventCollectionSelector.cpp.

190 {
191 if ( ctxt ) {
192 StatusCode status = connectDataSource( m_database, m_dbType );
193 if ( status.isSuccess() ) {
194 status = connectTuple( m_cntName, m_itemName, ctxt->tuple, ctxt->item );
195 if ( status.isSuccess() ) {
196 status = connectStatement( m_statement, m_criteria, ctxt->tuple );
197 if ( status.isSuccess() ) {
198 *( ctxt->item ) = 0;
199 return status;
200 }
201 }
202 }
203 return status;
204 }
205 return StatusCode::FAILURE;
206}
virtual StatusCode connectDataSource(const std::string &db, const std::string &typ) const
Connect collection's data source to selector.
Gaudi::Property< std::string > m_database
virtual StatusCode connectTuple(const std::string &nam, const std::string &itName, NTuple::Tuple *&tup, std::optional< NTuple::Item< IOpaqueAddress * > > &item) const
Connect to existing N-tuple.
Gaudi::Property< std::string > m_itemName
Gaudi::Property< std::string > m_cntName
virtual StatusCode connectStatement(const std::string &typ, const std::string &crit, INTuple *tuple) const
Connect selection statement to refine data access.
Gaudi::Property< std::string > m_dbType
Gaudi::Property< std::string > m_statement
Gaudi::Property< std::string > m_criteria
bool isSuccess() const
Definition StatusCode.h:314
constexpr static const auto FAILURE
Definition StatusCode.h:100

◆ connectDataSource()

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

Connect collection's data source to selector.

Definition at line 92 of file EventCollectionSelector.cpp.

92 {
93 StatusCode status = StatusCode::FAILURE;
94 SmartIF<IDataSourceMgr> svc( m_tupleSvc );
95 if ( svc && !db.empty() ) {
96 std::string ident = name() + ' ';
97 ident += "DATAFILE='" + m_database.value().substr( 5 ) + "' ";
98 if ( !m_dbSvc.empty() )
99 ident += "SVC='" + m_dbSvc + "' ";
100 else
101 ident += "TYP='" + m_dbType + "' ";
102 ident += "OPT='READ' ";
103 if ( m_authentication.length() > 0 ) { ident += "AUTH='" + m_authentication + "' "; }
104 status = svc->connect( ident );
105 }
106 return status;
107}
Gaudi::Property< std::string > m_authentication
Gaudi::Property< std::string > m_dbSvc
SmartIF< INTupleSvc > m_tupleSvc
Reference to Tuple service.
const std::string & name() const override
Retrieve name of the service.
Definition Service.cpp:333

◆ connectStatement()

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

130 {
131 std::string seltyp = typ;
132 if ( !seltyp.empty() || !crit.empty() ) {
133 if ( !crit.empty() && seltyp.length() == 0 ) seltyp = "NTuple::Selector";
134 SmartIF<ISelectStatement> stmt( ObjFactory::create( seltyp, serviceLocator() ).release() );
135 if ( stmt ) {
136 if ( !crit.empty() ) stmt->setCriteria( crit );
137 tuple->attachSelector( stmt ).ignore();
138 return StatusCode::SUCCESS;
139 }
140 return StatusCode::FAILURE;
141 }
142 return StatusCode::SUCCESS;
143}
virtual StatusCode attachSelector(ISelectStatement *sel)=0
Attach selector.
SmartIF< ISvcLocator > & serviceLocator() const override
Retrieve pointer to service locator.
Definition Service.cpp:336
const StatusCode & ignore() const
Allow discarding a StatusCode without warning.
Definition StatusCode.h:139
constexpr static const auto SUCCESS
Definition StatusCode.h:99
str release
Definition conf.py:27

◆ connectTuple()

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

Connect to existing N-tuple.

Definition at line 110 of file EventCollectionSelector.cpp.

112 {
113 std::string top = "/NTUPLES/" + name() + '/' + nam;
114 StatusCode status = m_tupleSvc->retrieveObject( top, (DataObject*&)tup );
115 if ( status.isSuccess() ) {
116 item.emplace();
117 status = tup->item( itName, *item );
118 if ( status.isSuccess() ) return status;
119 error() << "Item " << itName << " is not part of the collection:" << top << endmsg;
120 item.reset();
121 } else {
122 error() << "Cannot connect to collection:" << top << endmsg;
123 }
124 tup = nullptr;
125 return status;
126}
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition MsgStream.h:198
MsgStream & error() const
shortcut for the method msgStream(MSG::ERROR)

◆ createAddress()

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

263 {
264 const MyContextType* ctxt = dynamic_cast<const MyContextType*>( &refCtxt );
265 if ( ctxt ) {
266 IOpaqueAddress* pA = *( ctxt->item );
267 if ( pA ) {
268 IOpaqueAddress* pAddress = nullptr;
269 StatusCode status = m_pAddrCreator->createAddress( pA->svcType(), pA->clID(), pA->par(), pA->ipar(), pAddress );
270 if ( status.isSuccess() ) {
271 refpAddr = pAddress;
272 return StatusCode::SUCCESS;
273 } else {
274 error() << "Failed to access " << pA->par()[0] << ":" << pA->par()[1] << " SvcTyp:" << long( pA->svcType() )
275 << " CLID:" << pA->clID() << endmsg;
276 }
277 }
278 }
279 return StatusCode::FAILURE;
280}
SmartIF< IAddressCreator > m_pAddrCreator
virtual long svcType() const =0
Retrieve service type.
virtual const unsigned long * ipar() const =0
Access to generic link parameters.
virtual const CLID & clID() const =0
Retrieve class information from link.
virtual const std::string * par() const =0
Retrieve String parameters.

◆ createContext()

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

217 {
218 refpCtxt = nullptr;
219 auto ctxt = std::make_unique<MyContextType>();
220 StatusCode status = connectCollection( ctxt.get() );
221 if ( !status.isSuccess() ) {
222 error() << "Unable to connect Collection file \"" << m_database << "\"" << endmsg;
223 return status;
224 }
225 refpCtxt = ctxt.release();
226 return StatusCode::SUCCESS;
227}
virtual StatusCode connectCollection(MyContextType *ctxt) const
Connect collection to selector.

◆ finalize()

StatusCode EventCollectionSelector::finalize ( )
override

Service override: Finalize Service.

Definition at line 209 of file EventCollectionSelector.cpp.

209 {
210 // release services
211 m_pAddrCreator = nullptr;
212 m_tupleSvc = nullptr;
213 return Service::finalize();
214}
StatusCode finalize() override
Definition Service.cpp:223

◆ getNextRecord()

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

Read next record of the N-tuple.

Definition at line 146 of file EventCollectionSelector.cpp.

146 {
147 StatusCode status = StatusCode::FAILURE;
148 if ( tuple ) {
149 do {
150 status = m_tupleSvc->readRecord( tuple );
151 if ( status.isSuccess() ) {
152 ISelectStatement* statement = tuple->selector();
153 bool use_it = ( statement ) ? ( *statement )( tuple ) : true;
154 if ( use_it ) { return status; }
155 }
156 } while ( status.isSuccess() );
157 }
158 return status;
159}
virtual ISelectStatement * selector()=0
Access selector.

◆ getPreviousRecord()

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

162 {
163 StatusCode status = StatusCode::FAILURE;
164 if ( tuple ) {
165 IRegistry* pReg = tuple->registry();
166 if ( pReg ) {
167 IOpaqueAddress* pAddr = pReg->address();
168 if ( pAddr ) {
169 long* ip = (long*)pAddr->ipar();
170 do {
171 if ( ip[1] > 1 ) {
172 ip[1] -= 2;
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 ) { return status; }
178 }
179 } else {
180 return StatusCode::FAILURE;
181 }
182 } while ( status.isSuccess() );
183 }
184 }
185 }
186 return StatusCode::FAILURE;
187}
IRegistry * registry() const
Get pointer to Registry.
Definition DataObject.h:79
virtual IOpaqueAddress * address() const =0
Retrieve opaque storage address.

◆ initialize()

StatusCode EventCollectionSelector::initialize ( )
override

Service override: Initialize service.

Definition at line 70 of file EventCollectionSelector.cpp.

70 {
71 // Initialize base class
72 StatusCode status = Service::initialize();
73 if ( !status.isSuccess() ) {
74 error() << "Error initializing base class Service!" << endmsg;
75 return status;
76 }
77 m_pAddrCreator = serviceLocator()->service( "EventPersistencySvc" );
78 if ( !m_pAddrCreator ) {
79 error() << "Unable to locate IAddressCreator interface of "
80 << "EventPersistencySvc" << endmsg;
81 return status;
82 }
84 if ( !m_tupleSvc ) {
85 error() << "Unable to locate INTupleSvc interface of " << m_tupleSvcName << endmsg;
86 return status;
87 }
88 return status;
89}
Gaudi::Property< std::string > m_tupleSvcName
virtual SmartIF< IService > & service(const Gaudi::Utils::TypeNameString &typeName, const bool createIf=true)=0
Returns a smart pointer to a service.
StatusCode initialize() override
Definition Service.cpp:118

◆ last()

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

305{ return StatusCode::FAILURE; }

◆ next() [1/2]

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

230{ return next( refCtxt, 1 ); }
StatusCode next(Context &refCtxt) const override
Get next iteration item from the event loop context.

◆ next() [2/2]

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

233 {
234 MyContextType* ctxt = dynamic_cast<MyContextType*>( &refCtxt );
235 if ( ctxt ) {
236 *( ctxt->item ) = ctxt->addressBuffer;
237 StatusCode sc = StatusCode::SUCCESS;
238 for ( int i = 0; i < jump && sc.isSuccess(); ++i ) { sc = getNextRecord( ctxt->tuple ); }
239 return sc;
240 }
241 return StatusCode::FAILURE;
242}
virtual StatusCode getNextRecord(NTuple::Tuple *tuple) const
Read next record of the N-tuple.

◆ previous() [1/2]

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

245{ return previous( refCtxt, 1 ); }
StatusCode previous(Context &refCtxt) const override
Get previous iteration item from the event loop context.

◆ previous() [2/2]

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

248 {
249 MyContextType* ctxt = dynamic_cast<MyContextType*>( &refCtxt );
250 if ( ctxt ) {
251 *( ctxt->item ) = ctxt->addressBuffer;
252 StatusCode sc = StatusCode::SUCCESS;
253 for ( int i = 0; i < jump && sc.isSuccess(); ++i ) { sc = getPreviousRecord( ctxt->tuple ); }
254 return sc;
255 }
256 return StatusCode::FAILURE;
257}
virtual StatusCode getPreviousRecord(NTuple::Tuple *tuple) const
Read next record of the N-tuple.

◆ releaseContext()

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

283 {
284 MyContextType* ctxt = dynamic_cast<MyContextType*>( refCtxt );
285 if ( ctxt ) {
286 delete ctxt;
287 ctxt = nullptr;
288 return StatusCode::SUCCESS;
289 }
290 return StatusCode::FAILURE;
291}

◆ resetCriteria()

StatusCode EventCollectionSelector::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.

Parameters
crThe new criteria string.
cReference pointer to the Context object.
Returns
StatusCode indicating success or failure

Definition at line 295 of file EventCollectionSelector.cpp.

295 {
296 MyContextType* ctxt = dynamic_cast<MyContextType*>( &refCtxt );
297 if ( ctxt ) {
298 ctxt->criteria = cr;
299 return StatusCode::SUCCESS;
300 }
301 return StatusCode::FAILURE;
302}

◆ rewind()

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

260{ return StatusCode::FAILURE; }

Member Data Documentation

◆ m_authentication

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

Definition at line 76 of file EventCollectionSelector.h.

76{ this, "Authentication", "", "authentication string (if needed)" };

◆ m_cntName

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

Definition at line 77 of file EventCollectionSelector.h.

77{ this, "Container", "B2PiPi", "container name" };

◆ m_criteria

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

Definition at line 79 of file EventCollectionSelector.h.

79{ this, "Criteria", "", "criteria" };

◆ m_database

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

Definition at line 80 of file EventCollectionSelector.h.

80{ this, "DB", "", "datafile name" };

◆ m_dbSvc

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

Definition at line 82 of file EventCollectionSelector.h.

82{ this, "DbService", "", "database service (exclusive property with db type)" };

◆ m_dbType

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

Definition at line 81 of file EventCollectionSelector.h.

81{ this, "DbType", "", "database type identifier" };

◆ m_itemName

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

Definition at line 78 of file EventCollectionSelector.h.

78{ this, "Item", "Address", "item name" };

◆ m_pAddrCreator

SmartIF<IAddressCreator> EventCollectionSelector::m_pAddrCreator
mutableprotected

Definition at line 71 of file EventCollectionSelector.h.

◆ m_statement

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

Definition at line 83 of file EventCollectionSelector.h.

83{ this, "Function", "NTuple::Selector", "selector name" };

◆ m_tupleSvc

SmartIF<INTupleSvc> EventCollectionSelector::m_tupleSvc
mutableprotected

Reference to Tuple service.

Definition at line 70 of file EventCollectionSelector.h.

◆ m_tupleSvcName

Gaudi::Property<std::string> EventCollectionSelector::m_tupleSvcName
protected
Initial value:
{ this, "CnvService", "EvtTupleSvc",
"name of the event collection service" }

Definition at line 74 of file EventCollectionSelector.h.

74 { this, "CnvService", "EvtTupleSvc",
75 "name of the event collection service" };

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