File DD4hepConversionHelpers.hpp
-
namespace Acts
Note
This file is foreseen for the
Geometry
module to replaceExtent
Functions
-
template<typename value_type>
std::vector<value_type> extractSeries(const dd4hep::DetElement &dd4hepElement, const std::string &bname, const value_type &unitConversion = 1) A simple helper function to extract a series.
- Template Parameters
value_type – the primitive type allowed by variant parameters
- Parameters
dd4hepElement – the detector element w
bname – The base name attribute of the variant parameter pack
unitConversion – is a conversion factor DD4hep -> ACTS
- Returns
the extracted series as a vector
-
template<typename value_type>
value_type getAttrValueOr(const dd4hep::xml::Component &node, const std::string &attrName, const value_type &fallbackValue) Helper method to get an attribute with fallback.
Note
the fallback value has to be provided
- Template Parameters
value_type – the primitive type allowed by variant parameters
- Parameters
node – the node object from DD4hep
attrName – the name of the attribute that is checked
fallbackValue – the fallbackValue
- Returns
either the gathered attribute or the fallback
-
template<typename T>
T getParam(const std::string &key, dd4hep::DetElement &elt) Helper function to extract a parameter value from a dd4hep detector element from VariantParameters.
- Template Parameters
T – The value type
- Parameters
key – The key of the value to extract
elt – The detector element instance
- Returns
A copy of the value contained in the params instance
-
template<typename T>
T getParamOr(const std::string &key, const dd4hep::DetElement &elt, T alternative) Get a parameter value or an alternative value if either the VariantParameters extension isn’t set, or it doesn’t contain the demanded key.
- Template Parameters
T – The value type
- Parameters
key – The key of the value to extract
elt – The detector element instance
alternative – The value to return if no params are set of the key doesn’t exist
- Returns
The value behind key, or
alternative
-
inline const dd4hep::rec::VariantParameters &getParams(const dd4hep::DetElement &elt)
Helper function to extract a VariantParameters instance, const version.
- Parameters
elt – The detector element instance
- Returns
The VariantParameters instance
-
inline dd4hep::rec::VariantParameters &getParams(dd4hep::DetElement &elt)
Helper function to extract a VariantParameters instance.
- Parameters
elt – The detector element instance
- Returns
The VariantParameters instance
-
inline bool hasParam(const std::string &key, dd4hep::DetElement &elt)
Check if a detector element has a key set in its VariantParameters.
- Parameters
key – The key to check existence for
elt – The detector element instance
- Returns
True if the element has VariantParameters and the key exists, false if either of these is not true
-
template<typename value_type>