| The Gaudi Framework v27r1

- 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 (const std::string &name, ISvcLocator *svcloc)
| Service Constructor. More...
virtual | ~RootEvtSelector ()=default
| Standard destructor. More...
virtual StatusCode | initialize ()
| IService implementation: Db event selector override. More...
virtual StatusCode | finalize ()
| IService implementation: Service finalization. More...
virtual StatusCode | createContext (Context *&refpCtxt) const
| Create a new event loop context. More...
virtual StatusCode | last (Context &refContext) const
| Access last item in the iteration. More...
virtual StatusCode | next (Context &refCtxt) const
| Get next iteration item from the event loop context. More...
virtual StatusCode | next (Context &refCtxt, int jump) const
| Get next iteration item from the event loop context, but skip jump elements. More...
virtual StatusCode | previous (Context &refCtxt) const
| Get previous iteration item from the event loop context. More...
virtual StatusCode | previous (Context &refCtxt, int jump) const
| Get previous iteration item from the event loop context, but skip jump elements. More...
virtual StatusCode | rewind (Context &refCtxt) const
| Rewind the dataset. More...
virtual StatusCode | createAddress (const Context &refCtxt, IOpaqueAddress *&) const
| Create new Opaque address corresponding to the current record. More...
virtual StatusCode | releaseContext (Context *&refCtxt) const
| Release existing event iteration context. More...
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 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...
StatusCode | setProperty (const Property &p) override
StatusCode | setProperty (const std::string &s) override
StatusCode | setProperty (const std::string &n, const std::string &v) override
StatusCode | getProperty (Property *p) const override
const Property & | getProperty (const std::string &name) const override
StatusCode | getProperty (const std::string &n, std::string &v) const override
const std::vector< Property * > & | getProperties () const override
bool | hasProperty (const std::string &name) const override
template<class TYPE >
StatusCode | setProperty (const std::string &name, const TYPE &value)
| set the property form the value 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 >
Property * | declareProperty (const std::string &name, T &property, const std::string &doc="none") const
| Declare the named property. More...
Property * | declareRemoteProperty (const std::string &name, IProperty *rsvc, const std::string &rname="") const
| Declare remote named properties. 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 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
| Class id of root node to create opaque address. More...
std::string | m_persName
| Property; Name of the persistency service to search for conversion service. More...
std::string | m_cnvSvcName
| 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...
std::string | m_dummy
| Property: dummy to fake backwards compatibility. More...
Protected Attributes inherited from Service
IntegerProperty | m_outputLevel = MSG::NIL
| Service output level. More...
Gaudi::StateMachine::State | m_state = Gaudi::StateMachine::OFFLINE
| Service state. More...
Gaudi::StateMachine::State | m_targetState = Gaudi::StateMachine::OFFLINE
| Service state. 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 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 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 39 of file RootEvtSelector.h.

## Constructor & Destructor Documentation

RootEvtSelector::RootEvtSelector | ( | const std::string & | name,
|  | ISvcLocator * | svcloc
| ) |  |

Service Constructor.

Definition at line 99 of file RootEvtSelector.cpp.

100 : base_class(name, svcloc), m_rootCLID(CLID_NULL)
101 {
102 m_cnvSvcName = "Gaudi::RootCnvSvc/RootCnvSvc";
103 m_persName = "EventPersistencySvc";
104 declareProperty("EvtPersistencySvc",m_persName="EventPersistencySvc");
105 declareProperty("DbType",m_dummy);
106 }
Gaudi::RootEvtSelector::m_persName
std::string m_persName
Property; Name of the persistency service to search for conversion service.
Definition: RootEvtSelector.h:135
Gaudi::RootEvtSelector::m_dummy
std::string m_dummy
Property: dummy to fake backwards compatibility.
Definition: RootEvtSelector.h:143
extends< Service, IEvtSelector >::base_class
extends base_class
Typedef to this class.
Definition: extends.h:14
Gaudi::RootEvtSelector::m_cnvSvcName
std::string m_cnvSvcName
Property; Name of the concversion service used to create opaque addresses.
Definition: RootEvtSelector.h:137
Service::declareProperty
Property * declareProperty(const std::string &name, T &property, const std::string &doc="none") const
Declare the named property.
Definition: Service.h:215
Gaudi::RootEvtSelector::m_rootCLID
CLID m_rootCLID
Class id of root node to create opaque address.
Definition: RootEvtSelector.h:133

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

Standard destructor.

## Member Function Documentation

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

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 271 of file RootEvtSelector.cpp.

271 {
272 const RootEvtSelectorContext* pctxt = dynamic_cast<const RootEvtSelectorContext*>(&ctxt);
273 if ( pctxt ) {
274 long ent = pctxt->entry();
275 if ( ent >= 0 ) {
276 auto fileit = pctxt->fileIterator();
277 if ( fileit != pctxt->files().end() ) {
278 const string par[2] = {pctxt->fid(), m_rootName};
279 const unsigned long ipar[2] = {0,(unsigned long)ent};
280 return m_dbMgr->createAddress(m_dbMgr->repSvcType(),m_rootCLID,&par[0],&ipar[0],pAddr);
281 }
282 }
283 }
284 pAddr = nullptr;
285 return StatusCode::FAILURE;
286 }
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::RootCnvSvc::createAddress
virtual StatusCode createAddress(long svc_type, const CLID &clid, const std::string *par, const unsigned long *ip, IOpaqueAddress *&refpAddress)
IAddressCreator implementation: Address creation.
Definition: RootCnvSvc.cpp:389
std::vector::end
T end(T...args)
Gaudi::RootEvtSelector::m_dbMgr
RootCnvSvc * m_dbMgr
Reference to the corresponding conversion service.
Definition: RootEvtSelector.h:131
compareOutputFiles.par
string par
Definition: compareOutputFiles.py:386
ConversionSvc::repSvcType
virtual long repSvcType() const
Retrieve the class type of the data store the converter uses.
Definition: ConversionSvc.cpp:330
StatusCode::FAILURE
Definition: StatusCode.h:29
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
Gaudi::RootEvtSelector::m_rootCLID
CLID m_rootCLID
Class id of root node to create opaque address.
Definition: RootEvtSelector.h:133
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:139

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

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 164 of file RootEvtSelector.cpp.

164 {
165 refpCtxt = new RootEvtSelectorContext(this);
166 return StatusCode::SUCCESS;
167 }
Gaudi::RootEvtSelectorContext
ROOT specific event selector context.
Definition: RootEvtSelector.cpp:32
StatusCode::SUCCESS
Definition: StatusCode.h:30

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

Helper method to issue error messages.

Definition at line 109 of file RootEvtSelector.cpp.

109 {
110 MsgStream log(msgSvc(), name());
111 log << MSG::ERROR << msg << endmsg;
112 return StatusCode::FAILURE;
113 }
MsgStream
Definition of the MsgStream class used to transmit messages.
Definition: MsgStream.h:24
Gaudi.Configuration.log
tuple log
Definition: Configuration.py:13
Service::name
const std::string & name() const override
Retrieve name of the service.
Definition: Service.cpp:319
StatusCode::FAILURE
Definition: StatusCode.h:29
CommonMessagingBase::msgSvc
SmartIF< IMessageSvc > & msgSvc() const
The standard message service.
Definition: CommonMessaging.h:73
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

StatusCode RootEvtSelector::finalize | ( |  | ) |
| virtual

IService implementation: Service finalization.

Definition at line 156 of file RootEvtSelector.cpp.

156 {
157 // Initialize base class
158 if ( m_dbMgr ) m_dbMgr->release();
159 m_dbMgr = nullptr; // release
160 return Service::finalize();
161 }
Service::finalize
StatusCode finalize() override
Definition: Service.cpp:193
Gaudi::RootEvtSelector::m_dbMgr
RootCnvSvc * m_dbMgr
Reference to the corresponding conversion service.
Definition: RootEvtSelector.h:131

StatusCode RootEvtSelector::initialize | ( |  | ) |
| virtual

IService implementation: Db event selector override.

Definition at line 116 of file RootEvtSelector.cpp.

116 {
117 // Initialize base class
118 StatusCode status = Service::initialize();
119 if ( !status.isSuccess() ) {
120 return error("Error initializing base class Service!");
121 }
122
123 auto ipers = serviceLocator()->service<IPersistencySvc>(m_persName);
124 if( !ipers ) {
125 return error("Unable to locate IPersistencySvc interface of "+m_persName);
126 }
127 IConversionSvc *cnvSvc = nullptr;
128 Gaudi::Utils::TypeNameString itm(m_cnvSvcName);
129 status = ipers->getService(itm.name(),cnvSvc);
130 if( !status.isSuccess() ) {
131 status = ipers->getService(itm.type(),cnvSvc);
132 if( !status.isSuccess() ) {
133 return error("Unable to locate IConversionSvc interface of database type "+m_cnvSvcName);
134 }
135 }
136 m_dbMgr = dynamic_cast<RootCnvSvc*>(cnvSvc);
137 if( !m_dbMgr ) {
138 cnvSvc->release();
139 return error("Unable to localize service:"+m_cnvSvcName);
140 }
141 m_dbMgr->addRef();
142
143 // Get DataSvc
144 auto eds = serviceLocator()->service<IDataManagerSvc>("EventDataSvc");
145 if( !eds ) {
146 return error("Unable to localize service EventDataSvc");
147 }
148 m_rootCLID = eds->rootCLID();
149 m_rootName = eds->rootName();
150 MsgStream log(msgSvc(), name());
151 log << MSG::DEBUG << "Selection root:" << m_rootName << " CLID:" << m_rootCLID << endmsg;
152 return status;
153 }
MsgStream
Definition of the MsgStream class used to transmit messages.
Definition: MsgStream.h:24
Service::initialize
StatusCode initialize() override
Definition: Service.cpp:68
Gaudi::RootEvtSelector::m_persName
std::string m_persName
Property; Name of the persistency service to search for conversion service.
Definition: RootEvtSelector.h:135
Service::serviceLocator
SmartIF< ISvcLocator > & serviceLocator() const override
Retrieve pointer to service locator.
Definition: Service.cpp:324
IConversionSvc
Definition: IConversionSvc.h:37
ana.itm
tuple itm
Definition: ana.py:57
Gaudi.Configuration.log
tuple log
Definition: Configuration.py:13
StatusCode::isSuccess
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:76
MSG::DEBUG
Definition: IMessageSvc.h:18
Gaudi::RootCnvSvc
Description:
Definition: RootCnvSvc.h:52
Gaudi::RootEvtSelector::m_dbMgr
RootCnvSvc * m_dbMgr
Reference to the corresponding conversion service.
Definition: RootEvtSelector.h:131
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
Service::name
const std::string & name() const override
Retrieve name of the service.
Definition: Service.cpp:319
CommonMessagingBase::error
MsgStream & error() const
shortcut for the method msgStream(MSG::ERROR)
Definition: CommonMessaging.h:118
Gaudi::Utils::TypeNameString
Helper class to parse a string of format "type/name".
Definition: TypeNameString.h:9
Gaudi::RootEvtSelector::m_cnvSvcName
std::string m_cnvSvcName
Property; Name of the concversion service used to create opaque addresses.
Definition: RootEvtSelector.h:137
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:73
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:133
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:139

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

Access last item in the iteration.

Parameters

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

Definition at line 170 of file RootEvtSelector.cpp.

170 {
171 return StatusCode::FAILURE;
172 }
StatusCode::FAILURE
Definition: StatusCode.h:29

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

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 175 of file RootEvtSelector.cpp.

175 {
176 RootEvtSelectorContext* pCtxt = dynamic_cast<RootEvtSelectorContext*>(&ctxt);
177 if ( pCtxt ) {
178 TBranch* b = pCtxt->branch();
179 if ( !b ) {
180 auto fileit = pCtxt->fileIterator();
181 pCtxt->setBranch(nullptr);
182 pCtxt->setEntry(-1);
183 if ( fileit != pCtxt->files().end() ) {
184 RootDataConnection* con=nullptr;
185 string in = *fileit;
186 StatusCode sc = m_dbMgr->connectDatabase(in,IDataConnection::READ,&con);
187 if ( sc.isSuccess() ) {
188 string section = m_rootName[0] == '/' ? m_rootName.substr(1) : m_rootName;
189 b = con->getBranch(section,m_rootName);
190 if ( b ) {
191 pCtxt->setFID(con->fid());
192 pCtxt->setBranch(b);
193 return next(ctxt);
194 }
195 }
196 m_dbMgr->disconnect(in).ignore();
197 pCtxt->setFileIterator(++fileit);
198 return next(ctxt);
199 }
200 return StatusCode::FAILURE;
201 }
202 long ent = pCtxt->entry();
203 Long64_t nent = b->GetEntries();
204 if ( nent > (ent+1) ) {
205 pCtxt->setEntry(++ent);
206 return StatusCode::SUCCESS;
207 }
208 auto fit = pCtxt->fileIterator();
209 pCtxt->setFileIterator(++fit);
210 pCtxt->setEntry(-1);
211 pCtxt->setBranch(nullptr);
212 pCtxt->setFID("");
213 return next(ctxt);
214 }
215 return StatusCode::FAILURE;
216 }
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::isSuccess
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:76
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:223
merge_files.sc
int sc
Definition: merge_files.py:167
Gaudi::RootEvtSelector::m_dbMgr
RootCnvSvc * m_dbMgr
Reference to the corresponding conversion service.
Definition: RootEvtSelector.h:131
Gaudi::IDataConnection::READ
Definition: IIODataManager.h:38
StatusCode::FAILURE
Definition: StatusCode.h:29
Gaudi::RootEvtSelectorContext
ROOT specific event selector context.
Definition: RootEvtSelector.cpp:32
StatusCode::SUCCESS
Definition: StatusCode.h:30
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:383
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
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:108
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::next
virtual StatusCode next(Context &refCtxt) const
Get next iteration item from the event loop context.
Definition: RootEvtSelector.cpp:175
Gaudi::RootEvtSelector::m_rootName
std::string m_rootName
Property: Name of the ROOT entry name.
Definition: RootEvtSelector.h:139

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

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 219 of file RootEvtSelector.cpp.

219 {
220 if ( jump > 0 ) {
221 for ( int i = 0; i < jump; ++i ) {
222 StatusCode status = next(ctxt);
223 if ( !status.isSuccess() ) {
224 return status;
225 }
226 }
227 return StatusCode::SUCCESS;
228 }
229 return StatusCode::FAILURE;
230 }
StatusCode::isSuccess
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:76
StatusCode::FAILURE
Definition: StatusCode.h:29
StatusCode::SUCCESS
Definition: StatusCode.h:30
StatusCode
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
ana.i
list i
Definition: ana.py:128
Gaudi::RootEvtSelector::next
virtual StatusCode next(Context &refCtxt) const
Get next iteration item from the event loop context.
Definition: RootEvtSelector.cpp:175

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

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 233 of file RootEvtSelector.cpp.

233 {
234 return error("EventSelector Iterator, operator -- not supported ");
235 }
CommonMessagingBase::error
MsgStream & error() const
shortcut for the method msgStream(MSG::ERROR)
Definition: CommonMessaging.h:118

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

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 238 of file RootEvtSelector.cpp.

238 {
239 if ( jump > 0 ) {
240 for ( int i = 0; i < jump; ++i ) {
241 StatusCode status = previous(ctxt);
242 if ( !status.isSuccess() ) {
243 return status;
244 }
245 }
246 return StatusCode::SUCCESS;
247 }
248 return StatusCode::FAILURE;
249 }
StatusCode::isSuccess
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:76
Gaudi::RootEvtSelector::previous
virtual StatusCode previous(Context &refCtxt) const
Get previous iteration item from the event loop context.
Definition: RootEvtSelector.cpp:233
StatusCode::FAILURE
Definition: StatusCode.h:29
StatusCode::SUCCESS
Definition: StatusCode.h:30
StatusCode
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
ana.i
list i
Definition: ana.py:128

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

Release existing event iteration context.

Parameters

  refCtxt | [IN/OUT] Reference to the context

Returns
  StatusCode indicating success or failure

Definition at line 289 of file RootEvtSelector.cpp.

289 {
290 RootEvtSelectorContext* pCtxt = dynamic_cast<RootEvtSelectorContext*>(ctxt);
291 if ( pCtxt ) {
292 delete pCtxt;
293 return StatusCode::SUCCESS;
294 }
295 return StatusCode::FAILURE;
296 }
StatusCode::FAILURE
Definition: StatusCode.h:29
Gaudi::RootEvtSelectorContext
ROOT specific event selector context.
Definition: RootEvtSelector.cpp:32
StatusCode::SUCCESS
Definition: StatusCode.h:30

StatusCode RootEvtSelector::resetCriteria | ( | const std::string & | cr,
|  | Context & | c
| ) |  | const
| virtual

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 301 of file RootEvtSelector.cpp.

302 {
303 MsgStream log(msgSvc(), name());
304 RootEvtSelectorContext* ctxt = dynamic_cast<RootEvtSelectorContext*>(&context);
305 string db, typ, item, sel, stmt, aut, addr;
306 if ( ctxt ) {
307 if ( criteria.compare(0,5,"FILE ")==0 ) {
308 // The format for the criteria is:
309 // FILE filename1, filename2 ...
310 db = criteria.substr(5);
311 }
312 else {
313 using Parser = Gaudi::Utils::AttribStringParser;
314 for(auto attrib: Parser(criteria)) {
315 string tmp = attrib.tag.substr(0,3);
316 if(tmp=="DAT") {
317 db = std::move(attrib.value);
318 }
319 else if(tmp=="OPT") {
320 if(attrib.value.compare(0, 3,"REA") != 0) {
321 log << MSG::ERROR << "Option:\"" << attrib.value << "\" not valid" << endmsg;
322 return StatusCode::FAILURE;
323 }
324 }
325 else if (tmp=="TYP") {
326 typ = std::move(attrib.value);
327 }
328 else if(tmp=="ADD") {
329 item = std::move(attrib.value);
330 }
331 else if(tmp=="SEL") {
332 sel = std::move(attrib.value);
333 }
334 else if(tmp=="FUN") {
335 stmt = std::move(attrib.value);
336 }
337 else if(tmp=="AUT") {
338 aut = std::move(attrib.value);
339 }
340 else if(tmp=="COL") {
341 addr = std::move(attrib.value);
342 }
343 }
344 }
345 // It's now time to parse the criteria for the event selection
346 // The format for the criteria is:
347 // FILE filename1, filename2 ...
348 // JOBID number1-number2, number3, ...
349 RootEvtSelectorContext::Files files;
350 string rest = db;
351 files.clear();
352 while(true) {
353 int ipos = rest.find_first_not_of(" ,");
354 if (ipos == -1 ) break;
355 rest = rest.substr(ipos,string::npos);// remove blanks before
356 int lpos = rest.find_first_of(" ,"); // locate next blank
357 files.push_back(rest.substr(0,lpos )); // insert in list
358 if (lpos == -1 ) break;
359 rest = rest.substr(lpos,string::npos);// get the rest
360 }
361 ctxt->setFiles(files);
362 ctxt->setFileIterator(ctxt->files().begin());
363 return StatusCode::SUCCESS;
364 }
365 return error("Invalid iteration context.");
366 }
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
Gaudi::RootEvtSelectorContext::files
const Files & files() const
Access to the file container.
Definition: RootEvtSelector.cpp:55
std::string::find_first_not_of
T find_first_not_of(T...args)
Gaudi.Configuration.log
tuple log
Definition: Configuration.py:13
Service::name
const std::string & name() const override
Retrieve name of the service.
Definition: Service.cpp:319
std::vector::push_back
T push_back(T...args)
CommonMessagingBase::error
MsgStream & error() const
shortcut for the method msgStream(MSG::ERROR)
Definition: CommonMessaging.h:118
read_lhcb_event_file.sel
tuple sel
Definition: read_lhcb_event_file.py:10
StatusCode::FAILURE
Definition: StatusCode.h:29
Gaudi::RootEvtSelectorContext
ROOT specific event selector context.
Definition: RootEvtSelector.cpp:32
StatusCode::SUCCESS
Definition: StatusCode.h:30
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)
ana.item
tuple item
print s1,s2
Definition: ana.py:146
CommonMessagingBase::msgSvc
SmartIF< IMessageSvc > & msgSvc() const
The standard message service.
Definition: CommonMessaging.h:73
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

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

Rewind the dataset.

Parameters

  refCtxt | [IN/OUT] Reference to the context

Returns
  StatusCode indicating success or failure

Definition at line 252 of file RootEvtSelector.cpp.

252 {
253 RootEvtSelectorContext* pCtxt = dynamic_cast<RootEvtSelectorContext*>(&ctxt);
254 if ( pCtxt ) {
255 auto fileit = pCtxt->fileIterator();
256 if ( fileit != pCtxt->files().end() ) {
257 string input = *fileit;
258 m_dbMgr->disconnect(input).ignore();
259 }
260 pCtxt->setFID("");
261 pCtxt->setEntry(-1);
262 pCtxt->setBranch(nullptr);
263 pCtxt->setFileIterator(pCtxt->files().begin());
264 return StatusCode::SUCCESS;
265 }
266 return StatusCode::FAILURE;
267 }
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
std::vector::end
T end(T...args)
Gaudi::RootEvtSelector::m_dbMgr
RootCnvSvc * m_dbMgr
Reference to the corresponding conversion service.
Definition: RootEvtSelector.h:131
StatusCode::FAILURE
Definition: StatusCode.h:29
Gaudi::RootEvtSelectorContext
ROOT specific event selector context.
Definition: RootEvtSelector.cpp:32
StatusCode::SUCCESS
Definition: StatusCode.h:30
Gaudi::RootCnvSvc::disconnect
virtual StatusCode disconnect(const std::string &dbName)
Disconnect from an existing data stream.
Definition: RootCnvSvc.cpp:383
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:108

## Member Data Documentation

std::string Gaudi::RootEvtSelector::m_cnvSvcName
| protected

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

Definition at line 137 of file RootEvtSelector.h.

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

Property: File criteria to define item iteration.

Definition at line 141 of file RootEvtSelector.h.

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

Reference to the corresponding conversion service.

Definition at line 131 of file RootEvtSelector.h.

std::string Gaudi::RootEvtSelector::m_dummy
| protected

Property: dummy to fake backwards compatibility.

Definition at line 143 of file RootEvtSelector.h.

std::string Gaudi::RootEvtSelector::m_persName
| protected

Property; Name of the persistency service to search for conversion service.

Definition at line 135 of file RootEvtSelector.h.

CLID Gaudi::RootEvtSelector::m_rootCLID
| protected

Class id of root node to create opaque address.

Definition at line 133 of file RootEvtSelector.h.

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

Property: Name of the ROOT entry name.

Definition at line 139 of file RootEvtSelector.h.

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

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