9 #ifndef GAUDIROOTCNV_ROOTEVTSELECTORCONTEXT_H 10 #define GAUDIROOTCNV_ROOTEVTSELECTORCONTEXT_H 59 m_fiter = m_files.
begin();
81 #endif // GAUDIROOTCNV_ROOTEVTSELECTORCONTEXT_H 95 using namespace Gaudi;
110 return error(
"Error initializing base class Service!");
115 return error(
"Unable to locate IPersistencySvc interface of "+m_persName);
119 status = ipers->getService(itm.
name(),cnvSvc);
121 status = ipers->getService(itm.
type(),cnvSvc);
123 return error(
"Unable to locate IConversionSvc interface of database type "+m_cnvSvcName);
129 return error(
"Unable to localize service:"+m_cnvSvcName);
136 return error(
"Unable to localize service EventDataSvc");
138 m_rootCLID = eds->rootCLID();
139 m_rootName = eds->rootName();
141 log <<
MSG::DEBUG <<
"Selection root:" << m_rootName <<
" CLID:" << m_rootCLID <<
endmsg;
148 if ( m_dbMgr ) m_dbMgr->release();
168 TBranch* b = pCtxt->
branch();
173 if ( fileit != pCtxt->
files().
end() ) {
178 string section = m_rootName[0] ==
'/' ? m_rootName.substr(1) : m_rootName;
186 m_dbMgr->disconnect(in).ignore();
192 long ent = pCtxt->
entry();
193 Long64_t nent = b->GetEntries();
194 if ( nent > (ent+1) ) {
211 for (
int i = 0; i < jump; ++i ) {
224 return error(
"EventSelector Iterator, operator -- not supported ");
230 for (
int i = 0; i < jump; ++i ) {
246 if ( fileit != pCtxt->
files().
end() ) {
247 string input = *fileit;
248 m_dbMgr->disconnect(input).ignore();
264 long ent = pctxt->
entry();
267 if ( fileit != pctxt->
files().
end() ) {
268 const string par[2] = {pctxt->
fid(), m_rootName};
269 const unsigned long ipar[2] = {0,(
unsigned long)ent};
270 return m_dbMgr->createAddress(m_dbMgr->repSvcType(),m_rootCLID,&par[0],&ipar[0],pAddr);
295 string db, typ, item,
sel, stmt, aut, addr;
297 if ( criteria.
compare(0,5,
"FILE ")==0 ) {
304 for(
auto attrib: Parser(criteria)) {
305 string tmp = attrib.tag.substr(0,3);
309 else if(tmp==
"OPT") {
310 if(attrib.value.compare(0, 3,
"REA") != 0) {
311 log <<
MSG::ERROR <<
"Option:\"" << attrib.value <<
"\" not valid" <<
endmsg;
315 else if (tmp==
"TYP") {
318 else if(tmp==
"ADD") {
321 else if(tmp==
"SEL") {
324 else if(tmp==
"FUN") {
327 else if(tmp==
"AUT") {
330 else if(tmp==
"COL") {
344 if (ipos == -1 )
break;
345 rest = rest.
substr(ipos,string::npos);
348 if (lpos == -1 )
break;
349 rest = rest.
substr(lpos,string::npos);
355 return error(
"Invalid iteration context.");
Parse attribute strings allowing iteration over the various attributes.
StatusCode resetCriteria(const std::string &cr, Context &c) const override
Will set a new criteria for the selection of the next list of events and will change the state of the...
Definition of the MsgStream class used to transmit messages.
StatusCode initialize() override
const Files & files() const
Access to the file container.
Files::const_iterator fileIterator() const
Access to the file iterator.
const std::string & fid() const
Access file id.
RootEvtSelectorContext(const RootEvtSelector *s)
Standard constructor with initialization.
T find_first_not_of(T...args)
StatusCode finalize() override
std::vector< std::string > Files
Definition of the file container.
bool isSuccess() const
Test for a status code of SUCCESS.
std::string m_fid
Connection fid.
StatusCode last(Context &refContext) const override
Access last item in the iteration.
StatusCode releaseContext(Context *&refCtxt) const override
Release existing event iteration context.
~RootEvtSelectorContext() override=default
Standard destructor.
MsgStream & error() const
shortcut for the method msgStream(MSG::ERROR)
Helper class to parse a string of format "type/name".
StatusCode rewind(Context &refCtxt) const override
Rewind the dataset.
ROOT specific event selector context.
This class is used for returning status codes from appropriate routines.
StatusCode finalize() override
IService implementation: Service finalization.
TBranch * getBranch(const std::string §ion, const std::string &branch_name)
Access data branch by name: Get existing branch in read only mode.
T find_first_of(T...args)
void * identifier() const override
Context identifier.
const RootEvtSelector * m_sel
Reference to the hosting event selector instance.
void setFiles(const Files &f)
Set the file container.
void setBranch(TBranch *b)
Set the top level branch (typically /Event) used to iterate.
StatusCode next(Context &refCtxt) const override
Get next iteration item from the event loop context.
Concrete event selector implementation to access ROOT files.
void setEntry(long e)
Set current event entry number.
virtual unsigned long release()=0
Release Interface instance.
StatusCode createAddress(const Context &refCtxt, IOpaqueAddress *&) const override
Create new Opaque address corresponding to the current record.
const std::string & type() const
const std::string & fid() const
Access connection fid.
void setFID(const std::string &fid)
Set connection FID.
Files::const_iterator m_fiter
The iterator to the.
Data persistency service interface.
void setFileIterator(Files::const_iterator i)
Set file iterator.
TBranch * branch() const
Access to the top level branch (typically /Event) used to iterate.
StatusCode createContext(Context *&refpCtxt) const override
Create a new event loop context.
const std::string & name() const
Opaque address interface definition.
StatusCode initialize() override
IService implementation: Db event selector override.
Files m_files
The file container managed by this context.
Concrete implementation of the IDataConnection interface to access ROOT files.
TBranch * m_branch
Reference to the top level branch (typically /Event) used to iterate.
StatusCode previous(Context &refCtxt) const override
Get previous iteration item from the event loop context.
Helper functions to set/get the application return code.
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
long entry() const
Access to the current event entry number.
long m_entry
Current entry of current file.