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;
101 :
base_class(name, svcloc), m_rootCLID(CLID_NULL)
121 return error(
"Error initializing base class Service!");
126 return error(
"Unable to locate IPersistencySvc interface of "+
m_persName);
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);
147 return error(
"Unable to localize service EventDataSvc");
179 TBranch* b = pCtxt->
branch();
181 RootEvtSelectorContext::Files::const_iterator fileit = pCtxt->
fileIterator();
184 if ( fileit != pCtxt->
files().end() ) {
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;
275 long ent = pctxt->
entry();
277 RootEvtSelectorContext::Files::const_iterator fileit = pctxt->
fileIterator();
278 if ( fileit != pctxt->
files().end() ) {
280 const unsigned long ipar[2] = {0,(
unsigned long)ent};
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.");
Definition of the MsgStream class used to transmit messages.
const Files & files() const
Access to the file container.
std::string m_persName
Property; Name of the persistency service to search for conversion service.
Small smart pointer class with automatic reference counting for IInterface.
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.
virtual void * identifier() const
Context identifier.
Items & items()
Access token collection.
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.
SmartIF< IMessageSvc > & msgSvc() const
The standard message service.
bool isSuccess() const
Test for a status code of SUCCESS.
std::string m_fid
Connection fid.
void analyse(const std::string &s, const char *delim, const char *tagBegin, const char *tagEnd, const char *eq, const char *valBegin, const char *valEnd)
Analyse tokens from string.
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.
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.
bool isValid() const
Allow for check if smart pointer is valid.
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.
const RootEvtSelector * m_sel
Reference to the hosting event selector instance.
virtual const std::string & name() const
Retrieve name of the service.
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.
virtual StatusCode initialize()
Initialization (from CONFIGURED to INITIALIZED).
virtual unsigned long release()
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.
Templated class to add the standard messaging functionalities.
virtual unsigned long addRef()=0
Increment the reference count of Interface instance.
virtual ~RootEvtSelectorContext()
Standard destructor.
StatusCode service(const std::string &name, const T *&psvc, bool createIf=true) const
Access a service by name, creating it if it doesn't already exist.
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.
This is a number of static methods for bootstrapping the Gaudi framework.
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.
MsgStream & error() const
shortcut for the method msgStream(MSG::ERROR)
virtual StatusCode finalize()
Finalize (from INITIALIZED to CONFIGURED).
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.
SmartIF< ISvcLocator > & serviceLocator() const
Retrieve pointer to service locator.
long m_entry
Current entry of current file.