16#include "GaudiKernel/System.h"
20#include "TVirtualCollectionProxy.h"
44 for (
Var& v : *
this) {
57 const std::string& name,
58 const IInterface* parent)
69 "List of contained block filler tools.");
71 "Variable name prefix for the contained blocks.");
73 "Name of the variable for the count of rows. "
76 "Name of the variable for the count of objects. "
79 "Name of the variable for the object index. "
90 CHECK( AthAlgTool::initialize() );
92 return StatusCode::SUCCESS;
103 return StatusCode::SUCCESS;
117 "Number of ntuple rows.") );
119 "Number of ntuple rows.") );
123 "Number of objects.") );
125 "Number of objects.") );
129 "Index of this object.") );
135 return StatusCode::SUCCESS;
152 const std::type_info& ti = it.elementTypeinfo();
158 return StatusCode::SUCCESS;
170 sz = std::max(
static_cast<size_t>(16), 2*
sz);
200 const std::vector<unsigned long>& codes_in,
201 std::vector<unsigned long>& codes_out)
209 bool all_empty =
true;
214 codes_out[j] = scode.getCode();
232 return StatusCode::SUCCESS;
247 m_vars.resize_all (sizeHint);
250 size_t sz = sizeHint;
252 std::vector<unsigned long> codes_in;
253 std::vector<unsigned long> codes_out;
258 while (
const void* obj = it.nextUntyped() ) {
261 codes_in.resize (
m_blockFillers.size(), StatusCode(StatusCode::SUCCESS).getCode());
263 codes_in = codes_out;
264 while (std::find (codes_out.begin(), codes_out.end(),
273 it.releaseElementUntyped (obj);
287 return StatusCode::SUCCESS;
307 const std::type_info& ti,
309 const std::string& docstring ,
315 return StatusCode::SUCCESS;
322 EDataType dt = TDataType::GetType (ti);
345 <<
"Requested a default value for variable " << name
346 <<
" of type " << System::typeinfoName (ti)
347 <<
"; but default values are only supported for basic types.";
348 return StatusCode::FAILURE;
351 TDataType* tdt = gROOT->GetType (TDataType::GetTypeName (dt));
353 defsize = tdt->Size();
354 defcopied =
new char[defsize];
355 std::memcpy (defcopied, defval, defsize);
358 m_vars.push_back (
Var (name, ti, ptr, docstring, defcopied, defsize));
362 return StatusCode::SUCCESS;
384 const std::type_info& ,
390 REPORT_MESSAGE(MSG::ERROR) <<
"addDimensionedVariable not yet implemented.";
391 return StatusCode::FAILURE;
409 const std::type_info& ti,
411 const std::string& docstring,
416 m_addr (reinterpret_cast<char**> (&ptr)),
433 const std::string& prefix)
439 if (eltname ==
"bool")
443 std::string vname =
"std::vector<" + eltname;
444 if (vname[vname.size()-1] ==
'>')
449 TClass* cls = TClass::GetClass (vname.c_str());
455 return StatusCode::FAILURE;
457 m_proxy = cls->GetCollectionProxy();
460 REPORT_MESSAGE(MSG::ERROR) <<
"Can't find root collection proxy for type "
464 return StatusCode::FAILURE;
467 if (!
m_proxy->GetCollectionClass() ||
468 !
m_proxy->GetCollectionClass()->GetTypeInfo())
470 REPORT_MESSAGE(MSG::ERROR) <<
"Dictionary error for collection class "
474 return StatusCode::FAILURE;
483 *
m_proxy->GetCollectionClass()->GetTypeInfo(),
498 size_t oldsz =
m_proxy->Size();
505 char* begin =
static_cast<char*
> (
m_proxy->At(0));
525 for (
char* p = begin + oldsz *
m_valdiff;
552 for (
Var& v : *
this) {
565 for (
Var& v : *
this) {
Helpers for checking error return status codes and reporting errors.
#define REPORT_MESSAGE(LVL)
Report a message.
#define CHECK(...)
Evaluate an expression and check for errors.
Abstract interface for iterating over a set of things.
Utility functions for converting between type names, type_info, and CLIDs.
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
Common interface for adding a variable to a tuple.
StatusCode addVariable(const std::string &name, T *&ptr, const std::string &docstring="")
Add a variable to the tuple.
Abstract interface for iterating over a set of things.
Block filler tool for noisy FEB information.
std::string typeinfoToName(const std::type_info &ti)
Convert from a type_info to a name.