ATLAS Offline Software
Classes | Public Member Functions | Protected Member Functions | Protected Attributes | Private Types | Private Member Functions | Private Attributes | List of all members
D3PD::VectorFillerToolBase Class Reference

Common code for wrapping filled variables up into a vector. More...

#include <VectorFillerToolBase.h>

Inheritance diagram for D3PD::VectorFillerToolBase:
Collaboration diagram for D3PD::VectorFillerToolBase:

Classes

class  Var
 Description for a single variable. More...
 
struct  Vars
 Description for the list of variables. More...
 

Public Member Functions

 VectorFillerToolBase (const std::string &type, const std::string &name, const IInterface *parent)
 Standard Gaudi tool constructor. More...
 
virtual StatusCode initialize ()
 Standard Gaudi initialize method. More...
 
virtual StatusCode finalize ()
 Standard Gaudi finalize method. More...
 
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. More...
 
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. More...
 
ServiceHandle< StoreGateSvc > & evtStore ()
 The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc. More...
 
const ServiceHandle< StoreGateSvc > & evtStore () const
 The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc. More...
 
const ServiceHandle< StoreGateSvc > & detStore () const
 The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc. More...
 
virtual StatusCode sysInitialize () override
 Perform system initialization for an algorithm. More...
 
virtual StatusCode sysStart () override
 Handle START transition. More...
 
virtual std::vector< Gaudi::DataHandle * > inputHandles () const override
 Return this algorithm's input handles. More...
 
virtual std::vector< Gaudi::DataHandle * > outputHandles () const override
 Return this algorithm's output handles. More...
 
Gaudi::Details::PropertyBase & declareProperty (Gaudi::Property< T > &t)
 
Gaudi::Details::PropertyBase * declareProperty (const std::string &name, SG::VarHandleKey &hndl, const std::string &doc, const SG::VarHandleKeyType &)
 Declare a new Gaudi property. More...
 
Gaudi::Details::PropertyBase * declareProperty (const std::string &name, SG::VarHandleBase &hndl, const std::string &doc, const SG::VarHandleType &)
 Declare a new Gaudi property. More...
 
Gaudi::Details::PropertyBase * declareProperty (const std::string &name, SG::VarHandleKeyArray &hndArr, const std::string &doc, const SG::VarHandleKeyArrayType &)
 
Gaudi::Details::PropertyBase * declareProperty (const std::string &name, T &property, const std::string &doc, const SG::NotHandleType &)
 Declare a new Gaudi property. More...
 
Gaudi::Details::PropertyBase * declareProperty (const std::string &name, T &property, const std::string &doc="none")
 Declare a new Gaudi property. More...
 
void updateVHKA (Gaudi::Details::PropertyBase &)
 
MsgStream & msg () const
 
MsgStream & msg (const MSG::Level lvl) const
 
bool msgLvl (const MSG::Level lvl) const
 
template<class T >
StatusCode addVariable (const std::string &name, T *&ptr, const std::string &docstring="")
 Add a variable to the tuple. More...
 
template<class T , class U >
StatusCode addVariable (const std::string &name, T *&ptr, const std::string &docstring, const U &defval)
 Add a variable to the tuple. More...
 
template<class T >
StatusCode addDimensionedVariable (const std::string &name, T *&ptr, const std::string &dim, const std::string &docstring="")
 Add a variable to the tuple. More...
 
template<class T , class U >
StatusCode addDimensionedVariable (const std::string &name, T *&ptr, const std::string &dim, const std::string &docstring, const U &defval)
 Add a variable to the tuple. More...
 

Protected Member Functions

StatusCode doConfigure (IAddVariable *tree, IIteration &it)
 Configure the tool. More...
 
StatusCode doBook ()
 Declare tuple variables. More...
 
StatusCode doFill (IIteration &it, size_t sizeHint)
 Fill objects from an IIteration. More...
 
void renounceArray (SG::VarHandleKeyArray &handlesArray)
 remove all handles from I/O resolution More...
 
std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > renounce (T &h)
 
void extraDeps_update_handler (Gaudi::Details::PropertyBase &ExtraDeps)
 Add StoreName to extra input/output deps as needed. More...
 

Protected Attributes

ObjectMetadata m_metadata
 Metadata about the variables created by this tool. More...
 
std::string m_prefix
 Property: Variable prefix for this block. More...
 

Private Types

typedef ServiceHandle< StoreGateSvcStoreGateSvc_t
 

Private Member Functions

void maybeExtend (size_t &n, size_t &sz)
 Extend vectors if needed. More...
 
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. More...
 
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T > &hndl, const SG::VarHandleKeyType &)
 specialization for handling Gaudi::Property<SG::VarHandleKey> More...
 
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T > &hndl, const SG::VarHandleKeyArrayType &)
 specialization for handling Gaudi::Property<SG::VarHandleKeyArray> More...
 
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T > &hndl, const SG::VarHandleType &)
 specialization for handling Gaudi::Property<SG::VarHandleBase> More...
 
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T > &t, const SG::NotHandleType &)
 specialization for handling everything that's not a Gaudi::Property<SG::VarHandleKey> or a <SG::VarHandleKeyArray> More...
 

Private Attributes

ToolHandleArray< IBlockFillerToolm_blockFillers
 Property: The list of block filler tools. More...
 
std::string m_nrowName
 Property: Name of the variable for the count of rows. More...
 
std::string m_nobjName
 Property: Name of the variable for the count of objects. More...
 
std::string m_objIndexName
 Property: Name of the variable for the object index. More...
 
IAddVariablem_tree
 The parent tree. More...
 
int * m_nrow
 Variable for the row count. More...
 
int * m_nobj
 Variable for the object count. More...
 
int * m_objIndex
 Variable for the object index. More...
 
Vars m_vars
 All booked variables. More...
 
StoreGateSvc_t m_evtStore
 Pointer to StoreGate (event store by default) More...
 
StoreGateSvc_t m_detStore
 Pointer to StoreGate (detector store by default) More...
 
std::vector< SG::VarHandleKeyArray * > m_vhka
 
bool m_varHandleArraysDeclared
 

Detailed Description

Common code for wrapping filled variables up into a vector.

In several places we want to be able to run a set of block filler tools over a set of objects and wrap the results up in vectors. This is used at least in VectorFillerTool and ContainedVectorMultiAssociationFillerTool. This class factors out the common behavior involved in wrapping results up in vectors.

The actual iteration over a set of objects is expressed by the interface IIteration. The way this class is used is as follows:

This tool has the following properties:

BlockFillers - List of IBlockFillerTool instances. Prefix - Prefix to add to variable names for this block. NrowName - Name of the variable for the count of rows. Omitted if empty. Default: ‘n’. NobjName - Name of the variable for the count of objects. (May be less than the number of rows if AGAIN is used.) Omitted if empty (default). ObjIndexName - Name of the variable for the object index. Omitted if empty (default).

Definition at line 77 of file VectorFillerToolBase.h.

Member Typedef Documentation

◆ StoreGateSvc_t

typedef ServiceHandle<StoreGateSvc> AthCommonDataStore< AthCommonMsg< AlgTool > >::StoreGateSvc_t
privateinherited

Definition at line 388 of file AthCommonDataStore.h.

Constructor & Destructor Documentation

◆ VectorFillerToolBase()

D3PD::VectorFillerToolBase::VectorFillerToolBase ( const std::string &  type,
const std::string &  name,
const IInterface *  parent 
)

Standard Gaudi tool constructor.

Parameters
typeThe name of the tool type.
nameThe tool name.
parentThe tool's Gaudi parent.

Definition at line 56 of file VectorFillerToolBase.cxx.

59  : AthAlgTool (type, name, parent),
60  m_metadata (),
61  m_prefix (),
62  m_blockFillers (this),
63  m_tree (0),
64  m_nrow (0),
65  m_nobj (0),
66  m_objIndex (0)
67 {
68  declareProperty ("BlockFillers", m_blockFillers,
69  "List of contained block filler tools.");
70  declareProperty ("Prefix", m_prefix = "",
71  "Variable name prefix for the contained blocks.");
72  declareProperty ("NrowName", m_nrowName = "n",
73  "Name of the variable for the count of rows. "
74  "Omitted if empty.");
75  declareProperty ("NobjName", m_nobjName = "",
76  "Name of the variable for the count of objects. "
77  "Omitted if empty.");
78  declareProperty ("ObjIndexName", m_objIndexName = "",
79  "Name of the variable for the object index. "
80  "Omitted if empty.");
81 }

Member Function Documentation

◆ addDimensionedVariable() [1/3]

StatusCode D3PD::VectorFillerToolBase::addDimensionedVariable ( const std::string &  name,
const std::type_info &  ti,
void *&  ptr,
const std::string &  dim,
const std::string &  docstring = "",
const void *  defval = 0 
)
virtual

Add a variable to the tuple.

Parameters
nameThe name of the variable.
typeThe type of the variable.
ptrPointer to the type of the variable. The pointer need not be initialized; the D3PD software will set the pointer prior to calling fill().
dimDimension for the variable. (Presently unimplemented!)
docstringDocumentation string for this variable.
defvalPointer to the default value to use for this variable. Null for no default (generally means to fill with zeros). Of the type given by ti. Only works for basic types.

Implements D3PD::IAddVariable.

Definition at line 383 of file VectorFillerToolBase.cxx.

389 {
390  REPORT_MESSAGE(MSG::ERROR) << "addDimensionedVariable not yet implemented.";
391  return StatusCode::FAILURE;
392 }

◆ addDimensionedVariable() [2/3]

template<class T , class U >
StatusCode D3PD::IAddVariable::addDimensionedVariable ( const std::string &  name,
T *&  ptr,
const std::string &  dim,
const std::string &  docstring,
const U &  defval 
)
inherited

Add a variable to the tuple.

Parameters
nameThe name of the variable.
ptrPointer to the type of the variable. The pointer need not be initialized; the D3PD software will set the pointer prior to calling fill().
dimDimension for the variable. (Presently unimplemented!)
docstringDocumentation string for this variable.
defvalPointer to the default value to use for this variable. Only works for basic types.

If called from the constructor, the only effect is to clear ptr.

◆ addDimensionedVariable() [3/3]

template<class T >
StatusCode D3PD::IAddVariable::addDimensionedVariable ( const std::string &  name,
T *&  ptr,
const std::string &  dim,
const std::string &  docstring = "" 
)
inherited

Add a variable to the tuple.

Parameters
nameThe name of the variable.
ptrPointer to the type of the variable. The pointer need not be initialized; the D3PD software will set the pointer prior to calling fill().
dimDimension for the variable. (Presently unimplemented!)
docstringDocumentation string for this variable.

If called from the constructor, the only effect is to clear ptr.

◆ addVariable() [1/3]

StatusCode D3PD::VectorFillerToolBase::addVariable ( const std::string &  name,
const std::type_info &  ti,
void *&  ptr,
const std::string &  docstring = "",
const void *  defval = 0 
)
virtual

Add a variable to the tuple.

Parameters
nameThe name of the variable.
typeThe type of the variable.
ptrPointer to the type of the variable. The pointer need not be initialized; the D3PD software will set the pointer prior to calling fill().
docstringDocumentation string for this variable.
defvalPointer to the default value to use for this variable. Null for no default (generally means to fill with zeros). Of the type given by ti. Only works for basic types.

If called from the constructor, the only effect is to clear ptr.

Parameters
nameThe name of the variable.
typeThe type of the variable.
ptrPointer to the type of the variable. The pointer need not be initialized; the D3PD software will set the pointer prior to calling fill().
docstringDocumentation string for this variable.
defvalPointer to the default value to use for this variable. Null for no default (generally means to fill with zeros). Of the type given by ti. Only works for basic types.

Implements D3PD::IAddVariable.

Definition at line 306 of file VectorFillerToolBase.cxx.

311 {
312  if (!m_tree) {
313  // Called from constructor --- just initialize pointer.
314  ptr = 0;
315  return StatusCode::SUCCESS;
316  }
317 
318  // Default value handling.
319  size_t defsize = 0;
320  char* defcopied = 0;
321  if (defval) {
322  EDataType dt = TDataType::GetType (ti);
323  switch (dt) {
324  case kChar_t:
325  case kUChar_t:
326  case kShort_t:
327  case kUShort_t:
328  case kInt_t:
329  case kUInt_t:
330  case kLong_t:
331  case kULong_t:
332  case kFloat_t:
333  case kDouble_t:
334  case kDouble32_t:
335  case kchar:
336  case kBool_t:
337  case kLong64_t:
338  case kULong64_t:
339  case kFloat16_t:
340  // ok
341  break;
342 
343  default:
344  REPORT_MESSAGE (MSG::ERROR)
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;
349  }
350 
351  TDataType* tdt = gROOT->GetType (TDataType::GetTypeName (dt));
352  assert (tdt != 0);
353  defsize = tdt->Size();
354  defcopied = new char[defsize];
355  std::memcpy (defcopied, defval, defsize);
356  }
357 
358  m_vars.push_back (Var (name, ti, ptr, docstring, defcopied, defsize));
359  CHECK( m_vars.back().init (&m_metadata, m_prefix) );
360  CHECK( m_vars.back().init (m_tree, m_prefix) );
361 
362  return StatusCode::SUCCESS;
363 }

◆ addVariable() [2/3]

template<class T , class U >
StatusCode D3PD::IAddVariable::addVariable ( const std::string &  name,
T *&  ptr,
const std::string &  docstring,
const U &  defval 
)
inherited

Add a variable to the tuple.

Parameters
nameThe name of the variable.
ptrPointer to the type of the variable. The pointer need not be initialized; the D3PD software will set the pointer prior to calling fill().
docstringDocumentation string for this variable.
defvalPointer to the default value to use for this variable. Only works for basic types.

If called from the constructor, the only effect is to clear ptr.

◆ addVariable() [3/3]

template<class T >
StatusCode D3PD::IAddVariable::addVariable ( const std::string &  name,
T *&  ptr,
const std::string &  docstring = "" 
)
inherited

Add a variable to the tuple.

Parameters
nameThe name of the variable.
ptrPointer to the type of the variable. The pointer need not be initialized; the D3PD software will set the pointer prior to calling fill().
docstringDocumentation string for this variable.

If called from the constructor, the only effect is to clear ptr.

◆ declareGaudiProperty() [1/4]

Gaudi::Details::PropertyBase& AthCommonDataStore< AthCommonMsg< AlgTool > >::declareGaudiProperty ( Gaudi::Property< T > &  hndl,
const SG::VarHandleKeyArrayType  
)
inlineprivateinherited

specialization for handling Gaudi::Property<SG::VarHandleKeyArray>

Definition at line 170 of file AthCommonDataStore.h.

172  {
173  return *AthCommonDataStore<PBASE>::declareProperty(hndl.name(),
174  hndl.value(),
175  hndl.documentation());
176 
177  }

◆ declareGaudiProperty() [2/4]

Gaudi::Details::PropertyBase& AthCommonDataStore< AthCommonMsg< AlgTool > >::declareGaudiProperty ( Gaudi::Property< T > &  hndl,
const SG::VarHandleKeyType  
)
inlineprivateinherited

specialization for handling Gaudi::Property<SG::VarHandleKey>

Definition at line 156 of file AthCommonDataStore.h.

158  {
159  return *AthCommonDataStore<PBASE>::declareProperty(hndl.name(),
160  hndl.value(),
161  hndl.documentation());
162 
163  }

◆ declareGaudiProperty() [3/4]

Gaudi::Details::PropertyBase& AthCommonDataStore< AthCommonMsg< AlgTool > >::declareGaudiProperty ( Gaudi::Property< T > &  hndl,
const SG::VarHandleType  
)
inlineprivateinherited

specialization for handling Gaudi::Property<SG::VarHandleBase>

Definition at line 184 of file AthCommonDataStore.h.

186  {
187  return *AthCommonDataStore<PBASE>::declareProperty(hndl.name(),
188  hndl.value(),
189  hndl.documentation());
190  }

◆ declareGaudiProperty() [4/4]

Gaudi::Details::PropertyBase& AthCommonDataStore< AthCommonMsg< AlgTool > >::declareGaudiProperty ( Gaudi::Property< T > &  t,
const SG::NotHandleType  
)
inlineprivateinherited

specialization for handling everything that's not a Gaudi::Property<SG::VarHandleKey> or a <SG::VarHandleKeyArray>

Definition at line 199 of file AthCommonDataStore.h.

200  {
201  return PBASE::declareProperty(t);
202  }

◆ declareProperty() [1/6]

Gaudi::Details::PropertyBase* AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty ( const std::string &  name,
SG::VarHandleBase hndl,
const std::string &  doc,
const SG::VarHandleType  
)
inlineinherited

Declare a new Gaudi property.

Parameters
nameName of the property.
hndlObject holding the property value.
docDocumentation string for the property.

This is the version for types that derive from SG::VarHandleBase. The property value object is put on the input and output lists as appropriate; then we forward to the base class.

Definition at line 245 of file AthCommonDataStore.h.

249  {
250  this->declare(hndl.vhKey());
251  hndl.vhKey().setOwner(this);
252 
253  return PBASE::declareProperty(name,hndl,doc);
254  }

◆ declareProperty() [2/6]

Gaudi::Details::PropertyBase* AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty ( const std::string &  name,
SG::VarHandleKey hndl,
const std::string &  doc,
const SG::VarHandleKeyType  
)
inlineinherited

Declare a new Gaudi property.

Parameters
nameName of the property.
hndlObject holding the property value.
docDocumentation string for the property.

This is the version for types that derive from SG::VarHandleKey. The property value object is put on the input and output lists as appropriate; then we forward to the base class.

Definition at line 221 of file AthCommonDataStore.h.

225  {
226  this->declare(hndl);
227  hndl.setOwner(this);
228 
229  return PBASE::declareProperty(name,hndl,doc);
230  }

◆ declareProperty() [3/6]

Gaudi::Details::PropertyBase* AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty ( const std::string &  name,
SG::VarHandleKeyArray hndArr,
const std::string &  doc,
const SG::VarHandleKeyArrayType  
)
inlineinherited

Definition at line 259 of file AthCommonDataStore.h.

263  {
264 
265  // std::ostringstream ost;
266  // ost << Algorithm::name() << " VHKA declareProp: " << name
267  // << " size: " << hndArr.keys().size()
268  // << " mode: " << hndArr.mode()
269  // << " vhka size: " << m_vhka.size()
270  // << "\n";
271  // debug() << ost.str() << endmsg;
272 
273  hndArr.setOwner(this);
274  m_vhka.push_back(&hndArr);
275 
276  Gaudi::Details::PropertyBase* p = PBASE::declareProperty(name, hndArr, doc);
277  if (p != 0) {
278  p->declareUpdateHandler(&AthCommonDataStore<PBASE>::updateVHKA, this);
279  } else {
280  ATH_MSG_ERROR("unable to call declareProperty on VarHandleKeyArray "
281  << name);
282  }
283 
284  return p;
285 
286  }

◆ declareProperty() [4/6]

Gaudi::Details::PropertyBase* AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty ( const std::string &  name,
T &  property,
const std::string &  doc,
const SG::NotHandleType  
)
inlineinherited

Declare a new Gaudi property.

Parameters
nameName of the property.
propertyObject holding the property value.
docDocumentation string for the property.

This is the generic version, for types that do not derive from SG::VarHandleKey. It just forwards to the base class version of declareProperty.

Definition at line 333 of file AthCommonDataStore.h.

337  {
338  return PBASE::declareProperty(name, property, doc);
339  }

◆ declareProperty() [5/6]

Gaudi::Details::PropertyBase* AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty ( const std::string &  name,
T &  property,
const std::string &  doc = "none" 
)
inlineinherited

Declare a new Gaudi property.

Parameters
nameName of the property.
propertyObject holding the property value.
docDocumentation string for the property.

This dispatches to either the generic declareProperty or the one for VarHandle/Key/KeyArray.

Definition at line 352 of file AthCommonDataStore.h.

355  {
356  typedef typename SG::HandleClassifier<T>::type htype;
357  return declareProperty (name, property, doc, htype());
358  }

◆ declareProperty() [6/6]

Gaudi::Details::PropertyBase& AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty ( Gaudi::Property< T > &  t)
inlineinherited

Definition at line 145 of file AthCommonDataStore.h.

145  {
146  typedef typename SG::HandleClassifier<T>::type htype;
148  }

◆ detStore()

const ServiceHandle<StoreGateSvc>& AthCommonDataStore< AthCommonMsg< AlgTool > >::detStore ( ) const
inlineinherited

The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 95 of file AthCommonDataStore.h.

95 { return m_detStore; }

◆ doBook()

StatusCode D3PD::VectorFillerToolBase::doBook ( )
protected

Declare tuple variables.

This is called at the start of the first event.

Definition at line 112 of file VectorFillerToolBase.cxx.

113 {
114  // Create the count/index variables.
115  if (!m_nrowName.empty()) {
117  "Number of ntuple rows.") );
119  "Number of ntuple rows.") );
120  }
121  if (!m_nobjName.empty()) {
123  "Number of objects.") );
125  "Number of objects.") );
126  }
127  if (!m_objIndexName.empty())
129  "Index of this object.") );
130 
131  // Book child variables.
132  for (size_t i = 0; i < m_blockFillers.size(); i++)
133  CHECK( m_blockFillers[i]->book() );
134 
135  return StatusCode::SUCCESS;
136 }

◆ doConfigure()

StatusCode D3PD::VectorFillerToolBase::doConfigure ( IAddVariable tree,
IIteration it 
)
protected

Configure the tool.

Parameters
treeThe parent D3PD tree.
itThe iteration object we'll use. (Used to get the elt type.)

This is called during initialization.

Definition at line 147 of file VectorFillerToolBase.cxx.

148 {
149  m_tree = tree;
150 
151  // Get the type of object we'll get from the iteration.
152  const std::type_info& ti = it.elementTypeinfo();
153 
154  // Configure all child tools.
155  for (size_t i = 0; i < m_blockFillers.size(); i++)
156  CHECK( m_blockFillers[i]->configureD3PD (this, ti) );
157 
158  return StatusCode::SUCCESS;
159 }

◆ doFill()

StatusCode D3PD::VectorFillerToolBase::doFill ( IIteration it,
size_t  sizeHint 
)
protected

Fill objects from an IIteration.

Parameters
itIteration object. Must have already been reset.
sizeHintHint for the expected size of the iteration.

This will loop over the objects in the iteration; for each object, it will loop over the contained block filler tools.

Parameters
itIteration object. Must have already been reset.

This will loop over the objects in the iteration; for each object, it will loop over the contained block filler tools.

Definition at line 244 of file VectorFillerToolBase.cxx.

245 {
246  // Set variable vectors to the expected size.
247  m_vars.resize_all (sizeHint);
248  size_t n = 0;
249  size_t nobj = 0;
250  size_t sz = sizeHint;
251 
252  std::vector<unsigned long> codes_in;
253  std::vector<unsigned long> codes_out;
254 
255  // Loop over objects.
256  // Note: @c nextUntyped may try to fill variables. Make sure there's space.
257  maybeExtend (n, sz);
258  while (const void* obj = it.nextUntyped() ) {
259  // AGAIN processing.
260  codes_in.clear();
261  codes_in.resize (m_blockFillers.size(), StatusCode(StatusCode::SUCCESS).getCode());
262  CHECK( fillOnce (obj, nobj, n, sz, codes_in, codes_out) );
263  codes_in = codes_out;
264  while (std::find (codes_out.begin(), codes_out.end(),
265  (unsigned long)IBlockFillerTool::AGAIN)
266  != codes_out.end())
267  {
268  CHECK( fillOnce (obj, nobj, n, sz, codes_in, codes_out) );
269  }
270 
271  ++nobj;
272 
273  it.releaseElementUntyped (obj);
274  maybeExtend (n, sz);
275  }
276 
277  // Set vectors to the proper final size.
278  if (sz != n)
279  m_vars.resize_all (n);
280 
281  // Save the counts.
282  if (m_nrow)
283  *m_nrow = n;
284  if (m_nobj)
285  *m_nobj = nobj;
286 
287  return StatusCode::SUCCESS;
288 }

◆ evtStore() [1/2]

ServiceHandle<StoreGateSvc>& AthCommonDataStore< AthCommonMsg< AlgTool > >::evtStore ( )
inlineinherited

The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 85 of file AthCommonDataStore.h.

85 { return m_evtStore; }

◆ evtStore() [2/2]

const ServiceHandle<StoreGateSvc>& AthCommonDataStore< AthCommonMsg< AlgTool > >::evtStore ( ) const
inlineinherited

The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 90 of file AthCommonDataStore.h.

90 { return m_evtStore; }

◆ extraDeps_update_handler()

void AthCommonDataStore< AthCommonMsg< AlgTool > >::extraDeps_update_handler ( Gaudi::Details::PropertyBase &  ExtraDeps)
protectedinherited

Add StoreName to extra input/output deps as needed.

use the logic of the VarHandleKey to parse the DataObjID keys supplied via the ExtraInputs and ExtraOuputs Properties to add the StoreName if it's not explicitly given

◆ fillOnce()

StatusCode D3PD::VectorFillerToolBase::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 
)
private

Make one loop over block filler tools.

Parameters
objObject being processed.
objndxThe index of the object we're currently processing.
nNumber of entries currently made in the vectors.
szCurrent size of the vectors.
codes_inVector of status returns for each tool from the first fill call.
codes_out[out]Vector of status returns for each tool from this fill call.

This function may be called more than once for an object if AGAIN was requested.

We loop over all block filler tools. For each, we call fillUntyped with the again parameter set depending on whether codes_in for this tool is AGAIN. We collect the return codes from each tool in codes_out.

Definition at line 196 of file VectorFillerToolBase.cxx.

202 {
203  codes_out.resize (m_blockFillers.size());
204 
205  // Extend vectors if needed.
206  maybeExtend (n, sz);
207 
208  // Loop over block fillers.
209  bool all_empty = true;
210  for (size_t j = 0; j < m_blockFillers.size(); j++) {
211  StatusCode scode =
212  m_blockFillers[j]->fillUntyped(obj,
213  codes_in[j] == IBlockFillerTool::AGAIN);
214  codes_out[j] = scode.getCode();
215  if (codes_out[j] != IBlockFillerTool::EMPTY)
216  all_empty = false;
217  CHECK( IBlockFillerTool::againok (scode) );
218  }
219 
220  // If all tools returned empty, then ignore this row.
221  // But don't ignore it if there are no block fillers at all
222  // (it may be that an associator tool will be filling variables).
223  if (!all_empty || m_blockFillers.empty()) {
224  if (m_objIndex)
225  *m_objIndex = objndx;
226 
227  // Count rows and update variable pointers.
228  ++n;
229  m_vars.next_all();
230  }
231 
232  return StatusCode::SUCCESS;
233 }

◆ finalize()

StatusCode D3PD::VectorFillerToolBase::finalize ( )
virtual

Standard Gaudi finalize method.

Definition at line 99 of file VectorFillerToolBase.cxx.

100 {
101  // Don't clear the m_vars variable, because some memory will never be freed
102  // in that case...
103  return StatusCode::SUCCESS;
104 }

◆ initialize()

StatusCode D3PD::VectorFillerToolBase::initialize ( )
virtual

Standard Gaudi initialize method.

Definition at line 88 of file VectorFillerToolBase.cxx.

89 {
91  CHECK( m_blockFillers.retrieve() );
92  return StatusCode::SUCCESS;
93 }

◆ inputHandles()

virtual std::vector<Gaudi::DataHandle*> AthCommonDataStore< AthCommonMsg< AlgTool > >::inputHandles ( ) const
overridevirtualinherited

Return this algorithm's input handles.

We override this to include handle instances from key arrays if they have not yet been declared. See comments on updateVHKA.

◆ maybeExtend()

void D3PD::VectorFillerToolBase::maybeExtend ( size_t &  n,
size_t &  sz 
)
private

Extend vectors if needed.

Parameters
nNumber of entries currently made in the vectors.
szCurrent size of the vectors.

Definition at line 167 of file VectorFillerToolBase.cxx.

168 {
169  if (n >= sz) {
170  sz = std::max(static_cast<size_t>(16), 2*sz);
171  m_vars.resize_all (sz, n);
172  }
173 }

◆ msg() [1/2]

MsgStream& AthCommonMsg< AlgTool >::msg ( ) const
inlineinherited

Definition at line 24 of file AthCommonMsg.h.

24  {
25  return this->msgStream();
26  }

◆ msg() [2/2]

MsgStream& AthCommonMsg< AlgTool >::msg ( const MSG::Level  lvl) const
inlineinherited

Definition at line 27 of file AthCommonMsg.h.

27  {
28  return this->msgStream(lvl);
29  }

◆ msgLvl()

bool AthCommonMsg< AlgTool >::msgLvl ( const MSG::Level  lvl) const
inlineinherited

Definition at line 30 of file AthCommonMsg.h.

30  {
31  return this->msgLevel(lvl);
32  }

◆ outputHandles()

virtual std::vector<Gaudi::DataHandle*> AthCommonDataStore< AthCommonMsg< AlgTool > >::outputHandles ( ) const
overridevirtualinherited

Return this algorithm's output handles.

We override this to include handle instances from key arrays if they have not yet been declared. See comments on updateVHKA.

◆ renounce()

std::enable_if_t<std::is_void_v<std::result_of_t<decltype(&T::renounce)(T)> > && !std::is_base_of_v<SG::VarHandleKeyArray, T> && std::is_base_of_v<Gaudi::DataHandle, T>, void> AthCommonDataStore< AthCommonMsg< AlgTool > >::renounce ( T &  h)
inlineprotectedinherited

Definition at line 380 of file AthCommonDataStore.h.

381  {
382  h.renounce();
383  PBASE::renounce (h);
384  }

◆ renounceArray()

void AthCommonDataStore< AthCommonMsg< AlgTool > >::renounceArray ( SG::VarHandleKeyArray handlesArray)
inlineprotectedinherited

remove all handles from I/O resolution

Definition at line 364 of file AthCommonDataStore.h.

364  {
365  handlesArray.renounce();
366  }

◆ sysInitialize()

virtual StatusCode AthCommonDataStore< AthCommonMsg< AlgTool > >::sysInitialize ( )
overridevirtualinherited

Perform system initialization for an algorithm.

We override this to declare all the elements of handle key arrays at the end of initialization. See comments on updateVHKA.

Reimplemented in DerivationFramework::CfAthAlgTool, AthCheckedComponent< AthAlgTool >, AthCheckedComponent<::AthAlgTool >, and asg::AsgMetadataTool.

◆ sysStart()

virtual StatusCode AthCommonDataStore< AthCommonMsg< AlgTool > >::sysStart ( )
overridevirtualinherited

Handle START transition.

We override this in order to make sure that conditions handle keys can cache a pointer to the conditions container.

◆ updateVHKA()

void AthCommonDataStore< AthCommonMsg< AlgTool > >::updateVHKA ( Gaudi::Details::PropertyBase &  )
inlineinherited

Definition at line 308 of file AthCommonDataStore.h.

308  {
309  // debug() << "updateVHKA for property " << p.name() << " " << p.toString()
310  // << " size: " << m_vhka.size() << endmsg;
311  for (auto &a : m_vhka) {
312  std::vector<SG::VarHandleKey*> keys = a->keys();
313  for (auto k : keys) {
314  k->setOwner(this);
315  }
316  }
317  }

Member Data Documentation

◆ m_blockFillers

ToolHandleArray<IBlockFillerTool> D3PD::VectorFillerToolBase::m_blockFillers
private

Property: The list of block filler tools.

Definition at line 189 of file VectorFillerToolBase.h.

◆ m_detStore

StoreGateSvc_t AthCommonDataStore< AthCommonMsg< AlgTool > >::m_detStore
privateinherited

Pointer to StoreGate (detector store by default)

Definition at line 393 of file AthCommonDataStore.h.

◆ m_evtStore

StoreGateSvc_t AthCommonDataStore< AthCommonMsg< AlgTool > >::m_evtStore
privateinherited

Pointer to StoreGate (event store by default)

Definition at line 390 of file AthCommonDataStore.h.

◆ m_metadata

ObjectMetadata D3PD::VectorFillerToolBase::m_metadata
protected

Metadata about the variables created by this tool.

Definition at line 180 of file VectorFillerToolBase.h.

◆ m_nobj

int* D3PD::VectorFillerToolBase::m_nobj
private

Variable for the object count.

Definition at line 210 of file VectorFillerToolBase.h.

◆ m_nobjName

std::string D3PD::VectorFillerToolBase::m_nobjName
private

Property: Name of the variable for the count of objects.

Omitted if empty.

Definition at line 197 of file VectorFillerToolBase.h.

◆ m_nrow

int* D3PD::VectorFillerToolBase::m_nrow
private

Variable for the row count.

Definition at line 207 of file VectorFillerToolBase.h.

◆ m_nrowName

std::string D3PD::VectorFillerToolBase::m_nrowName
private

Property: Name of the variable for the count of rows.

Omitted if empty.

Definition at line 193 of file VectorFillerToolBase.h.

◆ m_objIndex

int* D3PD::VectorFillerToolBase::m_objIndex
private

Variable for the object index.

Definition at line 213 of file VectorFillerToolBase.h.

◆ m_objIndexName

std::string D3PD::VectorFillerToolBase::m_objIndexName
private

Property: Name of the variable for the object index.

Omitted if empty.

Definition at line 201 of file VectorFillerToolBase.h.

◆ m_prefix

std::string D3PD::VectorFillerToolBase::m_prefix
protected

Property: Variable prefix for this block.

Definition at line 184 of file VectorFillerToolBase.h.

◆ m_tree

IAddVariable* D3PD::VectorFillerToolBase::m_tree
private

The parent tree.

Definition at line 204 of file VectorFillerToolBase.h.

◆ m_varHandleArraysDeclared

bool AthCommonDataStore< AthCommonMsg< AlgTool > >::m_varHandleArraysDeclared
privateinherited

Definition at line 399 of file AthCommonDataStore.h.

◆ m_vars

Vars D3PD::VectorFillerToolBase::m_vars
private

All booked variables.

Definition at line 346 of file VectorFillerToolBase.h.

◆ m_vhka

std::vector<SG::VarHandleKeyArray*> AthCommonDataStore< AthCommonMsg< AlgTool > >::m_vhka
privateinherited

Definition at line 398 of file AthCommonDataStore.h.


The documentation for this class was generated from the following files:
D3PD::IBlockFillerTool::AGAIN
@ AGAIN
Definition: IBlockFillerTool.h:69
fitman.sz
sz
Definition: fitman.py:527
find
std::string find(const std::string &s)
return a remapped string
Definition: hcg.cxx:135
D3PD::VectorFillerToolBase::m_nrowName
std::string m_nrowName
Property: Name of the variable for the count of rows.
Definition: VectorFillerToolBase.h:193
AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
Definition: AthCommonDataStore.h:145
max
constexpr double max()
Definition: ap_fixedTest.cxx:33
initialize
void initialize()
Definition: run_EoverP.cxx:894
tree
TChain * tree
Definition: tile_monitor.h:30
skel.it
it
Definition: skel.GENtoEVGEN.py:396
AthCommonDataStore< AthCommonMsg< AlgTool > >::m_evtStore
StoreGateSvc_t m_evtStore
Pointer to StoreGate (event store by default)
Definition: AthCommonDataStore.h:390
AthCommonDataStore< AthCommonMsg< AlgTool > >::m_vhka
std::vector< SG::VarHandleKeyArray * > m_vhka
Definition: AthCommonDataStore.h:398
LArDigits2NtupleDumper.tdt
tdt
Definition: LArDigits2NtupleDumper.py:121
D3PD::VectorFillerToolBase::m_metadata
ObjectMetadata m_metadata
Metadata about the variables created by this tool.
Definition: VectorFillerToolBase.h:180
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
dbg::ptr
void * ptr(T *p)
Definition: SGImplSvc.cxx:74
D3PD::VectorFillerToolBase::m_vars
Vars m_vars
All booked variables.
Definition: VectorFillerToolBase.h:346
SG::VarHandleKeyArray::setOwner
virtual void setOwner(IDataHandleHolder *o)=0
IDTPMcnv.htype
htype
Definition: IDTPMcnv.py:29
D3PD::VectorFillerToolBase::maybeExtend
void maybeExtend(size_t &n, size_t &sz)
Extend vectors if needed.
Definition: VectorFillerToolBase.cxx:167
python.utils.AtlRunQueryDQUtils.p
p
Definition: AtlRunQueryDQUtils.py:210
AthCommonDataStore
Definition: AthCommonDataStore.h:52
D3PD::IBlockFillerTool::againok
static StatusCode againok(StatusCode sc)
StatusCode check helper: change AGAIN or EMPTY to SUCCESS.
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
Athena::typeinfoName
std::string typeinfoName(const std::type_info &ti)
Convert a type_info to a demangled string.
Definition: AthenaKernel/src/ClassName.cxx:23
lumiFormat.i
int i
Definition: lumiFormat.py:85
D3PD::VectorFillerToolBase::m_nobjName
std::string m_nobjName
Property: Name of the variable for the count of objects.
Definition: VectorFillerToolBase.h:197
beamspotman.n
n
Definition: beamspotman.py:731
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
CaloNoise_fillDB.dt
dt
Definition: CaloNoise_fillDB.py:58
D3PD::VectorFillerToolBase::m_nobj
int * m_nobj
Variable for the object count.
Definition: VectorFillerToolBase.h:210
D3PD::VectorFillerToolBase::m_tree
IAddVariable * m_tree
The parent tree.
Definition: VectorFillerToolBase.h:204
D3PD::VectorFillerToolBase::fillOnce
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.
Definition: VectorFillerToolBase.cxx:196
test_pyathena.parent
parent
Definition: test_pyathena.py:15
CHECK
#define CHECK(...)
Evaluate an expression and check for errors.
Definition: Control/AthenaKernel/AthenaKernel/errorcheck.h:422
AthCommonDataStore< AthCommonMsg< AlgTool > >::m_detStore
StoreGateSvc_t m_detStore
Pointer to StoreGate (detector store by default)
Definition: AthCommonDataStore.h:393
AthAlgTool::AthAlgTool
AthAlgTool()
Default constructor:
SG::VarHandleKeyArray::renounce
virtual void renounce()=0
SG::HandleClassifier::type
std::conditional< std::is_base_of< SG::VarHandleKeyArray, T >::value, VarHandleKeyArrayType, type2 >::type type
Definition: HandleClassifier.h:54
merge_scale_histograms.doc
string doc
Definition: merge_scale_histograms.py:9
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
D3PD::ObjectMetadata::addVariable
virtual StatusCode addVariable(const std::string &name, const std::type_info &ti, void *&ptr, const std::string &docstring="", const void *defval=0)
This function can be used to save the metadata about a D3PD variable.
Definition: ObjectMetadata.cxx:109
D3PD::VectorFillerToolBase::m_objIndex
int * m_objIndex
Variable for the object index.
Definition: VectorFillerToolBase.h:213
REPORT_MESSAGE
#define REPORT_MESSAGE(LVL)
Report a message.
Definition: Control/AthenaKernel/AthenaKernel/errorcheck.h:365
D3PD::IBlockFillerTool::EMPTY
@ EMPTY
Definition: IBlockFillerTool.h:70
a
TList * a
Definition: liststreamerinfos.cxx:10
h
D3PD::VectorFillerToolBase::m_nrow
int * m_nrow
Variable for the row count.
Definition: VectorFillerToolBase.h:207
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
SG::VarHandleBase::vhKey
SG::VarHandleKey & vhKey()
Return a non-const reference to the HandleKey.
Definition: StoreGate/src/VarHandleBase.cxx:623
D3PD::IAddVariable::addVariable
StatusCode addVariable(const std::string &name, T *&ptr, const std::string &docstring="")
Add a variable to the tuple.
D3PD::VectorFillerToolBase::m_objIndexName
std::string m_objIndexName
Property: Name of the variable for the object index.
Definition: VectorFillerToolBase.h:201
D3PD::VectorFillerToolBase::m_prefix
std::string m_prefix
Property: Variable prefix for this block.
Definition: VectorFillerToolBase.h:184
python.Bindings.keys
keys
Definition: Control/AthenaPython/python/Bindings.py:798
Prompt::Def::Var
Var
Definition: VarHolder.h:57
D3PD::VectorFillerToolBase::m_blockFillers
ToolHandleArray< IBlockFillerTool > m_blockFillers
Property: The list of block filler tools.
Definition: VectorFillerToolBase.h:189
python.PyAthena.obj
obj
Definition: PyAthena.py:132
AthCommonDataStore::declareGaudiProperty
Gaudi::Details::PropertyBase & declareGaudiProperty(Gaudi::Property< T > &hndl, const SG::VarHandleKeyType &)
specialization for handling Gaudi::Property<SG::VarHandleKey>
Definition: AthCommonDataStore.h:156
fitman.k
k
Definition: fitman.py:528
D3PD::VectorFillerToolBase::Vars::resize_all
void resize_all(size_t sz, size_t pos=0)
Resize all vector.
Definition: VectorFillerToolBase.cxx:563
D3PD::VectorFillerToolBase::Vars::next_all
void next_all()
Move all variable pointers to the next element.
Definition: VectorFillerToolBase.cxx:42