CGEM BOSS 6.6.5.f
BESIII Offline Software System
Loading...
Searching...
No Matches
RootEvtSelector Class Reference

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

#include <RootEvtSelector.h>

+ Inheritance diagram for RootEvtSelector:

Public Member Functions

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

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/CgemBossCvs/Event/RootCnvSvc/RootCnvSvc/RootEvtSelector.h,v 1.1.1.1 2013/11/22 02:06:44 juxd Exp

Definition at line 27 of file Event/RootCnvSvc/bak_RootCnvSvc-04-01-14/RootCnvSvc/RootEvtSelector.h.

Constructor & Destructor Documentation

◆ RootEvtSelector() [1/3]

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

Definition at line 23 of file bak_RootCnvSvc-04-01-14/src/RootEvtSelector.cxx.

24 : Service( name, svcloc),
25 p_beginContext(0),
26 p_endContext(0) {
27 m_recId = new int;
28 (*m_recId) = -1;
29 declareProperty( "Input", m_jobInput="ROOT");
30 getMaxEvent();
31}

◆ ~RootEvtSelector() [1/3]

RootEvtSelector::~RootEvtSelector ( )

Definition at line 32 of file bak_RootCnvSvc-04-01-14/src/RootEvtSelector.cxx.

32 {
33 delete m_recId;
34}

◆ RootEvtSelector() [2/3]

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

◆ ~RootEvtSelector() [2/3]

RootEvtSelector::~RootEvtSelector ( )

◆ RootEvtSelector() [3/3]

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

◆ ~RootEvtSelector() [3/3]

RootEvtSelector::~RootEvtSelector ( )

Member Function Documentation

◆ createAddress() [1/3]

virtual StatusCode RootEvtSelector::createAddress ( const Context &  it,
IOpaqueAddress *&  iop 
) const
virtual

◆ createAddress() [2/3]

virtual StatusCode RootEvtSelector::createAddress ( const Context &  it,
IOpaqueAddress *&  iop 
) const
virtual

◆ createAddress() [3/3]

virtual StatusCode RootEvtSelector::createAddress ( const Context &  it,
IOpaqueAddress *&  iop 
) const
virtual

◆ createContext() [1/3]

virtual StatusCode RootEvtSelector::createContext ( Context *&  it) const
virtual

◆ createContext() [2/3]

virtual StatusCode RootEvtSelector::createContext ( Context *&  it) const
virtual

◆ createContext() [3/3]

virtual StatusCode RootEvtSelector::createContext ( Context *&  it) const
virtual

◆ getRecId() [1/3]

int RootEvtSelector::getRecId ( ) const
inline

◆ getRecId() [2/3]

int RootEvtSelector::getRecId ( ) const
inline

Definition at line 59 of file Event/RootCnvSvc/RootCnvSvc-04-01-15/RootCnvSvc/RootEvtSelector.h.

59{ return (*m_recId); }

◆ getRecId() [3/3]

int RootEvtSelector::getRecId ( ) const
inline

Definition at line 59 of file InstallArea/include/RootCnvSvc/RootCnvSvc/RootEvtSelector.h.

59{ return (*m_recId); }

◆ initialize() [1/3]

StatusCode RootEvtSelector::initialize ( )
virtual

Definition at line 37 of file bak_RootCnvSvc-04-01-14/src/RootEvtSelector.cxx.

37 {
38 MsgStream log(msgSvc(), name());
39 StatusCode sc = Service::initialize();
40 log << MSG::DEBUG << "RootEvtSelector::initialize" << endreq; if( sc.isSuccess() ) {
41 setProperties();
42 } else {
43 log << MSG::ERROR << "Unable to initialize service " << endreq;
44 }
45
46 if(m_jobInput.value() != " "){
47 sc = setCriteria(m_jobInput);
48 if(sc.isFailure()){
49 log << MSG::ERROR << "Unable to get input value" << endreq;
50 return sc;
51 }
52 }
53
54 // Retrieve conversion service handling event iteration
55 sc = serviceLocator()->service("EventCnvSvc", m_addrCreator);
56 if( !sc.isSuccess() ) {
57 log << MSG::ERROR <<
58 "Unable to localize interface IID_IAddressCreator from service:"
59 << "RootEventSelector"
60 << endreq;
61 return sc;
62 }
63 // Get DataSvc
64 IDataManagerSvc* eds = 0;
65 sc = serviceLocator()->service("EventDataSvc", eds, true);
66 if( !sc.isSuccess() ) {
67 log << MSG::ERROR
68 << "Unable to localize interface IID_IDataManagerSvc "
69 << "from RootEventSelector"
70 << endreq;
71 return sc;
72 }
73
74 m_rootCLID = eds->rootCLID();
75
76 // provide access to the Root Interface
77 m_rootInterface=RootInterface::Instance(log);
78 if (!m_rootInterface) log << MSG::ERROR << "Unable to start Root service within RootCnvSvc" << endreq;
79
80 // create root event context
81 p_beginContext = new RootEventContext(this);
82
83 return sc;
84}
This class provides the Context for RootEventSelector.
virtual StatusCode setCriteria(const std::string &criteria)
static RootInterface * Instance(MsgStream log)
singleton behaviour

◆ initialize() [2/3]

virtual StatusCode RootEvtSelector::initialize ( )
virtual

◆ initialize() [3/3]

virtual StatusCode RootEvtSelector::initialize ( )
virtual

◆ last() [1/3]

virtual StatusCode RootEvtSelector::last ( Context &  it) const
virtual

◆ last() [2/3]

virtual StatusCode RootEvtSelector::last ( Context &  it) const
virtual

◆ last() [3/3]

virtual StatusCode RootEvtSelector::last ( Context &  it) const
virtual

◆ next() [1/9]

StatusCode RootEvtSelector::next ( ) const

Definition at line 174 of file bak_RootCnvSvc-04-01-14/src/RootEvtSelector.cxx.

174 {
175 MsgStream log(msgSvc(), name());
176
177 if(m_criteriaType == ROOT)
178 {
179 log<<MSG::INFO<<"m_criteriaType == ROOT"<<endreq;
180 (*m_recId)++;
181
182 //if((*m_recId)>m_evtMax){ // if get the max event number?
183 // return StatusCode::FAILURE;
184 //}else{ //didn't get the max event number
185 static int entry = 0;
186
187 bool endOfFile = m_rootInterface->getEOF();
188 entry++;
189 bool maxEntry = (entry >m_rootInterface->getEntries() && m_rootInterface->getEntries()>=0);
190 if(maxEntry) entry =1;
191 log<<MSG::INFO<<"entry = "<<entry<<" "<<maxEntry<<" "<<endOfFile<<endreq;
192 if(endOfFile || maxEntry){ //the using file is get max event or get the end of file
193 bool endAll = m_rootInterface->checkEndOfTree();
194
195 if(endAll){ //if all is finished ?
196 return StatusCode::FAILURE;
197 }
198 }
199 //} // to make it run if not set event number from jobOption
200 }
201 else if( m_criteriaType == NONE)
202 {
203 log << MSG::DEBUG << "Reading Event " << (*m_recId) << endreq;
204 //If we go over the count set equal to the end
205 if((*m_recId) > m_evtMax) {
206 return StatusCode::FAILURE;
207 }
208 }else {
209 //We are going to blow up if this situation happens
210 log << MSG::FATAL << "Cannot iterate a dead iterator" << endreq;
211 return StatusCode::FAILURE;
212 }
213 log << MSG::DEBUG << "Reading Event " << (*m_recId) << endreq;
214 log << MSG::DEBUG << "Max Event " << m_evtMax << endreq;
215 return StatusCode::SUCCESS;
216}
virtual bool checkEndOfTree()
check if all the files is over 2005-11-28

◆ next() [2/9]

StatusCode RootEvtSelector::next ( ) const

◆ next() [3/9]

StatusCode RootEvtSelector::next ( ) const

◆ next() [4/9]

virtual StatusCode RootEvtSelector::next ( Context &  it) const
virtual

◆ next() [5/9]

virtual StatusCode RootEvtSelector::next ( Context &  it) const
virtual

◆ next() [6/9]

virtual StatusCode RootEvtSelector::next ( Context &  it) const
virtual

◆ next() [7/9]

virtual StatusCode RootEvtSelector::next ( Context &  it,
int  jump 
) const
virtual

◆ next() [8/9]

virtual StatusCode RootEvtSelector::next ( Context &  it,
int  jump 
) const
virtual

◆ next() [9/9]

virtual StatusCode RootEvtSelector::next ( Context &  it,
int  jump 
) const
virtual

◆ previous() [1/6]

virtual StatusCode RootEvtSelector::previous ( Context &  it) const
virtual

◆ previous() [2/6]

virtual StatusCode RootEvtSelector::previous ( Context &  it) const
virtual

◆ previous() [3/6]

virtual StatusCode RootEvtSelector::previous ( Context &  it) const
virtual

◆ previous() [4/6]

virtual StatusCode RootEvtSelector::previous ( Context &  it,
int  jump 
) const
virtual

◆ previous() [5/6]

virtual StatusCode RootEvtSelector::previous ( Context &  it,
int  jump 
) const
virtual

◆ previous() [6/6]

virtual StatusCode RootEvtSelector::previous ( Context &  it,
int  jump 
) const
virtual

◆ queryInterface() [1/3]

StatusCode RootEvtSelector::queryInterface ( const InterfaceID &  riid,
void **  ppvInterface 
)
virtual

Definition at line 218 of file bak_RootCnvSvc-04-01-14/src/RootEvtSelector.cxx.

218 {
219 if ( riid == IID_IRootEvtSelector ) {
220 *ppvInterface = (RootEvtSelector*)this;
221 }
222 else if ( riid == IEvtSelector::interfaceID() ) {
223 *ppvInterface = (IEvtSelector*)this;
224 }
225 else if ( riid == IProperty::interfaceID() ) {
226 *ppvInterface = (IProperty*)this;
227 }
228 else {
229 return Service::queryInterface( riid, ppvInterface );
230 }
231 addRef();
232 return SUCCESS;
233}
RootEvtSelector performs the function of controlling the ApplicationMgr loop.

◆ queryInterface() [2/3]

virtual StatusCode RootEvtSelector::queryInterface ( const InterfaceID &  riid,
void **  ppvInterface 
)
virtual

◆ queryInterface() [3/3]

virtual StatusCode RootEvtSelector::queryInterface ( const InterfaceID &  riid,
void **  ppvInterface 
)
virtual

◆ releaseContext() [1/3]

virtual StatusCode RootEvtSelector::releaseContext ( Context *&  it) const
virtual

◆ releaseContext() [2/3]

virtual StatusCode RootEvtSelector::releaseContext ( Context *&  it) const
virtual

◆ releaseContext() [3/3]

virtual StatusCode RootEvtSelector::releaseContext ( Context *&  it) const
virtual

◆ resetCriteria() [1/3]

virtual StatusCode RootEvtSelector::resetCriteria ( const std::string &  criteria,
Context &  context 
) const
virtual

◆ resetCriteria() [2/3]

virtual StatusCode RootEvtSelector::resetCriteria ( const std::string &  criteria,
Context &  context 
) const
virtual

◆ resetCriteria() [3/3]

virtual StatusCode RootEvtSelector::resetCriteria ( const std::string &  criteria,
Context &  context 
) const
virtual

◆ rewind() [1/3]

virtual StatusCode RootEvtSelector::rewind ( Context &  it) const
virtual

◆ rewind() [2/3]

virtual StatusCode RootEvtSelector::rewind ( Context &  it) const
virtual

◆ rewind() [3/3]

virtual StatusCode RootEvtSelector::rewind ( Context &  it) const
virtual

◆ setCriteria() [1/3]

StatusCode RootEvtSelector::setCriteria ( const std::string &  criteria)
virtual

Definition at line 86 of file bak_RootCnvSvc-04-01-14/src/RootEvtSelector.cxx.

86 {
87 // Purpose and Method: set the input criteria
88 MsgStream log(msgSvc(), name());
89 m_criteria = criteria;
90
91 if( criteria == "ROOT" ) {
92 log << MSG::INFO << "RootEvtSelector input has been set to ROOT" << endreq;
93 m_criteriaType = ROOT;
94 }else if( criteria == "NONE"){
95 m_criteriaType = NONE;
96 log << MSG::INFO << "RootEvtSelector input has been set to NONE" << endreq;
97 }
98 else {
99 log << MSG::ERROR << "Invalid Event Selection Criteria: " << criteria << endreq;
100 return StatusCode::FAILURE;
101 }
102 return StatusCode::SUCCESS;
103}

Referenced by initialize().

◆ setCriteria() [2/3]

virtual StatusCode RootEvtSelector::setCriteria ( const std::string &  criteria)
virtual

◆ setCriteria() [3/3]

virtual StatusCode RootEvtSelector::setCriteria ( const std::string &  criteria)
virtual

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