ATLAS Offline Software
Loading...
Searching...
No Matches
VectorFillerToolBase.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-2017 CERN for the benefit of the ATLAS collaboration
5*/
6
7// $Id$
14
15
16#ifndef D3PDMAKERUTILS_VECTORFILLERTOOLBASE_H
17#define D3PDMAKERUTILS_VECTORFILLERTOOLBASE_H
18
19
20#include "ObjectMetadata.h"
24#include "GaudiKernel/ToolHandle.h"
25#include <vector>
26#include <list>
27#include <string>
28#include <typeinfo>
29class TVirtualCollectionProxy;
30
31
32namespace D3PD {
33
34
35class IIteration;
36
37
78 : public AthAlgTool,
79 public IAddVariable
80{
81public:
88 VectorFillerToolBase (const std::string& type,
89 const std::string& name,
90 const IInterface* parent);
91
92
94 virtual StatusCode initialize();
95
96
98 virtual StatusCode finalize();
99
100
117 virtual StatusCode addVariable (const std::string& name,
118 const std::type_info& ti,
119 void* & ptr,
120 const std::string& docstring = "",
121 const void* defval = 0);
122
123
140 virtual StatusCode
141 addDimensionedVariable (const std::string& name,
142 const std::type_info& ti,
143 void* & ptr,
144 const std::string& dim,
145 const std::string& docstring = "",
146 const void* defval = 0);
147
148
149protected:
157 StatusCode doConfigure (IAddVariable* tree, IIteration& it);
158
159
165 StatusCode doBook();
166
167
176 StatusCode doFill (IIteration& it, size_t sizeHint);
177
178
181
182
184 std::string m_prefix;
185
186
187private:
189 ToolHandleArray<IBlockFillerTool> m_blockFillers;
190
193 std::string m_nrowName;
194
197 std::string m_nobjName;
198
201 std::string m_objIndexName;
202
205
207 int* m_nrow;
208
210 int* m_nobj;
211
214
215
227 class Var
228 {
229 public:
243 Var (const std::string& name,
244 const std::type_info& ti,
245 void* & ptr,
246 const std::string& dim,
247 char* defval,
248 size_t defsize);
249
250
256 StatusCode init (IAddVariable* tree,
257 const std::string& prefix);
258
259
265 void resize (size_t sz, size_t pos);
266
267
271 void next();
272
273
279 void free();
280
281
282 private:
284 std::string m_name;
285
287 const std::type_info* m_ti;
288
290 char** m_addr;
291
293 std::string m_docstring;
294
296 TVirtualCollectionProxy* m_proxy;
297
299 size_t m_valdiff;
300
303
307
311 size_t m_defsize;
312 };
313
314
324 struct Vars
325 : public std::list<Var>
326 {
328 ~Vars();
329
330
336 void resize_all (size_t sz, size_t pos = 0);
337
338
342 void next_all ();
343 };
344
347
348
354 void maybeExtend (size_t& n, size_t& sz);
355
356
376 StatusCode fillOnce (const void* obj,
377 size_t objndx,
378 size_t& n,
379 size_t& sz,
380 const std::vector<unsigned long>& codes_in,
381 std::vector<unsigned long>& codes_out);
382};
383
384
385} // namespace D3PD
386
387
388#endif // not D3PDMAKERUTILS_VECTORFILLERTOOLBASE_H
Common interface for adding a variable to a tuple.
Abstract interface for tool to fill a block in the D3PD.
static Double_t sz
AthAlgTool(const std::string &type, const std::string &name, const IInterface *parent)
Constructor with parameters:
Common interface for adding a variable to a tuple.
Abstract interface for iterating over a set of things.
Definition IIteration.h:41
D3PD variable metadata handling class.
std::string m_docstring
Documentation string.
void resize(size_t sz, size_t pos)
Resize the vector.
std::string m_name
The variable name.
Var(const std::string &name, const std::type_info &ti, void *&ptr, const std::string &dim, char *defval, size_t defsize)
Constructor.
TVirtualCollectionProxy * m_proxy
The root collection proxy.
char * m_default
Pointer to the default value for this variable, if one has been requested.
StatusCode init(IAddVariable *tree, const std::string &prefix)
Initialize the variable.
size_t m_valdiff
Offset between collection elements.
void free()
Free allocated storage.
void next()
Move the variable pointer to the next element.
const std::type_info * m_ti
The type of the variable element (for each object).
char ** m_addr
Pointer to the variable pointer.
size_t m_defsize
Size of the object pointed to by m_default.
void * m_contptr
Pointer to the vector instance.
void maybeExtend(size_t &n, size_t &sz)
Extend vectors if needed.
IAddVariable * m_tree
The parent tree.
StatusCode doFill(IIteration &it, size_t sizeHint)
Fill objects from an IIteration.
Vars m_vars
All booked variables.
int * m_objIndex
Variable for the object index.
StatusCode doBook()
Declare tuple variables.
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)
Add a variable to the tuple.
StatusCode doConfigure(IAddVariable *tree, IIteration &it)
Configure the tool.
std::string m_nrowName
Property: Name of the variable for the count of rows.
int * m_nobj
Variable for the object count.
ObjectMetadata m_metadata
Metadata about the variables created by this tool.
virtual StatusCode addVariable(const std::string &name, const std::type_info &ti, void *&ptr, const std::string &docstring="", const void *defval=0)
Add a variable to the tuple.
ToolHandleArray< IBlockFillerTool > m_blockFillers
Property: The list of block filler tools.
virtual StatusCode initialize()
Standard Gaudi initialize method.
std::string m_prefix
Property: Variable prefix for this block.
StatusCode fillOnce(const void *obj, size_t objndx, size_t &n, size_t &sz, const std::vector< unsigned long > &codes_in, std::vector< unsigned long > &codes_out)
Make one loop over block filler tools.
virtual StatusCode finalize()
Standard Gaudi finalize method.
std::string m_objIndexName
Property: Name of the variable for the object index.
VectorFillerToolBase(const std::string &type, const std::string &name, const IInterface *parent)
Standard Gaudi tool constructor.
std::string m_nobjName
Property: Name of the variable for the count of objects.
int * m_nrow
Variable for the row count.
Block filler tool for noisy FEB information.
Description for the list of variables.
void next_all()
Move all variable pointers to the next element.
void resize_all(size_t sz, size_t pos=0)
Resize all vector.
TChain * tree