10 #ifndef GAUDIROOTCNV_ROOTEVTSELECTORCONTEXT_H
11 #define GAUDIROOTCNV_ROOTEVTSELECTORCONTEXT_H
36 typedef std::vector<std::string>
Files;
75 const std::string&
fid()
const {
return m_fid; }
82 #endif // GAUDIROOTCNV_ROOTEVTSELECTORCONTEXT_H
96 using namespace Gaudi;
100 RootEvtSelector::RootEvtSelector(
const string& name,
ISvcLocator* svcloc)
121 return error(
"Error initializing base class Service!");
126 return error(
"Unable to locate IPersistencySvc interface of "+m_persName);
129 Gaudi::Utils::TypeNameString
itm(m_cnvSvcName);
130 status = ipers->getService(itm.name(),cnvSvc);
132 status = ipers->getService(itm.type(),cnvSvc);
134 return error(
"Unable to locate IConversionSvc interface of database type "+m_cnvSvcName);
140 return error(
"Unable to localize service:"+m_cnvSvcName);
147 return error(
"Unable to localize service EventDataSvc");
149 m_rootCLID = eds->rootCLID();
150 m_rootName = eds->rootName();
152 log <<
MSG::DEBUG <<
"Selection root:" << m_rootName <<
" CLID:" << m_rootCLID <<
endmsg;
159 if ( m_dbMgr ) m_dbMgr->release();
179 TBranch* b = pCtxt->
branch();
181 RootEvtSelectorContext::Files::const_iterator fileit = pCtxt->
fileIterator();
184 if ( fileit != pCtxt->
files().end() ) {
189 string section = m_rootName[0] ==
'/' ? m_rootName.substr(1) : m_rootName;
197 m_dbMgr->disconnect(in).ignore();
203 long ent = pCtxt->
entry();
204 Long64_t nent = b->GetEntries();
205 if ( nent > (ent+1) ) {
209 RootEvtSelectorContext::Files::const_iterator fit = pCtxt->
fileIterator();
222 for (
int i = 0;
i < jump; ++
i ) {
235 return error(
"EventSelector Iterator, operator -- not supported ");
241 for (
int i = 0;
i < jump; ++
i ) {
256 RootEvtSelectorContext::Files::const_iterator fileit = pCtxt->
fileIterator();
257 if ( fileit != pCtxt->
files().end() ) {
258 string input = *fileit;
259 m_dbMgr->disconnect(input).ignore();
275 long ent = pctxt->
entry();
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);
302 RootEvtSelector::resetCriteria(
const string& criteria,
Context& context)
const
306 string db, typ,
item,
sel, stmt, aut, addr;
308 if ( criteria.substr(0,5) ==
"FILE " ) {
311 db = criteria.substr(5);
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);
322 if((*i).value() !=
"REA") {
323 log <<
MSG::ERROR <<
"Option:\"" << (*i).value() <<
"\" not valid" <<
endmsg;
355 int ipos = rest.find_first_not_of(
" ,");
356 if (ipos == -1 )
break;
357 rest = rest.substr(ipos,string::npos);
358 int lpos = rest.find_first_of(
" ,");
359 files.push_back(rest.substr(0,lpos ));
360 if (lpos == -1 )
break;
361 rest = rest.substr(lpos,string::npos);
367 return error(
"Invalid iteration context.");