![]() |
The Gaudi Framework
master (ff829712)
|
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 class | Status : StatusCode::code_t { ROOT_READ_ERROR = 0x2 , ROOT_OPEN_ERROR = 0x4 } |
typedef std::vector< std::string > | StringVec |
Type definition for string maps. | |
typedef std::vector< std::pair< std::string, std::string > > | ParamMap |
Type definition for the parameter map. | |
typedef std::map< std::string, TTree *, std::less<> > | Sections |
Definition of tree sections. | |
typedef std::vector< ContainerSection > | ContainerSections |
Definition of container sections to handle merged files. | |
typedef std::map< std::string, ContainerSections, std::less<> > | MergeSections |
Definition of database section to handle merged files. | |
typedef std::vector< RootRef > | LinkSections |
Link sections definition. | |
typedef std::set< const IInterface * > | Clients |
Client set. | |
![]() | |
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. | |
IIncidentSvc * | incidentSvc () const |
Tool * | makeTool () |
Create file access tool to encapsulate POOL compatibiliy. | |
RootDataConnection (const IInterface *own, std::string_view nam, std::shared_ptr< RootConnectionSetup > setup) | |
Standard constructor. | |
TFile * | file () const |
Direct access to TFile structure. | |
bool | isConnected () const override |
Check if connected to data source. | |
bool | isWritable () const |
Is the file writable? | |
Tool * | tool () const |
Access tool. | |
const MergeSections & | mergeSections () const |
Access merged data section inventory. | |
const StringVec & | mergeFIDs () const |
Access merged FIDs. | |
void | addClient (const IInterface *client) |
Add new client to this data source. | |
size_t | removeClient (const IInterface *client) |
Remove client from this data source. | |
bool | lookupClient (const IInterface *client) const |
Lookup client for this data source. | |
void | badWriteError (std::string_view msg) const |
Error handler when bad write statements occur. | |
std::pair< const RootRef *, const ContainerSection * > | getMergeSection (std::string_view container, int entry) const |
Access link section for single container and entry. | |
void | enableStatistics (std::string_view section) |
Enable TTreePerStats. | |
void | saveStatistics (std::string_view statisticsFile) |
Save TTree access statistics if required. | |
int | loadObj (std::string_view section, std::string_view cnt, unsigned long entry, DataObject *&pObj) |
Load object. | |
int | loadRefs (std::string_view section, std::string_view cnt, unsigned long entry, RootObjectRefs &refs) |
Load references object. | |
std::pair< int, unsigned long > | saveObj (std::string_view section, std::string_view cnt, TClass *cl, DataObject *pObj, int minBufferSize, int maxBufferSize, int approxEventsPerBasket, int split_lvl, bool fill_missing=false) |
Save object of a given class to section and container. | |
std::pair< int, unsigned long > | save (std::string_view section, std::string_view cnt, TClass *cl, void *pObj, int minBufferSize, int maxBufferSize, int approxEventsPerBasket, int split_lvl, bool fill_missing=false) |
Save object of a given class to section and container. | |
StatusCode | connectRead () override |
Open data stream in read mode. | |
StatusCode | connectWrite (IoType typ) override |
Open data stream in write mode. | |
StatusCode | disconnect () override |
Release data stream and release implementation dependent resources. | |
StatusCode | read (void *const, size_t) override |
Read root byte buffer from input stream. | |
StatusCode | write (const void *, int) override |
Write root byte buffer to output stream. | |
long long int | seek (long long int, int) override |
Seek on the file described by ioDesc. Arguments as in seek() | |
TTree * | getSection (std::string_view sect, bool create=false) |
Access TTree section from section name. The section is created if required. | |
TBranch * | getBranch (std::string_view section, std::string_view branch_name) |
Access data branch by name: Get existing branch in read only mode. | |
TBranch * | getBranch (std::string_view section, std::string_view branch_name, TClass *cl, void *ptr, int buff_siz, int split_lvl) |
Access data branch by name: Get existing branch in write mode. | |
void | makeRef (const IRegistry &pA, RootRef &ref) |
Create reference object from registry entry. | |
void | makeRef (std::string_view name, long clid, int tech, std::string_view db, std::string_view cnt, int entry, RootRef &ref) |
Create reference object from values. | |
int | makeLink (std::string_view p) |
Convert path string to path index. | |
const std::string & | getDb (int which) const |
Access database/file name from saved index. | |
const std::string & | getCont (int which) const |
Access container name from saved index. | |
const std::string & | getLink (int which) const |
Access link name from saved index. | |
![]() | |
IDataConnection (const IInterface *own, std::string nam) | |
Standard constructor. | |
virtual | ~IDataConnection ()=default |
Standard destructor. | |
const std::string & | name () const |
Connection name. | |
void | setFID (std::string fid) |
Set file ID. | |
const std::string & | fid () const |
Access file id. | |
const std::string & | pfn () const |
Access physical file name. | |
void | setPFN (std::string fn) |
Set physical file name. | |
int | ageFile () |
Increase age of I/O source. | |
void | resetAge () |
Reset age. | |
int | age () const |
Access age counter. | |
const IInterface * | owner () const |
Owner instance. | |
Public Attributes | |
std::unique_ptr< Tool > | m_tool |
Protected Member Functions | |
const std::string & | empty () const |
Empty string reference. | |
StatusCode | saveRefs () |
Internal helper to save/update reference tables. | |
Protected Attributes | |
std::shared_ptr< RootConnectionSetup > | m_setup |
Reference to the setup structure. | |
std::unique_ptr< TTreePerfStats > | m_statistics |
I/O read statistics from TTree. | |
std::unique_ptr< TFile > | m_file |
Reference to ROOT file. | |
TTree * | m_refs = nullptr |
Pointer to the reference tree. | |
Sections | m_sections |
Tree sections in TFile. | |
StringVec | m_dbs |
Map containing external database file names (fids) | |
StringVec | m_conts |
Map containing external container names. | |
StringVec | m_links |
Map containing internal links names. | |
StringVec | m_mergeFIDs |
Map containing merge FIDs. | |
ParamMap | m_params |
Parameter map for file parameters. | |
MergeSections | m_mergeSects |
Database section map for merged files. | |
LinkSections | m_linkSects |
Database link sections. | |
Clients | m_clients |
Client list. | |
std::string | m_empty |
Buffer for empty string reference. | |
![]() | |
std::string | m_name |
Connection name/identifier. | |
std::string | m_fid |
File ID of the connection. | |
std::string | m_pfn |
Physical file name of the connection. | |
int | m_age = 0 |
Age counter. | |
const IInterface * | m_owner = nullptr |
Owner pointer. | |
Friends | |
class | Tool |
Concrete implementation of the IDataConnection interface to access ROOT files.
Definition at line 112 of file RootDataConnection.h.
typedef std::set<const IInterface*> Gaudi::RootDataConnection::Clients |
Client set.
Definition at line 160 of file RootDataConnection.h.
typedef std::vector<ContainerSection> Gaudi::RootDataConnection::ContainerSections |
Definition of container sections to handle merged files.
Definition at line 154 of file RootDataConnection.h.
typedef std::vector<RootRef> Gaudi::RootDataConnection::LinkSections |
Link sections definition.
Definition at line 158 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 156 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 150 of file RootDataConnection.h.
typedef std::map<std::string, TTree*, std::less<> > Gaudi::RootDataConnection::Sections |
Definition of tree sections.
Definition at line 152 of file RootDataConnection.h.
typedef std::vector<std::string> Gaudi::RootDataConnection::StringVec |
Type definition for string maps.
Definition at line 148 of file RootDataConnection.h.
|
strong |
Enumerator | |
---|---|
ROOT_READ_ERROR | |
ROOT_OPEN_ERROR |
Definition at line 114 of file RootDataConnection.h.
RootDataConnection::RootDataConnection | ( | const IInterface * | own, |
std::string_view | nam, | ||
std::shared_ptr< RootConnectionSetup > | setup ) |
Standard constructor.
Definition at line 175 of file RootDataConnection.cpp.
void RootDataConnection::addClient | ( | const IInterface * | client | ) |
Add new client to this data source.
Definition at line 190 of file RootDataConnection.cpp.
void RootDataConnection::badWriteError | ( | std::string_view | msg | ) | const |
Error handler when bad write statements occur.
Definition at line 206 of file RootDataConnection.cpp.
|
overridevirtual |
Open data stream in read mode.
Connect the file in READ mode.
Implements Gaudi::IDataConnection.
Definition at line 247 of file RootDataConnection.cpp.
|
overridevirtual |
Open data stream in write mode.
Implements Gaudi::IDataConnection.
Definition at line 294 of file RootDataConnection.cpp.
|
overridevirtual |
Release data stream and release implementation dependent resources.
Implements Gaudi::IDataConnection.
Definition at line 355 of file RootDataConnection.cpp.
|
protected |
Empty string reference.
Definition at line 495 of file RootDataConnection.cpp.
void RootDataConnection::enableStatistics | ( | std::string_view | section | ) |
Enable TTreePerStats.
Definition at line 220 of file RootDataConnection.cpp.
|
inline |
|
inline |
Access data branch by name: Get existing branch in read only mode.
Definition at line 326 of file RootDataConnection.h.
TBranch * RootDataConnection::getBranch | ( | std::string_view | section, |
std::string_view | 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 461 of file RootDataConnection.cpp.
|
inline |
Access container name from saved index.
Definition at line 346 of file RootDataConnection.h.
CSTR RootDataConnection::getDb | ( | int | which | ) | const |
Access database/file name from saved index.
Definition at line 486 of file RootDataConnection.cpp.
|
inline |
Access link name from saved index.
Definition at line 351 of file RootDataConnection.h.
pair< const RootRef *, const RootDataConnection::ContainerSection * > RootDataConnection::getMergeSection | ( | std::string_view | container, |
int | entry ) const |
Access link section for single container and entry.
Definition at line 620 of file RootDataConnection.cpp.
TTree * RootDataConnection::getSection | ( | std::string_view | sect, |
bool | create = false ) |
Access TTree section from section name. The section is created if required.
Definition at line 387 of file RootDataConnection.cpp.
|
inline |
Definition at line 164 of file RootDataConnection.h.
|
inlineoverridevirtual |
Check if connected to data source.
Implements Gaudi::IDataConnection.
Definition at line 266 of file RootDataConnection.h.
|
inline |
Is the file writable?
Definition at line 268 of file RootDataConnection.h.
int RootDataConnection::loadObj | ( | std::string_view | section, |
std::string_view | cnt, | ||
unsigned long | entry, | ||
DataObject *& | pObj ) |
Load object.
Definition at line 553 of file RootDataConnection.cpp.
int RootDataConnection::loadRefs | ( | std::string_view | section, |
std::string_view | cnt, | ||
unsigned long | entry, | ||
RootObjectRefs & | refs ) |
Load references object.
Definition at line 603 of file RootDataConnection.cpp.
bool RootDataConnection::lookupClient | ( | const IInterface * | client | ) | const |
Lookup client for this data source.
Definition at line 200 of file RootDataConnection.cpp.
int RootDataConnection::makeLink | ( | std::string_view | p | ) |
Convert path string to path index.
Definition at line 478 of file RootDataConnection.cpp.
Create reference object from registry entry.
Definition at line 646 of file RootDataConnection.cpp.
void RootDataConnection::makeRef | ( | std::string_view | name, |
long | clid, | ||
int | tech, | ||
std::string_view | db, | ||
std::string_view | cnt, | ||
int | entry, | ||
RootRef & | ref ) |
Create reference object from values.
Definition at line 652 of file RootDataConnection.cpp.
RootDataConnection::Tool * RootDataConnection::makeTool | ( | ) |
Create file access tool to encapsulate POOL compatibiliy.
Create file access tool to encapsulate POOL compatibility.
Definition at line 234 of file RootDataConnection.cpp.
|
inline |
|
inline |
|
inline |
|
inlineoverridevirtual |
Read root byte buffer from input stream.
Implements Gaudi::IDataConnection.
Definition at line 316 of file RootDataConnection.h.
size_t RootDataConnection::removeClient | ( | const IInterface * | client | ) |
pair< int, unsigned long > RootDataConnection::save | ( | std::string_view | section, |
std::string_view | cnt, | ||
TClass * | cl, | ||
void * | pObj, | ||
int | minBufferSize, | ||
int | maxBufferSize, | ||
int | approxEventsPerBasket, | ||
int | split_lvl, | ||
bool | fill_missing = false ) |
Save object of a given class to section and container.
Definition at line 506 of file RootDataConnection.cpp.
pair< int, unsigned long > RootDataConnection::saveObj | ( | std::string_view | section, |
std::string_view | cnt, | ||
TClass * | cl, | ||
DataObject * | pObj, | ||
int | minBufferSize, | ||
int | maxBufferSize, | ||
int | approxEventsPerBasket, | ||
int | split_lvl, | ||
bool | fill_missing = false ) |
Save object of a given class to section and container.
Definition at line 498 of file RootDataConnection.cpp.
|
protected |
Internal helper to save/update reference tables.
void RootDataConnection::saveStatistics | ( | std::string_view | statisticsFile | ) |
Save TTree access statistics if required.
Definition at line 211 of file RootDataConnection.cpp.
|
inlineoverridevirtual |
Seek on the file described by ioDesc. Arguments as in seek()
Implements Gaudi::IDataConnection.
Definition at line 320 of file RootDataConnection.h.
|
inline |
|
inlineoverridevirtual |
Write root byte buffer to output stream.
Implements Gaudi::IDataConnection.
Definition at line 318 of file RootDataConnection.h.
|
friend |
Definition at line 254 of file RootDataConnection.h.
|
protected |
Client list.
Definition at line 192 of file RootDataConnection.h.
|
protected |
Map containing external container names.
Definition at line 180 of file RootDataConnection.h.
|
protected |
Map containing external database file names (fids)
Definition at line 178 of file RootDataConnection.h.
|
protected |
Buffer for empty string reference.
Definition at line 194 of file RootDataConnection.h.
|
protected |
Reference to ROOT file.
Definition at line 172 of file RootDataConnection.h.
|
protected |
Map containing internal links names.
Definition at line 182 of file RootDataConnection.h.
|
protected |
Database link sections.
Definition at line 190 of file RootDataConnection.h.
|
protected |
Map containing merge FIDs.
Definition at line 184 of file RootDataConnection.h.
|
protected |
Database section map for merged files.
Definition at line 188 of file RootDataConnection.h.
|
protected |
Parameter map for file parameters.
Definition at line 186 of file RootDataConnection.h.
|
protected |
Pointer to the reference tree.
Definition at line 174 of file RootDataConnection.h.
|
protected |
Tree sections in TFile.
Definition at line 176 of file RootDataConnection.h.
|
protected |
Reference to the setup structure.
Definition at line 168 of file RootDataConnection.h.
|
protected |
I/O read statistics from TTree.
Definition at line 170 of file RootDataConnection.h.
std::unique_ptr<Tool> Gaudi::RootDataConnection::m_tool |
Definition at line 253 of file RootDataConnection.h.