| The Gaudi Framework v28r2-patches (bc4ad17a)

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

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

Public Member Functions | List of all members
Gaudi::RootDatabaseCnv Class Reference

Statistics file converter class definition. More...

`#include <Root/RootDatabaseCnv.h>`

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

## Public Member Functions
| RootDatabaseCnv (long typ, const CLID &, ISvcLocator *svc, RootCnvSvc *mgr)
| Initializing Constructor. More...
| ~RootDatabaseCnv () override=default
| Standard destructor. More...
const std::string | containerName (IRegistry *) const override
| Retrieve the name of the container a given object is placed into. More...
StatusCode | createObj (IOpaqueAddress *pAddr, DataObject *&refpObj) override
| Converter overrides: Create transient object from persistent data. More...
Public Member Functions inherited from Gaudi::RootDirectoryCnv
| RootDirectoryCnv (long typ, const CLID &clid, ISvcLocator *svc, RootCnvSvc *mgr)
| Initializing Constructor. More...
| ~RootDirectoryCnv () override=default
| Standard Destructor. More...
StatusCode | createObj (IOpaqueAddress *pAddr, DataObject *&refpObj) override
| Converter overrides: Create transient object from persistent data. More...
StatusCode | fillObjRefs (IOpaqueAddress *pAddr, DataObject *pObj) override
| Converter overrides: Resolve the references of the transient object. More...
StatusCode | updateObj (IOpaqueAddress *pAddr, DataObject *pObj) override
| Converter overrides: Update transient object from persistent data. More...
StatusCode | updateObjRefs (IOpaqueAddress *pAddr, DataObject *pObj) override
| Converter overrides: Update the references of an updated transient object. More...
StatusCode | createRep (DataObject *pObj, IOpaqueAddress *&refpAddr) override
| Converter overrides: Convert the transient object to the requested representation. More...
StatusCode | fillRepRefs (IOpaqueAddress *pAddr, DataObject *pObj) override
| Converter overrides: Fill references of persistent object representation. More...
StatusCode | updateRep (IOpaqueAddress *pAddr, DataObject *pObj) override
| Converter overrides: Update persistent object representation. More...
StatusCode | updateRepRefs (IOpaqueAddress *pAddr, DataObject *pObj) override
| Converter overrides: Update references of persistent object representation. More...
Public Member Functions inherited from Gaudi::RootStatCnv
| RootStatCnv (long typ, const CLID &clid, ISvcLocator *svc, RootCnvSvc *mgr)
| Initializing Constructor. More...
| ~RootStatCnv () override=default
| Standard Destructor. More...
Public Member Functions inherited from Gaudi::RootConverter
| RootConverter (long typ, const CLID &clid, ISvcLocator *svc, RootCnvSvc *mgr)
| Initializing Constructor. More...
| ~RootConverter () override=default
| Standard Destructor. More...
long | repSvcType () const override
| Retrieve the class type of the data store the converter uses. More...
StatusCode | createObj (IOpaqueAddress *pAddr, DataObject *&refpObj) override
| Converter overrides: Create transient object from persistent data. More...
StatusCode | fillObjRefs (IOpaqueAddress *pAddr, DataObject *pObj) override
| Resolve the references of the created transient object. More...
StatusCode | createRep (DataObject *pObj, IOpaqueAddress *&refpAddr) override
| Converter overrides: Convert the transient object to the requested representation. More...
StatusCode | fillRepRefs (IOpaqueAddress *pAddr, DataObject *pObj) override
| Resolve the references of the created transient object. More...
Public Member Functions inherited from Converter
StatusCode | initialize () override
| Initialize the converter. More...
StatusCode | finalize () override
| Initialize the converter. More...
StatusCode | setDataProvider (IDataProviderSvc *svc) override
| Set Data provider service. More...
SmartIF< IDataProviderSvc > & | dataProvider () const override
| Get Data provider service. More...
StatusCode | setConversionSvc (IConversionSvc *svc) override
| Set conversion service the converter is connected to. More...
SmartIF< IConversionSvc > & | conversionSvc () const override
| Get conversion service the converter is connected to. More...
StatusCode | setAddressCreator (IAddressCreator *creator) override
| Set address creator facility. More...
SmartIF< IAddressCreator > & | addressCreator () const override
| Retrieve address creator facility. More...
const CLID & | objType () const override
| Retrieve the class type of objects the converter produces. More...
virtual long | i_repSvcType () const
| Retrieve the class type of the data store the converter uses. More...
StatusCode | createObj (IOpaqueAddress *pAddress, DataObject *&refpObject) override
| Create the transient representation of an object. More...
StatusCode | fillObjRefs (IOpaqueAddress *pAddress, DataObject *pObject) override
| Resolve the references of the created transient object. More...
StatusCode | updateObj (IOpaqueAddress *pAddress, DataObject *refpObject) override
| Update the transient object from the other representation. More...
StatusCode | updateObjRefs (IOpaqueAddress *pAddress, DataObject *pObject) override
| Update the references of an updated transient object. More...
StatusCode | createRep (DataObject *pObject, IOpaqueAddress *&refpAddress) override
| Convert the transient object to the requested representation. More...
StatusCode | fillRepRefs (IOpaqueAddress *pAddress, DataObject *pObject) override
| Resolve the references of the converted object. More...
StatusCode | updateRep (IOpaqueAddress *pAddress, DataObject *pObject) override
| Update the converted representation of a transient object. More...
StatusCode | updateRepRefs (IOpaqueAddress *pAddress, DataObject *pObject) override
| Update the references of an already converted object. More...
| Converter (long storage_type, const CLID &class_type, ISvcLocator *svc=0)
| Standard Constructor. More...
template<class T >
StatusCode | service (const std::string &name, T *&psvc, bool createIf=false) const
| Access a service by name, creating it if it doesn't already exist. More...
template<class T >
StatusCode | service (const std::string &type, const std::string &name, T *&psvc) const
| Access a service by name, type creating it if it doesn't already exist. More...
SmartIF< IService > | service (const std::string &name, const bool createIf=true) const
| Return a pointer to the service identified by name (or "type/name") More...
Public Member Functions inherited from implements< IConverter >
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...
| implements ()=default
| Default constructor. More...
| implements (const implements &)
| Copy constructor (zero the reference count) More...
implements & | operator= (const implements &)
| Assignment operator (do not touch the reference count). More...
| ~implements () override=default
| Virtual destructor. More...
unsigned long | addRef () override
| Reference Interface instance. More...
unsigned long | release () override
| Release Interface instance. More...
unsigned long | refCount () const override
| Current reference count. More...
Public Member Functions inherited from extend_interfaces< Interfaces... >
| ~extend_interfaces () override=default
| Virtual destructor. More...

## Additional Inherited Members
Public Types inherited from Converter
typedef Gaudi::PluginService::Factory< IConverter *, ISvcLocator * > | Factory
Public Types inherited from implements< IConverter >
using | base_class = implements< Interfaces... >
| Typedef to this class. More...
using | extend_interfaces_base = extend_interfaces< Interfaces... >
| Typedef to the base of this class. More...
using | iids = typename extend_interfaces_base::ext_iids
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 Gaudi::RootStatCnv
MsgStream & | log () const
| Helper to use mesage logger. More...
StatusCode | initialize () override
| Initialize converter object. More...
StatusCode | finalize () override
| Finalize converter object. More...
virtual const std::string | fileName (IRegistry *pReg) const
| Retrieve the name of the file a given object is placed into. More...
virtual const std::string | topLevel (IRegistry *pReg) const
| Retrieve the full path of the file a given object is placed into. More...
StatusCode | makeError (const std::string &msg, bool throw_exception=false) const
| Helper method to issue error messages. More...
StatusCode | saveDescription (const std::string &path, const std::string &ident, const std::string &desc, const std::string &opt, const CLID &clid)
| Save statistics object description. More...
Protected Member Functions inherited from Converter
| ~Converter () override=default
| Standard Destructor. More...
SmartIF< ISvcLocator > & | serviceLocator () const
| Retrieve pointer to service locator. More...
SmartIF< IMessageSvc > & | msgSvc () const
| Retrieve pointer to message service. More...
Protected Attributes inherited from Gaudi::RootStatCnv
SmartIF< IDataManagerSvc > | m_dataMgr
| Reference to data manager service to manipulate the TES. More...
std::unique_ptr< MsgStream > | m_log
| Reference to logger object. More...
Protected Attributes inherited from Gaudi::RootConverter
RootCnvSvc * | m_dbMgr
| Conversion service needed for proper operation to forward requests. More...
Protected Attributes inherited from implements< IConverter >
std::atomic_ulong | m_refCount
| Reference counter. More...

## Detailed Description

Statistics file converter class definition.

Description: Definition of the converter to open root database files.

Author
  M.Frank

Version
  1.0

Definition at line 28 of file RootDatabaseCnv.h.

## Constructor & Destructor Documentation

RootDatabaseCnv::RootDatabaseCnv | ( | long | typ,
|  | const CLID & | cl,
|  | ISvcLocator * | svc,
|  | RootCnvSvc * | mgr
| ) |  |

Initializing Constructor.

Parameters

  typ | [IN] Concrete storage type of the converter
  svc | [IN] Pointer to service locator object
  mgr | [IN] Pointer to hosting conversion service

Returns
  Reference to RootDatabaseCnv object

Definition at line 25 of file RootDatabaseCnv.cpp.

26 : RootDirectoryCnv(typ, cl, svc, mgr)
27 {
28 }
Gaudi::RootDirectoryCnv::RootDirectoryCnv
RootDirectoryCnv(long typ, const CLID &clid, ISvcLocator *svc, RootCnvSvc *mgr)
Initializing Constructor.
Definition: RootDirectoryCnv.cpp:30

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

Standard destructor.

## Member Function Documentation

const std::string Gaudi::RootDatabaseCnv::containerName | ( | IRegistry * |  | ) | const
| inline override virtual

Retrieve the name of the container a given object is placed into.

Parameters

  pReg | [IN] Pointer to registry entry.

Returns
  Name of the container the object should be put to.

Reimplemented from Gaudi::RootStatCnv.

Definition at line 48 of file RootDatabaseCnv.h.

48 {
49 return "<local>";
50 }

StatusCode RootDatabaseCnv::createObj | ( | IOpaqueAddress * | pAddr,
|  | DataObject *& | refpObj
| ) |  |
| override

Converter overrides: Create transient object from persistent data.

Parameters

  refpAddress | [IN] Pointer to object address.
  refpObject | [OUT] Location to pointer to store data object

Returns
  Status code indicating success or failure.

Definition at line 32 of file RootDatabaseCnv.cpp.

32 {
33 StatusCode status = StatusCode::FAILURE;
34 if ( pAddr ) {
35 RootDataConnection* con = nullptr;
36 IRegistry* pReg = pAddr->registry();
37 const unsigned long* ipars = pAddr->ipar();
38 const string* spars = pAddr->par();
39 char mode = char(ipars[1]);
40 string fname = spars[0];
41 string oname = pReg->name();
42 bool recrea = mode == 'R';
43 bool create = mode == 'N';
44 bool update = mode == 'U';
45 bool read = mode == 'O';
46 const CLID& clid = objType();
47 status = StatusCode::SUCCESS;
48 string cntName = containerName(pReg);
49 if ( create ) {
50 m_dbMgr->connectDatabase(fname,IDataConnection::CREATE,&con).ignore();
51 status = saveDescription(fname, cntName, "File containing statistics results.","", clid);
52 if ( status.isSuccess() ) {
53 log() << MSG::INFO << "Opened NEW Database file:"
54 << fname << " as " << oname << endmsg;
55 }
56 }
57 else if ( update ) {
58 m_dbMgr->connectDatabase(fname,IDataConnection::UPDATE,&con).ignore();
59 status = saveDescription(fname, cntName, "File containing statistics results.","", clid);
60 if ( status.isSuccess() ) {
61 log() << MSG::INFO << "Connect to existing Database file:"
62 << fname << " as " << oname << " for UPDATE" << endmsg;
63 }
64 }
65 else if ( read ) {
66 status = m_dbMgr->connectDatabase(fname,IDataConnection::READ,&con);
67 if ( status.isSuccess() ) {
68 log() << MSG::INFO << "Connect to existing Database file:"
69 << fname << " as " << oname << " for READ" << endmsg;
70 }
71 }
72 else if ( recrea ) {
73 m_dbMgr->connectDatabase(fname,IDataConnection::RECREATE,&con).ignore();
74 status = saveDescription(fname, cntName, "File containing statistics results.","", clid);
75 if ( status.isSuccess() ) {
76 log() << MSG::INFO << "Recreate Database file:" << fname << " as " << oname << endmsg;
77 }
78 }
79 else {
80 log() << MSG::ERROR << "Don't know what to do:" << fname << endmsg;
81 status = StatusCode::FAILURE;
82 }
83 // Now create object
84 if ( status.isSuccess() ) {
85 NTuple::File* pFile = new NTuple::File(objType(), fname, oname);
86 pFile->setOpen(false);
87 refpObj = pFile;
88 }
89 }
90 return status;
91 }
Gaudi::RootStatCnv::log
MsgStream & log() const
Helper to use mesage logger.
Definition: RootStatCnv.h:38
StatusCode::SUCCESS
Definition: StatusCode.h:30
NTuple::File::setOpen
void setOpen(bool flag)
Set "open" flag.
Definition: NTuple.h:1140
StatusCode::FAILURE
Definition: StatusCode.h:29
Converter::objType
const CLID & objType() const override
Retrieve the class type of objects the converter produces.
Definition: Converter.cpp:14
Gaudi::RootDatabaseCnv::containerName
const std::string containerName(IRegistry *) const override
Retrieve the name of the container a given object is placed into.
Definition: RootDatabaseCnv.h:48
StatusCode::isSuccess
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:74
Gaudi::RootConverter::m_dbMgr
RootCnvSvc * m_dbMgr
Conversion service needed for proper operation to forward requests.
Definition: RootConverter.h:36
IOpaqueAddress::registry
virtual IRegistry * registry() const =0
Update branch name.
hivetimeline.read
def read(f, regex='.*', skipevents=0)
Definition: hivetimeline.py:19
IRegistry::name
virtual const name_type & name() const =0
Name of the directory (or key)
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::IDataConnection::RECREATE
Definition: IIODataManager.h:38
IOpaqueAddress::par
virtual const std::string * par() const =0
Retrieve String parameters.
Gaudi::IDataConnection::READ
Definition: IIODataManager.h:38
IOpaqueAddress::ipar
virtual const unsigned long * ipar() const =0
Access to generic link parameters.
StatusCode
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
Gaudi::RootStatCnv::saveDescription
StatusCode saveDescription(const std::string &path, const std::string &ident, const std::string &desc, const std::string &opt, const CLID &clid)
Save statistics object description.
Definition: RootStatCnv.cpp:112
IRegistry
The IRegistry represents the entry door to the environment any data object residing in a transient da...
Definition: IRegistry.h:22
CLID
unsigned int CLID
Class ID definition.
Definition: ClassID.h:8
Gaudi::IDataConnection::UPDATE
Definition: IIODataManager.h:38
Gaudi::IDataConnection::CREATE
Definition: IIODataManager.h:38
MSG::ERROR
Definition: IMessageSvc.h:21
StatusCode::ignore
void ignore() const
Definition: StatusCode.h:106
MSG::INFO
Definition: IMessageSvc.h:19
Gaudi::RootDataConnection
Concrete implementation of the IDataConnection interface to access ROOT files.
Definition: RootDataConnection.h:92
endmsg
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
GaudiPython.Pythonizations.update
update
Definition: Pythonizations.py:94
NTuple::File
Small class representing an N tuple file in the transient store.
Definition: NTuple.h:1088

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

- RootCnv/RootCnv/RootDatabaseCnv.h
- RootCnv/src/RootDatabaseCnv.cpp