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
 
SmartIF< 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 58 of file RootDatabase.h.

Member Typedef Documentation

◆ ContainerSet_t

Definition at line 119 of file RootDatabase.h.

◆ indexLookup_t

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

Definition at line 132 of file RootDatabase.h.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
Enumerator
READ_COUNTER 
WRITE_COUNTER 
OTHER_COUNTER 

Definition at line 61 of file RootDatabase.h.

61 { 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 172 of file RootDatabase.h.

172 { 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 143 of file RootDatabase.h.

143 { 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 149 of file RootDatabase.h.

149 { 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 175 of file RootDatabase.h.

175 { 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 178 of file RootDatabase.h.

178 { 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 187 of file RootDatabase.h.

187 { 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 184 of file RootDatabase.h.

184 { 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 182 of file RootDatabase.h.

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

Member Data Documentation

◆ m_autoFlushTrees

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

Definition at line 116 of file RootDatabase.h.

◆ m_branchOffsetTabLen

int pool::RootDatabase::m_branchOffsetTabLen
private

Offset table length for branches.

Definition at line 89 of file RootDatabase.h.

◆ m_containersInTree

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

Definition at line 120 of file RootDatabase.h.

◆ m_counters

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

Counter statistics.

Definition at line 71 of file RootDatabase.h.

◆ m_customSplitLevel

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

Definition at line 122 of file RootDatabase.h.

◆ m_dbH

DbDatabase pool::RootDatabase::m_dbH
private

Parent Database handle.

Definition at line 65 of file RootDatabase.h.

◆ m_defAutoSave

int pool::RootDatabase::m_defAutoSave
private

Default Autosave parameter for trees.

Definition at line 79 of file RootDatabase.h.

◆ m_defBufferSize

int pool::RootDatabase::m_defBufferSize
private

Default buffer size parameter for Branches.

Definition at line 81 of file RootDatabase.h.

◆ m_defCompression

int pool::RootDatabase::m_defCompression
private

Default compression level.

Definition at line 73 of file RootDatabase.h.

◆ m_defCompressionAlg

int pool::RootDatabase::m_defCompressionAlg
private

Default compression algorithm.

Definition at line 75 of file RootDatabase.h.

◆ m_defSplitLevel

int pool::RootDatabase::m_defSplitLevel
private

Default split level.

Definition at line 77 of file RootDatabase.h.

◆ m_defTreeCacheLearnEvents

int pool::RootDatabase::m_defTreeCacheLearnEvents
private

Default tree cache learn events.

Definition at line 93 of file RootDatabase.h.

◆ m_defWritePolicy

int pool::RootDatabase::m_defWritePolicy
private

Default policy mode for keyed objects.

Definition at line 87 of file RootDatabase.h.

◆ m_file

TFile* pool::RootDatabase::m_file
private

Reference to the actual implemented file.

Definition at line 67 of file RootDatabase.h.

◆ m_fileMgr

SmartIF<IFileMgr> pool::RootDatabase::m_fileMgr
private

Definition at line 124 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 102 of file RootDatabase.h.

◆ m_indexMasterID

uint64_t pool::RootDatabase::m_indexMasterID
private

nextID of the master index

Definition at line 104 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 110 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 107 of file RootDatabase.h.

◆ m_iomutex

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

Definition at line 127 of file RootDatabase.h.

◆ m_maxBufferSize

int pool::RootDatabase::m_maxBufferSize
private

Maximum buffer size parameter for Branches.

Definition at line 83 of file RootDatabase.h.

◆ m_minBufferEntries

int pool::RootDatabase::m_minBufferEntries
private

Minimum buffer entries parameter for Branches.

Definition at line 85 of file RootDatabase.h.

◆ m_ntupleIndexMap

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

Definition at line 133 of file RootDatabase.h.

◆ m_ntupleReaderMap

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

Definition at line 130 of file RootDatabase.h.

◆ m_ntupleWriterMap

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

Definition at line 129 of file RootDatabase.h.

◆ m_rntBufferedWriteEnabled

int pool::RootDatabase::m_rntBufferedWriteEnabled
private

Flag to enable/disable buffered RNTuple writing.

Definition at line 95 of file RootDatabase.h.

◆ m_rntReaderMetricsEnabled

int pool::RootDatabase::m_rntReaderMetricsEnabled
private

Flag to enable/disable RNTupleReader metrics.

Definition at line 97 of file RootDatabase.h.

◆ m_rntWriterMetricsEnabled

int pool::RootDatabase::m_rntWriterMetricsEnabled
private

Flag to enable/disable RNTupleWriter metrics.

Definition at line 99 of file RootDatabase.h.

◆ m_treeNameWithCache

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

Name of tree with cache.

Definition at line 91 of file RootDatabase.h.

◆ m_version

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

Persistency format version.

Definition at line 69 of file RootDatabase.h.


The documentation for this class was generated from the following file:
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:110
pool::RootDatabase::m_indexMasterID
uint64_t m_indexMasterID
nextID of the master index
Definition: RootDatabase.h:104
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:107
pool::RootDatabase::WRITE_COUNTER
@ WRITE_COUNTER
Definition: RootDatabase.h:61
pool::RootDatabase::m_iomutex
std::recursive_mutex m_iomutex
Definition: RootDatabase.h:127
dumpFileToPlots.treeName
string treeName
Definition: dumpFileToPlots.py:20
pool::RootDatabase::READ_COUNTER
@ READ_COUNTER
Definition: RootDatabase.h:61
pool::RootDatabase::OTHER_COUNTER
@ OTHER_COUNTER
Definition: RootDatabase.h:61
RTTAlgmain.branch
branch
Definition: RTTAlgmain.py:61
pool::RootDatabase::m_file
TFile * m_file
Reference to the actual implemented file.
Definition: RootDatabase.h:67
pool::RootDatabase::m_version
std::string m_version
Persistency format version.
Definition: RootDatabase.h:69