File MaterialComposition.hpp

namespace Acts

Note

This file is foreseen for the Geometry module to replace Extent

class ElementFraction
#include <Acts/Material/MaterialComposition.hpp>

Memory-efficient storage of the relative fraction of an element.

This can be used to define materials that are compounds of multiple elements with varying fractions. The element is identified by its atomic number stored as a single byte (allows up to 256 elements; more than we need). Its fraction is also stored as a single byte with values between 0 and

  1. This gives an accuracy of 1/256 ~ 0.5 %.

The element fraction allows you to store element composition in merged materials with a large number of bins. Depending on the detector and the description granularity this can be a lot of information and thus requires the reduced memory footprint. This is really only needed for nuclear interaction in the fast simulation where the reduced fractional accuracy is not a problem. The fractional accuracy should be much better than the parametrization uncertainty for hadronic interactions.

Public Functions

inline constexpr ElementFraction(unsigned int e, float f)

Construct from atomic number and relative fraction.

Parameters
  • e – is the atomic number of the element

  • f – is the relative fraction and must be a value in [0,1]

inline explicit constexpr ElementFraction(unsigned int e, unsigned int w)

Construct from atomic number and integer weight.

Parameters
  • e – is the atomic number of the element

  • w – is the integer weight and must be a value in [0,256)

ElementFraction() = delete

Must always be created with valid data.

ElementFraction(ElementFraction&&) = default
ElementFraction(const ElementFraction&) = default
~ElementFraction() = default
inline constexpr uint8_t element() const

The element atomic number.

inline constexpr float fraction() const

The relative fraction of this element.

ElementFraction &operator=(ElementFraction&&) = default
ElementFraction &operator=(const ElementFraction&) = default

Private Members

uint8_t m_element
uint8_t m_fraction

Friends

friend class MaterialComposition
inline friend constexpr bool operator<(ElementFraction lhs, ElementFraction rhs)

Sort by fraction for fastest access to the most probable element.

inline friend constexpr bool operator==(ElementFraction lhs, ElementFraction rhs)
class MaterialComposition
#include <Acts/Material/MaterialComposition.hpp>

Material composed from multiple elements with varying factions.

See also

ElementFraction for details.

Public Functions

MaterialComposition() = default

Construct an empty composition corresponding to vacuum.

inline MaterialComposition(std::vector<ElementFraction> elements)

Constructor from element fractions.

Rescales the fractions so they all add up to unity within the accuracy.

MaterialComposition(MaterialComposition&&) = default
MaterialComposition(const MaterialComposition&) = default
~MaterialComposition() = default
inline auto begin() const
inline auto end() const
inline operator bool() const

Check if the composed material is valid, i.e. it is not vacuum.

MaterialComposition &operator=(MaterialComposition&&) = default
MaterialComposition &operator=(const MaterialComposition&) = default
inline size_t size() const

Return the number of elements.

Private Members

std::vector<ElementFraction> m_elements

Friends

inline friend bool operator==(const MaterialComposition &lhs, const MaterialComposition &rhs)