| The Gaudi Framework v28r2p1 (f1a77ff4)

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

Public Member Functions | Protected Attributes | Private Member Functions | List of all members
Gaudi::RootEvtSelector Class Reference

Concrete event selector implementation to access ROOT files. More...

`#include <GAUDIROOT/RootEvtSelector.h>`

Inheritance diagram for Gaudi::RootEvtSelector:
[legend]
Collaboration diagram for Gaudi::RootEvtSelector:
[legend]

## Public Member Functions
| ~RootEvtSelector () override=default
| Standard destructor. More...
StatusCode | initialize () override
| IService implementation: Db event selector override. More...
StatusCode | finalize () override
| IService implementation: Service finalization. More...
StatusCode | createContext (Context *&refpCtxt) const override
| Create a new event loop context. More...
StatusCode | last (Context &refContext) const override
| Access last item in the iteration. More...
StatusCode | next (Context &refCtxt) const override
| Get next iteration item from the event loop context. More...
StatusCode | next (Context &refCtxt, int jump) const override
| Get next iteration item from the event loop context, but skip jump elements. More...
StatusCode | previous (Context &refCtxt) const override
| Get previous iteration item from the event loop context. More...
StatusCode | previous (Context &refCtxt, int jump) const override
| Get previous iteration item from the event loop context, but skip jump elements. More...
StatusCode | rewind (Context &refCtxt) const override
| Rewind the dataset. More...
StatusCode | createAddress (const Context &refCtxt, IOpaqueAddress *&) const override
| Create new Opaque address corresponding to the current record. More...
StatusCode | releaseContext (Context *&refCtxt) const override
| Release existing event iteration context. More...
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 context in a way to point to the new list. More...
Public Member Functions inherited from extends< Service, IEvtSelector >
void * | i_cast (const InterfaceID &tid) const override
| Implementation of IInterface::i_cast. More...
StatusCode | queryInterface (const InterfaceID &ti, void **pp) override
| Implementation of IInterface::queryInterface. More...
std::vector< std::string > | getInterfaceNames () const override
| Implementation of IInterface::getInterfaceNames. More...
| ~extends () override=default
| Virtual destructor. More...
Public Member Functions inherited from Service
const std::string & | name () const override
| Retrieve name of the service. More...
StatusCode | configure () override
StatusCode | initialize () override
StatusCode | start () override
StatusCode | stop () override
StatusCode | finalize () override
StatusCode | terminate () override
Gaudi::StateMachine::State | FSMState () const override
Gaudi::StateMachine::State | targetFSMState () const override
StatusCode | reinitialize () override
StatusCode | restart () override
StatusCode | sysInitialize () override
| Initialize Service. More...
StatusCode | sysStart () override
| Initialize Service. More...
StatusCode | sysStop () override
| Initialize Service. More...
StatusCode | sysFinalize () override
| Finalize Service. More...
StatusCode | sysReinitialize () override
| Re-initialize the Service. More...
StatusCode | sysRestart () override
| Re-initialize the Service. More...
| Service (std::string name, ISvcLocator *svcloc)
| Standard Constructor. More...
SmartIF< ISvcLocator > & | serviceLocator () const override
| Retrieve pointer to service locator. More...
StatusCode | setProperties ()
| Method for setting declared properties to the values specified for the job. More...
template<class T >
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. More...
template<class T >
StatusCode | service (const std::string &name, T *&psvc, bool createIf=true) const
template<typename IFace = IService>
SmartIF< IFace > | service (const std::string &name, bool createIf=true) const
template<class T >
StatusCode | service (const std::string &svcType, const std::string &svcName, T *&psvc) const
| Access a service by name and type, creating it if it doesn't already exist. More...
template<class T >
StatusCode | declarePrivateTool (ToolHandle< T > &handle, std::string toolTypeAndName="", bool createIf=true)
| Declare used Private tool. More...
template<class T >
StatusCode | declarePublicTool (ToolHandle< T > &handle, std::string toolTypeAndName="", bool createIf=true)
| Declare used Public tool. More...
SmartIF< IAuditorSvc > & | auditorSvc () const
| The standard auditor service.May not be invoked before sysInitialize() has been invoked. More...
Public Member Functions inherited from PropertyHolder< CommonMessaging< implements< IService, IProperty, IStateful > > >
| PropertyHolder ()=default
| ~PropertyHolder () override=default
Gaudi::Details::PropertyBase & | declareProperty (Gaudi::Details::PropertyBase &prop)
| Declare a property. More...
Gaudi::Details::PropertyBase * | declareProperty (const std::string &name, TYPE &value, const std::string &doc="none")
| Helper to wrap a regular data member and use it as a regular property. More...
Gaudi::Details::PropertyBase * | declareProperty (const std::string &name, TYPE &value, const std::string &doc="none") const
Gaudi::Details::PropertyBase * | declareProperty (const std::string &name, Gaudi::Property< TYPE, VERIFIER, HANDLERS > &prop, const std::string &doc="none")
| Declare a PropertyBase instance setting name and documentation. More...
Gaudi::Details::PropertyBase * | declareRemoteProperty (const std::string &name, IProperty *rsvc, const std::string &rname="")
| Declare a remote property. More...
StatusCode | setProperty (const Gaudi::Details::PropertyBase &p) override
| set the property form another property More...
StatusCode | setProperty (const std::string &s) override
| set the property from the formatted string More...
StatusCode | setProperty (const std::string &n, const std::string &v) override
| set the property from name and the value More...
StatusCode | setProperty (const std::string &name, const TYPE &value)
| set the property form the value More...
StatusCode | getProperty (Gaudi::Details::PropertyBase *p) const override
| get the property More...
const Gaudi::Details::PropertyBase & | getProperty (const std::string &name) const override
| get the property by name More...
StatusCode | getProperty (const std::string &n, std::string &v) const override
| convert the property to the string More...
const std::vector< Gaudi::Details::PropertyBase * > & | getProperties () const override
| get all properties More...
bool | hasProperty (const std::string &name) const override
| Return true if we have a property with the given name. More...
| PropertyHolder (const PropertyHolder &)=delete
PropertyHolder & | operator= (const PropertyHolder &)=delete
Gaudi::Details::PropertyBase * | declareProperty (const std::string &name, GaudiHandleBase &ref, const std::string &doc="none")
| Specializations for various GaudiHandles. More...
Gaudi::Details::PropertyBase * | declareProperty (const std::string &name, GaudiHandleArrayBase &ref, const std::string &doc="none")
Gaudi::Details::PropertyBase * | declareProperty (const std::string &name, DataObjectHandleBase &ref, const std::string &doc="none")
Public Member Functions inherited from CommonMessagingBase
virtual | ~CommonMessagingBase ()=default
| Virtual destructor. More...
SmartIF< IMessageSvc > & | msgSvc () const
| The standard message service. More...
MsgStream & | msgStream () const
| Return an uninitialized MsgStream. More...
MsgStream & | msgStream (const MSG::Level level) const
| Predefined configurable message stream for the efficient printouts. More...
MsgStream & | always () const
| shortcut for the method msgStream(MSG::ALWAYS) More...
MsgStream & | fatal () const
| shortcut for the method msgStream(MSG::FATAL) More...
MsgStream & | err () const
| shortcut for the method msgStream(MSG::ERROR) More...
MsgStream & | error () const
| shortcut for the method msgStream(MSG::ERROR) More...
MsgStream & | warning () const
| shortcut for the method msgStream(MSG::WARNING) More...
MsgStream & | info () const
| shortcut for the method msgStream(MSG::INFO) More...
MsgStream & | debug () const
| shortcut for the method msgStream(MSG::DEBUG) More...
MsgStream & | verbose () const
| shortcut for the method msgStream(MSG::VERBOSE) More...
MsgStream & | msg () const
| shortcut for the method msgStream(MSG::INFO) More...
MSG::Level | msgLevel () const
| get the output level from the embedded MsgStream More...
MSG::Level | outputLevel () const __attribute__((deprecated))
| Backward compatibility function for getting the output level. More...
bool | msgLevel (MSG::Level lvl) const
| get the output level from the embedded MsgStream More...
Public Member Functions inherited from extend_interfaces< Interfaces... >
| ~extend_interfaces () override=default
| Virtual destructor. More...

## Protected Attributes
RootCnvSvc * | m_dbMgr
| Reference to the corresponding conversion service. More...
CLID | m_rootCLID = CLID_NULL
| Class id of root node to create opaque address. More...
Gaudi::Property< std::string > | m_persName
Gaudi::Property< std::string > | m_dummy {this, "DbType", "", "dummy property to fake backwards compatibility"}
std::string | m_cnvSvcName = "Gaudi::RootCnvSvc/RootCnvSvc"
| Property; Name of the concversion service used to create opaque addresses. More...
std::string | m_rootName
| Property: Name of the ROOT entry name. More...
std::string | m_criteria
| Property: File criteria to define item iteration. More...
Protected Attributes inherited from Service
Gaudi::StateMachine::State | m_state = Gaudi::StateMachine::OFFLINE
| Service state. More...
Gaudi::StateMachine::State | m_targetState = Gaudi::StateMachine::OFFLINE
| Service state. More...
Gaudi::Property< int > | m_outputLevel {this, "OutputLevel", MSG::NIL, "output level"}
Gaudi::Property< bool > | m_auditInit {this, "AuditServices", false, "[[deprecated]] unused"}
Gaudi::Property< bool > | m_auditorInitialize {this, "AuditInitialize", false, "trigger auditor on initialize()"}
Gaudi::Property< bool > | m_auditorStart {this, "AuditStart", false, "trigger auditor on start()"}
Gaudi::Property< bool > | m_auditorStop {this, "AuditStop", false, "trigger auditor on stop()"}
Gaudi::Property< bool > | m_auditorFinalize {this, "AuditFinalize", false, "trigger auditor on finalize()"}
Gaudi::Property< bool > | m_auditorReinitialize {this, "AuditReinitialize", false, "trigger auditor on reinitialize()"}
Gaudi::Property< bool > | m_auditorRestart {this, "AuditRestart", false, "trigger auditor on restart()"}
SmartIF< IAuditorSvc > | m_pAuditorSvc
| Auditor Service. More...

## Private Member Functions
StatusCode | error (const std::string &msg) const
| Helper method to issue error messages. More...

## Additional Inherited Members
Public Types inherited from extends< Service, IEvtSelector >
using | base_class = extends
| Typedef to this class. More...
using | extend_interfaces_base = extend_interfaces< Interfaces... >
| Typedef to the base of this class. More...
Public Types inherited from Service
typedef Gaudi::PluginService::Factory< IService *, const std::string &, ISvcLocator * > | Factory
Public Types inherited from PropertyHolder< CommonMessaging< implements< IService, IProperty, IStateful > > >
using | PropertyHolderImpl = PropertyHolder< CommonMessaging< implements< IService, IProperty, IStateful > > >
| Typedef used to refer to this class from derived classes, as in. More...
Public Types inherited from CommonMessaging< implements< IService, IProperty, IStateful > >
using | base_class = CommonMessaging
Public Types inherited from extend_interfaces< Interfaces... >
using | ext_iids = typename Gaudi::interface_list_cat< typename Interfaces::ext_iids... >::type
| take union of the ext_iids of all Interfaces... More...
Protected Member Functions inherited from Service
| ~Service () override
| Standard Destructor. More...
int | outputLevel () const
| get the `Service's` output level More...
Protected Member Functions inherited from PropertyHolder< CommonMessaging< implements< IService, IProperty, IStateful > > >
Gaudi::Details::PropertyBase * | property (const std::string &name) const
Protected Member Functions inherited from CommonMessaging< implements< IService, IProperty, IStateful > >
void | updateMsgStreamOutputLevel (int level)
| Update the output level of the cached MsgStream. More...

## Detailed Description

Concrete event selector implementation to access ROOT files.

Author
  M.Frank

Version
  1.0

Date
  20/12/2009

Definition at line 40 of file RootEvtSelector.h.

## Constructor & Destructor Documentation

Gaudi::RootEvtSelector::~RootEvtSelector | ( |  | ) |
| override default

Standard destructor.

## Member Function Documentation

StatusCode RootEvtSelector::createAddress | ( | const Context & | refCtxt,
|  | IOpaqueAddress *& | pAddr
| ) |  | const
| override

Create new Opaque address corresponding to the current record.

Parameters

  refCtxt | [IN/OUT] Reference to the context

Returns
  StatusCode indicating success or failure

Definition at line 261 of file RootEvtSelector.cpp.

261 {
262 const RootEvtSelectorContext* pctxt = dynamic_cast<const RootEvtSelectorContext*>(&ctxt);
263 if ( pctxt ) {
264 long ent = pctxt->entry();
265 if ( ent >= 0 ) {
266 auto fileit = pctxt->fileIterator();
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);
271 }
272 }
273 }
274 pAddr = nullptr;
275 return StatusCode::FAILURE;
276 }
Gaudi::RootEvtSelectorContext::files
const Files & files() const
Access to the file container.
Definition: RootEvtSelector.cpp:55
Gaudi::RootEvtSelectorContext::fileIterator
Files::const_iterator fileIterator() const
Access to the file iterator.
Definition: RootEvtSelector.cpp:64
StatusCode::FAILURE
Definition: StatusCode.h:29
Gaudi::RootCnvSvc::createAddress
StatusCode createAddress(long svc_type, const CLID &clid, const std::string *par, const unsigned long *ip, IOpaqueAddress *&refpAddress) override
IAddressCreator implementation: Address creation.
Definition: RootCnvSvc.cpp:373
std::vector::end
T end(T...args)
Gaudi::RootEvtSelector::m_dbMgr
RootCnvSvc * m_dbMgr
Reference to the corresponding conversion service.
Definition: RootEvtSelector.h:133
compareOutputFiles.par
string par
Definition: compareOutputFiles.py:386
Gaudi::RootEvtSelectorContext
ROOT specific event selector context.
Definition: RootEvtSelector.cpp:32
Gaudi::RootEvtSelectorContext::fid
const std::string & fid() const
Access connection fid.
Definition: RootEvtSelector.cpp:74
ConversionSvc::repSvcType
long repSvcType() const override
Retrieve the class type of the data store the converter uses.
Definition: ConversionSvc.cpp:330
Gaudi::RootEvtSelector::m_rootCLID
CLID m_rootCLID
Class id of root node to create opaque address.
Definition: RootEvtSelector.h:135
Gaudi::RootEvtSelectorContext::entry
long entry() const
Access to the current event entry number.
Definition: RootEvtSelector.cpp:68
Gaudi::RootEvtSelector::m_rootName
std::string m_rootName
Property: Name of the ROOT entry name.
Definition: RootEvtSelector.h:144

StatusCode RootEvtSelector::createContext | ( | Context *& | refpCtxt | ) | const
| override

Create a new event loop context.

Parameters

  refpCtxt | [IN/OUT] Reference to pointer to store the context

Returns
  StatusCode indicating success or failure

Definition at line 154 of file RootEvtSelector.cpp.

154 {
155 refpCtxt = new RootEvtSelectorContext(this);
156 return StatusCode::SUCCESS;
157 }
StatusCode::SUCCESS
Definition: StatusCode.h:30
Gaudi::RootEvtSelectorContext
ROOT specific event selector context.
Definition: RootEvtSelector.cpp:32

StatusCode RootEvtSelector::error | ( | const std::string & | msg | ) | const
| private

Helper method to issue error messages.

Definition at line 99 of file RootEvtSelector.cpp.

99 {
100 MsgStream log(msgSvc(), name());
101 log << MSG::ERROR << msg << endmsg;
102 return StatusCode::FAILURE;
103 }
MsgStream
Definition of the MsgStream class used to transmit messages.
Definition: MsgStream.h:24
Service::name
const std::string & name() const override
Retrieve name of the service.
Definition: Service.cpp:289
StatusCode::FAILURE
Definition: StatusCode.h:29
CommonMessagingBase::msgSvc
SmartIF< IMessageSvc > & msgSvc() const
The standard message service.
Definition: CommonMessaging.h:70
MSG::ERROR
Definition: IMessageSvc.h:21
endmsg
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
Gaudi.Configuration.log
log
Definition: Configuration.py:13

StatusCode RootEvtSelector::finalize | ( |  | ) |
| override

IService implementation: Service finalization.

Definition at line 146 of file RootEvtSelector.cpp.

146 {
147 // Initialize base class
148 if ( m_dbMgr ) m_dbMgr->release();
149 m_dbMgr = nullptr; // release
150 return Service::finalize();
151 }
Service::finalize
StatusCode finalize() override
Definition: Service.cpp:174
Gaudi::RootEvtSelector::m_dbMgr
RootCnvSvc * m_dbMgr
Reference to the corresponding conversion service.
Definition: RootEvtSelector.h:133

StatusCode RootEvtSelector::initialize | ( |  | ) |
| override

IService implementation: Db event selector override.

Definition at line 106 of file RootEvtSelector.cpp.

106 {
107 // Initialize base class
108 StatusCode status = Service::initialize();
109 if ( !status.isSuccess() ) {
110 return error("Error initializing base class Service!");
111 }
112
113 auto ipers = serviceLocator()->service<IPersistencySvc>(m_persName);
114 if( !ipers ) {
115 return error("Unable to locate IPersistencySvc interface of "+m_persName);
116 }
117 IConversionSvc *cnvSvc = nullptr;
118 Gaudi::Utils::TypeNameString itm(m_cnvSvcName);
119 status = ipers->getService(itm.name(),cnvSvc);
120 if( !status.isSuccess() ) {
121 status = ipers->getService(itm.type(),cnvSvc);
122 if( !status.isSuccess() ) {
123 return error("Unable to locate IConversionSvc interface of database type "+m_cnvSvcName);
124 }
125 }
126 m_dbMgr = dynamic_cast<RootCnvSvc*>(cnvSvc);
127 if( !m_dbMgr ) {
128 cnvSvc->release();
129 return error("Unable to localize service:"+m_cnvSvcName);
130 }
131 m_dbMgr->addRef();
132
133 // Get DataSvc
134 auto eds = serviceLocator()->service<IDataManagerSvc>("EventDataSvc");
135 if( !eds ) {
136 return error("Unable to localize service EventDataSvc");
137 }
138 m_rootCLID = eds->rootCLID();
139 m_rootName = eds->rootName();
140 MsgStream log(msgSvc(), name());
141 log << MSG::DEBUG << "Selection root:" << m_rootName << " CLID:" << m_rootCLID << endmsg;
142 return status;
143 }
MsgStream
Definition of the MsgStream class used to transmit messages.
Definition: MsgStream.h:24
Service::initialize
StatusCode initialize() override
Definition: Service.cpp:64
Service::name
const std::string & name() const override
Retrieve name of the service.
Definition: Service.cpp:289
IConversionSvc
Definition: IConversionSvc.h:37
StatusCode::isSuccess
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:74
MSG::DEBUG
Definition: IMessageSvc.h:18
Gaudi::RootCnvSvc
Description:
Definition: RootCnvSvc.h:53
Gaudi::RootEvtSelector::m_persName
Gaudi::Property< std::string > m_persName
Definition: RootEvtSelector.h:137
Gaudi::RootEvtSelector::m_dbMgr
RootCnvSvc * m_dbMgr
Reference to the corresponding conversion service.
Definition: RootEvtSelector.h:133
ISvcLocator::service
StatusCode service(const Gaudi::Utils::TypeNameString &name, T *&svc, bool createIf=true)
Templated method to access a service by name.
Definition: ISvcLocator.h:78
CommonMessagingBase::error
MsgStream & error() const
shortcut for the method msgStream(MSG::ERROR)
Definition: CommonMessaging.h:117
Gaudi::Utils::TypeNameString
Helper class to parse a string of format "type/name".
Definition: TypeNameString.h:12
Gaudi::RootEvtSelector::m_cnvSvcName
std::string m_cnvSvcName
Property; Name of the concversion service used to create opaque addresses.
Definition: RootEvtSelector.h:142
StatusCode
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
IInterface::release
virtual unsigned long release()=0
Release Interface instance.
IDataManagerSvc
Definition: IDataManagerSvc.h:45
CommonMessagingBase::msgSvc
SmartIF< IMessageSvc > & msgSvc() const
The standard message service.
Definition: CommonMessaging.h:70
IPersistencySvc
Data persistency service interface.
Definition: IPersistencySvc.h:19
Gaudi::RootEvtSelector::m_rootCLID
CLID m_rootCLID
Class id of root node to create opaque address.
Definition: RootEvtSelector.h:135
Service::serviceLocator
SmartIF< ISvcLocator > & serviceLocator() const override
Retrieve pointer to service locator.
Definition: Service.cpp:292
endmsg
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
Gaudi::RootEvtSelector::m_rootName
std::string m_rootName
Property: Name of the ROOT entry name.
Definition: RootEvtSelector.h:144
Gaudi.Configuration.log
log
Definition: Configuration.py:13

StatusCode RootEvtSelector::last | ( | Context & | refContext | ) | const
| override

Access last item in the iteration.

Parameters

  refContext | [IN/OUT] Reference to the Context object.

Definition at line 160 of file RootEvtSelector.cpp.

160 {
161 return StatusCode::FAILURE;
162 }
StatusCode::FAILURE
Definition: StatusCode.h:29

StatusCode RootEvtSelector::next | ( | Context & | refCtxt | ) | const
| override

Get next iteration item from the event loop context.

Parameters

  refCtxt | [IN/OUT] Reference to the context

Returns
  StatusCode indicating success or failure

Definition at line 165 of file RootEvtSelector.cpp.

165 {
166 RootEvtSelectorContext* pCtxt = dynamic_cast<RootEvtSelectorContext*>(&ctxt);
167 if ( pCtxt ) {
168 TBranch* b = pCtxt->branch();
169 if ( !b ) {
170 auto fileit = pCtxt->fileIterator();
171 pCtxt->setBranch(nullptr);
172 pCtxt->setEntry(-1);
173 if ( fileit != pCtxt->files().end() ) {
174 RootDataConnection* con=nullptr;
175 string in = *fileit;
176 StatusCode sc = m_dbMgr->connectDatabase(in,IDataConnection::READ,&con);
177 if ( sc.isSuccess() ) {
178 string section = m_rootName[0] == '/' ? m_rootName.substr(1) : m_rootName;
179 b = con->getBranch(section,m_rootName);
180 if ( b ) {
181 pCtxt->setFID(con->fid());
182 pCtxt->setBranch(b);
183 return next(ctxt);
184 }
185 }
186 m_dbMgr->disconnect(in).ignore();
187 pCtxt->setFileIterator(++fileit);
188 return next(ctxt);
189 }
190 return StatusCode::FAILURE;
191 }
192 long ent = pCtxt->entry();
193 Long64_t nent = b->GetEntries();
194 if ( nent > (ent+1) ) {
195 pCtxt->setEntry(++ent);
196 return StatusCode::SUCCESS;
197 }
198 auto fit = pCtxt->fileIterator();
199 pCtxt->setFileIterator(++fit);
200 pCtxt->setEntry(-1);
201 pCtxt->setBranch(nullptr);
202 pCtxt->setFID("");
203 return next(ctxt);
204 }
205 return StatusCode::FAILURE;
206 }
StatusCode::SUCCESS
Definition: StatusCode.h:30
Gaudi::RootEvtSelectorContext::files
const Files & files() const
Access to the file container.
Definition: RootEvtSelector.cpp:55
Gaudi::RootEvtSelectorContext::fileIterator
Files::const_iterator fileIterator() const
Access to the file iterator.
Definition: RootEvtSelector.cpp:64
Gaudi::IDataConnection::fid
const std::string & fid() const
Access file id.
Definition: IIODataManager.h:52
StatusCode::FAILURE
Definition: StatusCode.h:29
StatusCode::isSuccess
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:74
std::vector::end
T end(T...args)
Gaudi::RootCnvSvc::connectDatabase
StatusCode connectDatabase(const std::string &dataset, int mode, RootDataConnection **con)
Connect the output file to the service with open mode.
Definition: RootCnvSvc.cpp:207
Gaudi::RootEvtSelector::m_dbMgr
RootCnvSvc * m_dbMgr
Reference to the corresponding conversion service.
Definition: RootEvtSelector.h:133
Gaudi::IDataConnection::READ
Definition: IIODataManager.h:38
Gaudi::RootEvtSelectorContext
ROOT specific event selector context.
Definition: RootEvtSelector.cpp:32
StatusCode
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
Gaudi::RootDataConnection::getBranch
TBranch * getBranch(const std::string &section, const std::string &branch_name)
Access data branch by name: Get existing branch in read only mode.
Definition: RootDataConnection.h:307
Gaudi::RootCnvSvc::disconnect
virtual StatusCode disconnect(const std::string &dbName)
Disconnect from an existing data stream.
Definition: RootCnvSvc.cpp:367
Gaudi::RootEvtSelectorContext::setBranch
void setBranch(TBranch *b)
Set the top level branch (typically /Event) used to iterate.
Definition: RootEvtSelector.cpp:78
Gaudi::RootEvtSelector::next
StatusCode next(Context &refCtxt) const override
Get next iteration item from the event loop context.
Definition: RootEvtSelector.cpp:165
Gaudi::RootEvtSelectorContext::setEntry
void setEntry(long e)
Set current event entry number.
Definition: RootEvtSelector.cpp:70
Gaudi::RootEvtSelectorContext::setFID
void setFID(const std::string &fid)
Set connection FID.
Definition: RootEvtSelector.cpp:72
std::string::substr
T substr(T...args)
Gaudi::RootEvtSelectorContext::setFileIterator
void setFileIterator(Files::const_iterator i)
Set file iterator.
Definition: RootEvtSelector.cpp:66
Gaudi::RootEvtSelectorContext::branch
TBranch * branch() const
Access to the top level branch (typically /Event) used to iterate.
Definition: RootEvtSelector.cpp:76
StatusCode::ignore
void ignore() const
Definition: StatusCode.h:106
Gaudi::RootDataConnection
Concrete implementation of the IDataConnection interface to access ROOT files.
Definition: RootDataConnection.h:92
Gaudi::RootEvtSelectorContext::entry
long entry() const
Access to the current event entry number.
Definition: RootEvtSelector.cpp:68
Gaudi::RootEvtSelector::m_rootName
std::string m_rootName
Property: Name of the ROOT entry name.
Definition: RootEvtSelector.h:144

StatusCode RootEvtSelector::next | ( | Context & | refCtxt,
|  | int | jump
| ) |  | const
| override

Get next iteration item from the event loop context, but skip jump elements.

Parameters

  refCtxt | [IN/OUT] Reference to the context

Returns
  StatusCode indicating success or failure

Definition at line 209 of file RootEvtSelector.cpp.

209 {
210 if ( jump > 0 ) {
211 for ( int i = 0; i < jump; ++i ) {
212 StatusCode status = next(ctxt);
213 if ( !status.isSuccess() ) {
214 return status;
215 }
216 }
217 return StatusCode::SUCCESS;
218 }
219 return StatusCode::FAILURE;
220 }
StatusCode::SUCCESS
Definition: StatusCode.h:30
StatusCode::FAILURE
Definition: StatusCode.h:29
StatusCode::isSuccess
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:74
StatusCode
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
Gaudi::RootEvtSelector::next
StatusCode next(Context &refCtxt) const override
Get next iteration item from the event loop context.
Definition: RootEvtSelector.cpp:165

StatusCode RootEvtSelector::previous | ( | Context & | refCtxt | ) | const
| override

Get previous iteration item from the event loop context.

Parameters

  refCtxt | [IN/OUT] Reference to the context
  jump | [IN] Number of events to be skipped

Returns
  StatusCode indicating success or failure

Definition at line 223 of file RootEvtSelector.cpp.

223 {
224 return error("EventSelector Iterator, operator -- not supported ");
225 }
CommonMessagingBase::error
MsgStream & error() const
shortcut for the method msgStream(MSG::ERROR)
Definition: CommonMessaging.h:117

StatusCode RootEvtSelector::previous | ( | Context & | refCtxt,
|  | int | jump
| ) |  | const
| override

Get previous iteration item from the event loop context, but skip jump elements.

Parameters

  refCtxt | [IN/OUT] Reference to the context
  jump | [IN] Number of events to be skipped

Returns
  StatusCode indicating success or failure

Definition at line 228 of file RootEvtSelector.cpp.

228 {
229 if ( jump > 0 ) {
230 for ( int i = 0; i < jump; ++i ) {
231 StatusCode status = previous(ctxt);
232 if ( !status.isSuccess() ) {
233 return status;
234 }
235 }
236 return StatusCode::SUCCESS;
237 }
238 return StatusCode::FAILURE;
239 }
StatusCode::SUCCESS
Definition: StatusCode.h:30
StatusCode::FAILURE
Definition: StatusCode.h:29
StatusCode::isSuccess
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:74
StatusCode
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
Gaudi::RootEvtSelector::previous
StatusCode previous(Context &refCtxt) const override
Get previous iteration item from the event loop context.
Definition: RootEvtSelector.cpp:223

StatusCode RootEvtSelector::releaseContext | ( | Context *& | refCtxt | ) | const
| override

Release existing event iteration context.

Parameters

  refCtxt | [IN/OUT] Reference to the context

Returns
  StatusCode indicating success or failure

Definition at line 279 of file RootEvtSelector.cpp.

279 {
280 RootEvtSelectorContext* pCtxt = dynamic_cast<RootEvtSelectorContext*>(ctxt);
281 if ( pCtxt ) {
282 delete pCtxt;
283 return StatusCode::SUCCESS;
284 }
285 return StatusCode::FAILURE;
286 }
StatusCode::SUCCESS
Definition: StatusCode.h:30
StatusCode::FAILURE
Definition: StatusCode.h:29
Gaudi::RootEvtSelectorContext
ROOT specific event selector context.
Definition: RootEvtSelector.cpp:32

StatusCode RootEvtSelector::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 context in a way to point to the new list.

Parameters

  cr | The new criteria string.
  c | Reference pointer to the Context object.

Definition at line 291 of file RootEvtSelector.cpp.

292 {
293 MsgStream log(msgSvc(), name());
294 RootEvtSelectorContext* ctxt = dynamic_cast<RootEvtSelectorContext*>(&context);
295 string db, typ, item, sel, stmt, aut, addr;
296 if ( ctxt ) {
297 if ( criteria.compare(0,5,"FILE ")==0 ) {
298 // The format for the criteria is:
299 // FILE filename1, filename2 ...
300 db = criteria.substr(5);
301 }
302 else {
303 using Parser = Gaudi::Utils::AttribStringParser;
304 for(auto attrib: Parser(criteria)) {
305 string tmp = attrib.tag.substr(0,3);
306 if(tmp=="DAT") {
307 db = std::move(attrib.value);
308 }
309 else if(tmp=="OPT") {
310 if(attrib.value.compare(0, 3,"REA") != 0) {
311 log << MSG::ERROR << "Option:\"" << attrib.value << "\" not valid" << endmsg;
312 return StatusCode::FAILURE;
313 }
314 }
315 else if (tmp=="TYP") {
316 typ = std::move(attrib.value);
317 }
318 else if(tmp=="ADD") {
319 item = std::move(attrib.value);
320 }
321 else if(tmp=="SEL") {
322 sel = std::move(attrib.value);
323 }
324 else if(tmp=="FUN") {
325 stmt = std::move(attrib.value);
326 }
327 else if(tmp=="AUT") {
328 aut = std::move(attrib.value);
329 }
330 else if(tmp=="COL") {
331 addr = std::move(attrib.value);
332 }
333 }
334 }
335 // It's now time to parse the criteria for the event selection
336 // The format for the criteria is:
337 // FILE filename1, filename2 ...
338 // JOBID number1-number2, number3, ...
339 RootEvtSelectorContext::Files files;
340 string rest = db;
341 files.clear();
342 while(true) {
343 int ipos = rest.find_first_not_of(" ,");
344 if (ipos == -1 ) break;
345 rest = rest.substr(ipos,string::npos);// remove blanks before
346 int lpos = rest.find_first_of(" ,"); // locate next blank
347 files.push_back(rest.substr(0,lpos )); // insert in list
348 if (lpos == -1 ) break;
349 rest = rest.substr(lpos,string::npos);// get the rest
350 }
351 ctxt->setFiles(files);
352 ctxt->setFileIterator(ctxt->files().begin());
353 return StatusCode::SUCCESS;
354 }
355 return error("Invalid iteration context.");
356 }
Gaudi::Utils::AttribStringParser
Parse attribute strings allowing iteration over the various attributes.
Definition: AttribStringParser.h:30
MsgStream
Definition of the MsgStream class used to transmit messages.
Definition: MsgStream.h:24
StatusCode::SUCCESS
Definition: StatusCode.h:30
Gaudi::RootEvtSelectorContext::files
const Files & files() const
Access to the file container.
Definition: RootEvtSelector.cpp:55
Service::name
const std::string & name() const override
Retrieve name of the service.
Definition: Service.cpp:289
std::string::find_first_not_of
T find_first_not_of(T...args)
StatusCode::FAILURE
Definition: StatusCode.h:29
IOTest.sel
sel
Definition: IOTest.py:84
std::vector::push_back
T push_back(T...args)
CommonMessagingBase::error
MsgStream & error() const
shortcut for the method msgStream(MSG::ERROR)
Definition: CommonMessaging.h:117
Gaudi::RootEvtSelectorContext
ROOT specific event selector context.
Definition: RootEvtSelector.cpp:32
std::string::find_first_of
T find_first_of(T...args)
std::vector::clear
T clear(T...args)
std::move
T move(T...args)
Gaudi::RootEvtSelectorContext::setFiles
void setFiles(const Files &f)
Set the file container.
Definition: RootEvtSelector.cpp:57
std::vector< std::string >
std::vector::begin
T begin(T...args)
CommonMessagingBase::msgSvc
SmartIF< IMessageSvc > & msgSvc() const
The standard message service.
Definition: CommonMessaging.h:70
MSG::ERROR
Definition: IMessageSvc.h:21
std::string::substr
T substr(T...args)
Gaudi::RootEvtSelectorContext::setFileIterator
void setFileIterator(Files::const_iterator i)
Set file iterator.
Definition: RootEvtSelector.cpp:66
endmsg
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
Gaudi.Configuration.log
log
Definition: Configuration.py:13

StatusCode RootEvtSelector::rewind | ( | Context & | refCtxt | ) | const
| override

Rewind the dataset.

Parameters

  refCtxt | [IN/OUT] Reference to the context

Returns
  StatusCode indicating success or failure

Definition at line 242 of file RootEvtSelector.cpp.

242 {
243 RootEvtSelectorContext* pCtxt = dynamic_cast<RootEvtSelectorContext*>(&ctxt);
244 if ( pCtxt ) {
245 auto fileit = pCtxt->fileIterator();
246 if ( fileit != pCtxt->files().end() ) {
247 string input = *fileit;
248 m_dbMgr->disconnect(input).ignore();
249 }
250 pCtxt->setFID("");
251 pCtxt->setEntry(-1);
252 pCtxt->setBranch(nullptr);
253 pCtxt->setFileIterator(pCtxt->files().begin());
254 return StatusCode::SUCCESS;
255 }
256 return StatusCode::FAILURE;
257 }
StatusCode::SUCCESS
Definition: StatusCode.h:30
Gaudi::RootEvtSelectorContext::files
const Files & files() const
Access to the file container.
Definition: RootEvtSelector.cpp:55
Gaudi::RootEvtSelectorContext::fileIterator
Files::const_iterator fileIterator() const
Access to the file iterator.
Definition: RootEvtSelector.cpp:64
StatusCode::FAILURE
Definition: StatusCode.h:29
std::vector::end
T end(T...args)
Gaudi::RootEvtSelector::m_dbMgr
RootCnvSvc * m_dbMgr
Reference to the corresponding conversion service.
Definition: RootEvtSelector.h:133
Gaudi::RootEvtSelectorContext
ROOT specific event selector context.
Definition: RootEvtSelector.cpp:32
Gaudi::RootCnvSvc::disconnect
virtual StatusCode disconnect(const std::string &dbName)
Disconnect from an existing data stream.
Definition: RootCnvSvc.cpp:367
Gaudi::RootEvtSelectorContext::setBranch
void setBranch(TBranch *b)
Set the top level branch (typically /Event) used to iterate.
Definition: RootEvtSelector.cpp:78
Gaudi::RootEvtSelectorContext::setEntry
void setEntry(long e)
Set current event entry number.
Definition: RootEvtSelector.cpp:70
std::vector::begin
T begin(T...args)
Gaudi::RootEvtSelectorContext::setFID
void setFID(const std::string &fid)
Set connection FID.
Definition: RootEvtSelector.cpp:72
Gaudi::RootEvtSelectorContext::setFileIterator
void setFileIterator(Files::const_iterator i)
Set file iterator.
Definition: RootEvtSelector.cpp:66
StatusCode::ignore
void ignore() const
Definition: StatusCode.h:106

## Member Data Documentation

std::string Gaudi::RootEvtSelector::m_cnvSvcName = "Gaudi::RootCnvSvc/RootCnvSvc"
| protected

Property; Name of the concversion service used to create opaque addresses.

Definition at line 142 of file RootEvtSelector.h.

std::string Gaudi::RootEvtSelector::m_criteria
| protected

Property: File criteria to define item iteration.

Definition at line 146 of file RootEvtSelector.h.

RootCnvSvc* Gaudi::RootEvtSelector::m_dbMgr
| mutable protected

Reference to the corresponding conversion service.

Definition at line 133 of file RootEvtSelector.h.

Gaudi::Property<std::string> Gaudi::RootEvtSelector::m_dummy {this, "DbType", "", "dummy property to fake backwards compatibility"}
| protected

Definition at line 139 of file RootEvtSelector.h.

Gaudi::Property<std::string> Gaudi::RootEvtSelector::m_persName
| protected

Initial value:
{this, "EvtPersistencySvc", "EventPersistencySvc",
"Name of the persistency service to search for conversion service"}

Definition at line 137 of file RootEvtSelector.h.

CLID Gaudi::RootEvtSelector::m_rootCLID = CLID_NULL
| protected

Class id of root node to create opaque address.

Definition at line 135 of file RootEvtSelector.h.

std::string Gaudi::RootEvtSelector::m_rootName
| protected

Property: Name of the ROOT entry name.

Definition at line 144 of file RootEvtSelector.h.

The documentation for this class was generated from the following files:

- RootCnv/RootCnv/RootEvtSelector.h
- RootCnv/src/RootEvtSelector.cpp