The Gaudi Framework
v30r3 (a5ef0a68)
|
Concrete implementation of the IDataConnection interface to access ROOT files. More...
#include <GaudiRootCnv/RootDataConnection.h>
Classes | |
class | ContainerSection |
Internal helper class, which described a TBranch section in a ROOT file. More... | |
class | Tool |
Helper class to facilitate an abstraction layer for reading POOL style files with this package. More... | |
Public Types | |
enum | Status : StatusCode::code_t { Status::ROOT_READ_ERROR = 0x2, Status::ROOT_OPEN_ERROR = 0x4 } |
typedef std::vector< std::string > | StringVec |
Type definition for string maps. More... | |
typedef std::vector< std::pair< std::string, std::string > > | ParamMap |
Type definition for the parameter map. More... | |
typedef std::map< std::string, TTree *, std::less<> > | Sections |
Definition of tree sections. More... | |
typedef std::vector< ContainerSection > | ContainerSections |
Definition of container sections to handle merged files. More... | |
typedef std::map< std::string, ContainerSections, std::less<> > | MergeSections |
Definition of database section to handle merged files. More... | |
typedef std::vector< RootRef > | LinkSections |
Link sections definition. More... | |
typedef std::set< const IInterface * > | Clients |
Client set. More... | |
Public Types inherited from Gaudi::IDataConnection | |
enum | IoType { READ = 1 << 1, UPDATE = 1 << 2, CREATE = 1 << 3, RECREATE = ( 1 << 4 ) + ( 1 << 3 ) } |
I/O Connection types. More... | |
enum | IoStatus { BAD_DATA_CONNECTION = 4 } |
Status Code on bad file connection. More... | |
Public Member Functions | |
MsgStream & | msgSvc () const |
Allow access to printer service. More... | |
Tool * | makeTool () |
Create file access tool to encapsulate POOL compatibiliy. More... | |
RootDataConnection (const IInterface *own, boost::string_ref nam, std::shared_ptr< RootConnectionSetup > setup) | |
Standard constructor. More... | |
TFile * | file () const |
Direct access to TFile structure. More... | |
bool | isConnected () const override |
Check if connected to data source. More... | |
bool | isWritable () const |
Is the file writable? More... | |
Tool * | tool () const |
Access tool. More... | |
const MergeSections & | mergeSections () const |
Access merged data section inventory. More... | |
const StringVec & | mergeFIDs () const |
Access merged FIDs. More... | |
void | addClient (const IInterface *client) |
Add new client to this data source. More... | |
size_t | removeClient (const IInterface *client) |
Remove client from this data source. More... | |
bool | lookupClient (const IInterface *client) const |
Lookup client for this data source. More... | |
void | badWriteError (boost::string_ref msg) const |
Error handler when bad write statements occur. More... | |
std::pair< const RootRef *, const ContainerSection * > | getMergeSection (boost::string_ref container, int entry) const |
Access link section for single container and entry. More... | |
void | enableStatistics (boost::string_ref section) |
Enable TTreePerStats. More... | |
void | saveStatistics (boost::string_ref statisticsFile) |
Save TTree access statistics if required. More... | |
int | loadObj (boost::string_ref section, boost::string_ref cnt, unsigned long entry, DataObject *&pObj) |
Load object. More... | |
int | loadRefs (boost::string_ref section, boost::string_ref cnt, unsigned long entry, RootObjectRefs &refs) |
Load references object. More... | |
std::pair< int, unsigned long > | saveObj (boost::string_ref section, boost::string_ref cnt, TClass *cl, DataObject *pObj, int buff_siz, int split_lvl, bool fill_missing=false) |
Save object of a given class to section and container. More... | |
std::pair< int, unsigned long > | save (boost::string_ref section, boost::string_ref cnt, TClass *cl, void *pObj, int buff_siz, int split_lvl, bool fill_missing=false) |
Save object of a given class to section and container. More... | |
StatusCode | connectRead () override |
Open data stream in read mode. More... | |
StatusCode | connectWrite (IoType typ) override |
Open data stream in write mode. More... | |
StatusCode | disconnect () override |
Release data stream and release implementation dependent resources. More... | |
StatusCode | read (void *const, size_t) override |
Read root byte buffer from input stream. More... | |
StatusCode | write (const void *, int) override |
Write root byte buffer to output stream. More... | |
long long int | seek (long long int, int) override |
Seek on the file described by ioDesc. Arguments as in ::seek() More... | |
TTree * | getSection (boost::string_ref sect, bool create=false) |
Access TTree section from section name. The section is created if required. More... | |
TBranch * | getBranch (boost::string_ref section, boost::string_ref branch_name) |
Access data branch by name: Get existing branch in read only mode. More... | |
TBranch * | getBranch (boost::string_ref section, boost::string_ref branch_name, TClass *cl, void *ptr, int buff_siz, int split_lvl) |
Access data branch by name: Get existing branch in write mode. More... | |
void | makeRef (const IRegistry &pA, RootRef &ref) |
Create reference object from registry entry. More... | |
void | makeRef (boost::string_ref name, long clid, int tech, boost::string_ref db, boost::string_ref cnt, int entry, RootRef &ref) |
Create reference object from values. More... | |
int | makeLink (boost::string_ref p) |
Convert path string to path index. More... | |
const std::string & | getDb (int which) const |
Access database/file name from saved index. More... | |
const std::string & | getCont (int which) const |
Access container name from saved index. More... | |
const std::string & | getLink (int which) const |
Access link name from saved index. More... | |
Public Member Functions inherited from Gaudi::IDataConnection | |
IDataConnection (const IInterface *own, std::string nam) | |
Standard constructor. More... | |
virtual | ~IDataConnection ()=default |
Standard destructor. More... | |
const std::string & | name () const |
Connection name. More... | |
void | setFID (std::string fid) |
Set file ID. More... | |
const std::string & | fid () const |
Access file id. More... | |
const std::string & | pfn () const |
Access physical file name. More... | |
void | setPFN (std::string fn) |
Set physical file name. More... | |
int | ageFile () |
Increase age of I/O source. More... | |
void | resetAge () |
Reset age. More... | |
int | age () const |
Access age counter. More... | |
const IInterface * | owner () const |
Owner instance. More... | |
Public Attributes | |
std::unique_ptr< Tool > | m_tool |
Protected Member Functions | |
const std::string & | empty () const |
Empty string reference. More... | |
StatusCode | saveRefs () |
Internal helper to save/update reference tables. More... | |
Protected Attributes | |
std::shared_ptr< RootConnectionSetup > | m_setup |
Reference to the setup structure. More... | |
std::unique_ptr< TTreePerfStats > | m_statistics |
I/O read statistics from TTree. More... | |
std::unique_ptr< TFile > | m_file |
Reference to ROOT file. More... | |
TTree * | m_refs = nullptr |
Pointer to the reference tree. More... | |
Sections | m_sections |
Tree sections in TFile. More... | |
StringVec | m_dbs |
Map containing external database file names (fids) More... | |
StringVec | m_conts |
Map containing external container names. More... | |
StringVec | m_links |
Map containing internal links names. More... | |
StringVec | m_mergeFIDs |
Map containing merge FIDs. More... | |
ParamMap | m_params |
Parameter map for file parameters. More... | |
MergeSections | m_mergeSects |
Database section map for merged files. More... | |
LinkSections | m_linkSects |
Database link sections. More... | |
Clients | m_clients |
Client list. More... | |
std::string | m_empty |
Buffer for empty string reference. More... | |
Protected Attributes inherited from Gaudi::IDataConnection | |
std::string | m_name |
Connection name/identifier. More... | |
std::string | m_fid |
File ID of the connection. More... | |
std::string | m_pfn |
Physical file name of the connection. More... | |
int | m_age = 0 |
Age counter. More... | |
const IInterface * | m_owner = nullptr |
Owner pointer. More... | |
Friends | |
class | Tool |
Concrete implementation of the IDataConnection interface to access ROOT files.
Definition at line 95 of file RootDataConnection.h.
typedef std::set<const IInterface*> Gaudi::RootDataConnection::Clients |
Client set.
Definition at line 145 of file RootDataConnection.h.
typedef std::vector<ContainerSection> Gaudi::RootDataConnection::ContainerSections |
Definition of container sections to handle merged files.
Definition at line 139 of file RootDataConnection.h.
typedef std::vector<RootRef> Gaudi::RootDataConnection::LinkSections |
Link sections definition.
Definition at line 143 of file RootDataConnection.h.
typedef std::map<std::string, ContainerSections, std::less<> > Gaudi::RootDataConnection::MergeSections |
Definition of database section to handle merged files.
Definition at line 141 of file RootDataConnection.h.
typedef std::vector<std::pair<std::string, std::string> > Gaudi::RootDataConnection::ParamMap |
Type definition for the parameter map.
Definition at line 135 of file RootDataConnection.h.
typedef std::map<std::string, TTree*, std::less<> > Gaudi::RootDataConnection::Sections |
Definition of tree sections.
Definition at line 137 of file RootDataConnection.h.
typedef std::vector<std::string> Gaudi::RootDataConnection::StringVec |
Type definition for string maps.
Definition at line 133 of file RootDataConnection.h.
|
strong |
RootDataConnection::RootDataConnection | ( | const IInterface * | own, |
boost::string_ref | nam, | ||
std::shared_ptr< RootConnectionSetup > | setup | ||
) |
Standard constructor.
Definition at line 161 of file RootDataConnection.cpp.
void RootDataConnection::addClient | ( | const IInterface * | client | ) |
Add new client to this data source.
Definition at line 176 of file RootDataConnection.cpp.
void RootDataConnection::badWriteError | ( | boost::string_ref | msg | ) | const |
Error handler when bad write statements occur.
Definition at line 194 of file RootDataConnection.cpp.
|
overridevirtual |
Open data stream in read mode.
Connect the file in READ mode.
Implements Gaudi::IDataConnection.
Definition at line 239 of file RootDataConnection.cpp.
|
overridevirtual |
Open data stream in write mode.
Implements Gaudi::IDataConnection.
Definition at line 289 of file RootDataConnection.cpp.
|
overridevirtual |
Release data stream and release implementation dependent resources.
Implements Gaudi::IDataConnection.
Definition at line 349 of file RootDataConnection.cpp.
|
protected |
Empty string reference.
Definition at line 485 of file RootDataConnection.cpp.
void RootDataConnection::enableStatistics | ( | boost::string_ref | section | ) |
Enable TTreePerStats.
Definition at line 210 of file RootDataConnection.cpp.
|
inline |
Direct access to TFile structure.
Definition at line 248 of file RootDataConnection.h.
|
inline |
Access data branch by name: Get existing branch in read only mode.
Definition at line 308 of file RootDataConnection.h.
TBranch * RootDataConnection::getBranch | ( | boost::string_ref | section, |
boost::string_ref | branch_name, | ||
TClass * | cl, | ||
void * | ptr, | ||
int | buff_siz, | ||
int | split_lvl | ||
) |
Access data branch by name: Get existing branch in write mode.
Definition at line 449 of file RootDataConnection.cpp.
|
inline |
Access container name from saved index.
Definition at line 329 of file RootDataConnection.h.
CSTR RootDataConnection::getDb | ( | int | which | ) | const |
Access database/file name from saved index.
Definition at line 475 of file RootDataConnection.cpp.
|
inline |
Access link name from saved index.
Definition at line 335 of file RootDataConnection.h.
pair< const RootRef *, const RootDataConnection::ContainerSection * > RootDataConnection::getMergeSection | ( | boost::string_ref | container, |
int | entry | ||
) | const |
Access link section for single container and entry.
Definition at line 604 of file RootDataConnection.cpp.
TTree * RootDataConnection::getSection | ( | boost::string_ref | sect, |
bool | create = false |
||
) |
Access TTree section from section name. The section is created if required.
Definition at line 382 of file RootDataConnection.cpp.
|
inlineoverridevirtual |
Check if connected to data source.
Implements Gaudi::IDataConnection.
Definition at line 250 of file RootDataConnection.h.
|
inline |
Is the file writable?
Definition at line 252 of file RootDataConnection.h.
int RootDataConnection::loadObj | ( | boost::string_ref | section, |
boost::string_ref | cnt, | ||
unsigned long | entry, | ||
DataObject *& | pObj | ||
) |
Load object.
Definition at line 529 of file RootDataConnection.cpp.
int RootDataConnection::loadRefs | ( | boost::string_ref | section, |
boost::string_ref | cnt, | ||
unsigned long | entry, | ||
RootObjectRefs & | refs | ||
) |
Load references object.
Definition at line 584 of file RootDataConnection.cpp.
bool RootDataConnection::lookupClient | ( | const IInterface * | client | ) | const |
Lookup client for this data source.
Definition at line 187 of file RootDataConnection.cpp.
int RootDataConnection::makeLink | ( | boost::string_ref | p | ) |
Convert path string to path index.
Definition at line 466 of file RootDataConnection.cpp.
Create reference object from registry entry.
Definition at line 631 of file RootDataConnection.cpp.
void RootDataConnection::makeRef | ( | boost::string_ref | name, |
long | clid, | ||
int | tech, | ||
boost::string_ref | db, | ||
boost::string_ref | cnt, | ||
int | entry, | ||
RootRef & | ref | ||
) |
Create reference object from values.
Definition at line 638 of file RootDataConnection.cpp.
RootDataConnection::Tool * RootDataConnection::makeTool | ( | ) |
Create file access tool to encapsulate POOL compatibiliy.
Definition at line 225 of file RootDataConnection.cpp.
|
inline |
Access merged FIDs.
Definition at line 258 of file RootDataConnection.h.
|
inline |
Access merged data section inventory.
Definition at line 256 of file RootDataConnection.h.
|
inline |
Allow access to printer service.
Definition at line 148 of file RootDataConnection.h.
|
inlineoverridevirtual |
Read root byte buffer from input stream.
Implements Gaudi::IDataConnection.
Definition at line 298 of file RootDataConnection.h.
size_t RootDataConnection::removeClient | ( | const IInterface * | client | ) |
Remove client from this data source.
Definition at line 179 of file RootDataConnection.cpp.
pair< int, unsigned long > RootDataConnection::save | ( | boost::string_ref | section, |
boost::string_ref | cnt, | ||
TClass * | cl, | ||
void * | pObj, | ||
int | buff_siz, | ||
int | split_lvl, | ||
bool | fill_missing = false |
||
) |
Save object of a given class to section and container.
Definition at line 496 of file RootDataConnection.cpp.
pair< int, unsigned long > RootDataConnection::saveObj | ( | boost::string_ref | section, |
boost::string_ref | cnt, | ||
TClass * | cl, | ||
DataObject * | pObj, | ||
int | buff_siz, | ||
int | split_lvl, | ||
bool | fill_missing = false |
||
) |
Save object of a given class to section and container.
Definition at line 488 of file RootDataConnection.cpp.
|
protected |
Internal helper to save/update reference tables.
void RootDataConnection::saveStatistics | ( | boost::string_ref | statisticsFile | ) |
Save TTree access statistics if required.
Definition at line 200 of file RootDataConnection.cpp.
|
inlineoverridevirtual |
Seek on the file described by ioDesc. Arguments as in ::seek()
Implements Gaudi::IDataConnection.
Definition at line 302 of file RootDataConnection.h.
|
inline |
|
inlineoverridevirtual |
Write root byte buffer to output stream.
Implements Gaudi::IDataConnection.
Definition at line 300 of file RootDataConnection.h.
Definition at line 238 of file RootDataConnection.h.
|
protected |
Client list.
Definition at line 176 of file RootDataConnection.h.
|
protected |
Map containing external container names.
Definition at line 164 of file RootDataConnection.h.
|
protected |
Map containing external database file names (fids)
Definition at line 162 of file RootDataConnection.h.
|
protected |
Buffer for empty string reference.
Definition at line 178 of file RootDataConnection.h.
|
protected |
Reference to ROOT file.
Definition at line 156 of file RootDataConnection.h.
|
protected |
Map containing internal links names.
Definition at line 166 of file RootDataConnection.h.
|
protected |
Database link sections.
Definition at line 174 of file RootDataConnection.h.
|
protected |
Map containing merge FIDs.
Definition at line 168 of file RootDataConnection.h.
|
protected |
Database section map for merged files.
Definition at line 172 of file RootDataConnection.h.
|
protected |
Parameter map for file parameters.
Definition at line 170 of file RootDataConnection.h.
|
protected |
Pointer to the reference tree.
Definition at line 158 of file RootDataConnection.h.
|
protected |
Tree sections in TFile.
Definition at line 160 of file RootDataConnection.h.
|
protected |
Reference to the setup structure.
Definition at line 152 of file RootDataConnection.h.
|
protected |
I/O read statistics from TTree.
Definition at line 154 of file RootDataConnection.h.
std::unique_ptr<Tool> Gaudi::RootDataConnection::m_tool |
Definition at line 237 of file RootDataConnection.h.