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...
 
 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::stringgetInterfaceNames () const override
 Implementation of IInterface::getInterfaceNames. More...
 
 ~extends () override=default
 Virtual destructor. 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...
 
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 PropertygetProperty (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 >
PropertydeclareProperty (const std::string &name, T &property, const std::string &doc="none") const
 Declare the named property. More...
 
PropertydeclareRemoteProperty (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...
 
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...
 
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< INTupleSvcm_tupleSvc
 Reference to Tuple service. More...
 
SmartIF< IAddressCreatorm_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 }
std::string m_criteria
Criteria.
extends base_class
Typedef to this class.
Definition: extends.h:14
std::string m_tupleSvcName
Name of the event collection service name.
std::string m_cntName
Container name.
std::string m_itemName
Item name.
std::string m_dbType
Database type identifier.
std::string m_dbSvc
Database service (exclusive property with db type)
std::string m_database
Datafile name.
std::string m_authentication
Authentication string (if needed)
Property * declareProperty(const std::string &name, T &property, const std::string &doc="none") const
Declare the named property.
Definition: Service.h:215
std::string m_statement
Selector name.
EventCollectionSelector::~EventCollectionSelector ( )
overridedefault

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 ) {
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 }
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:76
virtual StatusCode connectDataSource(const std::string &db, const std::string &typ) const
Connect collection's data source to selector.
std::string m_criteria
Criteria.
std::string m_cntName
Container name.
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
std::string m_itemName
Item name.
std::string m_dbType
Database type identifier.
std::string m_database
Datafile name.
virtual StatusCode connectTuple(const std::string &nam, const std::string &itName, NTuple::Tuple *&tup, NTuple::Item< IOpaqueAddress * > *&item) const
Connect to existing N-tuple.
std::string m_statement
Selector name.
virtual StatusCode connectStatement(const std::string &typ, const std::string &crit, INTuple *tuple) const
Connect selection statement to refine data access.
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  {
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 }
SmartIF< INTupleSvc > m_tupleSvc
Reference to Tuple service.
Small smart pointer class with automatic reference counting for IInterface.
Definition: IConverter.h:14
T empty(T...args)
STL class.
const std::string & name() const override
Retrieve name of the service.
Definition: Service.cpp:319
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
std::string m_dbType
Database type identifier.
std::string m_dbSvc
Database service (exclusive property with db type)
T length(T...args)
std::string m_database
Datafile name.
T substr(T...args)
std::string m_authentication
Authentication string (if needed)
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< ISvcLocator > & serviceLocator() const override
Retrieve pointer to service locator.
Definition: Service.cpp:324
T empty(T...args)
STL class.
T length(T...args)
void ignore() const
Definition: StatusCode.h:108
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 }
SmartIF< INTupleSvc > m_tupleSvc
Reference to Tuple service.
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:76
STL class.
const std::string & name() const override
Retrieve name of the service.
Definition: Service.cpp:319
MsgStream & error() const
shortcut for the method msgStream(MSG::ERROR)
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
tuple item
print s1,s2
Definition: ana.py:146
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:244
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;
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 }
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.
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:76
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:26
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: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 }
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.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:26
STL class.
std::string m_database
Datafile name.
virtual StatusCode connectCollection(MyContextType *ctxt) const
Connect collection to selector.
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 }
SmartIF< INTupleSvc > m_tupleSvc
Reference to Tuple service.
StatusCode finalize() override
Definition: Service.cpp:193
SmartIF< IAddressCreator > m_pAddrCreator
StatusCode EventCollectionSelector::getNextRecord ( NTuple::Tuple tuple) const
virtual

Read next record of the N-tuple.

Definition at line 169 of file EventCollectionSelector.cpp.

169  {
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 }
SmartIF< INTupleSvc > m_tupleSvc
Reference to Tuple service.
A select statement can either contain.
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:76
virtual ISelectStatement * selector()=0
Access selector.
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
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  {
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 }
SmartIF< INTupleSvc > m_tupleSvc
Reference to Tuple service.
A select statement can either contain.
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:76
virtual ISelectStatement * selector()=0
Access selector.
IRegistry * registry() const
Get pointer to Registry.
Definition: DataObject.h:74
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
The IRegistry represents the entry door to the environment any data object residing in a transient da...
Definition: IRegistry.h:22
virtual IOpaqueAddress * address() const =0
Retrieve opaque storage address.
virtual StatusCode readRecord(NTuple::Tuple *tuple)=0
Read single record from N tuple.
Opaque address interface definition.
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
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  }
103  if( !m_tupleSvc ) {
104  error() << "Unable to locate INTupleSvc interface of " << m_tupleSvcName << endmsg;
105  return status;
106  }
107  return status;
108 }
SmartIF< INTupleSvc > m_tupleSvc
Reference to Tuple service.
StatusCode initialize() override
Definition: Service.cpp:68
SmartIF< ISvcLocator > & serviceLocator() const override
Retrieve pointer to service locator.
Definition: Service.cpp:324
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:76
std::string m_tupleSvcName
Name of the event collection service name.
StatusCode service(const Gaudi::Utils::TypeNameString &name, T *&svc, bool createIf=true)
Templated method to access a service by name.
Definition: ISvcLocator.h:78
MsgStream & error() const
shortcut for the method msgStream(MSG::ERROR)
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
SmartIF< IAddressCreator > m_pAddrCreator
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 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 }
StatusCode next(Context &refCtxt) const override
Get next iteration item from the event loop context.
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;
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 }
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:26
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 }
StatusCode previous(Context &refCtxt) const override
Get previous iteration item from the event loop context.
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;
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 }
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
virtual StatusCode getPreviousRecord(NTuple::Tuple *tuple) const
Read next record of the N-tuple.
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 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 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 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 }

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
mutableprotected

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
mutableprotected

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: