Go to the documentation of this file.
19 #ifndef GAUDIROOTCNV_ROOTEVTSELECTORCONTEXT_H
20 # define GAUDIROOTCNV_ROOTEVTSELECTORCONTEXT_H
110 #endif // GAUDIROOTCNV_ROOTEVTSELECTORCONTEXT_H
124 using namespace Gaudi;
138 if ( !status.
isSuccess() ) {
return error(
"Error initializing base class Service!" ); }
141 if ( !ipers ) {
return error(
"Unable to locate IPersistencySvc interface of " + m_persName ); }
144 status = ipers->getService( itm.
name(), cnvSvc );
146 status = ipers->getService( itm.
type(), cnvSvc );
148 return error(
"Unable to locate IConversionSvc interface of database type " + m_cnvSvcName );
151 m_dbMgr =
dynamic_cast<RootCnvSvc*
>( cnvSvc );
154 return error(
"Unable to localize service:" + m_cnvSvcName );
159 auto eds = serviceLocator()->service<
IDataManagerSvc>(
"EventDataSvc" );
160 if ( !eds ) {
return error(
"Unable to localize service EventDataSvc" ); }
161 m_rootCLID = eds->rootCLID();
162 m_rootName = eds->rootName();
171 if ( m_dbMgr ) m_dbMgr->release();
189 TBranch* b = pCtxt->
branch();
194 if ( fileit != pCtxt->
files().
end() ) {
199 string section = m_rootName[0] ==
'/' ? m_rootName.substr( 1 ) : m_rootName;
200 b = con->
getBranch( section, m_rootName );
207 m_dbMgr->disconnect( in ).ignore();
213 long ent = pCtxt->
entry();
214 Long64_t nent = b->GetEntries();
215 if ( nent > ( ent + 1 ) ) {
232 for (
int i = 0; i < jump; ++i ) {
234 if ( !status.
isSuccess() ) {
return status; }
243 return error(
"EventSelector Iterator, operator -- not supported " );
249 for (
int i = 0; i < jump; ++i ) {
251 if ( !status.
isSuccess() ) {
return status; }
263 if ( fileit != pCtxt->
files().
end() ) {
264 string input = *fileit;
265 m_dbMgr->disconnect( input ).ignore();
280 long ent = pctxt->
entry();
283 if ( fileit != pctxt->
files().
end() ) {
284 const string par[2] = { pctxt->
fid(), m_rootName };
285 const unsigned long ipar[2] = { 0, (
unsigned long)ent };
286 return m_dbMgr->createAddress( m_dbMgr->repSvcType(), m_rootCLID, &
par[0], &ipar[0], pAddr );
309 string db, typ, item,
sel, stmt, aut, addr;
311 if ( criteria.
compare( 0, 5,
"FILE " ) == 0 ) {
314 db = criteria.
substr( 5 );
317 for (
auto attrib : Parser( criteria ) ) {
318 string tmp = attrib.tag.substr( 0, 3 );
319 if ( tmp ==
"DAT" ) {
321 }
else if ( tmp ==
"OPT" ) {
322 if ( attrib.value.compare( 0, 3,
"REA" ) != 0 ) {
326 }
else if ( tmp ==
"TYP" ) {
328 }
else if ( tmp ==
"ADD" ) {
330 }
else if ( tmp ==
"SEL" ) {
332 }
else if ( tmp ==
"FUN" ) {
334 }
else if ( tmp ==
"AUT" ) {
336 }
else if ( tmp ==
"COL" ) {
350 if ( ipos == -1 )
break;
351 rest = rest.
substr( ipos, string::npos );
355 if ( lpos == -1 )
break;
356 rest = rest.
substr( lpos, string::npos );
362 return error(
"Invalid iteration context." );
StatusCode initialize() override
StatusCode last(Context &refContext) const override
Access last item in the iteration.
void setFileIterator(Files::const_iterator i)
Set file iterator.
Files::const_iterator m_fiter
The iterator to the.
const std::string & name() const
void * identifier() const override
Context identifier.
Files::const_iterator fileIterator() const
Access to the file iterator.
StatusCode error(const std::string &msg) const
Helper method to issue error messages.
StatusCode rewind(Context &refCtxt) const override
Rewind the dataset.
const std::string & fid() const
Access connection fid.
TBranch * m_branch
Reference to the top level branch (typically /Event) used to iterate.
T find_first_not_of(T... args)
StatusCode finalize() override
RootEvtSelectorContext(const RootEvtSelector *s)
Standard constructor with initialization.
StatusCode createContext(Context *&refpCtxt) const override
Create a new event loop context.
const RootEvtSelector * m_sel
Reference to the hosting event selector instance.
StatusCode previous(Context &refCtxt) const override
Get previous iteration item from the event loop context.
long entry() const
Access to the current event entry number.
void setBranch(TBranch *b)
Set the top level branch (typically /Event) used to iterate.
Helper class to parse a string of format "type/name".
void setEntry(long e)
Set current event entry number.
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...
void setFID(const std::string &fid)
Set connection FID.
std::string m_fid
Connection fid.
Files m_files
The file container managed by this context.
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
This file provides a Grammar for the type Gaudi::Accumulators::Axis It allows to use that type from p...
TBranch * branch() const
Access to the top level branch (typically /Event) used to iterate.
const std::string & type() const
const Files & files() const
Access to the file container.
constexpr static const auto SUCCESS
StatusCode finalize() override
IService implementation: Service finalization.
long m_entry
Current entry of current file.
StatusCode releaseContext(Context *&refCtxt) const override
Release existing event iteration context.
const std::string & fid() const
Access file id.
T find_first_of(T... args)
void setFiles(const Files &f)
Set the file container.
constexpr static const auto FAILURE
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.
StatusCode next(Context &refCtxt) const override
Get next iteration item from the event loop context.
TBranch * getBranch(std::string_view section, std::string_view branch_name)
Access data branch by name: Get existing branch in read only mode.
Parse attribute strings allowing iteration over the various attributes.
std::vector< std::string > Files
Definition of the file container.
StatusCode initialize() override
IService implementation: Db event selector override.