#include <RootEvtSelector.h>
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 |
RootInterface * | m_rootInterface |
RootInterface * | m_rootInterface |
RootEventContext * | p_beginContext |
RootEventContext * | p_beginContext |
RootEventContext * | p_endContext |
RootEventContext * | p_endContext |
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.
|
00062 { 00063 ROOT, //When the input is a ROOT file 00064 NONE //When there is no input 00065 };
|
|
00062 { 00063 ROOT, //When the input is a ROOT file 00064 NONE //When there is no input 00065 };
|
|
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 }
|
|
00032 {
00033 delete m_recId;
00034 }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 }
|
|
00059 { return (*m_recId); }
|
|
00059 { return (*m_recId); }
|
|
|
|
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 }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 }
|
|
|
|
|
|
|
|
|
|
|
|
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 }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 }
|
|
|
|
|
|
|
|
|
|
max nr of events to be treated
|
|
|
|
counts number of event
|
|
counts number of event
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|