All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Gaudi::RootEvtSelector Class Reference

Concrete event selector implementation to access ROOT files. More...

#include <GAUDIROOT/RootEvtSelector.h>

Inheritance diagram for Gaudi::RootEvtSelector:
Collaboration diagram for Gaudi::RootEvtSelector:

Public Member Functions

 RootEvtSelector (const std::string &name, ISvcLocator *svcloc)
 Service Constructor. More...
 
virtual ~RootEvtSelector ()
 Standard destructor. More...
 
virtual StatusCode initialize ()
 IService implementation: Db event selector override. More...
 
virtual StatusCode finalize ()
 IService implementation: Service finalization. More...
 
virtual StatusCode createContext (Context *&refpCtxt) const
 Create a new event loop context. More...
 
virtual StatusCode last (Context &refContext) const
 Access last item in the iteration. 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 *&) 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...
 
- 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

RootCnvSvcm_dbMgr
 Reference to the corresponding conversion service. More...
 
CLID m_rootCLID
 Class id of root node to create opaque address. More...
 
std::string m_persName
 Property; Name of the persistency service to search for conversion service. More...
 
std::string m_cnvSvcName
 Property; Name of the concversion service used to create opaque addresses. More...
 
std::string m_rootName
 Property: Name of the ROOT entry name. More...
 
std::string m_criteria
 Property: File criteria to define item iteration. More...
 
std::string m_dummy
 Property: dummy to fake backwards compatibility. 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...
 

Private Member Functions

StatusCode error (const std::string &msg) const
 Helper method to issue error messages. 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

Concrete event selector implementation to access ROOT files.

Author
M.Frank
Version
1.0
Date
20/12/2009

Definition at line 41 of file RootEvtSelector.h.

Constructor & Destructor Documentation

RootEvtSelector::RootEvtSelector ( const std::string &  name,
ISvcLocator svcloc 
)

Service Constructor.

Definition at line 100 of file RootEvtSelector.cpp.

101 : base_class(name, svcloc), m_rootCLID(CLID_NULL)
102 {
103  m_cnvSvcName = "Gaudi::RootCnvSvc/RootCnvSvc";
104  m_persName = "EventPersistencySvc";
105  declareProperty("EvtPersistencySvc",m_persName="EventPersistencySvc");
106  declareProperty("DbType",m_dummy);
107 }
std::string m_persName
Property; Name of the persistency service to search for conversion service.
std::string m_dummy
Property: dummy to fake backwards compatibility.
extends1 base_class
Typedef to this class.
Definition: extends.h:12
std::string m_cnvSvcName
Property; Name of the concversion service used to create opaque addresses.
virtual const std::string & name() const
Retrieve name of the service.
Definition: Service.cpp:331
Property * declareProperty(const std::string &name, T &property, const std::string &doc="none") const
Declare the named property.
Definition: Service.h:211
CLID m_rootCLID
Class id of root node to create opaque address.
virtual Gaudi::RootEvtSelector::~RootEvtSelector ( )
inlinevirtual

Standard destructor.

Definition at line 51 of file RootEvtSelector.h.

51 {}

Member Function Documentation

StatusCode RootEvtSelector::createAddress ( const Context refCtxt,
IOpaqueAddress *&  pAddr 
) const
virtual

Create new Opaque address corresponding to the current record.

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

Implements IEvtSelector.

Definition at line 272 of file RootEvtSelector.cpp.

272  {
273  const RootEvtSelectorContext* pctxt = dynamic_cast<const RootEvtSelectorContext*>(&ctxt);
274  if ( pctxt ) {
275  long ent = pctxt->entry();
276  if ( ent >= 0 ) {
277  RootEvtSelectorContext::Files::const_iterator fileit = pctxt->fileIterator();
278  if ( fileit != pctxt->files().end() ) {
279  const string par[2] = {pctxt->fid(), m_rootName};
280  const unsigned long ipar[2] = {0,(unsigned long)ent};
281  return m_dbMgr->createAddress(m_dbMgr->repSvcType(),m_rootCLID,&par[0],&ipar[0],pAddr);
282  }
283  }
284  }
285  pAddr = 0;
286  return StatusCode::FAILURE;
287 }
const Files & files() const
Access to the file container.
Files::const_iterator fileIterator() const
Access to the file iterator.
virtual StatusCode createAddress(long svc_type, const CLID &clid, const std::string *par, const unsigned long *ip, IOpaqueAddress *&refpAddress)
IAddressCreator implementation: Address creation.
Definition: RootCnvSvc.cpp:391
RootCnvSvc * m_dbMgr
Reference to the corresponding conversion service.
virtual long repSvcType() const
Retrieve the class type of the data store the converter uses.
ROOT specific event selector context.
const std::string & fid() const
Access connection fid.
CLID m_rootCLID
Class id of root node to create opaque address.
long entry() const
Access to the current event entry number.
std::string m_rootName
Property: Name of the ROOT entry name.
StatusCode RootEvtSelector::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 165 of file RootEvtSelector.cpp.

165  {
166  refpCtxt = new RootEvtSelectorContext(this);
167  return StatusCode::SUCCESS;
168 }
ROOT specific event selector context.
StatusCode RootEvtSelector::error ( const std::string &  msg) const
private

Helper method to issue error messages.

Definition at line 110 of file RootEvtSelector.cpp.

110  {
111  MsgStream log(msgSvc(), name());
112  log << MSG::ERROR << msg << endmsg;
113  return StatusCode::FAILURE;
114 }
Definition of the MsgStream class used to transmit messages.
Definition: MsgStream.h:24
SmartIF< IMessageSvc > & msgSvc() const
The standard message service.
MsgStream & msg() const
shortcut for the method msgStream(MSG::INFO)
virtual const std::string & name() const
Retrieve name of the service.
Definition: Service.cpp:331
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
StatusCode RootEvtSelector::finalize ( )
virtual

IService implementation: Service finalization.

Reimplemented from Service.

Definition at line 157 of file RootEvtSelector.cpp.

157  {
158  // Initialize base class
159  if ( m_dbMgr ) m_dbMgr->release();
160  m_dbMgr = 0; // release
161  return Service::finalize();
162 }
RootCnvSvc * m_dbMgr
Reference to the corresponding conversion service.
virtual unsigned long release()
Release Interface instance.
Definition: Service.cpp:24
virtual StatusCode finalize()
Finalize (from INITIALIZED to CONFIGURED).
Definition: Service.cpp:199
StatusCode RootEvtSelector::initialize ( )
virtual

IService implementation: Db event selector override.

Reimplemented from Service.

Definition at line 117 of file RootEvtSelector.cpp.

117  {
118  // Initialize base class
119  StatusCode status = Service::initialize();
120  if ( !status.isSuccess() ) {
121  return error("Error initializing base class Service!");
122  }
123 
125  if( !ipers.isValid() ) {
126  return error("Unable to locate IPersistencySvc interface of "+m_persName);
127  }
128  IConversionSvc *cnvSvc = 0;
130  status = ipers->getService(itm.name(),cnvSvc);
131  if( !status.isSuccess() ) {
132  status = ipers->getService(itm.type(),cnvSvc);
133  if( !status.isSuccess() ) {
134  return error("Unable to locate IConversionSvc interface of database type "+m_cnvSvcName);
135  }
136  }
137  m_dbMgr = dynamic_cast<RootCnvSvc*>(cnvSvc);
138  if( !m_dbMgr ) {
139  cnvSvc->release();
140  return error("Unable to localize service:"+m_cnvSvcName);
141  }
142  m_dbMgr->addRef();
143 
144  // Get DataSvc
145  SmartIF<IDataManagerSvc> eds(serviceLocator()->service("EventDataSvc"));
146  if( !eds.isValid() ) {
147  return error("Unable to localize service EventDataSvc");
148  }
149  m_rootCLID = eds->rootCLID();
150  m_rootName = eds->rootName();
151  MsgStream log(msgSvc(), name());
152  log << MSG::DEBUG << "Selection root:" << m_rootName << " CLID:" << m_rootCLID << endmsg;
153  return status;
154 }
Definition of the MsgStream class used to transmit messages.
Definition: MsgStream.h:24
std::string m_persName
Property; Name of the persistency service to search for conversion service.
Small smart pointer class with automatic reference counting for IInterface.
Definition: IConverter.h:14
tuple itm
Definition: ana.py:57
SmartIF< IMessageSvc > & msgSvc() const
The standard message service.
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:62
Description:
Definition: RootCnvSvc.h:54
RootCnvSvc * m_dbMgr
Reference to the corresponding conversion service.
Helper class to parse a string of format "type/name".
Definition: TypeNameString.h:9
std::string m_cnvSvcName
Property; Name of the concversion service used to create opaque addresses.
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 unsigned long release()=0
Release Interface instance.
virtual StatusCode initialize()
Initialization (from CONFIGURED to INITIALIZED).
Definition: Service.cpp:74
virtual unsigned long addRef()=0
Increment the reference count of Interface instance.
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.
Definition: Service.h:142
CLID m_rootCLID
Class id of root node to create opaque address.
MsgStream & error() const
shortcut for the method msgStream(MSG::ERROR)
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
std::string m_rootName
Property: Name of the ROOT entry name.
SmartIF< ISvcLocator > & serviceLocator() const
Retrieve pointer to service locator.
Definition: Service.cpp:336
StatusCode RootEvtSelector::last ( Context refContext) const
virtual

Access last item in the iteration.

Parameters
refContext[IN/OUT] Reference to the Context object.

Implements IEvtSelector.

Definition at line 171 of file RootEvtSelector.cpp.

171  {
172  return StatusCode::FAILURE;
173 }
StatusCode RootEvtSelector::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 176 of file RootEvtSelector.cpp.

176  {
177  RootEvtSelectorContext* pCtxt = dynamic_cast<RootEvtSelectorContext*>(&ctxt);
178  if ( pCtxt ) {
179  TBranch* b = pCtxt->branch();
180  if ( !b ) {
181  RootEvtSelectorContext::Files::const_iterator fileit = pCtxt->fileIterator();
182  pCtxt->setBranch(0);
183  pCtxt->setEntry(-1);
184  if ( fileit != pCtxt->files().end() ) {
185  RootDataConnection* con=0;
186  string in = *fileit;
188  if ( sc.isSuccess() ) {
189  string section = m_rootName[0] == '/' ? m_rootName.substr(1) : m_rootName;
190  b = con->getBranch(section,m_rootName);
191  if ( b ) {
192  pCtxt->setFID(con->fid());
193  pCtxt->setBranch(b);
194  return next(ctxt);
195  }
196  }
197  m_dbMgr->disconnect(in).ignore();
198  pCtxt->setFileIterator(++fileit);
199  return next(ctxt);
200  }
201  return StatusCode::FAILURE;
202  }
203  long ent = pCtxt->entry();
204  Long64_t nent = b->GetEntries();
205  if ( nent > (ent+1) ) {
206  pCtxt->setEntry(++ent);
207  return StatusCode::SUCCESS;
208  }
209  RootEvtSelectorContext::Files::const_iterator fit = pCtxt->fileIterator();
210  pCtxt->setFileIterator(++fit);
211  pCtxt->setEntry(-1);
212  pCtxt->setBranch(0);
213  pCtxt->setFID("");
214  return next(ctxt);
215  }
216  return StatusCode::FAILURE;
217 }
const Files & files() const
Access to the file container.
Files::const_iterator fileIterator() const
Access to the file iterator.
const std::string & fid() const
Access file id.
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:62
StatusCode connectDatabase(const std::string &dataset, int mode, RootDataConnection **con)
Connect the output file to the service with open mode.
Definition: RootCnvSvc.cpp:224
RootCnvSvc * m_dbMgr
Reference to the corresponding conversion service.
ROOT specific event selector context.
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:30
TBranch * getBranch(const std::string &section, const std::string &branch_name)
Access data branch by name: Get existing branch in read only mode.
virtual StatusCode disconnect(const std::string &dbName)
Disconnect from an existing data stream.
Definition: RootCnvSvc.cpp:385
void setBranch(TBranch *b)
Set the top level branch (typically /Event) used to iterate.
void setEntry(long e)
Set current event entry number.
void setFID(const std::string &fid)
Set connection FID.
void setFileIterator(Files::const_iterator i)
Set file iterator.
TBranch * branch() const
Access to the top level branch (typically /Event) used to iterate.
void ignore() const
Definition: StatusCode.h:94
Concrete implementation of the IDataConnection interface to access ROOT files.
long entry() const
Access to the current event entry number.
virtual StatusCode next(Context &refCtxt) const
Get next iteration item from the event loop context.
std::string m_rootName
Property: Name of the ROOT entry name.
StatusCode RootEvtSelector::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 220 of file RootEvtSelector.cpp.

220  {
221  if ( jump > 0 ) {
222  for ( int i = 0; i < jump; ++i ) {
223  StatusCode status = next(ctxt);
224  if ( !status.isSuccess() ) {
225  return status;
226  }
227  }
228  return StatusCode::SUCCESS;
229  }
230  return StatusCode::FAILURE;
231 }
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:62
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:30
list i
Definition: ana.py:128
virtual StatusCode next(Context &refCtxt) const
Get next iteration item from the event loop context.
StatusCode RootEvtSelector::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 234 of file RootEvtSelector.cpp.

234  {
235  return error("EventSelector Iterator, operator -- not supported ");
236 }
MsgStream & error() const
shortcut for the method msgStream(MSG::ERROR)
StatusCode RootEvtSelector::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 239 of file RootEvtSelector.cpp.

239  {
240  if ( jump > 0 ) {
241  for ( int i = 0; i < jump; ++i ) {
242  StatusCode status = previous(ctxt);
243  if ( !status.isSuccess() ) {
244  return status;
245  }
246  }
247  return StatusCode::SUCCESS;
248  }
249  return StatusCode::FAILURE;
250 }
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:62
virtual StatusCode previous(Context &refCtxt) const
Get previous iteration item from the event loop context.
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:30
list i
Definition: ana.py:128
StatusCode RootEvtSelector::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 290 of file RootEvtSelector.cpp.

290  {
291  RootEvtSelectorContext* pCtxt = dynamic_cast<RootEvtSelectorContext*>(ctxt);
292  if ( pCtxt ) {
293  delete pCtxt;
294  return StatusCode::SUCCESS;
295  }
296  return StatusCode::FAILURE;
297 }
ROOT specific event selector context.
StatusCode RootEvtSelector::resetCriteria ( const std::string &  cr,
Context c 
) 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.

Implements IEvtSelector.

Definition at line 302 of file RootEvtSelector.cpp.

303 {
304  MsgStream log(msgSvc(), name());
305  RootEvtSelectorContext* ctxt = dynamic_cast<RootEvtSelectorContext*>(&context);
306  string db, typ, item, sel, stmt, aut, addr;
307  if ( ctxt ) {
308  if ( criteria.substr(0,5) == "FILE " ) {
309  // The format for the criteria is:
310  // FILE filename1, filename2 ...
311  db = criteria.substr(5);
312  }
313  else {
314  Tokenizer tok(true);
315  tok.analyse(criteria," ","","","=","'","'");
316  for(Tokenizer::Items::iterator i=tok.items().begin(); i!=tok.items().end();i++) {
317  string tmp = (*i).tag().substr(0,3);
318  if(tmp=="DAT") {
319  db = (*i).value();
320  }
321  if(tmp=="OPT") {
322  if((*i).value() != "REA") {
323  log << MSG::ERROR << "Option:\"" << (*i).value() << "\" not valid" << endmsg;
324  return StatusCode::FAILURE;
325  }
326  }
327  if (tmp=="TYP") {
328  typ = (*i).value();
329  }
330  if(tmp=="ADD") {
331  item = (*i).value();
332  }
333  if(tmp=="SEL") {
334  sel = (*i).value();
335  }
336  if(tmp=="FUN") {
337  stmt = (*i).value();
338  }
339  if(tmp=="AUT") {
340  aut = (*i).value();
341  }
342  if(tmp=="COL") {
343  addr = (*i).value();
344  }
345  }
346  }
347  // It's now time to parse the criteria for the event selection
348  // The format for the criteria is:
349  // FILE filename1, filename2 ...
350  // JOBID number1-number2, number3, ...
352  string rest = db;
353  files.clear();
354  while(true) {
355  int ipos = rest.find_first_not_of(" ,");
356  if (ipos == -1 ) break;
357  rest = rest.substr(ipos,string::npos);// remove blanks before
358  int lpos = rest.find_first_of(" ,"); // locate next blank
359  files.push_back(rest.substr(0,lpos )); // insert in list
360  if (lpos == -1 ) break;
361  rest = rest.substr(lpos,string::npos);// get the rest
362  }
363  ctxt->setFiles(files);
364  ctxt->setFileIterator(ctxt->files().begin());
365  return StatusCode::SUCCESS;
366  }
367  return error("Invalid iteration context.");
368 }
Definition of the MsgStream class used to transmit messages.
Definition: MsgStream.h:24
const Files & files() const
Access to the file container.
std::vector< std::string > Files
Definition of the file container.
SmartIF< IMessageSvc > & msgSvc() const
The standard message service.
ROOT specific event selector context.
STL Include files.
Definition: Tokenizer.h:24
virtual const std::string & name() const
Retrieve name of the service.
Definition: Service.cpp:331
void setFiles(const Files &f)
Set the file container.
tuple item
print s1,s2
Definition: ana.py:146
void setFileIterator(Files::const_iterator i)
Set file iterator.
list i
Definition: ana.py:128
MsgStream & error() const
shortcut for the method msgStream(MSG::ERROR)
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
StatusCode RootEvtSelector::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 253 of file RootEvtSelector.cpp.

253  {
254  RootEvtSelectorContext* pCtxt = dynamic_cast<RootEvtSelectorContext*>(&ctxt);
255  if ( pCtxt ) {
256  RootEvtSelectorContext::Files::const_iterator fileit = pCtxt->fileIterator();
257  if ( fileit != pCtxt->files().end() ) {
258  string input = *fileit;
259  m_dbMgr->disconnect(input).ignore();
260  }
261  pCtxt->setFID("");
262  pCtxt->setEntry(-1);
263  pCtxt->setBranch(0);
264  pCtxt->setFileIterator(pCtxt->files().begin());
265  return StatusCode::SUCCESS;
266  }
267  return StatusCode::FAILURE;
268 }
const Files & files() const
Access to the file container.
Files::const_iterator fileIterator() const
Access to the file iterator.
RootCnvSvc * m_dbMgr
Reference to the corresponding conversion service.
ROOT specific event selector context.
virtual StatusCode disconnect(const std::string &dbName)
Disconnect from an existing data stream.
Definition: RootCnvSvc.cpp:385
void setBranch(TBranch *b)
Set the top level branch (typically /Event) used to iterate.
void setEntry(long e)
Set current event entry number.
void setFID(const std::string &fid)
Set connection FID.
void setFileIterator(Files::const_iterator i)
Set file iterator.
void ignore() const
Definition: StatusCode.h:94

Member Data Documentation

std::string Gaudi::RootEvtSelector::m_cnvSvcName
protected

Property; Name of the concversion service used to create opaque addresses.

Definition at line 138 of file RootEvtSelector.h.

std::string Gaudi::RootEvtSelector::m_criteria
protected

Property: File criteria to define item iteration.

Definition at line 142 of file RootEvtSelector.h.

RootCnvSvc* Gaudi::RootEvtSelector::m_dbMgr
mutableprotected

Reference to the corresponding conversion service.

Definition at line 132 of file RootEvtSelector.h.

std::string Gaudi::RootEvtSelector::m_dummy
protected

Property: dummy to fake backwards compatibility.

Definition at line 144 of file RootEvtSelector.h.

std::string Gaudi::RootEvtSelector::m_persName
protected

Property; Name of the persistency service to search for conversion service.

Definition at line 136 of file RootEvtSelector.h.

CLID Gaudi::RootEvtSelector::m_rootCLID
protected

Class id of root node to create opaque address.

Definition at line 134 of file RootEvtSelector.h.

std::string Gaudi::RootEvtSelector::m_rootName
protected

Property: Name of the ROOT entry name.

Definition at line 140 of file RootEvtSelector.h.


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