ACTS
Experiment-independent tracking
Loading...
Searching...
No Matches
Acts::GeometryHierarchyMap< value_t > Class Template Reference

Store values mapped into the geometry hierarchy. More...

#include <Acts/Geometry/GeometryHierarchyMap.hpp>

Inheritance diagram for Acts::GeometryHierarchyMap< value_t >:
[legend]

Public Types

using InputElement = typename std::pair<GeometryIdentifier, value_t>
 Combined geometry identifier and value element. Only used for input.
using Iterator = typename std::vector<value_t>::const_iterator
 Type alias for const iterator over stored values.
using Value = value_t
 Type alias for stored value type.

Public Member Functions

 GeometryHierarchyMap ()=default
 GeometryHierarchyMap (const GeometryHierarchyMap &)=default
 Copy constructor.
 GeometryHierarchyMap (GeometryHierarchyMap &&) noexcept=default
 Move constructor.
 GeometryHierarchyMap (std::initializer_list< InputElement > elements)
 Construct the container from an initializer list.
 GeometryHierarchyMap (std::vector< InputElement > elements)
 Construct the container from the given elements.
 ~GeometryHierarchyMap ()=default
Iterator begin () const
 Return an iterator pointing to the beginning of the stored values.
bool contains (const GeometryIdentifier &id) const
 Check if the most specific value exists for a given geometry identifier.
bool empty () const
 Check if any elements are stored.
Iterator end () const
 Return an iterator pointing to the end of the stored values.
Iterator find (const GeometryIdentifier &id) const
 Find the most specific value for a given geometry identifier.
GeometryIdentifier idAt (std::size_t index) const
 Access the geometry identifier for the i-th element with bounds check.
GeometryHierarchyMapoperator= (const GeometryHierarchyMap &)=default
 Copy assignment operator.
GeometryHierarchyMapoperator= (GeometryHierarchyMap &&) noexcept=default
 Move assignment operator.
std::size_t size () const
 Return the number of stored elements.
const ValuevalueAt (std::size_t index) const
 Access the value of the i-th element in the container with bounds check.

Detailed Description

template<typename value_t>
class Acts::GeometryHierarchyMap< value_t >

Store values mapped into the geometry hierarchy.

Template Parameters
value_tstored value type

The core functionality is to find an equivalent element, i.e. an identifier-value pair, for a given geometry identifier via

auto it = container.find(GeometryIdentifier(...));
if (it != container.end()) {
    ...
}

Trailing zero levels of stored geometry identifiers are used as broadcast values to refer to higher-level objects within the geometry, e.g. a geometry identifier with vanishing approach and sensitive index identifies a layer. An entry will all geometry identifier levels set to zero acts as the global default value.

The container also supports range-based iteration over all stored elements

for (const auto& element : container) {
    ...
}

and index-based access to stored elements and associated geometry identifiers

GeometryIdentifier id3 = container.idAt(3);
const auto& element4 = container.valueAt(4);
Note
No guarantees are given for the element order when using range-based or index-based access. Any apparent ordering must be considered an implementation detail and might change.

Adding elements is potentially expensive as the internal lookup structure must be updated. In addition, modifying an element in-place could change its identifier which would also break the lookup. Thus, the container can not be modified after construction to prevent misuse.

Member Typedef Documentation

◆ InputElement

template<typename value_t>
using Acts::GeometryHierarchyMap< value_t >::InputElement = typename std::pair<GeometryIdentifier, value_t>

Combined geometry identifier and value element. Only used for input.

◆ Iterator

template<typename value_t>
using Acts::GeometryHierarchyMap< value_t >::Iterator = typename std::vector<value_t>::const_iterator

Type alias for const iterator over stored values.

◆ Value

template<typename value_t>
using Acts::GeometryHierarchyMap< value_t >::Value = value_t

Type alias for stored value type.

Constructor & Destructor Documentation

◆ GeometryHierarchyMap() [1/5]

template<typename value_t>
Acts::GeometryHierarchyMap< value_t >::GeometryHierarchyMap ( std::vector< InputElement > elements)
explicit

Construct the container from the given elements.

Parameters
elementsinput elements (must be unique with respect to identifier)

◆ GeometryHierarchyMap() [2/5]

template<typename value_t>
Acts::GeometryHierarchyMap< value_t >::GeometryHierarchyMap ( std::initializer_list< InputElement > elements)

Construct the container from an initializer list.

Parameters
elementsinput initializer list

◆ GeometryHierarchyMap() [3/5]

template<typename value_t>
Acts::GeometryHierarchyMap< value_t >::GeometryHierarchyMap ( )
default

◆ GeometryHierarchyMap() [4/5]

template<typename value_t>
Acts::GeometryHierarchyMap< value_t >::GeometryHierarchyMap ( const GeometryHierarchyMap< value_t > & )
default

Copy constructor.

◆ GeometryHierarchyMap() [5/5]

template<typename value_t>
Acts::GeometryHierarchyMap< value_t >::GeometryHierarchyMap ( GeometryHierarchyMap< value_t > && )
defaultnoexcept

Move constructor.

◆ ~GeometryHierarchyMap()

template<typename value_t>
Acts::GeometryHierarchyMap< value_t >::~GeometryHierarchyMap ( )
default

Member Function Documentation

◆ begin()

template<typename value_t>
Iterator Acts::GeometryHierarchyMap< value_t >::begin ( ) const

Return an iterator pointing to the beginning of the stored values.

Returns
Iterator to the first element

◆ contains()

template<typename value_t>
auto Acts::GeometryHierarchyMap< value_t >::contains ( const GeometryIdentifier & id) const

Check if the most specific value exists for a given geometry identifier.

This function checks if there is an element matching exactly the given geometry id, or from the element for the next available higher level within the geometry hierarchy.

Parameters
idgeometry identifier for which existence is being checked
Return values
`true`if a matching element exists
`false`if no matching element exists

◆ empty()

template<typename value_t>
bool Acts::GeometryHierarchyMap< value_t >::empty ( ) const

Check if any elements are stored.

Returns
True if the container is empty, false otherwise

◆ end()

template<typename value_t>
Iterator Acts::GeometryHierarchyMap< value_t >::end ( ) const

Return an iterator pointing to the end of the stored values.

Returns
Iterator past the last element

◆ find()

template<typename value_t>
auto Acts::GeometryHierarchyMap< value_t >::find ( const GeometryIdentifier & id) const

Find the most specific value for a given geometry identifier.

This can be either from the element matching exactly to the given geometry id, if it exists, or from the element for the next available higher level within the geometry hierarchy.

Parameters
idgeometry identifier for which information is requested
Return values
iteratorto an existing value
`.end()`iterator if no matching element exists

◆ idAt()

template<typename value_t>
GeometryIdentifier Acts::GeometryHierarchyMap< value_t >::idAt ( std::size_t index) const

Access the geometry identifier for the i-th element with bounds check.

Parameters
indexThe index of the element to access
Exceptions
std::out_of_rangefor invalid indices
Returns
The geometry identifier at the specified index

◆ operator=() [1/2]

template<typename value_t>
GeometryHierarchyMap & Acts::GeometryHierarchyMap< value_t >::operator= ( const GeometryHierarchyMap< value_t > & )
default

Copy assignment operator.

Returns
Reference to this object for chaining

◆ operator=() [2/2]

template<typename value_t>
GeometryHierarchyMap & Acts::GeometryHierarchyMap< value_t >::operator= ( GeometryHierarchyMap< value_t > && )
defaultnoexcept

Move assignment operator.

Returns
Reference to this object for chaining

◆ size()

template<typename value_t>
std::size_t Acts::GeometryHierarchyMap< value_t >::size ( ) const

Return the number of stored elements.

Returns
Number of elements in the container

◆ valueAt()

template<typename value_t>
const Value & Acts::GeometryHierarchyMap< value_t >::valueAt ( std::size_t index) const

Access the value of the i-th element in the container with bounds check.

Parameters
indexThe index of the element to access
Exceptions
std::out_of_rangefor invalid indices
Returns
Reference to the value at the specified index