Loading [MathJax]/extensions/tex2jax.js
ATLAS Offline Software
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
RootTreeContainer.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 //====================================================================
6 // Root Database implementation
7 //--------------------------------------------------------------------
8 //
9 // Package : APR RootStorageSvc (former POOL project)
10 //
11 // Author : M.Frank M.Nowak S.Snyder
12 //====================================================================
13 #ifndef POOL_ROOTTREECONTAINER_H
14 #define POOL_ROOTTREECONTAINER_H 1
15 
16 // Framework include files
17 #include "StorageSvc/DbDatabase.h"
19 
20 #include <map>
21 #include <vector>
22 #include <set>
23 #include <functional>
24 
25 // Forward declarations
26 class TBranch;
27 class TTree;
28 class TLeaf;
29 class TClass;
30 
31 namespace RootAuxDynIO {
32  class IRootAuxDynWriter;
33  class IRootAuxDynReader;
34  class IFactoryTool;
35 }
36 
37 
38 /*
39  * POOL namespace declaration
40  */
41 namespace pool {
42 
43  // Forward declaration
44  class DbColumn;
45  class RootDatabase;
46 
60  {
61  protected:
62 
64  struct BranchDesc {
65  TClass* clazz = nullptr;
66  TBranch* branch = nullptr;
67  TLeaf* leaf = nullptr;
68  void* object = nullptr;
69  void* buffer = nullptr;
70  const DbColumn* column = nullptr;
71 
72  // ---- extra variables used for AuxDyn attributes
73  // number of rows written to this branch so far
74  size_t rows_written = 0;
75 
78  // AuxDyn writer and the reader for this branch (object type)
79  std::unique_ptr<RootAuxDynIO::IRootAuxDynWriter> auxdyn_writer;
80  std::unique_ptr<RootAuxDynIO::IRootAuxDynReader> auxdyn_reader;
81 
82 
83  BranchDesc() = default;
84  BranchDesc(TClass* cl, TBranch* b, TLeaf* l, void* o, const DbColumn* c);
85  BranchDesc(BranchDesc && other) = default;
86  BranchDesc(BranchDesc const& other) = delete;
87 
88  BranchDesc& operator=(BranchDesc const& other) = delete;
90  };
91 
93  typedef std::vector<BranchDesc> Branches;
94 
96  TTree* m_tree;
106  std::string m_branchName;
112  bool m_isDirty;
113 
115  std::unique_ptr<RootAuxDynIO::IFactoryTool> m_auxDynTool;
116 
117  private:
118 
121  BranchDesc& dsc,
122  const std::string& desc);
123 
126  const DbColumn* col,
127  BranchDesc& dsc,
128  const std::string& desc,
129  int splitLevel,
130  int bufferSize,
131  int branchOffsetTabLen);
132 
134  DbStatus selectRow( const DataCallBack* call,
135  const Token::OID_t& linkH,
137 
138  // Routine needed for TRANSACT_FLUSH, if branch is specified by user.
140 
142  TBranch* branch(const std::string& nam) const;
143 
145  void setBranchOffsetTabLen(TBranch* b, int offsettab_len);
146 
147  public:
150 
153 
155  virtual DbStatus close() override;
156 
158  virtual DbStatus open(DbDatabase& dbH,
159  const std::string& nam,
160  const DbTypeInfo* info,
161  DbAccessMode mod) override;
162 
165  const std::string& nam) const override final;
166 
168 
172  virtual DbStatus getOption(DbOption& opt) override;
173 
175 
179  virtual DbStatus setOption(const DbOption& opt) override;
180 
182  virtual DbStatus isShapeSupported(const DbTypeInfo* typ) const override;
183 
185  virtual DbStatus select(DbSelect& criteria) override;
186 
188  virtual uint64_t size() override;
189 
191  TTree* getTTree() { return m_tree; }
192 
194  const std::string& getName() const { return m_name; }
195 
197  bool isBranchContainer() const { return !m_branchName.empty(); }
198 
200  void setTreeFillMode(bool mode);
201 
203  bool usingTreeFillMode() const { return m_treeFillMode; }
204 
206  bool isDirty() const { return m_isDirty; }
207 
209  void clearDirty() { m_isDirty = false; }
210 
212  virtual DbStatus fetch(DbSelect& sel) override;
213 
215  virtual DbStatus fetch(const Token::OID_t& linkH, Token::OID_t& stmt) override;
216 
218 
224  virtual DbStatus loadObject( void** ptr, ShapeH shape,
225  Token::OID_t& oid) override;
226 
228  virtual DbStatus writeObject(ActionList::value_type&) override;
229 
232  };
233 }
234 #endif //POOL_ROOTTREECONTAINER_H
grepfile.info
info
Definition: grepfile.py:38
pool::RootTreeContainer::setBranchOffsetTabLen
void setBranchOffsetTabLen(TBranch *b, int offsettab_len)
Recursively set Offset Table length for a branch and it's subbranches.
pool::DbAccessMode
int DbAccessMode
Definition: Database/APR/StorageSvc/StorageSvc/pool.h:47
pool::RootTreeContainer::BranchDesc::auxdyn_reader
std::unique_ptr< RootAuxDynIO::IRootAuxDynReader > auxdyn_reader
Definition: RootTreeContainer.h:80
createCoolChannelIdFile.stmt
stmt
Definition: createCoolChannelIdFile.py:42
pool::RootTreeContainer::BranchDesc::branch
TBranch * branch
Definition: RootTreeContainer.h:66
pool::RootTreeContainer::BranchDesc::BranchDesc
BranchDesc(TClass *cl, TBranch *b, TLeaf *l, void *o, const DbColumn *c)
pool::DbStatus
Definition: DbStatus.h:67
pool::RootTreeContainer::m_branches
Branches m_branches
Branch map.
Definition: RootTreeContainer.h:100
pool::RootTreeContainer::m_treeFillMode
bool m_treeFillMode
if True, branch container will not use Branch->Fill() but will be filled with its Tree by the databas...
Definition: RootTreeContainer.h:110
make_coralServer_rep.opt
opt
Definition: make_coralServer_rep.py:19
pool::RootTreeContainer::close
virtual DbStatus close() override
Close the container and deallocate resources.
pool::RootTreeContainer::m_branchName
std::string m_branchName
Branch name, if branch is specified by user.
Definition: RootTreeContainer.h:106
pool::RootTreeContainer::getTTree
TTree * getTTree()
return the TTree in which this container is stored
Definition: RootTreeContainer.h:191
pool::RootTreeContainer::addBranch
DbStatus addBranch(const DbColumn *col, BranchDesc &dsc, const std::string &desc)
Add item branch.
pool::RootTreeContainer::checkAccess
virtual DbStatus checkAccess(DbDatabase &dbH, const std::string &nam) const override final
Check if we can access the container for reading with the given type.
pool::RootTreeContainer::BranchDesc::column
const DbColumn * column
Definition: RootTreeContainer.h:70
pool::RootTreeContainer::selectRow
DbStatus selectRow(const DataCallBack *call, const Token::OID_t &linkH, DbAccessMode mode)
Find entry identified by his number (=primary key) in the Database.
pool
pool namespace
Definition: libname.h:15
pool::RootTreeContainer::getName
const std::string & getName() const
return the name of the container
Definition: RootTreeContainer.h:194
UploadAMITag.l
list l
Definition: UploadAMITag.larcaf.py:158
pool::RootTreeContainer::RootTreeContainer
RootTreeContainer()
Standard constructor.
pool::DbContainerImp::m_name
std::string m_name
Container name.
Definition: DbContainerImp.h:76
pool::RootTreeContainer::usingTreeFillMode
bool usingTreeFillMode() const
return true if this branch container is using TTree Filling mode
Definition: RootTreeContainer.h:203
pool::RootTreeContainer::BranchDesc::rows_written
size_t rows_written
Definition: RootTreeContainer.h:74
dbg::ptr
void * ptr(T *p)
Definition: SGImplSvc.cxx:74
pool::RootTreeContainer::m_auxDynTool
std::unique_ptr< RootAuxDynIO::IFactoryTool > m_auxDynTool
Factory object from AuxDynIO plugin that creates AuxDyn readers and writers.
Definition: RootTreeContainer.h:115
pool::RootTreeContainer::~RootTreeContainer
virtual ~RootTreeContainer()
Standard destructor.
DbDatabase.h
pool::RootTreeContainer::BranchDesc::operator=
BranchDesc & operator=(BranchDesc &&other)=default
pool::RootTreeContainer::m_tree
TTree * m_tree
Reference to the root tree object.
Definition: RootTreeContainer.h:96
Token::OID_t
Definition: Token.h:24
pool::RootTreeContainer::m_ioBytes
int m_ioBytes
Number of bytes written/read during last operation. Set to -1 if it failed.
Definition: RootTreeContainer.h:108
pool::RootTreeContainer::finishTransAct
DbStatus finishTransAct()
pool::ShapeH
const class Shape * ShapeH
Definition: DbContainerObj.h:27
EFTrackingXrtAlgorithmConfig.bufferSize
bufferSize
Definition: EFTrackingXrtAlgorithmConfig.py:73
pool::RootTreeContainer::getOption
virtual DbStatus getOption(DbOption &opt) override
Access options.
python.trfUtils.call
def call(args, bufsize=0, executable=None, stdin=None, preexec_fn=None, close_fds=False, shell=False, cwd=None, env=None, universal_newlines=False, startupinfo=None, creationflags=0, message="", logger=msg, loglevel=None, timeout=None, retry=2, timefactor=1.5, sleeptime=10)
Definition: trfUtils.py:155
CaloCondBlobAlgs_fillNoiseFromASCII.desc
desc
Definition: CaloCondBlobAlgs_fillNoiseFromASCII.py:54
pool::RootTreeContainer::BranchDesc::BranchDesc
BranchDesc(BranchDesc &&other)=default
pool::RootTreeContainer::BranchDesc::auxdyn_writer
std::unique_ptr< RootAuxDynIO::IRootAuxDynWriter > auxdyn_writer
Definition: RootTreeContainer.h:79
pool::RootTreeContainer::BranchDesc
Definiton of a branch descriptor.
Definition: RootTreeContainer.h:64
maskDeadModules.mod
mod
Definition: maskDeadModules.py:36
pool::RootTreeContainer::branch
TBranch * branch(const std::string &nam) const
Access branch by name.
pool::DbOption
Definition: DbOption.h:36
sel
sel
Definition: SUSYToolsTester.cxx:97
pool::RootTreeContainer::open
virtual DbStatus open(DbDatabase &dbH, const std::string &nam, const DbTypeInfo *info, DbAccessMode mod) override
Open the container for object access.
pool::DbSelect
Definition: DbSelect.h:44
pool::RootTreeContainer::isBranchContainer
bool isBranchContainer() const
is this a container in a TBranch? (regular ones take the whole TTree)
Definition: RootTreeContainer.h:197
pool::RootTreeContainer::m_type
const DbTypeInfo * m_type
reference to exact type description
Definition: RootTreeContainer.h:98
pool::RootTreeContainer::m_rootDb
RootDatabase * m_rootDb
Root database file reference.
Definition: RootTreeContainer.h:104
pool::RootTreeContainer::Branches
std::vector< BranchDesc > Branches
Definition of the branch container.
Definition: RootTreeContainer.h:93
xAOD::uint64_t
uint64_t
Definition: EventInfo_v1.cxx:123
Preparation.mode
mode
Definition: Preparation.py:107
pool::RootTreeContainer
Definition: RootTreeContainer.h:60
pool::RootTreeContainer::transAct
virtual DbStatus transAct(Transaction::Action action) override
Execute Transaction action.
pool::RootTreeContainer::fetch
virtual DbStatus fetch(DbSelect &sel) override
Fetch next object address of the selection to set token.
pool::RootTreeContainer::isShapeSupported
virtual DbStatus isShapeSupported(const DbTypeInfo *typ) const override
Ask if a given shape is supported.
pool::RootTreeContainer::BranchDesc::aux_iostore_IFoffset
int aux_iostore_IFoffset
IOStore interface offset for object type in this branch (for casting)
Definition: RootTreeContainer.h:77
pool::RootTreeContainer::m_dbH
DbDatabase m_dbH
Parent Database handle.
Definition: RootTreeContainer.h:102
plotBeamSpotMon.b
b
Definition: plotBeamSpotMon.py:77
pool::Transaction::Action
Action
Definition: Transaction.h:34
pool::RootTreeContainer::writeObject
virtual DbStatus writeObject(ActionList::value_type &) override
Commit single entry to container.
query_example.col
col
Definition: query_example.py:7
RootAuxDynIO
Specialization of RootAuxDynStore for reading Aux Dynamic attributes from RNTuple.
Definition: RNTupleContainer.h:28
pool::DbColumn
Definition: DbColumn.h:35
pool::RootTreeContainer::select
virtual DbStatus select(DbSelect &criteria) override
Define selection criteria.
pool::RootTreeContainer::BranchDesc::buffer
void * buffer
Definition: RootTreeContainer.h:69
InDetDD::other
@ other
Definition: InDetDD_Defs.h:16
pool::RootDatabase
Definition: RootDatabase.h:59
pool::RootTreeContainer::BranchDesc::leaf
TLeaf * leaf
Definition: RootTreeContainer.h:67
python.CaloScaleNoiseConfig.action
action
Definition: CaloScaleNoiseConfig.py:77
DbContainerImp.h
pool::RootTreeContainer::m_isDirty
bool m_isDirty
flag set when a branch container was updated (but the branch was not Filled)
Definition: RootTreeContainer.h:112
pool::RootTreeContainer::size
virtual uint64_t size() override
Number of entries within the container.
pool::RootTreeContainer::loadObject
virtual DbStatus loadObject(void **ptr, ShapeH shape, Token::OID_t &oid) override
Find object by object identifier and load it into memory.
pool::RootTreeContainer::BranchDesc::operator=
BranchDesc & operator=(BranchDesc const &other)=delete
pool::RootTreeContainer::isDirty
bool isDirty() const
return true if this branch container was updated and it's TTree needs to be Filled
Definition: RootTreeContainer.h:206
pool::RootTreeContainer::BranchDesc::BranchDesc
BranchDesc()=default
pool::RootTreeContainer::clearDirty
void clearDirty()
clear the dirty status (used after containing TTree was Filled)
Definition: RootTreeContainer.h:209
pool::RootTreeContainer::BranchDesc::BranchDesc
BranchDesc(BranchDesc const &other)=delete
pool::RootTreeContainer::BranchDesc::clazz
TClass * clazz
Definition: RootTreeContainer.h:65
pool::DbContainerImp
Definition: DbContainerImp.h:44
pool::DbDatabase
Definition: DbDatabase.h:53
pool::RootTreeContainer::fetch
virtual DbStatus fetch(const Token::OID_t &linkH, Token::OID_t &stmt) override
Fetch refined object address. Default implementation returns identity.
python.compressB64.c
def c
Definition: compressB64.py:93
dq_make_web_display.cl
cl
print [x.__class__ for x in toList(dqregion.getSubRegions()) ]
Definition: dq_make_web_display.py:26
pool::RootTreeContainer::addObject
DbStatus addObject(DbDatabase &dbH, const DbColumn *col, BranchDesc &dsc, const std::string &desc, int splitLevel, int bufferSize, int branchOffsetTabLen)
Add BLOB.
pool::DbTypeInfo
Definition: DbTypeInfo.h:47
pool::RootTreeContainer::setOption
virtual DbStatus setOption(const DbOption &opt) override
Set options.
pool::RootTreeContainer::setTreeFillMode
void setTreeFillMode(bool mode)
set Tree Filling mode (true/false) for branch containers