ATLAS Offline Software
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Private Types | Private Attributes | List of all members
pool::RootDatabase Class Reference

#include <src/RootDatabase.h>

Inheritance diagram for pool::RootDatabase:
Collaboration diagram for pool::RootDatabase:

Public Types

enum  { READ_COUNTER = 0, WRITE_COUNTER = 1, OTHER_COUNTER = 2 }
 

Public Member Functions

 RootDatabase ()
 Standard Constructor. More...
 
virtual ~RootDatabase ()
 Standard destructor. More...
 
TFile * file ()
 Access to the actual implemented file. More...
 
TTree * getTree (const std::string &name)
 Get TTree by name from the TFile. More...
 
const std::string & fmtVersion () const
 Access to the version string. More...
 
virtual long long int size () const
 Access the size of the database: May be undefined for some technologies. More...
 
void addByteCount (int which, long long int num_bytes)
 Do some statistics: add number of bytes read/written/other. More...
 
long long int byteCount (int which) const
 Do some statistics: retrieve number of bytes read/written/other. More...
 
DbStatus markBranchContainerForFill (RootTreeContainer *)
 
void registerBranchContainer (RootTreeContainer *)
 
uint64_t currentIndexMasterID () const
 
uint64_t indexSize (TBranch *branch)
 get index size for indexed containers More...
 
uint64_t indexSizeInc (TBranch *branch)
 increase index size counter for indexed containers (by 1) More...
 
bool wasIndexRebuilt (const std::string &treeName)
 Check if a given TTree had its index rebuilt. More...
 
void markIndexRebuilt (const std::string &treeName)
 Mark that a given TTree had its index rebuilt. More...
 
std::recursive_mutex & ioMutex ()
 provide access to the I/O mutex for AuxDynReader and Containers More...
 
virtual DbStatus getOption (DbOption &opt)
 Access options. More...
 
virtual DbStatus setOption (const DbOption &opt)
 Set options. More...
 
virtual DbStatus setAutoFlush (const DbOption &opt)
 implementation of TREE_AUTO_FLUSH option - called from setOption() More...
 
virtual DbStatus open (const DbDomain &domH, const std::string &nam, DbAccessMode mode)
 Open Database object. More...
 
virtual DbStatus reopen (DbAccessMode mode)
 Re-open database with changing access permissions. More...
 
virtual DbStatus onOpen (DbDatabase &dbH, DbAccessMode mode)
 Callback after successful open of a database object. More...
 
virtual DbStatus close (DbAccessMode mode)
 Close database access. More...
 
virtual DbStatus transAct (Transaction::Action action)
 Execute Database Transaction action. More...
 
RNTupleReadergetNTupleReader (const std::string &ntuple_name)
 return RNTupleReader for a given ntuple_name More...
 
uint64_t indexLookup (RNTupleReader *ps, uint64_t idx_val)
 
RootStorageSvc::RNTupleWriterHelpergetNTupleWriter (const std::string &ntuple_name, bool create=false)
 Return RNTupleWriterHelper for a given ntuple_name create a new one if needed when create==true. More...
 

Static Public Member Functions

static bool exists (const std::string &nam)
 Check for file-existence. More...
 

Protected Member Functions

DbStatus fillBranchContainerTrees ()
 
void reduceBasketsSize (TTree *tree)
 
void increaseBasketsSize (TTree *tree)
 
DbStatus close ()
 

Private Types

typedef std::set< RootTreeContainer * > ContainerSet_t
 
using indexLookup_t = std::unordered_map< uint64_t, uint64_t >
 

Private Attributes

DbDatabase m_dbH
 Parent Database handle. More...
 
TFile * m_file
 Reference to the actual implemented file. More...
 
std::string m_version
 Persistency format version. More...
 
long long int m_counters [3]
 Counter statistics. More...
 
int m_defCompression
 Default compression level. More...
 
int m_defCompressionAlg
 Default compression algorithm. More...
 
int m_defSplitLevel
 Default split level. More...
 
int m_defAutoSave
 Default Autosave parameter for trees. More...
 
int m_defBufferSize
 Default buffer size parameter for Branches. More...
 
int m_maxBufferSize
 Maximum buffer size parameter for Branches. More...
 
int m_minBufferEntries
 Minimum buffer entries parameter for Branches. More...
 
int m_defWritePolicy
 Default policy mode for keyed objects. More...
 
int m_branchOffsetTabLen
 Offset table length for branches. More...
 
std::string m_treeNameWithCache
 Name of tree with cache. More...
 
int m_defTreeCacheLearnEvents
 Default tree cache learn events. More...
 
int m_rntBufferedWriteEnabled
 Flag to enable/disable buffered RNTuple writing. More...
 
int m_rntReaderMetricsEnabled
 Flag to enable/disable RNTupleReader metrics. More...
 
int m_rntWriterMetricsEnabled
 Flag to enable/disable RNTupleWriter metrics. More...
 
std::string m_indexMaster
 name of the container with master index ('*' means use the biggest) More...
 
uint64_t m_indexMasterID
 nextID of the master index More...
 
std::map< TBranch *, uint64_t > m_indexSizeMap
 Keep index sizes here, because Branches are emptied when fast merged by SharedWriter. More...
 
std::set< std::string > m_indexRebuilt
 marks if the index (for index Containers) was rebuilt for given TTree More...
 
std::map< std::string, int > m_autoFlushTrees
 
std::map< TTree *, ContainerSet_tm_containersInTree
 
std::map< std::string, int > m_customSplitLevel
 
IFileMgr * m_fileMgr
 
std::recursive_mutex m_iomutex
 
std::map< std::string, std::unique_ptr< RootStorageSvc::RNTupleWriterHelper > > m_ntupleWriterMap
 
std::map< std::string, std::unique_ptr< RNTupleReader > > m_ntupleReaderMap
 
std::map< void *, indexLookup_tm_ntupleIndexMap
 

Detailed Description

Description: ROOT specific implementation of Database file.

Author
M.Frank
Date
1/8/2002
Version
1.0

Definition at line 57 of file RootDatabase.h.

Member Typedef Documentation

◆ ContainerSet_t

Definition at line 118 of file RootDatabase.h.

◆ indexLookup_t

using pool::RootDatabase::indexLookup_t = std::unordered_map<uint64_t, uint64_t>
private

Definition at line 131 of file RootDatabase.h.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
Enumerator
READ_COUNTER 
WRITE_COUNTER 
OTHER_COUNTER 

Definition at line 60 of file RootDatabase.h.

60 { READ_COUNTER = 0, WRITE_COUNTER = 1, OTHER_COUNTER = 2 };

Constructor & Destructor Documentation

◆ RootDatabase()

pool::RootDatabase::RootDatabase ( )

Standard Constructor.

◆ ~RootDatabase()

virtual pool::RootDatabase::~RootDatabase ( )
virtual

Standard destructor.

Member Function Documentation

◆ addByteCount()

void pool::RootDatabase::addByteCount ( int  which,
long long int  num_bytes 
)

Do some statistics: add number of bytes read/written/other.

◆ byteCount()

long long int pool::RootDatabase::byteCount ( int  which) const

Do some statistics: retrieve number of bytes read/written/other.

◆ close() [1/2]

DbStatus pool::RootDatabase::close ( )
protected

◆ close() [2/2]

virtual DbStatus pool::RootDatabase::close ( DbAccessMode  mode)
virtual

Close database access.

Parameters
mode[IN] Desired session access mode.
Returns
DbStatus code indicating success or failure.

Implements pool::IDbDatabase.

◆ currentIndexMasterID()

uint64_t pool::RootDatabase::currentIndexMasterID ( ) const
inline

Definition at line 171 of file RootDatabase.h.

171 { return m_indexMasterID; }

◆ exists()

static bool pool::RootDatabase::exists ( const std::string &  nam)
static

Check for file-existence.

Parameters
nam[IN] Name of the database to be checked.
Returns
Boolean value indicating the database existence.

◆ file()

TFile* pool::RootDatabase::file ( )
inline

Access to the actual implemented file.

Definition at line 142 of file RootDatabase.h.

142 { return m_file; }

◆ fillBranchContainerTrees()

DbStatus pool::RootDatabase::fillBranchContainerTrees ( )
protected

◆ fmtVersion()

const std::string& pool::RootDatabase::fmtVersion ( ) const
inline

Access to the version string.

Definition at line 148 of file RootDatabase.h.

148 { return m_version; }

◆ getNTupleReader()

RNTupleReader* pool::RootDatabase::getNTupleReader ( const std::string &  ntuple_name)

return RNTupleReader for a given ntuple_name

◆ getNTupleWriter()

RootStorageSvc::RNTupleWriterHelper* pool::RootDatabase::getNTupleWriter ( const std::string &  ntuple_name,
bool  create = false 
)

Return RNTupleWriterHelper for a given ntuple_name create a new one if needed when create==true.

◆ getOption()

virtual DbStatus pool::RootDatabase::getOption ( DbOption opt)
virtual

Access options.

Parameters
opt[IN] Reference to option object.
Returns
DbStatus code indicating success or failure.

Implements pool::IDbDatabase.

◆ getTree()

TTree* pool::RootDatabase::getTree ( const std::string &  name)

Get TTree by name from the TFile.

◆ increaseBasketsSize()

void pool::RootDatabase::increaseBasketsSize ( TTree *  tree)
protected

◆ indexLookup()

uint64_t pool::RootDatabase::indexLookup ( RNTupleReader ps,
uint64_t  idx_val 
)

◆ indexSize()

uint64_t pool::RootDatabase::indexSize ( TBranch *  branch)
inline

get index size for indexed containers

Definition at line 174 of file RootDatabase.h.

174 { return m_indexSizeMap[branch]; }

◆ indexSizeInc()

uint64_t pool::RootDatabase::indexSizeInc ( TBranch *  branch)
inline

increase index size counter for indexed containers (by 1)

Definition at line 177 of file RootDatabase.h.

177 { return ++m_indexSizeMap[branch]; }

◆ ioMutex()

std::recursive_mutex& pool::RootDatabase::ioMutex ( )
inline

provide access to the I/O mutex for AuxDynReader and Containers

Definition at line 186 of file RootDatabase.h.

186 { return m_iomutex; }

◆ markBranchContainerForFill()

DbStatus pool::RootDatabase::markBranchContainerForFill ( RootTreeContainer )

◆ markIndexRebuilt()

void pool::RootDatabase::markIndexRebuilt ( const std::string &  treeName)
inline

Mark that a given TTree had its index rebuilt.

Definition at line 183 of file RootDatabase.h.

183 { m_indexRebuilt.insert(treeName); };

◆ onOpen()

virtual DbStatus pool::RootDatabase::onOpen ( DbDatabase dbH,
DbAccessMode  mode 
)
virtual

Callback after successful open of a database object.

Parameters
dbH[IN] Handle to valid database object
mode[IN] Desired session access mode.
Returns
DbStatus code indicating success or failure.

Implements pool::IDbDatabase.

◆ open()

virtual DbStatus pool::RootDatabase::open ( const DbDomain domH,
const std::string &  nam,
DbAccessMode  mode 
)
virtual

Open Database object.

Parameters
domH[IN] Handle to valid domain object (validity ensured by upper levels).
nam[IN] Name of the database to be opened.
mode[IN] Desired session access mode.
Returns
DbStatus code indicating success or failure.

Implements pool::IDbDatabase.

◆ reduceBasketsSize()

void pool::RootDatabase::reduceBasketsSize ( TTree *  tree)
protected

◆ registerBranchContainer()

void pool::RootDatabase::registerBranchContainer ( RootTreeContainer )

◆ reopen()

virtual DbStatus pool::RootDatabase::reopen ( DbAccessMode  mode)
virtual

Re-open database with changing access permissions.

Parameters
mode[IN] Desired session access mode.
Returns
DbStatus code indicating success or failure.

Implements pool::IDbDatabase.

◆ setAutoFlush()

virtual DbStatus pool::RootDatabase::setAutoFlush ( const DbOption opt)
virtual

implementation of TREE_AUTO_FLUSH option - called from setOption()

◆ setOption()

virtual DbStatus pool::RootDatabase::setOption ( const DbOption opt)
virtual

Set options.

Parameters
opt[IN] Reference to option object.
Returns
DbStatus code indicating success or failure.

Implements pool::IDbDatabase.

◆ size()

virtual long long int pool::RootDatabase::size ( ) const
virtual

Access the size of the database: May be undefined for some technologies.

Implements pool::IDbDatabase.

◆ transAct()

virtual DbStatus pool::RootDatabase::transAct ( Transaction::Action  action)
virtual

Execute Database Transaction action.

Implements pool::IDbDatabase.

◆ wasIndexRebuilt()

bool pool::RootDatabase::wasIndexRebuilt ( const std::string &  treeName)
inline

Check if a given TTree had its index rebuilt.

Definition at line 181 of file RootDatabase.h.

181 { return m_indexRebuilt.count(treeName)!=0; }

Member Data Documentation

◆ m_autoFlushTrees

std::map< std::string, int > pool::RootDatabase::m_autoFlushTrees
private

Definition at line 115 of file RootDatabase.h.

◆ m_branchOffsetTabLen

int pool::RootDatabase::m_branchOffsetTabLen
private

Offset table length for branches.

Definition at line 88 of file RootDatabase.h.

◆ m_containersInTree

std::map< TTree*, ContainerSet_t > pool::RootDatabase::m_containersInTree
private

Definition at line 119 of file RootDatabase.h.

◆ m_counters

long long int pool::RootDatabase::m_counters[3]
private

Counter statistics.

Definition at line 70 of file RootDatabase.h.

◆ m_customSplitLevel

std::map< std::string, int > pool::RootDatabase::m_customSplitLevel
private

Definition at line 121 of file RootDatabase.h.

◆ m_dbH

DbDatabase pool::RootDatabase::m_dbH
private

Parent Database handle.

Definition at line 64 of file RootDatabase.h.

◆ m_defAutoSave

int pool::RootDatabase::m_defAutoSave
private

Default Autosave parameter for trees.

Definition at line 78 of file RootDatabase.h.

◆ m_defBufferSize

int pool::RootDatabase::m_defBufferSize
private

Default buffer size parameter for Branches.

Definition at line 80 of file RootDatabase.h.

◆ m_defCompression

int pool::RootDatabase::m_defCompression
private

Default compression level.

Definition at line 72 of file RootDatabase.h.

◆ m_defCompressionAlg

int pool::RootDatabase::m_defCompressionAlg
private

Default compression algorithm.

Definition at line 74 of file RootDatabase.h.

◆ m_defSplitLevel

int pool::RootDatabase::m_defSplitLevel
private

Default split level.

Definition at line 76 of file RootDatabase.h.

◆ m_defTreeCacheLearnEvents

int pool::RootDatabase::m_defTreeCacheLearnEvents
private

Default tree cache learn events.

Definition at line 92 of file RootDatabase.h.

◆ m_defWritePolicy

int pool::RootDatabase::m_defWritePolicy
private

Default policy mode for keyed objects.

Definition at line 86 of file RootDatabase.h.

◆ m_file

TFile* pool::RootDatabase::m_file
private

Reference to the actual implemented file.

Definition at line 66 of file RootDatabase.h.

◆ m_fileMgr

IFileMgr* pool::RootDatabase::m_fileMgr
private

Definition at line 123 of file RootDatabase.h.

◆ m_indexMaster

std::string pool::RootDatabase::m_indexMaster
private

name of the container with master index ('*' means use the biggest)

Definition at line 101 of file RootDatabase.h.

◆ m_indexMasterID

uint64_t pool::RootDatabase::m_indexMasterID
private

nextID of the master index

Definition at line 103 of file RootDatabase.h.

◆ m_indexRebuilt

std::set< std::string > pool::RootDatabase::m_indexRebuilt
private

marks if the index (for index Containers) was rebuilt for given TTree

Definition at line 109 of file RootDatabase.h.

◆ m_indexSizeMap

std::map<TBranch*, uint64_t> pool::RootDatabase::m_indexSizeMap
private

Keep index sizes here, because Branches are emptied when fast merged by SharedWriter.

Definition at line 106 of file RootDatabase.h.

◆ m_iomutex

std::recursive_mutex pool::RootDatabase::m_iomutex
private

Definition at line 126 of file RootDatabase.h.

◆ m_maxBufferSize

int pool::RootDatabase::m_maxBufferSize
private

Maximum buffer size parameter for Branches.

Definition at line 82 of file RootDatabase.h.

◆ m_minBufferEntries

int pool::RootDatabase::m_minBufferEntries
private

Minimum buffer entries parameter for Branches.

Definition at line 84 of file RootDatabase.h.

◆ m_ntupleIndexMap

std::map<void*, indexLookup_t> pool::RootDatabase::m_ntupleIndexMap
private

Definition at line 132 of file RootDatabase.h.

◆ m_ntupleReaderMap

std::map<std::string, std::unique_ptr<RNTupleReader> > pool::RootDatabase::m_ntupleReaderMap
private

Definition at line 129 of file RootDatabase.h.

◆ m_ntupleWriterMap

std::map<std::string, std::unique_ptr<RootStorageSvc::RNTupleWriterHelper> > pool::RootDatabase::m_ntupleWriterMap
private

Definition at line 128 of file RootDatabase.h.

◆ m_rntBufferedWriteEnabled

int pool::RootDatabase::m_rntBufferedWriteEnabled
private

Flag to enable/disable buffered RNTuple writing.

Definition at line 94 of file RootDatabase.h.

◆ m_rntReaderMetricsEnabled

int pool::RootDatabase::m_rntReaderMetricsEnabled
private

Flag to enable/disable RNTupleReader metrics.

Definition at line 96 of file RootDatabase.h.

◆ m_rntWriterMetricsEnabled

int pool::RootDatabase::m_rntWriterMetricsEnabled
private

Flag to enable/disable RNTupleWriter metrics.

Definition at line 98 of file RootDatabase.h.

◆ m_treeNameWithCache

std::string pool::RootDatabase::m_treeNameWithCache
private

Name of tree with cache.

Definition at line 90 of file RootDatabase.h.

◆ m_version

std::string pool::RootDatabase::m_version
private

Persistency format version.

Definition at line 68 of file RootDatabase.h.


The documentation for this class was generated from the following file:
pool::RootDatabase::READ_COUNTER
@ READ_COUNTER
Definition: RootDatabase.h:60
pool::RootDatabase::m_indexRebuilt
std::set< std::string > m_indexRebuilt
marks if the index (for index Containers) was rebuilt for given TTree
Definition: RootDatabase.h:109
pool::RootDatabase::m_indexMasterID
uint64_t m_indexMasterID
nextID of the master index
Definition: RootDatabase.h:103
pool::RootDatabase::WRITE_COUNTER
@ WRITE_COUNTER
Definition: RootDatabase.h:60
pool::RootDatabase::m_indexSizeMap
std::map< TBranch *, uint64_t > m_indexSizeMap
Keep index sizes here, because Branches are emptied when fast merged by SharedWriter.
Definition: RootDatabase.h:106
pool::RootDatabase::OTHER_COUNTER
@ OTHER_COUNTER
Definition: RootDatabase.h:60
pool::RootDatabase::m_iomutex
std::recursive_mutex m_iomutex
Definition: RootDatabase.h:126
dumpFileToPlots.treeName
string treeName
Definition: dumpFileToPlots.py:20
RTTAlgmain.branch
branch
Definition: RTTAlgmain.py:61
pool::RootDatabase::m_file
TFile * m_file
Reference to the actual implemented file.
Definition: RootDatabase.h:66
pool::RootDatabase::m_version
std::string m_version
Persistency format version.
Definition: RootDatabase.h:68