Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

RootEvtSelector Class Reference

RootEvtSelector performs the function of controlling the ApplicationMgr loop. More...

#include <RootEvtSelector.h>

List of all members.

Public Member Functions

virtual StatusCode createAddress (const Context &it, IOpaqueAddress *&iop) const
virtual StatusCode createAddress (const Context &it, IOpaqueAddress *&iop) const
virtual StatusCode createContext (Context *&it) const
virtual StatusCode createContext (Context *&it) const
int getRecId () const
int getRecId () const
virtual StatusCode initialize ()
virtual StatusCode initialize ()
virtual StatusCode last (Context &it) const
virtual StatusCode last (Context &it) const
virtual StatusCode next (Context &it, int jump) const
virtual StatusCode next (Context &it) const
StatusCode next () const
virtual StatusCode next (Context &it, int jump) const
virtual StatusCode next (Context &it) const
StatusCode next () const
virtual StatusCode previous (Context &it, int jump) const
virtual StatusCode previous (Context &it) const
virtual StatusCode previous (Context &it, int jump) const
virtual StatusCode previous (Context &it) const
virtual StatusCode queryInterface (const InterfaceID &riid, void **ppvInterface)
virtual StatusCode queryInterface (const InterfaceID &riid, void **ppvInterface)
virtual StatusCode releaseContext (Context *&it) const
virtual StatusCode releaseContext (Context *&it) const
virtual StatusCode resetCriteria (const std::string &criteria, Context &context) const
virtual StatusCode resetCriteria (const std::string &criteria, Context &context) const
virtual StatusCode rewind (Context &it) const
virtual StatusCode rewind (Context &it) const
 RootEvtSelector (const std::string &name, ISvcLocator *svcloc)
 RootEvtSelector (const std::string &name, ISvcLocator *svcloc)
virtual StatusCode setCriteria (const std::string &criteria)
virtual StatusCode setCriteria (const std::string &criteria)
 ~RootEvtSelector ()
 ~RootEvtSelector ()

Private Types

enum  CriteriaType { ROOT, NONE }
enum  CriteriaType { ROOT, NONE }

Private Member Functions

StatusCode getMaxEvent ()
StatusCode getMaxEvent ()

Private Attributes

IAddressCreator * m_addrCreator
IAddressCreator * m_addrCreator
std::string m_criteria
CriteriaType m_criteriaType
int m_evtMax
 max nr of events to be treated
StringProperty m_jobInput
int * m_recId
 counts number of event
int * m_recId
 counts number of event
CLID m_rootCLID
RootInterfacem_rootInterface
RootInterfacem_rootInterface
RootEventContextp_beginContext
RootEventContextp_beginContext
RootEventContextp_endContext
RootEventContextp_endContext


Detailed Description

RootEvtSelector performs the function of controlling the ApplicationMgr loop.

Adapted to RootCnvSvc from GlastSvc/EventSelector. The input property can now be set either to NONE or to ROOT. If it is NONE, the loop will run until it hits EvtMax. A new class variable was added :m_evtMax which is a local copy of the AppMgrs property.

Header
/bes/bes/BossCvs/Event/RootCnvSvc/RootCnvSvc/RootEvtSelector.h,v 1.11 2008/01/09 00:05:48 codeman Exp


Member Enumeration Documentation

enum RootEvtSelector::CriteriaType [private]
 

Enumeration values:
ROOT 
NONE 
00062                     { 
00063     ROOT,   //When the input is a ROOT file
00064     NONE    //When there is no input
00065   };

enum RootEvtSelector::CriteriaType [private]
 

Enumeration values:
ROOT 
NONE 
00062                     { 
00063     ROOT,   //When the input is a ROOT file
00064     NONE    //When there is no input
00065   };


Constructor & Destructor Documentation

RootEvtSelector::RootEvtSelector const std::string &  name,
ISvcLocator *  svcloc
 

00024   : Service( name, svcloc),
00025     p_beginContext(0),
00026     p_endContext(0) {
00027     m_recId = new int;
00028     (*m_recId) = -1;
00029     declareProperty( "Input", m_jobInput="ROOT");
00030     getMaxEvent();
00031 }

RootEvtSelector::~RootEvtSelector  ) 
 

00032                                   {
00033   delete m_recId;
00034 }

RootEvtSelector::RootEvtSelector const std::string &  name,
ISvcLocator *  svcloc
 

RootEvtSelector::~RootEvtSelector  ) 
 


Member Function Documentation

virtual StatusCode RootEvtSelector::createAddress const Context &  it,
IOpaqueAddress *&  iop
const [virtual]
 

virtual StatusCode RootEvtSelector::createAddress const Context &  it,
IOpaqueAddress *&  iop
const [virtual]
 

virtual StatusCode RootEvtSelector::createContext Context *&  it  )  const [virtual]
 

virtual StatusCode RootEvtSelector::createContext Context *&  it  )  const [virtual]
 

StatusCode RootEvtSelector::getMaxEvent  )  [private]
 

StatusCode RootEvtSelector::getMaxEvent  )  [private]
 

00235                                         {
00236   IProperty* appPropMgr=0;
00237   StatusCode status = 
00238     serviceLocator()->getService("ApplicationMgr", IID_IProperty,
00239                                  reinterpret_cast<IInterface*&>( appPropMgr ));
00240   if( status.isFailure() ) return status;
00241     
00242   IntegerProperty evtMax("EvtMax",0);
00243   status = appPropMgr->getProperty( &evtMax );
00244   if (status.isFailure()) return status;
00245   
00246   m_evtMax = evtMax.value();
00247   return status;
00248 }

int RootEvtSelector::getRecId  )  const [inline]
 

00059 {  return (*m_recId); }

int RootEvtSelector::getRecId  )  const [inline]
 

00059 {  return (*m_recId); }

virtual StatusCode RootEvtSelector::initialize  )  [virtual]
 

StatusCode RootEvtSelector::initialize  )  [virtual]
 

00037                                            {
00038   MsgStream log(msgSvc(), name());
00039   StatusCode sc = Service::initialize();
00040   log << MSG::DEBUG << "RootEvtSelector::initialize" << endreq;    if( sc.isSuccess() ) {
00041     setProperties();
00042   } else {
00043     log << MSG::ERROR << "Unable to initialize service " << endreq;
00044   }
00045     
00046   if(m_jobInput.value() != " "){
00047     sc = setCriteria(m_jobInput);
00048     if(sc.isFailure()){
00049       log << MSG::ERROR << "Unable to get input value" << endreq;
00050       return sc;
00051     }
00052   }
00053     
00054   // Retrieve conversion service handling event iteration
00055   sc = serviceLocator()->service("EventCnvSvc", m_addrCreator);
00056   if( !sc.isSuccess() ) {
00057     log << MSG::ERROR << 
00058       "Unable to localize interface IID_IAddressCreator from service:" 
00059         << "RootEventSelector" 
00060         << endreq;
00061     return sc;
00062   }
00063   // Get DataSvc
00064   IDataManagerSvc* eds = 0;
00065   sc = serviceLocator()->service("EventDataSvc", eds, true);
00066   if( !sc.isSuccess() ) {
00067     log << MSG::ERROR 
00068         << "Unable to localize interface IID_IDataManagerSvc "
00069         << "from RootEventSelector"
00070         << endreq;
00071     return sc;
00072   }
00073     
00074   m_rootCLID = eds->rootCLID();
00075 
00076   // provide access to the Root Interface
00077   m_rootInterface=RootInterface::Instance(log);
00078   if (!m_rootInterface)      log << MSG::ERROR << "Unable to start Root service within RootCnvSvc" << endreq;
00079 
00080   // create root event context
00081   p_beginContext = new RootEventContext(this); 
00082 
00083   return sc;
00084 }

virtual StatusCode RootEvtSelector::last Context &  it  )  const [virtual]
 

virtual StatusCode RootEvtSelector::last Context &  it  )  const [virtual]
 

virtual StatusCode RootEvtSelector::next Context &  it,
int  jump
const [virtual]
 

virtual StatusCode RootEvtSelector::next Context &  it  )  const [virtual]
 

StatusCode RootEvtSelector::next  )  const
 

virtual StatusCode RootEvtSelector::next Context &  it,
int  jump
const [virtual]
 

virtual StatusCode RootEvtSelector::next Context &  it  )  const [virtual]
 

StatusCode RootEvtSelector::next  )  const
 

00174                               {  
00175     MsgStream log(msgSvc(), name());
00176 
00177     if(m_criteriaType == ROOT)
00178     {
00179       log<<MSG::INFO<<"m_criteriaType == ROOT"<<endreq; 
00180       (*m_recId)++;        
00181 
00182       //if((*m_recId)>m_evtMax){ // if get the max event number?
00183       //  return StatusCode::FAILURE;
00184       //}else{  //didn't get the max event number
00185         static int entry = 0;
00186 
00187         bool endOfFile = m_rootInterface->getEOF();
00188         entry++;
00189         bool maxEntry = (entry >m_rootInterface->getEntries() &&  m_rootInterface->getEntries()>=0); 
00190         if(maxEntry) entry =1;
00191         log<<MSG::INFO<<"entry = "<<entry<<"    "<<maxEntry<<"   "<<endOfFile<<endreq;
00192         if(endOfFile || maxEntry){   //the using file is get max event or get the end of file
00193           bool endAll = m_rootInterface->checkEndOfTree();
00194 
00195           if(endAll){ //if all is finished ?
00196             return StatusCode::FAILURE;
00197           }
00198         }
00199       //}  // to make it run if not set event number from jobOption
00200     } 
00201     else if( m_criteriaType == NONE)
00202     {     
00203       log << MSG::DEBUG << "Reading Event " << (*m_recId) << endreq;
00204       //If we go over the count set equal to the end
00205       if((*m_recId) > m_evtMax) {
00206         return StatusCode::FAILURE;
00207       }
00208     }else {
00209       //We are going to blow up if this situation happens
00210       log << MSG::FATAL << "Cannot iterate a dead iterator" << endreq;
00211       return StatusCode::FAILURE;
00212     } 
00213     log << MSG::DEBUG << "Reading Event " <<  (*m_recId) << endreq;
00214     log << MSG::DEBUG << "Max Event " <<  m_evtMax << endreq; 
00215    return StatusCode::SUCCESS;
00216 }

virtual StatusCode RootEvtSelector::previous Context &  it,
int  jump
const [virtual]
 

virtual StatusCode RootEvtSelector::previous Context &  it  )  const [virtual]
 

virtual StatusCode RootEvtSelector::previous Context &  it,
int  jump
const [virtual]
 

virtual StatusCode RootEvtSelector::previous Context &  it  )  const [virtual]
 

virtual StatusCode RootEvtSelector::queryInterface const InterfaceID &  riid,
void **  ppvInterface
[virtual]
 

StatusCode RootEvtSelector::queryInterface const InterfaceID &  riid,
void **  ppvInterface
[virtual]
 

00218                                                                                        {
00219   if ( riid == IID_IRootEvtSelector )  {
00220     *ppvInterface = (RootEvtSelector*)this;
00221   }
00222   else if ( riid == IID_IEvtSelector )  {
00223     *ppvInterface = (IEvtSelector*)this;
00224   }
00225   else if ( riid == IID_IProperty )  {
00226     *ppvInterface = (IProperty*)this;
00227   }
00228   else   {
00229     return Service::queryInterface( riid, ppvInterface );
00230   }
00231   addRef();
00232   return SUCCESS;
00233 }

virtual StatusCode RootEvtSelector::releaseContext Context *&  it  )  const [virtual]
 

virtual StatusCode RootEvtSelector::releaseContext Context *&  it  )  const [virtual]
 

virtual StatusCode RootEvtSelector::resetCriteria const std::string &  criteria,
Context &  context
const [virtual]
 

virtual StatusCode RootEvtSelector::resetCriteria const std::string &  criteria,
Context &  context
const [virtual]
 

virtual StatusCode RootEvtSelector::rewind Context &  it  )  const [virtual]
 

virtual StatusCode RootEvtSelector::rewind Context &  it  )  const [virtual]
 

virtual StatusCode RootEvtSelector::setCriteria const std::string &  criteria  )  [virtual]
 

StatusCode RootEvtSelector::setCriteria const std::string &  criteria  )  [virtual]
 

00086                                                                    {
00087   // Purpose and Method:  set the input criteria
00088   MsgStream log(msgSvc(), name());
00089   m_criteria = criteria;
00090   
00091   if( criteria == "ROOT" ) {
00092     log << MSG::INFO << "RootEvtSelector input has been set to ROOT" << endreq;
00093     m_criteriaType = ROOT;
00094   }else if( criteria == "NONE"){
00095     m_criteriaType = NONE;
00096     log << MSG::INFO << "RootEvtSelector input has been set to NONE" << endreq;
00097   }
00098   else {
00099     log << MSG::ERROR << "Invalid Event Selection Criteria: " << criteria << endreq;
00100     return StatusCode::FAILURE;
00101   }
00102   return StatusCode::SUCCESS;
00103 }


Member Data Documentation

IAddressCreator* RootEvtSelector::m_addrCreator [private]
 

IAddressCreator* RootEvtSelector::m_addrCreator [private]
 

std::string RootEvtSelector::m_criteria [private]
 

CriteriaType RootEvtSelector::m_criteriaType [private]
 

int RootEvtSelector::m_evtMax [private]
 

max nr of events to be treated

StringProperty RootEvtSelector::m_jobInput [private]
 

int* RootEvtSelector::m_recId [private]
 

counts number of event

int* RootEvtSelector::m_recId [private]
 

counts number of event

CLID RootEvtSelector::m_rootCLID [private]
 

RootInterface* RootEvtSelector::m_rootInterface [private]
 

RootInterface* RootEvtSelector::m_rootInterface [private]
 

RootEventContext* RootEvtSelector::p_beginContext [private]
 

RootEventContext* RootEvtSelector::p_beginContext [private]
 

RootEventContext* RootEvtSelector::p_endContext [private]
 

RootEventContext* RootEvtSelector::p_endContext [private]
 


The documentation for this class was generated from the following files:
Generated on Wed Feb 2 18:48:38 2011 for BOSS6.5.5 by  doxygen 1.3.9.1