ATLAS Offline Software
RootD3PD.h
Go to the documentation of this file.
1 // This file's extension implies that it's C, but it's really -*- C++ -*-.
2 
3 /*
4  Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
5 */
6 
14 #ifndef D3PDMAKERROOT_ROOTD3PD_H
15 #define D3PDMAKERROOT_ROOTD3PD_H
16 
17 
18 // STL include(s):
19 #include <vector>
20 #include <string>
21 #include <map>
22 
23 
25 class TTree;
26 class TClass;
27 
28 
29 namespace D3PD {
30 
31 
32 // Helper for clearing tuple variables.
33 namespace Root {
34 class Cleartable;
35 }
36 class FakeProxy;
37 
38 
50 class RootD3PD
51  : public ID3PD
52 {
53 public:
64  RootD3PD (TTree* tree,
65  const std::string& master,
66  const std::vector< std::string >& allowedNames =
67  std::vector< std::string >(),
68  const std::vector< std::string >& vetoedNames =
69  std::vector< std::string >(),
70  int basketSize = -1,
71  int entryOffsetLen = -1);
72 
73 
75  ~RootD3PD();
76 
77 
92  virtual StatusCode addVariable (const std::string& name,
93  const std::type_info& ti,
94  void* & ptr,
95  const std::string& docstring = "",
96  const void* defval = 0) override;
97 
98 
115  virtual StatusCode
116  addDimensionedVariable (const std::string& name,
117  const std::type_info& ti,
118  void* & ptr,
119  const std::string& dim,
120  const std::string& docstring = "",
121  const void* defval = 0) override;
122 
123 
127  virtual StatusCode capture () override;
128 
129 
133  virtual StatusCode clear () override;
134 
135 
137  virtual StatusCode redim (const Dim_t* ptr) override;
138 
139 
143  const TTree* tree() const;
144  TTree* tree();
145 
146 
150  const std::string& master() const;
151 
152 
166  virtual StatusCode addMetadata (const std::string& key,
167  const void* obj,
168  const std::type_info& ti) override;
169 
170 
182  void setPoolFile (const std::string& poolFile);
183 
184 
189 
190 
191 private:
194  TClass* getClass (const std::type_info& ti);
195 
197  bool isAllowed (const std::string& name);
198 
200  StatusCode addFakeVariable (const std::string& name,
201  const std::type_info& ti,
202  void*& ptr);
203 
205  TTree* m_tree;
206 
208  std::string m_master;
209 
212 
215 
218 
221  std::vector< std::string > m_allowedNames;
222 
225  std::vector< std::string > m_vetoedNames;
226 
228  std::map< std::string, FakeProxy* > m_fakeVars;
229 
231  std::string m_poolFile;
232 
233  // Disallow copying.
234  RootD3PD (const RootD3PD&) = delete;
235  RootD3PD& operator= (const RootD3PD&) = delete;
236 };
237 
238 
239 } // namespace D3PD
240 
241 
242 #endif // not D3PDMAKERROOT_ROOTD3PD_H
D3PD::RootD3PD::m_vetoedNames
std::vector< std::string > m_vetoedNames
List of names/regular expressions not allowed to be put into the output tree.
Definition: RootD3PD.h:225
D3PD::RootD3PD::m_cleartable
Root::Cleartable * m_cleartable
Helper to clear variables.
Definition: RootD3PD.h:217
yodamerge_tmp.dim
dim
Definition: yodamerge_tmp.py:239
D3PD::RootD3PD::m_basketSize
int m_basketSize
Specified basket size.
Definition: RootD3PD.h:211
Root
Definition: GoodRunsListSelectorTool.h:30
D3PD::RootD3PD::tree
const TTree * tree() const
Return the underlying root tree.
Definition: RootD3PD.cxx:676
D3PD::RootD3PD::m_tree
TTree * m_tree
The underlying root tree.
Definition: RootD3PD.h:205
D3PD::RootD3PD::clear
virtual StatusCode clear() override
Clear all the tuple variables.
Definition: RootD3PD.cxx:659
D3PD::ID3PD
Define an abstract interface for building a D3PD tree.
Definition: ID3PD.h:37
D3PD::RootD3PD::getClass
TClass * getClass(const std::type_info &ti)
Try to convert from a std::type_info to a TClass.
Definition: RootD3PD.cxx:788
D3PD::RootD3PD
Root-based D3PD tree.
Definition: RootD3PD.h:52
D3PD::RootD3PD::addMetadata
virtual StatusCode addMetadata(const std::string &key, const void *obj, const std::type_info &ti) override
Add a new piece of metadata to the tuple.
Definition: RootD3PD.cxx:709
D3PD::RootD3PD::RootD3PD
RootD3PD(const RootD3PD &)=delete
D3PD::RootD3PD::setPoolFile
void setPoolFile(const std::string &poolFile)
Set the name of a pool file to which we should attach.
Definition: RootD3PD.cxx:885
D3PD::RootD3PD::operator=
RootD3PD & operator=(const RootD3PD &)=delete
master
Definition: master.py:1
dbg::ptr
void * ptr(T *p)
Definition: SGImplSvc.cxx:74
D3PD::RootD3PD::addVariable
virtual StatusCode addVariable(const std::string &name, const std::type_info &ti, void *&ptr, const std::string &docstring="", const void *defval=0) override
Add a variable to the tuple.
Definition: RootD3PD.cxx:485
D3PD::RootD3PD::m_master
std::string m_master
The name of the master tree.
Definition: RootD3PD.h:208
D3PD
Block filler tool for noisy FEB information.
Definition: CaloCellDetailsFillerTool.cxx:29
D3PD::RootD3PD::m_poolFile
std::string m_poolFile
If set, the name of a pool data file to which we should attach ourself.
Definition: RootD3PD.h:231
D3PD::RootD3PD::isAllowed
bool isAllowed(const std::string &name)
Decide if a given variable name is allowed.
Definition: RootD3PD.cxx:815
D3PD::RootD3PD::addDimensionedVariable
virtual StatusCode addDimensionedVariable(const std::string &name, const std::type_info &ti, void *&ptr, const std::string &dim, const std::string &docstring="", const void *defval=0) override
Add a variable to the tuple.
Definition: RootD3PD.cxx:605
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
D3PD::Root::Cleartable
Table giving information on how to clear all variables in a tree.
Definition: RootD3PD.cxx:362
D3PD::RootD3PD::m_entryOffsetLen
int m_entryOffsetLen
Specified entry offset buffer length.
Definition: RootD3PD.h:214
D3PD::RootD3PD::master
const std::string & master() const
Return the name of the master tree.
Definition: RootD3PD.cxx:690
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
D3PD::RootD3PD::attachPoolFile
StatusCode attachPoolFile()
Try to attach to a pool file, if we haven't yet done so.
Definition: RootD3PD.cxx:635
D3PD::RootD3PD::m_fakeVars
std::map< std::string, FakeProxy * > m_fakeVars
"Fake" variables, only kept in memory
Definition: RootD3PD.h:228
D3PD::ID3PD::Dim_t
unsigned int Dim_t
Currently unimplemented — see design note.
Definition: ID3PD.h:52
D3PD::RootD3PD::RootD3PD
RootD3PD(TTree *tree, const std::string &master, const std::vector< std::string > &allowedNames=std::vector< std::string >(), const std::vector< std::string > &vetoedNames=std::vector< std::string >(), int basketSize=-1, int entryOffsetLen=-1)
Constructor.
Definition: RootD3PD.cxx:439
ID3PD.h
Abstract interface for a D3PD tree.
skel.poolFile
poolFile
Definition: skel.ABtoEVGEN.py:344
python.PyAthena.obj
obj
Definition: PyAthena.py:132
D3PD::RootD3PD::addFakeVariable
StatusCode addFakeVariable(const std::string &name, const std::type_info &ti, void *&ptr)
Create a variable in memory only.
Definition: RootD3PD.cxx:838
D3PD::RootD3PD::capture
virtual StatusCode capture() override
Capture the current state of all variables and write to the tuple.
Definition: RootD3PD.cxx:621
D3PD::RootD3PD::redim
virtual StatusCode redim(const Dim_t *ptr) override
Currently unimplemented — see design note.
Definition: RootD3PD.cxx:667
D3PD::RootD3PD::m_allowedNames
std::vector< std::string > m_allowedNames
List of names/regular expressions allowed to be put into the output tree.
Definition: RootD3PD.h:221
mapkey::key
key
Definition: TElectronEfficiencyCorrectionTool.cxx:37
D3PD::RootD3PD::~RootD3PD
~RootD3PD()
Destructor.
Definition: RootD3PD.cxx:460