9 #ifndef GAUDIROOTCNV_ROOTEVTSELECTORCONTEXT_H 10 # define GAUDIROOTCNV_ROOTEVTSELECTORCONTEXT_H 81 void*
identifier()
const override {
return const_cast<RootEvtSelector*>(
m_sel ); }
100 #endif // GAUDIROOTCNV_ROOTEVTSELECTORCONTEXT_H 114 using namespace Gaudi;
128 if ( !status.
isSuccess() ) {
return error(
"Error initializing base class Service!" ); }
131 if ( !ipers ) {
return error(
"Unable to locate IPersistencySvc interface of " + m_persName ); }
134 status = ipers->getService( itm.
name(), cnvSvc );
136 status = ipers->getService( itm.
type(), cnvSvc );
138 return error(
"Unable to locate IConversionSvc interface of database type " + m_cnvSvcName );
141 m_dbMgr = dynamic_cast<RootCnvSvc*>( cnvSvc );
144 return error(
"Unable to localize service:" + m_cnvSvcName );
149 auto eds = serviceLocator()->service<
IDataManagerSvc>(
"EventDataSvc" );
150 if ( !eds ) {
return error(
"Unable to localize service EventDataSvc" ); }
151 m_rootCLID = eds->rootCLID();
152 m_rootName = eds->rootName();
161 if ( m_dbMgr ) m_dbMgr->release();
179 TBranch* b = pCtxt->
branch();
184 if ( fileit != pCtxt->
files().
end() ) {
189 string section = m_rootName[0] ==
'/' ? m_rootName.substr( 1 ) : m_rootName;
190 b = con->
getBranch( section, m_rootName );
197 m_dbMgr->disconnect( in ).ignore();
203 long ent = pCtxt->
entry();
204 Long64_t nent = b->GetEntries();
205 if ( nent > ( ent + 1 ) ) {
222 for (
int i = 0; i < jump; ++i ) {
224 if ( !status.
isSuccess() ) {
return status; }
233 return error(
"EventSelector Iterator, operator -- not supported " );
239 for (
int i = 0; i < jump; ++i ) {
241 if ( !status.
isSuccess() ) {
return status; }
253 if ( fileit != pCtxt->
files().
end() ) {
254 string input = *fileit;
255 m_dbMgr->disconnect( input ).ignore();
270 long ent = pctxt->
entry();
273 if ( fileit != pctxt->
files().
end() ) {
274 const string par[2] = {pctxt->
fid(), m_rootName};
275 const unsigned long ipar[2] = {0, (
unsigned long)ent};
276 return m_dbMgr->createAddress( m_dbMgr->repSvcType(), m_rootCLID, &
par[0], &ipar[0], pAddr );
299 string db, typ, item,
sel, stmt, aut, addr;
301 if ( criteria.
compare( 0, 5,
"FILE " ) == 0 ) {
304 db = criteria.
substr( 5 );
307 for (
auto attrib : Parser( criteria ) ) {
308 string tmp = attrib.tag.substr( 0, 3 );
309 if ( tmp ==
"DAT" ) {
311 }
else if ( tmp ==
"OPT" ) {
312 if ( attrib.value.compare( 0, 3,
"REA" ) != 0 ) {
316 }
else if ( tmp ==
"TYP" ) {
318 }
else if ( tmp ==
"ADD" ) {
320 }
else if ( tmp ==
"SEL" ) {
322 }
else if ( tmp ==
"FUN" ) {
324 }
else if ( tmp ==
"AUT" ) {
326 }
else if ( tmp ==
"COL" ) {
340 if ( ipos == -1 )
break;
341 rest = rest.
substr( ipos, string::npos );
344 if ( lpos == -1 )
break;
345 rest = rest.
substr( lpos, string::npos );
351 return error(
"Invalid iteration context." );
Parse attribute strings allowing iteration over the various attributes.
StatusCode next(Context &refCtxt) const override
Get next iteration item from the event loop context.
Definition of the MsgStream class used to transmit messages.
StatusCode initialize() override
TBranch * getBranch(std::string_view section, std::string_view branch_name)
Access data branch by name: Get existing branch in read only mode.
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.
std::string m_fid
Connection fid.
constexpr static const auto SUCCESS
const std::string & fid() const
Access file id.
StatusCode rewind(Context &refCtxt) const override
Rewind the dataset.
const std::string & type() const
StatusCode createContext(Context *&refpCtxt) const override
Create a new event loop context.
StatusCode previous(Context &refCtxt) const override
Get previous iteration item from the event loop context.
Files::const_iterator fileIterator() const
Access to the file iterator.
void * identifier() const override
Context identifier.
StatusCode releaseContext(Context *&refCtxt) const override
Release existing event iteration context.
MsgStream & error() const
shortcut for the method msgStream(MSG::ERROR)
Helper class to parse a string of format "type/name".
ROOT specific event selector context.
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...
const std::string & name() const
This class is used for returning status codes from appropriate routines.
StatusCode finalize() override
IService implementation: Service finalization.
T find_first_of(T... args)
const RootEvtSelector * m_sel
Reference to the hosting event selector instance.
void setFiles(const Files &f)
Set the file container.
StatusCode createAddress(const Context &refCtxt, IOpaqueAddress *&) const override
Create new Opaque address corresponding to the current record.
void setBranch(TBranch *b)
Set the top level branch (typically /Event) used to iterate.
Concrete event selector implementation to access ROOT files.
void setEntry(long e)
Set current event entry number.
long entry() const
Access to the current event entry number.
virtual unsigned long release()=0
Release Interface instance.
StatusCode last(Context &refContext) const override
Access last item in the iteration.
void setFID(const std::string &fid)
Set connection FID.
Files::const_iterator m_fiter
The iterator to the.
constexpr static const auto FAILURE
Data persistency service interface.
void setFileIterator(Files::const_iterator i)
Set file iterator.
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.
TBranch * branch() const
Access to the top level branch (typically /Event) used to iterate.
Header file for std:chrono::duration-based Counters.
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
const std::string & fid() const
Access connection fid.
long m_entry
Current entry of current file.
const Files & files() const
Access to the file container.