All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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

virtual StatusCode initialize ()
 Service override: Initialize service. More...
 
virtual StatusCode finalize ()
 Service override: Finalize Service. More...
 
virtual StatusCode createContext (Context *&refpCtxt) const
 Create a new event loop context. More...
 
virtual StatusCode next (Context &refCtxt) const
 Get next iteration item from the event loop context. More...
 
virtual StatusCode next (Context &refCtxt, int jump) const
 Get next iteration item from the event loop context, but skip jump elements. More...
 
virtual StatusCode previous (Context &refCtxt) const
 Get previous iteration item from the event loop context. More...
 
virtual StatusCode previous (Context &refCtxt, int jump) const
 Get previous iteration item from the event loop context, but skip jump elements. More...
 
virtual StatusCode rewind (Context &refCtxt) const
 Rewind the dataset. More...
 
virtual StatusCode createAddress (const Context &refCtxt, IOpaqueAddress *&refpAddr) const
 Create new Opaque address corresponding to the current record. More...
 
virtual StatusCode releaseContext (Context *&refCtxt) const
 Release existing event iteration context. More...
 
virtual StatusCode resetCriteria (const std::string &cr, Context &c) const
 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...
 
virtual StatusCode last (Context &refCtxt) const
 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...
 
virtual ~EventCollectionSelector ()
 Standard Destructor. More...
 
- Public Member Functions inherited from extends1< Service, IEvtSelector >
 extends1 (A1 a1, A2 a2, A3 a3)
 Templated constructor with 3 arguments. More...
 
 extends1 (A1 a1, A2 a2)
 Templated constructor with 2 arguments. More...
 
 extends1 (A1 a1)
 Templated constructor with 1 argument. More...
 
 extends1 ()
 Default constructor. More...
 
virtual void * i_cast (const InterfaceID &tid) const
 Implementation of IInterface::i_cast. More...
 
virtual StatusCode queryInterface (const InterfaceID &ti, void **pp)
 Implementation of IInterface::queryInterface. More...
 
virtual std::vector< std::string > getInterfaceNames () const
 Implementation of IInterface::getInterfaceNames. More...
 
virtual ~extends1 ()
 Virtual destructor. More...
 
- Public Member Functions inherited from Service
virtual unsigned long release ()
 Release Interface instance. More...
 
virtual const std::string & name () const
 Retrieve name of the service. More...
 
virtual StatusCode configure ()
 Configuration (from OFFLINE to CONFIGURED). More...
 
virtual StatusCode start ()
 Start (from INITIALIZED to RUNNING). More...
 
virtual StatusCode stop ()
 Stop (from RUNNING to INITIALIZED). More...
 
virtual StatusCode terminate ()
 Initialization (from CONFIGURED to OFFLINE). More...
 
virtual Gaudi::StateMachine::State FSMState () const
 Get the current state. More...
 
virtual Gaudi::StateMachine::State targetFSMState () const
 When we are in the middle of a transition, get the state where the transition is leading us. More...
 
virtual StatusCode reinitialize ()
 Initialization (from INITIALIZED or RUNNING to INITIALIZED, via CONFIGURED). More...
 
virtual StatusCode restart ()
 Initialization (from RUNNING to RUNNING, via INITIALIZED). More...
 
virtual StatusCode sysInitialize ()
 Initialize Service. More...
 
virtual StatusCode sysStart ()
 Initialize Service. More...
 
virtual StatusCode sysStop ()
 Initialize Service. More...
 
virtual StatusCode sysFinalize ()
 Finalize Service. More...
 
virtual StatusCode sysReinitialize ()
 Re-initialize the Service. More...
 
virtual StatusCode sysRestart ()
 Re-initialize the Service. More...
 
virtual StatusCode setProperty (const Property &p)
 Set the property by property. More...
 
virtual StatusCode setProperty (const std::string &s)
 Set the property by string. More...
 
virtual StatusCode setProperty (const std::string &n, const std::string &v)
 Set the property by std::string. More...
 
virtual StatusCode getProperty (Property *p) const
 Get the property by property. More...
 
virtual const PropertygetProperty (const std::string &name) const
 Get the property by name. More...
 
virtual StatusCode getProperty (const std::string &n, std::string &v) const
 Get the property by std::string. More...
 
virtual const std::vector
< Property * > & 
getProperties () const
 Get list of properties. More...
 
template<class TYPE >
StatusCode setProperty (const std::string &name, const TYPE &value)
 set the property form the value More...
 
 Service (const std::string &name, ISvcLocator *svcloc)
 Standard Constructor. More...
 
SmartIF< ISvcLocator > & serviceLocator () const
 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<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...
 
SmartIF< IAuditorSvc > & auditorSvc () const
 The standard auditor service.May not be invoked before sysInitialize() has been invoked. More...
 
- Public Member Functions inherited from CommonMessaging< implements3< IService, IProperty, IStateful > >
 CommonMessaging (const A1 &a1, const A2 &a2, const A3 &a3)
 Templated constructor with 3 arguments. More...
 
 CommonMessaging (const A1 &a1, const A2 &a2)
 Templated constructor with 2 arguments. More...
 
 CommonMessaging (const A1 &a1)
 Templated constructor with 1 argument. More...
 
 CommonMessaging ()
 Default constructor. More...
 
virtual ~CommonMessaging ()
 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...
 
bool msgLevel (MSG::Level lvl) const
 get the output level from the embedded MsgStream More...
 
- Public Member Functions inherited from extend_interfaces3< IService, IProperty, IStateful >
virtual ~extend_interfaces3 ()
 Virtual destructor. More...
 
- Public Member Functions inherited from IService
 DeclareInterfaceID (IService, 3, 0)
 InterfaceID. More...
 
virtual ~IService ()
 virtual destructor More...
 
- Public Member Functions inherited from INamedInterface
 DeclareInterfaceID (INamedInterface, 1, 0)
 InterfaceID. More...
 
virtual ~INamedInterface ()
 Virtual destructor (always needed for abstract classes). More...
 
- Public Member Functions inherited from IInterface
virtual unsigned long addRef ()=0
 Increment the reference count of Interface instance. More...
 
virtual unsigned long refCount () const =0
 Current reference count. More...
 
virtual ~IInterface ()
 Virtual destructor. More...
 
- Public Member Functions inherited from IProperty
 DeclareInterfaceID (IProperty, 2, 0)
 InterfaceID. More...
 
- Public Member Functions inherited from IStateful
 DeclareInterfaceID (IStateful, 1, 0)
 InterfaceID. More...
 
virtual ~IStateful ()
 
- Public Member Functions inherited from extend_interfaces1< IEvtSelector >
virtual ~extend_interfaces1 ()
 Virtual destructor. More...
 
- Public Member Functions inherited from IEvtSelector
 DeclareInterfaceID (IEvtSelector, 2, 0)
 InterfaceID. 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
 Service output level. More...
 
Gaudi::StateMachine::State m_state
 Service state. More...
 
Gaudi::StateMachine::State m_targetState
 Service state. More...
 
- Protected Attributes inherited from CommonMessaging< implements3< IService, IProperty, IStateful > >
SmartIF< IMessageSvcm_msgsvc
 Pointer to the message service;. More...
 
std::auto_ptr< MsgStreamm_msgStream
 The predefined message stream. More...
 
bool m_streamWithService
 Flag to create a new MsgStream if it was created without the message service. More...
 

Additional Inherited Members

- Public Types inherited from extends1< Service, IEvtSelector >
typedef extends1 base_class
 Typedef to this class. More...
 
typedef extend_interfaces1
< IEvtSelector
extend_interfaces_base
 Typedef to the base of this class. More...
 
typedef
extend_interfaces_base::ext_iids 
interfaces
 MPL set of all the implemented interfaces. More...
 
- Public Types inherited from Service
typedef
Gaudi::PluginService::Factory
< IService *, const
std::string &, ISvcLocator * > 
Factory
 
- Public Types inherited from CommonMessaging< implements3< IService, IProperty, IStateful > >
typedef CommonMessaging base_class
 
- Public Types inherited from implements3< IService, IProperty, IStateful >
typedef implements3 base_class
 Typedef to this class. More...
 
typedef extend_interfaces3
< IService, IProperty,
IStateful
extend_interfaces_base
 Typedef to the base of this class. More...
 
typedef
extend_interfaces_base::ext_iids 
interfaces
 MPL set of all the implemented interfaces. More...
 
- Public Types inherited from extend_interfaces3< IService, IProperty, IStateful >
typedef mpl::fold< typename
IService::iid::iids::type,
typename mpl::fold< typename
IProperty::iid::iids::type,
typename
IStateful::iid::iids::type,
mpl::insert< mpl::_1, mpl::_2 >
>::type, mpl::insert< mpl::_1,
mpl::_2 > >::type 
ext_iids
 MPL set of interfaces extended by this one. More...
 
- Public Types inherited from IInterface
enum  Status { SUCCESS = 1, NO_INTERFACE, VERSMISMATCH, LAST_ERROR }
 Return status. More...
 
typedef Gaudi::InterfaceId
< IInterface, 0, 0 > 
iid
 Interface ID. More...
 
typedef mpl::set1< iidext_iids
 Extra interfaces. More...
 
- Public Types inherited from extend_interfaces1< IEvtSelector >
typedef
IEvtSelector::iid::iids::type 
ext_iids
 MPL set of interfaces extended by this one. More...
 
- Static Public Member Functions inherited from IInterface
static const InterfaceIDinterfaceID ()
 Return an instance of InterfaceID identifying the interface. More...
 
- Protected Member Functions inherited from Service
virtual ~Service ()
 Standard Destructor. More...
 
int outputLevel () const
 get the Service's output level More...
 
- Protected Member Functions inherited from CommonMessaging< implements3< 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 76 of file EventCollectionSelector.cpp.

77  : base_class(name, svcloc)
78 {
79  declareProperty("CnvService", m_tupleSvcName = "EvtTupleSvc");
80  declareProperty("Authentication",m_authentication= "");
81  declareProperty("Container", m_cntName = "B2PiPi");
82  declareProperty("Item", m_itemName = "Address");
83  declareProperty("Criteria", m_criteria = "");
84  declareProperty("DB", m_database = "");
85  declareProperty("DbType", m_dbType = "");
86  declareProperty("DbService", m_dbSvc = "");
87  declareProperty("Function", m_statement= "NTuple::Selector");
88 }
std::string m_criteria
Criteria.
extends1 base_class
Typedef to this class.
Definition: extends.h:12
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.
virtual const std::string & name() const
Retrieve name of the service.
Definition: Service.cpp:331
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:211
std::string m_statement
Selector name.
EventCollectionSelector::~EventCollectionSelector ( )
virtual

Standard Destructor.

Definition at line 90 of file EventCollectionSelector.cpp.

90  {
91 }

Member Function Documentation

StatusCode EventCollectionSelector::connectCollection ( MyContextType ctxt) const
virtual

Connect collection to selector.

Definition at line 229 of file EventCollectionSelector.cpp.

230 {
231  if ( ctxt ) {
233  if ( status.isSuccess() ) {
234  status = connectTuple(m_cntName, m_itemName, ctxt->tuple, ctxt->item);
235  if ( status.isSuccess() ) {
236  status = connectStatement(m_statement, m_criteria, ctxt->tuple);
237  if ( status.isSuccess() ) {
238  *(ctxt->item) = 0;
239  return status;
240  }
241  }
242  }
243  return status;
244  }
245  return StatusCode::FAILURE;
246 }
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:75
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:30
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 117 of file EventCollectionSelector.cpp.

117  {
120  if ( svc.isValid( ) && db.length() > 0 ) {
121  std::string ident = name() + ' ';
122  ident += "DATAFILE='" + m_database.substr(5,m_database.length()) + "' ";
123  if ( !m_dbSvc.empty() )
124  ident += "SVC='" + m_dbSvc + "' ";
125  else
126  ident += "TYP='" + m_dbType + "' ";
127  ident += "OPT='READ' ";
128  if ( m_authentication.length() > 0 ) {
129  ident += "AUTH='" + m_authentication + "' ";
130  }
131  status = svc->connect(ident);
132  }
133  return status;
134 }
SmartIF< INTupleSvc > m_tupleSvc
Reference to Tuple service.
Small smart pointer class with automatic reference counting for IInterface.
Definition: IConverter.h:14
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:30
std::string m_dbType
Database type identifier.
virtual const std::string & name() const
Retrieve name of the service.
Definition: Service.cpp:331
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)
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 164 of file EventCollectionSelector.cpp.

164  {
165  std::string seltyp = typ;
166  if ( seltyp.length() > 0 || crit.length() > 0 ) {
167  if ( crit.length() > 0 && seltyp.length() == 0 ) seltyp = "NTuple::Selector";
168  SmartIF<ISelectStatement> stmt(ObjFactory::create(seltyp, serviceLocator()));
169  if ( stmt.isValid( ) ) {
170  if ( crit.length() > 0 ) stmt->setCriteria(crit);
171  tuple->attachSelector(stmt).ignore();
172  return StatusCode::SUCCESS;
173  }
174  return StatusCode::FAILURE;
175  }
176  return StatusCode::SUCCESS;
177 }
Small smart pointer class with automatic reference counting for IInterface.
Definition: IConverter.h:14
void ignore() const
Definition: StatusCode.h:107
virtual StatusCode attachSelector(ISelectStatement *sel)=0
Attach selector.
SmartIF< ISvcLocator > & serviceLocator() const
Retrieve pointer to service locator.
Definition: Service.cpp:336
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 138 of file EventCollectionSelector.cpp.

138  {
139  std::string top = "/NTUPLES/" + name() + '/' + nam;
140  StatusCode status = m_tupleSvc->retrieveObject(top, (DataObject*&)tup);
141  if ( status.isSuccess() ) {
142  item = new NTuple::Item<IOpaqueAddress*>();
143  status = tup->item(itName, *item);
144  if ( status.isSuccess() ) {
145  return status;
146  }
147  else {
148  MsgStream log(msgSvc(), name());
149  log << MSG::ERROR << "Item " << itName << " is not part of the collection:" << top << endmsg;
150  }
151  delete item;
152  item = 0;
153  }
154  else {
155  MsgStream err(msgSvc(), name());
156  err << MSG::ERROR << "Cannot connect to collection:" << top << endmsg;
157  }
158  tup = 0;
159  return status;
160 }
SmartIF< INTupleSvc > m_tupleSvc
Reference to Tuple service.
Definition of the MsgStream class used to transmit messages.
Definition: MsgStream.h:24
SmartIF< IMessageSvc > & msgSvc() const
The standard message service.
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:75
MsgStream & err() const
shortcut for the method msgStream(MSG::ERROR)
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:30
virtual const std::string & name() const
Retrieve name of the service.
Definition: Service.cpp:331
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:31
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
StatusCode EventCollectionSelector::createAddress ( const Context refCtxt,
IOpaqueAddress *&  refpAddr 
) const
virtual

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

Implements IEvtSelector.

Definition at line 327 of file EventCollectionSelector.cpp.

328 {
329  const MyContextType* ctxt = dynamic_cast<const MyContextType*>(&refCtxt);
330  if ( ctxt ) {
331  IOpaqueAddress* pA = *(ctxt->item);
332  if ( pA ) {
333  IOpaqueAddress* pAddress = 0;
334  StatusCode status = m_pAddrCreator->createAddress(pA->svcType(),
335  pA->clID(),
336  pA->par(),
337  pA->ipar(),
338  pAddress);
339  if ( status.isSuccess() ) {
340  refpAddr = pAddress;
341  return StatusCode::SUCCESS;
342  }
343  else {
344  MsgStream log(msgSvc(), name());
345  log << MSG::ERROR << "Failed to access " << pA->par()[0]
346  << ":" << pA->par()[1]
347  << " SvcTyp:" << long(pA->svcType())
348  << " CLID:" << pA->clID()
349  << endmsg;
350  }
351  }
352  }
353  return StatusCode::FAILURE;
354 }
virtual const std::string * par() const =0
Retrieve String parameters.
Definition of the MsgStream class used to transmit messages.
Definition: MsgStream.h:24
SmartIF< IMessageSvc > & msgSvc() const
The standard message service.
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:75
virtual long svcType() const =0
Retrieve service type.
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:30
virtual const std::string & name() const
Retrieve name of the service.
Definition: Service.cpp:331
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
virtual

Create a new event loop context.

Parameters
refpCtxt[IN/OUT] Reference to pointer to store the context
Returns
StatusCode indicating success or failure

Implements IEvtSelector.

Definition at line 258 of file EventCollectionSelector.cpp.

259 {
260  refpCtxt = 0;
261  std::auto_ptr<MyContextType> ctxt(new MyContextType());
262  StatusCode status = connectCollection(ctxt.get());
263  if( !status.isSuccess() ) {
264  MsgStream log(msgSvc(), name());
265  log << MSG::ERROR << "Unable to connect Collection file \"" << m_database << "\"" << endmsg;
266  return status;
267  }
268  refpCtxt = ctxt.release();
269  return StatusCode::SUCCESS;
270 }
Definition of the MsgStream class used to transmit messages.
Definition: MsgStream.h:24
SmartIF< IMessageSvc > & msgSvc() const
The standard message service.
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:75
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:30
virtual const std::string & name() const
Retrieve name of the service.
Definition: Service.cpp:331
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 ( )
virtual

Service override: Finalize Service.

Reimplemented from Service.

Definition at line 249 of file EventCollectionSelector.cpp.

249  {
250  // release services
251  m_pAddrCreator = 0;
252  m_tupleSvc = 0;
253  return Service::finalize();
254 }
SmartIF< INTupleSvc > m_tupleSvc
Reference to Tuple service.
SmartIF< IAddressCreator > m_pAddrCreator
virtual StatusCode finalize()
Finalize (from INITIALIZED to CONFIGURED).
Definition: Service.cpp:199
StatusCode EventCollectionSelector::getNextRecord ( NTuple::Tuple tuple) const
virtual

Read next record of the N-tuple.

Definition at line 180 of file EventCollectionSelector.cpp.

180  {
182  if ( 0 != tuple ) {
183  do {
184  status = m_tupleSvc->readRecord(tuple);
185  if ( status.isSuccess() ) {
186  ISelectStatement* statement = tuple->selector();
187  bool use_it = (statement) ? (*statement)(tuple) : true;
188  if ( use_it ) {
189  return status;
190  }
191  }
192  } while ( status.isSuccess() );
193  }
194  return status;
195 }
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:75
virtual ISelectStatement * selector()=0
Access selector.
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:30
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 198 of file EventCollectionSelector.cpp.

198  {
200  if ( tuple ) {
201  IRegistry* pReg = tuple->registry();
202  if ( pReg ) {
203  IOpaqueAddress* pAddr = pReg->address();
204  if ( pAddr ) {
205  long* ip = (long*)pAddr->ipar();
206  do {
207  if ( ip[1] > 1 ) {
208  ip[1] -= 2;
209  status = m_tupleSvc->readRecord(tuple);
210  if ( status.isSuccess() ) {
211  ISelectStatement* statement = tuple->selector();
212  bool use_it = (statement) ? (*statement)(tuple) : true;
213  if ( use_it ) {
214  return status;
215  }
216  }
217  }
218  else {
219  return StatusCode::FAILURE;
220  }
221  } while ( status.isSuccess() );
222  }
223  }
224  }
225  return StatusCode::FAILURE;
226 }
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:75
virtual ISelectStatement * selector()=0
Access selector.
IRegistry * registry() const
Get pointer to Registry.
Definition: DataObject.h:69
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:30
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.
Opaque address interface definition.
virtual const unsigned long * ipar() const =0
Access to generic link parameters.
StatusCode EventCollectionSelector::initialize ( )
virtual

Service override: Initialize service.

Reimplemented from Service.

Definition at line 94 of file EventCollectionSelector.cpp.

94  {
95  // Initialize base class
97  MsgStream log(msgSvc(), name());
98  if ( !status.isSuccess() ) {
99  log << MSG::ERROR << "Error initializing base class Service!" << endmsg;
100  return status;
101  }
102  m_pAddrCreator = serviceLocator()->service("EventPersistencySvc");
103  if(!m_pAddrCreator.isValid()) {
104  log << MSG::ERROR << "Unable to locate IAddressCreator interface of " << "EventPersistencySvc" << endmsg;
105  return status;
106  }
108  if( !m_tupleSvc.isValid() ) {
109  log << MSG::ERROR << "Unable to locate INTupleSvc interface of " << m_tupleSvcName << endmsg;
110  return status;
111  }
112  return status;
113 }
SmartIF< INTupleSvc > m_tupleSvc
Reference to Tuple service.
Definition of the MsgStream class used to transmit messages.
Definition: MsgStream.h:24
SmartIF< IMessageSvc > & msgSvc() const
The standard message service.
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:75
std::string m_tupleSvcName
Name of the event collection service name.
bool isValid() const
Allow for check if smart pointer is valid.
Definition: SmartIF.h:51
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:30
virtual const std::string & name() const
Retrieve name of the service.
Definition: Service.cpp:331
virtual StatusCode initialize()
Initialization (from CONFIGURED to INITIALIZED).
Definition: Service.cpp:74
SmartIF< IAddressCreator > m_pAddrCreator
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
SmartIF< ISvcLocator > & serviceLocator() const
Retrieve pointer to service locator.
Definition: Service.cpp:336
StatusCode EventCollectionSelector::last ( Context refCtxt) const
virtual

Access last item in the iteration.

Parameters
refCtxt[IN/OUT] Reference to the Context object.
Returns
StatusCode indicating success or failure

Implements IEvtSelector.

Definition at line 384 of file EventCollectionSelector.cpp.

385 {
386  return StatusCode::FAILURE;
387 }
StatusCode EventCollectionSelector::next ( Context refCtxt) const
virtual

Get next iteration item from the event loop context.

Parameters
refCtxt[IN/OUT] Reference to the context
Returns
StatusCode indicating success or failure

Implements IEvtSelector.

Definition at line 274 of file EventCollectionSelector.cpp.

275 {
276  return next(refCtxt, 1);
277 }
virtual StatusCode next(Context &refCtxt) const
Get next iteration item from the event loop context.
StatusCode EventCollectionSelector::next ( Context refCtxt,
int  jump 
) const
virtual

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

Implements IEvtSelector.

Definition at line 281 of file EventCollectionSelector.cpp.

282 {
283  MyContextType *ctxt = dynamic_cast<MyContextType*>(&refCtxt);
284  if ( ctxt ) {
285  *(ctxt->item) = ctxt->addressBuffer;
287  for ( int i=0; i<jump && sc.isSuccess(); ++i ) {
288  sc = getNextRecord(ctxt->tuple);
289  }
290  return sc;
291  }
292  return StatusCode::FAILURE;
293 }
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:30
list i
Definition: ana.py:128
StatusCode EventCollectionSelector::previous ( Context refCtxt) const
virtual

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

Implements IEvtSelector.

Definition at line 297 of file EventCollectionSelector.cpp.

298 {
299  return previous(refCtxt, 1);
300 }
virtual StatusCode previous(Context &refCtxt) const
Get previous iteration item from the event loop context.
StatusCode EventCollectionSelector::previous ( Context refCtxt,
int  jump 
) const
virtual

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

Implements IEvtSelector.

Definition at line 304 of file EventCollectionSelector.cpp.

305 {
306  MyContextType *ctxt = dynamic_cast<MyContextType*>(&refCtxt);
307  if ( ctxt ) {
308  *(ctxt->item) = ctxt->addressBuffer;
310  for ( int i=0; i<jump && sc.isSuccess(); ++i ) {
311  sc = getPreviousRecord(ctxt->tuple);
312  }
313  return sc;
314  }
315  return StatusCode::FAILURE;
316 }
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:30
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
virtual

Release existing event iteration context.

Parameters
refCtxt[IN/OUT] Reference to the context
Returns
StatusCode indicating success or failure

Implements IEvtSelector.

Definition at line 358 of file EventCollectionSelector.cpp.

359 {
360  MyContextType *ctxt = dynamic_cast<MyContextType*>(refCtxt);
361  if ( ctxt ) {
362  delete ctxt;
363  ctxt = 0;
364  return StatusCode::SUCCESS;
365  }
366  return StatusCode::FAILURE;
367 }
StatusCode EventCollectionSelector::resetCriteria ( const std::string &  cr,
Context refCtxt 
) const
virtual

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

Implements IEvtSelector.

Definition at line 372 of file EventCollectionSelector.cpp.

373 {
374  MyContextType *ctxt = dynamic_cast<MyContextType*>(&refCtxt);
375  if ( ctxt ) {
376  ctxt->criteria = cr;
377  return StatusCode::SUCCESS;
378  }
379  return StatusCode::FAILURE;
380 }
StatusCode EventCollectionSelector::rewind ( Context refCtxt) const
virtual

Rewind the dataset.

Parameters
refCtxt[IN/OUT] Reference to the context
Returns
StatusCode indicating success or failure

Implements IEvtSelector.

Definition at line 320 of file EventCollectionSelector.cpp.

321 {
322  return StatusCode::FAILURE;
323 }

Member Data Documentation

std::string EventCollectionSelector::m_authentication
protected

Authentication string (if needed)

Definition at line 84 of file EventCollectionSelector.h.

std::string EventCollectionSelector::m_cntName
protected

Container name.

Definition at line 86 of file EventCollectionSelector.h.

std::string EventCollectionSelector::m_criteria
protected

Criteria.

Definition at line 90 of file EventCollectionSelector.h.

std::string EventCollectionSelector::m_database
protected

Datafile name.

Definition at line 92 of file EventCollectionSelector.h.

std::string EventCollectionSelector::m_dbSvc
protected

Database service (exclusive property with db type)

Definition at line 96 of file EventCollectionSelector.h.

std::string EventCollectionSelector::m_dbType
protected

Database type identifier.

Definition at line 94 of file EventCollectionSelector.h.

std::string EventCollectionSelector::m_itemName
protected

Item name.

Definition at line 88 of file EventCollectionSelector.h.

SmartIF<IAddressCreator> EventCollectionSelector::m_pAddrCreator
mutableprotected

Definition at line 80 of file EventCollectionSelector.h.

std::string EventCollectionSelector::m_statement
protected

Selector name.

Definition at line 98 of file EventCollectionSelector.h.

SmartIF<INTupleSvc> EventCollectionSelector::m_tupleSvc
mutableprotected

Reference to Tuple service.

Definition at line 79 of file EventCollectionSelector.h.

std::string EventCollectionSelector::m_tupleSvcName
protected

Name of the event collection service name.

Definition at line 82 of file EventCollectionSelector.h.


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