| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

In This Package:

RootIOEvtSelector Class Reference

Example event selector for RootIO. More...

#include <RootIOEvtSelector.h>

Inheritance diagram for RootIOEvtSelector:

[legend]
Collaboration diagram for RootIOEvtSelector:
[legend]
List of all members.

Public Types

 SUCCESS
 NO_INTERFACE
 VERSMISMATCH
 LAST_ERROR
enum  Status
 SUCCESS
 NO_INTERFACE
 VERSMISMATCH
 LAST_ERROR
enum  Status

Public Member Functions

 RootIOEvtSelector (const std::string &name, ISvcLocator *svcloc)
virtual ~RootIOEvtSelector ()
virtual StatusCode setEntry (RootIOEvtSelector::Context &rc, int entry) const
 This will be called from the IEvtSelector navigation methods with the context prior to navigation (old entry) and the new entry.
virtual StatusCode initialize ()
virtual StatusCode finalize ()
virtual StatusCode createContext (IEvtSelector::Context *&c) const
 Create and return a context object that will keep track of the state of selection.
virtual StatusCode next (IEvtSelector::Context &c) const
 Fetch the next event or the first event if it will be use soon after the creation of the context.
virtual StatusCode next (IEvtSelector::Context &c, int jump) const
 Same of next(const Context&) plus the possibility to jump the next n-1 events.
virtual StatusCode previous (IEvtSelector::Context &c) const
 Fetch the previous event.
virtual StatusCode previous (IEvtSelector::Context &c, int jump) const
 Same of previous(Context& c) the possibility to jump the previous n-1 events.
virtual StatusCode last (IEvtSelector::Context &refContext) const
 Access last item in the iteration.
virtual StatusCode rewind (IEvtSelector::Context &c) const
 Will set the state of the context in a way that the next event read is the first of the list.
virtual StatusCode createAddress (const IEvtSelector::Context &c, IOpaqueAddress *&iop) const
 Create an IOpaqueAddress object from the event fetched.
virtual StatusCode releaseContext (IEvtSelector::Context *&c) const
 Release the Context object.
virtual StatusCode resetCriteria (const std::string &cr, IEvtSelector::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.
StatusCode queryInterface (const InterfaceID &riid, void **ppif)
virtual unsigned long addRef ()
virtual unsigned long release ()
virtual const std::string & name () const
virtual const InterfaceIDtype () const
virtual StatusCode configure ()
virtual StatusCode start ()
virtual StatusCode stop ()
virtual StatusCode terminate ()
virtual Gaudi::StateMachine::State FSMState () const
virtual Gaudi::StateMachine::State targetFSMState () const
virtual StatusCode reinitialize ()
virtual StatusCode restart ()
virtual StatusCode sysInitialize ()
virtual StatusCode sysStart ()
virtual StatusCode sysStop ()
virtual StatusCode sysFinalize ()
virtual StatusCode sysReinitialize ()
virtual StatusCode sysRestart ()
virtual StatusCode setProperty (const Property &p)
virtual StatusCode setProperty (const std::string &s)
virtual StatusCode setProperty (const std::string &n, const std::string &v)
StatusCode setProperty (const std::string &name, const TYPE &value)
virtual StatusCode getProperty (Property *p) const
virtual const PropertygetProperty (const std::string &name) const
virtual StatusCode getProperty (const std::string &n, std::string &v) const
virtual const std::vector<
Property * > & 
getProperties () const
ISvcLocatorserviceLocator () const
IMessageSvcmsgSvc ()
IMessageSvcmsgSvc () const
IMessageSvcmessageService ()
IMessageSvcmessageService () const
StatusCode setProperties ()
StatusCode service (const std::string &name, T *&psvc, bool createIf=true) const
StatusCode service (const std::string &svcType, const std::string &svcName, T *&psvc) const
PropertydeclareProperty (const std::string &name, T &property, const std::string &doc="none") const
PropertydeclareRemoteProperty (const std::string &name, IProperty *rsvc, const std::string &rname="") const
IAuditorSvcauditorSvc () const
virtual unsigned long addRef ()=0
virtual unsigned long release ()=0

Static Public Member Functions

static const InterfaceIDinterfaceID ()
static const InterfaceIDinterfaceID ()
static const InterfaceIDinterfaceID ()
static const InterfaceIDinterfaceID ()

Public Attributes

 SUCCESS
 NO_INTERFACE
 VERSMISMATCH
 LAST_ERROR

Protected Member Functions

int outputLevel () const

Protected Attributes

IRootIOSvcm_rioSvc
IntegerProperty m_outputLevel
Gaudi::StateMachine::State m_state
Gaudi::StateMachine::State m_targetState
IMessageSvcm_messageSvc

Friends

friend class ServiceManager

Classes

class  Context

Detailed Description

Example event selector for RootIO.

This loads in all input streams and assume each are to be kept in lock-step sync.

bv@bnl.gov Thu Jul 3 11:00:03 2008

Definition at line 20 of file RootIOEvtSelector.h.


Constructor & Destructor Documentation

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

RootIOEvtSelector::~RootIOEvtSelector (  )  [virtual]

Definition at line 19 of file RootIOEvtSelector.cc.

00020 {
00021     MsgStream log(msgSvc(), "RootIOEvtSelector");
00022     log << MSG::DEBUG << "RootIOEvtSelector::~RootIOEvtSelector()" << endreq;
00023 }


Member Function Documentation

StatusCode RootIOEvtSelector::setEntry ( RootIOEvtSelector::Context rc,
int  entry 
) const [virtual]

This will be called from the IEvtSelector navigation methods with the context prior to navigation (old entry) and the new entry.

By default this sets the context to the new entry and then loads all possible input streams to that entry.

Subclasses may override this method to enforce some other input policy.

Definition at line 116 of file RootIOEvtSelector.cc.

00117 {
00118     MsgStream log(msgSvc(), "RootIOEvtSelector");
00119     log << MSG::DEBUG << "setEntry(" << entry << ")" << endreq;
00120 
00121     IRootIOSvc::InputStreamMap& ism = m_rioSvc->inputStreams();
00122     IRootIOSvc::InputStreamMap::iterator it, done = ism.end();
00123     int errors = 0;
00124     for (it = ism.begin(); it != done; ++it) {
00125         RootInputStream* ris = it->second;
00126         bool okay = ris->setEntry(entry);
00127         if (!okay) {
00128             log << MSG::WARNING
00129                 << "setEntry("<<entry<<") failed to set entry on input stream for " 
00130                 << it->first << endreq;
00131             ++errors;
00132             continue;
00133         }
00134     }
00135 
00136     if (errors) return StatusCode::FAILURE;
00137     rc.m_entry = entry;
00138     return StatusCode::SUCCESS;
00139 }

StatusCode RootIOEvtSelector::initialize (  )  [virtual]

Reimplemented from Service.

Definition at line 25 of file RootIOEvtSelector.cc.

00026 {
00027     MsgStream log(msgSvc(), "RootIOEvtSelector");
00028     log << MSG::DEBUG << "initializing @" << (void*)this << endreq;
00029     log << MSG::DEBUG << "called " << this->name() << endreq;
00030 
00031     StatusCode sc = this->Service::initialize();
00032     if (sc.isFailure()) return sc;
00033 
00034     IService* isvc=0;
00035     sc = serviceLocator()->service("RootIOCnvSvc", isvc, false);
00036     //sc = serviceLocator()->service("EventPersistencySvc", isvc, false);
00037     if (sc.isFailure()) {
00038         log << MSG::ERROR << "Conversion service RootIOCnvSvc"
00039             << " could not be retrieved" << endreq;
00040         return sc;
00041     }
00042     isvc->addRef();
00043 
00044     sc = isvc->queryInterface(IRootIOSvc::interfaceID(), (void**)&m_rioSvc);
00045     if (sc.isFailure()) {
00046         log << MSG::ERROR << "Conversion service RootIOCnvSvc"
00047             << " does not implement IRootIOCnvSvc" << endreq;
00048         return sc;
00049     }
00050 
00051     log << MSG::DEBUG << "initialized @" << (void*)this
00052         << " got RootIOCnvSvc @" << (void*)m_rioSvc
00053         << endreq;
00054     return sc;
00055 }

StatusCode RootIOEvtSelector::finalize (  )  [virtual]

Reimplemented from Service.

Definition at line 56 of file RootIOEvtSelector.cc.

00057 {
00058     return this->Service::finalize();
00059 }

StatusCode RootIOEvtSelector::createContext ( IEvtSelector::Context *&  c  )  const [virtual]

Create and return a context object that will keep track of the state of selection.

Parameters:
c Reference of a pointer to a Context object.

Implements IEvtSelector.

Definition at line 62 of file RootIOEvtSelector.cc.

00063 {
00064     MsgStream log(msgSvc(), "RootIOEvtSelector");
00065     log << MSG::DEBUG << "createContext" << endreq;
00066 
00067     c = new RootIOEvtSelector::Context(this);
00068     return StatusCode::SUCCESS;
00069 }

StatusCode RootIOEvtSelector::next ( IEvtSelector::Context c  )  const [virtual]

Fetch the next event or the first event if it will be use soon after the creation of the context.

It will return StatusCode::FAILURE if there have been problem in the fetching or it has been reached the end of the list of events.

Parameters:
c Reference to the Context object.

Implements IEvtSelector.

Definition at line 71 of file RootIOEvtSelector.cc.

00072 {
00073     MsgStream log(msgSvc(), "RootIOEvtSelector");
00074     log << MSG::DEBUG << "next" << endreq;
00075     return this->next(c,1);
00076 }

StatusCode RootIOEvtSelector::next ( IEvtSelector::Context c,
int  jump 
) const [virtual]

Same of next(const Context&) plus the possibility to jump the next n-1 events.

Parameters:
c Reference to the Context object.
jump The event to jump to from the current event.

Implements IEvtSelector.

Definition at line 78 of file RootIOEvtSelector.cc.

00079 {
00080     MsgStream log(msgSvc(), "RootIOEvtSelector");
00081     log << MSG::DEBUG << "next(" << jump << ")" << endreq;
00082     RootIOEvtSelector::Context* rc = 
00083         dynamic_cast<RootIOEvtSelector::Context*>(&c);
00084     if (!rc) return StatusCode::FAILURE;
00085     return this->setEntry(*rc,rc->m_entry+jump);
00086 }

StatusCode RootIOEvtSelector::previous ( IEvtSelector::Context c  )  const [virtual]

Fetch the previous event.

It will return StatusCode::FAILURE if there have been problem in the fetching or it has been reached the begin of the list of events.

Parameters:
c Reference to the Context object.

Implements IEvtSelector.

Definition at line 88 of file RootIOEvtSelector.cc.

00089 {
00090     return this->previous(c,1);
00091 }

StatusCode RootIOEvtSelector::previous ( IEvtSelector::Context c,
int  jump 
) const [virtual]

Same of previous(Context& c) the possibility to jump the previous n-1 events.

Parameters:
c Reference to the Context object.
jump The event to jump to from the current event.

Implements IEvtSelector.

Definition at line 93 of file RootIOEvtSelector.cc.

00094 {
00095     RootIOEvtSelector::Context* rc = 
00096         dynamic_cast<RootIOEvtSelector::Context*>(&c);
00097     if (!rc) return StatusCode::FAILURE;
00098     rc->m_entry -= jump;
00099     return this->setEntry(*rc,rc->m_entry-jump);
00100 }

StatusCode RootIOEvtSelector::last ( IEvtSelector::Context refContext  )  const [virtual]

Access last item in the iteration.

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

Implements IEvtSelector.

Definition at line 102 of file RootIOEvtSelector.cc.

00103 {
00104     MsgStream log(msgSvc(), "RootIOEvtSelector");
00105     log << MSG::ERROR << "last() not currently supported" << endreq;
00106     return StatusCode::FAILURE;
00107 }

StatusCode RootIOEvtSelector::rewind ( IEvtSelector::Context c  )  const [virtual]

Will set the state of the context in a way that the next event read is the first of the list.

Parameters:
c Reference to the Context object.

Implements IEvtSelector.

Definition at line 109 of file RootIOEvtSelector.cc.

00110 {
00111     MsgStream log(msgSvc(), "RootIOEvtSelector");
00112     log << MSG::ERROR << "rewind() not currently supported" << endreq;
00113     return StatusCode::FAILURE;
00114 }

StatusCode RootIOEvtSelector::createAddress ( const IEvtSelector::Context c,
IOpaqueAddress *&  iop 
) const [virtual]

Create an IOpaqueAddress object from the event fetched.

Parameters:
c Reference to the Context object.
iop Refernce pointer to a IOpaqueAddress object

Implements IEvtSelector.

Definition at line 142 of file RootIOEvtSelector.cc.

00144 {
00145     MsgStream log(msgSvc(), "RootIOEvtSelector");
00146     log << MSG::DEBUG << "createAddress" << endreq;
00147     const RootIOEvtSelector::Context* rc = 
00148         dynamic_cast<const RootIOEvtSelector::Context*>(&c);
00149     if (!rc) {
00150         log << MSG::ERROR << "Failed to get RootIOEvtSelector::Context" << endreq;
00151         return StatusCode::FAILURE;
00152     }
00153 
00154     RootInputAddress* ria = 
00155         new RootInputAddress(DataObject::classID(),"/Event");
00156     ria->setEntry(rc->m_entry);
00157     iop = ria;
00158     log << MSG::DEBUG << "createAddress for /Event" << endreq;
00159     return StatusCode::SUCCESS;
00160 }

StatusCode RootIOEvtSelector::releaseContext ( IEvtSelector::Context *&  c  )  const [virtual]

Release the Context object.

Parameters:
c Reference pointer to the Context object.

Implements IEvtSelector.

Definition at line 162 of file RootIOEvtSelector.cc.

00164 {
00165     RootIOEvtSelector::Context* rc = 
00166         dynamic_cast<RootIOEvtSelector::Context*>(c);
00167     if (!rc) return StatusCode::FAILURE;
00168 
00169     delete rc;
00170     c = 0;
00171     return StatusCode::SUCCESS;
00172 }

virtual StatusCode RootIOEvtSelector::resetCriteria ( const std::string &  cr,
IEvtSelector::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:
cr The new criteria string.
c Reference pointer to the Context object.

Implements IEvtSelector.

StatusCode RootIOEvtSelector::queryInterface ( const InterfaceID riid,
void **  ppif 
) [virtual]

Implements IEvtSelector.

Definition at line 189 of file RootIOEvtSelector.cc.

00191 {
00192     MsgStream log(msgSvc(), "RootIOEvtSelector");
00193 
00194     if (riid == IID_IEvtSelector) {
00195         *ppif = (IEvtSelector*)this;
00196         addRef();
00197         log << MSG::DEBUG << "queryInterface(IID_IEvtSelector)" << endreq;
00198         return StatusCode::SUCCESS;
00199     }
00200     log << MSG::DEBUG << "queryInterface(" << riid << ")" << endreq;
00201     return Service::queryInterface(riid,ppif);
00202 }


Member Data Documentation

IRootIOSvc* RootIOEvtSelector::m_rioSvc [protected]

Definition at line 25 of file RootIOEvtSelector.h.


The documentation for this class was generated from the following files:
| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

Generated on Mon Apr 11 20:18:21 2011 for RootIOSvc by doxygen 1.4.7