File DD4hepConversionHelpers.hpp

namespace Acts

Note

This file is foreseen for the Geometry module to replace Extent

Functions

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 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 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 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 existance 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

inline bool hasParams(dd4hep::DetElement &elt)

Check if a detector element has VariantParameters set.

Parameters

elt – The detector element instance

Returns

True if the VariantParameters exist, false if not