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;
100 :
base_class(name, svcloc), m_rootCLID(CLID_NULL)
120 return error(
"Error initializing base class Service!");
125 return error(
"Unable to locate IPersistencySvc interface of "+
m_persName);
129 status = ipers->getService(itm.
name(),cnvSvc);
131 status = ipers->getService(itm.
type(),cnvSvc);
133 return error(
"Unable to locate IConversionSvc interface of database type "+
m_cnvSvcName);
146 return error(
"Unable to localize service EventDataSvc");
178 TBranch* b = pCtxt->
branch();
183 if ( fileit != pCtxt->
files().
end() ) {
202 long ent = pCtxt->
entry();
203 Long64_t nent = b->GetEntries();
204 if ( nent > (ent+1) ) {
221 for (
int i = 0;
i < jump; ++
i ) {
234 return error(
"EventSelector Iterator, operator -- not supported ");
240 for (
int i = 0;
i < jump; ++
i ) {
256 if ( fileit != pCtxt->
files().
end() ) {
257 string input = *fileit;
274 long ent = pctxt->
entry();
277 if ( fileit != pctxt->
files().
end() ) {
279 const unsigned long ipar[2] = {0,(
unsigned long)ent};
305 string db, typ,
item,
sel, stmt, aut, addr;
307 if ( criteria.
compare(0,5,
"FILE ")==0 ) {
314 for(
auto attrib: Parser(criteria)) {
315 string tmp = attrib.tag.substr(0,3);
319 else if(tmp==
"OPT") {
320 if(attrib.value.compare(0, 3,
"REA") != 0) {
321 log <<
MSG::ERROR <<
"Option:\"" << attrib.value <<
"\" not valid" <<
endmsg;
325 else if (tmp==
"TYP") {
328 else if(tmp==
"ADD") {
331 else if(tmp==
"SEL") {
334 else if(tmp==
"FUN") {
337 else if(tmp==
"AUT") {
340 else if(tmp==
"COL") {
354 if (ipos == -1 )
break;
355 rest = rest.
substr(ipos,string::npos);
358 if (lpos == -1 )
break;
359 rest = rest.
substr(lpos,string::npos);
365 return error(
"Invalid iteration context.");
Parse attribute strings allowing iteration over the various attributes.
Definition of the MsgStream class used to transmit messages.
StatusCode initialize() override
const Files & files() const
Access to the file container.
std::string m_persName
Property; Name of the persistency service to search for conversion service.
SmartIF< ISvcLocator > & serviceLocator() const override
Retrieve pointer to service locator.
virtual StatusCode rewind(Context &refCtxt) const
Rewind the dataset.
virtual StatusCode initialize()
IService implementation: Db event selector override.
Files::const_iterator fileIterator() const
Access to the file iterator.
The ISvcLocator is the interface implemented by the Service Factory in the Application Manager to loc...
const std::string & fid() const
Access file id.
virtual StatusCode last(Context &refContext) const
Access last item in the iteration.
RootEvtSelectorContext(const RootEvtSelector *s)
Standard constructor with initialization.
T find_first_not_of(T...args)
StatusCode finalize() override
virtual StatusCode createAddress(long svc_type, const CLID &clid, const std::string *par, const unsigned long *ip, IOpaqueAddress *&refpAddress)
IAddressCreator implementation: Address creation.
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.
virtual StatusCode resetCriteria(const std::string &cr, Context &c) const
Will set a new criteria for the selection of the next list of events and will change the state of the...
std::string m_dummy
Property: dummy to fake backwards compatibility.
virtual StatusCode previous(Context &refCtxt) const
Get previous iteration item from the event loop context.
StatusCode connectDatabase(const std::string &dataset, int mode, RootDataConnection **con)
Connect the output file to the service with open mode.
RootCnvSvc * m_dbMgr
Reference to the corresponding conversion service.
~RootEvtSelectorContext() override=default
Standard destructor.
void * identifier() const override
Context identifier.
StatusCode service(const Gaudi::Utils::TypeNameString &name, T *&svc, bool createIf=true)
Templated method to access a service by name.
const std::string & name() const override
Retrieve name of the service.
MsgStream & error() const
shortcut for the method msgStream(MSG::ERROR)
virtual StatusCode finalize()
IService implementation: Service finalization.
Helper class to parse a string of format "type/name".
virtual long repSvcType() const
Retrieve the class type of the data store the converter uses.
std::string m_cnvSvcName
Property; Name of the concversion service used to create opaque addresses.
ROOT specific event selector context.
This class is used for returning status codes from appropriate routines.
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)
const RootEvtSelector * m_sel
Reference to the hosting event selector instance.
void setFiles(const Files &f)
Set the file container.
virtual StatusCode disconnect(const std::string &dbName)
Disconnect from an existing data stream.
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.
virtual unsigned long release()=0
Release Interface instance.
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.
SmartIF< IMessageSvc > & msgSvc() const
The standard message service.
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.
const std::string & name() const
RootEvtSelector(const std::string &name, ISvcLocator *svcloc)
Service Constructor.
Opaque address interface definition.
Property * declareProperty(const std::string &name, T &property, const std::string &doc="none") const
Declare the named property.
Files m_files
The file container managed by this context.
virtual StatusCode createAddress(const Context &refCtxt, IOpaqueAddress *&) const
Create new Opaque address corresponding to the current record.
virtual StatusCode releaseContext(Context *&refCtxt) const
Release existing event iteration context.
CLID m_rootCLID
Class id of root node to create opaque address.
Concrete implementation of the IDataConnection interface to access ROOT files.
TBranch * m_branch
Reference to the top level branch (typically /Event) used to iterate.
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.
virtual StatusCode next(Context &refCtxt) const
Get next iteration item from the event loop context.
virtual StatusCode createContext(Context *&refpCtxt) const
Create a new event loop context.
std::string m_rootName
Property: Name of the ROOT entry name.
long m_entry
Current entry of current file.