The Gaudi Framework  v32r2 (46d42edc)
EventCollectionSelector Class Reference

Definition of class EventCollectionSelector. More...

#include <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. 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...
 
- 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::stringgetInterfaceNames () const override
 Implementation of IInterface::getInterfaceNames. More...
 
- Public Member Functions inherited from Service
const std::stringname () 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 declareTool (ToolHandle< T > &handle, std::string toolTypeAndName, bool createIf=true)
 Declare used 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
 
Gaudi::Details::PropertyBasedeclareProperty (Gaudi::Details::PropertyBase &prop)
 Declare a property. More...
 
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. More...
 
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. More...
 
Gaudi::Details::PropertyBasedeclareRemoteProperty (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::PropertyBasegetProperty (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
 
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) More...
 
bool msgLevel (MSG::Level lvl) const
 get the output level from the embedded MsgStream More...
 
MSG::Level outputLevel () const
 Backward compatibility function for getting the output level. More...
 
- Public Member Functions inherited from CommonMessagingBase
virtual ~CommonMessagingBase ()=default
 Virtual destructor. More...
 
const SmartIF< IMessageSvc > & msgSvc () const
 The standard message service. More...
 
MsgStreammsgStream () const
 Return an uninitialized MsgStream. More...
 
MsgStreammsgStream (const MSG::Level level) const
 Predefined configurable message stream for the efficient printouts. More...
 
MsgStreamalways () const
 shortcut for the method msgStream(MSG::ALWAYS) More...
 
MsgStreamfatal () const
 shortcut for the method msgStream(MSG::FATAL) More...
 
MsgStreamerr () const
 shortcut for the method msgStream(MSG::ERROR) More...
 
MsgStreamerror () const
 shortcut for the method msgStream(MSG::ERROR) More...
 
MsgStreamwarning () const
 shortcut for the method msgStream(MSG::WARNING) More...
 
MsgStreaminfo () const
 shortcut for the method msgStream(MSG::INFO) More...
 
MsgStreamdebug () const
 shortcut for the method msgStream(MSG::DEBUG) More...
 
MsgStreamverbose () const
 shortcut for the method msgStream(MSG::VERBOSE) More...
 
MsgStreammsg () const
 shortcut for the method msgStream(MSG::INFO) More...
 

Protected Attributes

SmartIF< INTupleSvcm_tupleSvc
 Reference to Tuple service. More...
 
SmartIF< IAddressCreatorm_pAddrCreator
 
Gaudi::Property< std::stringm_tupleSvcName
 
Gaudi::Property< std::stringm_authentication {this, "Authentication", "", "authentication string (if needed)"}
 
Gaudi::Property< std::stringm_cntName {this, "Container", "B2PiPi", "container name"}
 
Gaudi::Property< std::stringm_itemName {this, "Item", "Address", "item name"}
 
Gaudi::Property< std::stringm_criteria {this, "Criteria", "", "criteria"}
 
Gaudi::Property< std::stringm_database {this, "DB", "", "datafile name"}
 
Gaudi::Property< std::stringm_dbType {this, "DbType", "", "database type identifier"}
 
Gaudi::Property< std::stringm_dbSvc {this, "DbService", "", "database service (exclusive property with db type)"}
 
Gaudi::Property< std::stringm_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, " 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< IAuditorSvcm_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
using Factory = Gaudi::PluginService::Factory< IService *(const std::string &, ISvcLocator *)>
 
- 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::PropertyBaseproperty (const std::string &name) const
 
- Protected Member Functions inherited from CommonMessaging< implements< IService, IProperty, IStateful > >
MSG::Level setUpMessaging () const
 Set up local caches. More...
 
MSG::Level resetMessaging ()
 Reinitialize internal states. More...
 
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.

Member Function Documentation

◆ connectCollection()

StatusCode EventCollectionSelector::connectCollection ( MyContextType ctxt) const
virtual

Connect collection to selector.

Definition at line 179 of file EventCollectionSelector.cpp.

179  {
180  if ( ctxt ) {
182  if ( status.isSuccess() ) {
183  status = connectTuple( m_cntName, m_itemName, ctxt->tuple, ctxt->item );
184  if ( status.isSuccess() ) {
185  status = connectStatement( m_statement, m_criteria, ctxt->tuple );
186  if ( status.isSuccess() ) {
187  *( ctxt->item ) = 0;
188  return status;
189  }
190  }
191  }
192  return status;
193  }
194  return StatusCode::FAILURE;
195 }
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_cntName
Gaudi::Property< std::string > m_database
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:50
virtual StatusCode connectDataSource(const std::string &db, const std::string &typ) const
Connect collection's data source to selector.
Gaudi::Property< std::string > m_statement
bool isSuccess() const
Definition: StatusCode.h:267
Gaudi::Property< std::string > m_dbType
virtual StatusCode connectTuple(const std::string &nam, const std::string &itName, NTuple::Tuple *&tup, NTuple::Item< IOpaqueAddress * > *&item) const
Connect to existing N-tuple.
Gaudi::Property< std::string > m_criteria
constexpr static const auto FAILURE
Definition: StatusCode.h:86
Gaudi::Property< std::string > m_itemName

◆ connectDataSource()

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

Connect collection's data source to selector.

Definition at line 81 of file EventCollectionSelector.cpp.

81  {
84  if ( svc && !db.empty() ) {
85  std::string ident = name() + ' ';
86  ident += "DATAFILE='" + m_database.value().substr( 5 ) + "' ";
87  if ( !m_dbSvc.empty() )
88  ident += "SVC='" + m_dbSvc + "' ";
89  else
90  ident += "TYP='" + m_dbType + "' ";
91  ident += "OPT='READ' ";
92  if ( m_authentication.length() > 0 ) { ident += "AUTH='" + m_authentication + "' "; }
93  status = svc->connect( ident );
94  }
95  return status;
96 }
SmartIF< INTupleSvc > m_tupleSvc
Reference to Tuple service.
Small smart pointer class with automatic reference counting for IInterface.
Definition: IConverter.h:15
T empty(T... args)
Gaudi::Property< std::string > m_authentication
Gaudi::Property< std::string > m_database
STL class.
const std::string & name() const override
Retrieve name of the service.
Definition: Service.cpp:274
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:50
Gaudi::Property< std::string > m_dbType
Gaudi::Property< std::string > m_dbSvc
constexpr static const auto FAILURE
Definition: StatusCode.h:86

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

119  {
120  std::string seltyp = typ;
121  if ( !seltyp.empty() || !crit.empty() ) {
122  if ( !crit.empty() && seltyp.length() == 0 ) seltyp = "NTuple::Selector";
123  SmartIF<ISelectStatement> stmt( ObjFactory::create( seltyp, serviceLocator() ).release() );
124  if ( stmt ) {
125  if ( !crit.empty() ) stmt->setCriteria( crit );
126  tuple->attachSelector( stmt ).ignore();
127  return StatusCode::SUCCESS;
128  }
129  return StatusCode::FAILURE;
130  }
131  return StatusCode::SUCCESS;
132 }
SmartIF< ISvcLocator > & serviceLocator() const override
Retrieve pointer to service locator.
Definition: Service.cpp:277
T empty(T... args)
constexpr static const auto SUCCESS
Definition: StatusCode.h:85
STL class.
T length(T... args)
const StatusCode & ignore() const
Ignore/check StatusCode.
Definition: StatusCode.h:153
constexpr static const auto FAILURE
Definition: StatusCode.h:86
virtual StatusCode attachSelector(ISelectStatement *sel)=0
Attach selector.

◆ connectTuple()

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

100  {
101  std::string top = "/NTUPLES/" + name() + '/' + nam;
102  StatusCode status = m_tupleSvc->retrieveObject( top, (DataObject*&)tup );
103  if ( status.isSuccess() ) {
104  item = new NTuple::Item<IOpaqueAddress*>();
105  status = tup->item( itName, *item );
106  if ( status.isSuccess() ) return status;
107  error() << "Item " << itName << " is not part of the collection:" << top << endmsg;
108  delete item;
109  item = nullptr;
110  } else {
111  error() << "Cannot connect to collection:" << top << endmsg;
112  }
113  tup = nullptr;
114  return status;
115 }
SmartIF< INTupleSvc > m_tupleSvc
Reference to Tuple service.
STL class.
const std::string & name() const override
Retrieve name of the service.
Definition: Service.cpp:274
MsgStream & error() const
shortcut for the method msgStream(MSG::ERROR)
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:50
bool isSuccess() const
Definition: StatusCode.h:267
virtual StatusCode retrieveObject(IRegistry *pDirectory, std::string_view path, DataObject *&pObject)=0
Retrieve object identified by its directory entry.
A DataObject is the base class of any identifiable object on any data store.
Definition: DataObject.h:30
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:192

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

264  {
265  const MyContextType* ctxt = dynamic_cast<const MyContextType*>( &refCtxt );
266  if ( ctxt ) {
267  IOpaqueAddress* pA = *( ctxt->item );
268  if ( pA ) {
269  IOpaqueAddress* pAddress = nullptr;
270  StatusCode status = m_pAddrCreator->createAddress( pA->svcType(), pA->clID(), pA->par(), pA->ipar(), pAddress );
271  if ( status.isSuccess() ) {
272  refpAddr = pAddress;
273  return StatusCode::SUCCESS;
274  } else {
275  error() << "Failed to access " << pA->par()[0] << ":" << pA->par()[1] << " SvcTyp:" << long( pA->svcType() )
276  << " CLID:" << pA->clID() << endmsg;
277  }
278  }
279  }
280  return StatusCode::FAILURE;
281 }
virtual const std::string * par() const =0
Retrieve String parameters.
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.
constexpr static const auto SUCCESS
Definition: StatusCode.h:85
virtual long svcType() const =0
Retrieve service type.
MsgStream & error() const
shortcut for the method msgStream(MSG::ERROR)
virtual const CLID & clID() const =0
Retrieve class information from link.
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:50
bool isSuccess() const
Definition: StatusCode.h:267
constexpr static const auto FAILURE
Definition: StatusCode.h:86
Opaque address interface definition.
SmartIF< IAddressCreator > m_pAddrCreator
virtual const unsigned long * ipar() const =0
Access to generic link parameters.
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:192

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

218  {
219  refpCtxt = nullptr;
220  auto ctxt = std::make_unique<MyContextType>();
221  StatusCode status = connectCollection( ctxt.get() );
222  if ( !status.isSuccess() ) {
223  error() << "Unable to connect Collection file \"" << m_database << "\"" << endmsg;
224  return status;
225  }
226  refpCtxt = ctxt.release();
227  return StatusCode::SUCCESS;
228 }
constexpr static const auto SUCCESS
Definition: StatusCode.h:85
virtual StatusCode connectCollection(MyContextType *ctxt) const
Connect collection to selector.
Gaudi::Property< std::string > m_database
MsgStream & error() const
shortcut for the method msgStream(MSG::ERROR)
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:50
bool isSuccess() const
Definition: StatusCode.h:267
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:192

◆ finalize()

StatusCode EventCollectionSelector::finalize ( )
override

Service override: Finalize Service.

Definition at line 198 of file EventCollectionSelector.cpp.

198  {
199  // release services
200  m_pAddrCreator = nullptr;
201  m_tupleSvc = nullptr;
202  return Service::finalize();
203 }
SmartIF< INTupleSvc > m_tupleSvc
Reference to Tuple service.
StatusCode finalize() override
Definition: Service.cpp:164
SmartIF< IAddressCreator > m_pAddrCreator

◆ getNextRecord()

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

Read next record of the N-tuple.

Definition at line 135 of file EventCollectionSelector.cpp.

135  {
137  if ( tuple ) {
138  do {
139  status = m_tupleSvc->readRecord( tuple );
140  if ( status.isSuccess() ) {
141  ISelectStatement* statement = tuple->selector();
142  bool use_it = ( statement ) ? ( *statement )( tuple ) : true;
143  if ( use_it ) { return status; }
144  }
145  } while ( status.isSuccess() );
146  }
147  return status;
148 }
SmartIF< INTupleSvc > m_tupleSvc
Reference to Tuple service.
A select statement can either contain.
virtual ISelectStatement * selector()=0
Access selector.
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:50
bool isSuccess() const
Definition: StatusCode.h:267
virtual StatusCode readRecord(NTuple::Tuple *tuple)=0
Read single record from N tuple.
constexpr static const auto FAILURE
Definition: StatusCode.h:86

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

151  {
153  if ( tuple ) {
154  IRegistry* pReg = tuple->registry();
155  if ( pReg ) {
156  IOpaqueAddress* pAddr = pReg->address();
157  if ( pAddr ) {
158  long* ip = (long*)pAddr->ipar();
159  do {
160  if ( ip[1] > 1 ) {
161  ip[1] -= 2;
162  status = m_tupleSvc->readRecord( tuple );
163  if ( status.isSuccess() ) {
164  ISelectStatement* statement = tuple->selector();
165  bool use_it = ( statement ) ? ( *statement )( tuple ) : true;
166  if ( use_it ) { return status; }
167  }
168  } else {
169  return StatusCode::FAILURE;
170  }
171  } while ( status.isSuccess() );
172  }
173  }
174  }
175  return StatusCode::FAILURE;
176 }
SmartIF< INTupleSvc > m_tupleSvc
Reference to Tuple service.
IRegistry * registry() const
Get pointer to Registry.
Definition: DataObject.h:72
A select statement can either contain.
virtual ISelectStatement * selector()=0
Access selector.
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:50
The IRegistry represents the entry door to the environment any data object residing in a transient da...
Definition: IRegistry.h:22
bool isSuccess() const
Definition: StatusCode.h:267
virtual IOpaqueAddress * address() const =0
Retrieve opaque storage address.
virtual StatusCode readRecord(NTuple::Tuple *tuple)=0
Read single record from N tuple.
constexpr static const auto FAILURE
Definition: StatusCode.h:86
Opaque address interface definition.
virtual const unsigned long * ipar() const =0
Access to generic link parameters.

◆ initialize()

StatusCode EventCollectionSelector::initialize ( )
override

Service override: Initialize service.

Definition at line 59 of file EventCollectionSelector.cpp.

59  {
60  // Initialize base class
62  if ( !status.isSuccess() ) {
63  error() << "Error initializing base class Service!" << endmsg;
64  return status;
65  }
66  m_pAddrCreator = serviceLocator()->service( "EventPersistencySvc" );
67  if ( !m_pAddrCreator ) {
68  error() << "Unable to locate IAddressCreator interface of "
69  << "EventPersistencySvc" << endmsg;
70  return status;
71  }
73  if ( !m_tupleSvc ) {
74  error() << "Unable to locate INTupleSvc interface of " << m_tupleSvcName << endmsg;
75  return status;
76  }
77  return status;
78 }
SmartIF< INTupleSvc > m_tupleSvc
Reference to Tuple service.
StatusCode initialize() override
Definition: Service.cpp:60
SmartIF< ISvcLocator > & serviceLocator() const override
Retrieve pointer to service locator.
Definition: Service.cpp:277
Gaudi::Property< std::string > m_tupleSvcName
StatusCode service(const Gaudi::Utils::TypeNameString &name, T *&svc, bool createIf=true)
Templated method to access a service by name.
Definition: ISvcLocator.h:76
MsgStream & error() const
shortcut for the method msgStream(MSG::ERROR)
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:50
bool isSuccess() const
Definition: StatusCode.h:267
SmartIF< IAddressCreator > m_pAddrCreator
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:192

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

306 { return StatusCode::FAILURE; }
constexpr static const auto FAILURE
Definition: StatusCode.h:86

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

231 { 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 234 of file EventCollectionSelector.cpp.

234  {
235  MyContextType* ctxt = dynamic_cast<MyContextType*>( &refCtxt );
236  if ( ctxt ) {
237  *( ctxt->item ) = ctxt->addressBuffer;
239  for ( int i = 0; i < jump && sc.isSuccess(); ++i ) { sc = getNextRecord( ctxt->tuple ); }
240  return sc;
241  }
242  return StatusCode::FAILURE;
243 }
constexpr static const auto SUCCESS
Definition: StatusCode.h:85
virtual StatusCode getNextRecord(NTuple::Tuple *tuple) const
Read next record of the N-tuple.
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:50
constexpr static const auto FAILURE
Definition: StatusCode.h:86

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

246 { 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 249 of file EventCollectionSelector.cpp.

249  {
250  MyContextType* ctxt = dynamic_cast<MyContextType*>( &refCtxt );
251  if ( ctxt ) {
252  *( ctxt->item ) = ctxt->addressBuffer;
254  for ( int i = 0; i < jump && sc.isSuccess(); ++i ) { sc = getPreviousRecord( ctxt->tuple ); }
255  return sc;
256  }
257  return StatusCode::FAILURE;
258 }
constexpr static const auto SUCCESS
Definition: StatusCode.h:85
virtual StatusCode getPreviousRecord(NTuple::Tuple *tuple) const
Read next record of the N-tuple.
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:50
constexpr static const auto FAILURE
Definition: StatusCode.h:86

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

284  {
285  MyContextType* ctxt = dynamic_cast<MyContextType*>( refCtxt );
286  if ( ctxt ) {
287  delete ctxt;
288  ctxt = nullptr;
289  return StatusCode::SUCCESS;
290  }
291  return StatusCode::FAILURE;
292 }
constexpr static const auto SUCCESS
Definition: StatusCode.h:85
constexpr static const auto FAILURE
Definition: StatusCode.h:86

◆ resetCriteria()

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
crThe new criteria string.
cReference pointer to the Context object.
Returns
StatusCode indicating success or failure

Definition at line 296 of file EventCollectionSelector.cpp.

296  {
297  MyContextType* ctxt = dynamic_cast<MyContextType*>( &refCtxt );
298  if ( ctxt ) {
299  ctxt->criteria = cr;
300  return StatusCode::SUCCESS;
301  }
302  return StatusCode::FAILURE;
303 }
constexpr static const auto SUCCESS
Definition: StatusCode.h:85
constexpr static const auto FAILURE
Definition: StatusCode.h:86

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

261 { return StatusCode::FAILURE; }
constexpr static const auto FAILURE
Definition: StatusCode.h:86

Member Data Documentation

◆ m_authentication

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

Definition at line 81 of file EventCollectionSelector.h.

◆ m_cntName

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

Definition at line 82 of file EventCollectionSelector.h.

◆ m_criteria

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

Definition at line 84 of file EventCollectionSelector.h.

◆ m_database

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

Definition at line 85 of file EventCollectionSelector.h.

◆ m_dbSvc

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

Definition at line 87 of file EventCollectionSelector.h.

◆ m_dbType

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

Definition at line 86 of file EventCollectionSelector.h.

◆ m_itemName

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

Definition at line 83 of file EventCollectionSelector.h.

◆ m_pAddrCreator

SmartIF<IAddressCreator> EventCollectionSelector::m_pAddrCreator
mutableprotected

Definition at line 76 of file EventCollectionSelector.h.

◆ m_statement

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

Definition at line 88 of file EventCollectionSelector.h.

◆ m_tupleSvc

SmartIF<INTupleSvc> EventCollectionSelector::m_tupleSvc
mutableprotected

Reference to Tuple service.

Definition at line 75 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 79 of file EventCollectionSelector.h.


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