The Gaudi Framework
master (37c0b60a)
|
#include <GaudiRootCnv/RootDataConnection.h>
Classes | |
class | ContainerSection |
class | Tool |
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... | |
IIncidentSvc * | incidentSvc () const |
Tool * | makeTool () |
Create file access tool to encapsulate POOL compatibiliy. More... | |
RootDataConnection (const IInterface *own, std::string_view 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 (std::string_view msg) const |
Error handler when bad write statements occur. More... | |
std::pair< const RootRef *, const ContainerSection * > | getMergeSection (std::string_view container, int entry) const |
Access link section for single container and entry. More... | |
void | enableStatistics (std::string_view section) |
Enable TTreePerStats. More... | |
void | saveStatistics (std::string_view statisticsFile) |
Save TTree access statistics if required. More... | |
int | loadObj (std::string_view section, std::string_view cnt, unsigned long entry, DataObject *&pObj) |
Load object. More... | |
int | loadRefs (std::string_view section, std::string_view cnt, unsigned long entry, RootObjectRefs &refs) |
Load references object. More... | |
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. More... | |
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. 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 (std::string_view sect, bool create=false) |
Access TTree section from section name. The section is created if required. More... | |
TBranch * | getBranch (std::string_view section, std::string_view branch_name) |
Access data branch by name: Get existing branch in read only mode. More... | |
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. More... | |
void | makeRef (const IRegistry &pA, RootRef &ref) |
Create reference object from registry entry. More... | |
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. More... | |
int | makeLink (std::string_view 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 112 of file RootDataConnection.h.
typedef std::set<const IInterface*> Gaudi::RootDataConnection::Clients |
Client set.
Definition at line 160 of file RootDataConnection.h.
Definition of container sections to handle merged files.
Definition at line 154 of file RootDataConnection.h.
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.
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.
Type definition for string maps.
Definition at line 148 of file RootDataConnection.h.
|
strong |
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 | ) |
|
inline |
Direct access to TFile structure.
Definition at line 264 of file RootDataConnection.h.
|
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 |
CSTR RootDataConnection::getDb | ( | int | which | ) | const |
Access database/file name from saved index.
Definition at line 486 of file RootDataConnection.cpp.
|
inline |
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 | ||
) |
bool RootDataConnection::lookupClient | ( | const IInterface * | client | ) | const |
int RootDataConnection::makeLink | ( | std::string_view | p | ) |
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 | ) |
|
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.
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.