ATLAS Offline Software
Loading...
Searching...
No Matches
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
13
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
25class TTree;
26class TClass;
27
28
29namespace D3PD {
30
31
32// Helper for clearing tuple variables.
33namespace Root {
34class Cleartable;
35}
36class FakeProxy;
37
38
51 : public ID3PD
52{
53public:
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
188 StatusCode attachPoolFile();
189
190
191private:
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
Abstract interface for a D3PD tree.
Proxy class for storing any kind of object.
Definition FakeProxy.h:33
Define an abstract interface for building a D3PD tree.
Definition ID3PD.h:37
unsigned int Dim_t
Currently unimplemented — see design note.
Definition ID3PD.h:52
int m_entryOffsetLen
Specified entry offset buffer length.
Definition RootD3PD.h:214
TTree * m_tree
The underlying root tree.
Definition RootD3PD.h:205
bool isAllowed(const std::string &name)
Decide if a given variable name is allowed.
Definition RootD3PD.cxx:815
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
std::vector< std::string > m_vetoedNames
List of names/regular expressions not allowed to be put into the output tree.
Definition RootD3PD.h:225
std::map< std::string, FakeProxy * > m_fakeVars
"Fake" variables, only kept in memory
Definition RootD3PD.h:228
RootD3PD & operator=(const RootD3PD &)=delete
int m_basketSize
Specified basket size.
Definition RootD3PD.h:211
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
std::string m_poolFile
If set, the name of a pool data file to which we should attach ourself.
Definition RootD3PD.h:231
std::vector< std::string > m_allowedNames
List of names/regular expressions allowed to be put into the output tree.
Definition RootD3PD.h:221
const TTree * tree() const
Return the underlying root tree.
Definition RootD3PD.cxx:676
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
RootD3PD(const RootD3PD &)=delete
virtual StatusCode capture() override
Capture the current state of all variables and write to the tuple.
Definition RootD3PD.cxx:621
Root::Cleartable * m_cleartable
Helper to clear variables.
Definition RootD3PD.h:217
std::string m_master
The name of the master tree.
Definition RootD3PD.h:208
StatusCode attachPoolFile()
Try to attach to a pool file, if we haven't yet done so.
Definition RootD3PD.cxx:635
virtual StatusCode clear() override
Clear all the tuple variables.
Definition RootD3PD.cxx:659
TClass * getClass(const std::type_info &ti)
Try to convert from a std::type_info to a TClass.
Definition RootD3PD.cxx:788
~RootD3PD()
Destructor.
Definition RootD3PD.cxx:460
const std::string & master() const
Return the name of the master tree.
Definition RootD3PD.cxx:690
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
void setPoolFile(const std::string &poolFile)
Set the name of a pool file to which we should attach.
Definition RootD3PD.cxx:885
StatusCode addFakeVariable(const std::string &name, const std::type_info &ti, void *&ptr)
Create a variable in memory only.
Definition RootD3PD.cxx:838
virtual StatusCode redim(const Dim_t *ptr) override
Currently unimplemented — see design note.
Definition RootD3PD.cxx:667
Table giving information on how to clear all variables in a tree.
Definition RootD3PD.cxx:356
Block filler tool for noisy FEB information.