EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Acts::GeometryHierarchyMap< value_t > Class Template Reference

#include <acts/blob/sPHENIX/Core/include/Acts/Geometry/GeometryHierarchyMap.hpp>

+ Collaboration diagram for Acts::GeometryHierarchyMap< value_t >:

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
 
using Size = typename std::vector< value_t >::size_type
 
using Value = value_t
 

Public Member Functions

 GeometryHierarchyMap (std::vector< InputElement > elements)
 
 GeometryHierarchyMap (std::initializer_list< InputElement > elements)
 
 GeometryHierarchyMap ()=default
 
 GeometryHierarchyMap (const GeometryHierarchyMap &)=default
 
 GeometryHierarchyMap (GeometryHierarchyMap &&)=default
 
 ~GeometryHierarchyMap ()=default
 
GeometryHierarchyMapoperator= (const GeometryHierarchyMap &)=default
 
GeometryHierarchyMapoperator= (GeometryHierarchyMap &&)=default
 
Iterator begin () const
 Return an iterator pointing to the beginning of the stored values.
 
Iterator end () const
 Return an iterator pointing to the end of the stored values.
 
bool empty () const
 Check if any elements are stored.
 
Size size () const
 Return the number of stored elements.
 
GeometryIdentifier idAt (Size index) const
 
const ValuevalueAt (Size index) const
 
Iterator find (GeometryIdentifier id) const
 

Private Types

using Identifier = GeometryIdentifier::Value
 

Private Member Functions

template<typename iterator_t >
void fill (iterator_t beg, iterator_t end)
 

Static Private Member Functions

static constexpr Identifier makeLeadingLevelsMask (GeometryIdentifier id)
 Construct a mask where all leading non-zero levels are set.
 
static constexpr Identifier makeHighestLevelMask ()
 Construct a mask where only the highest level is set.
 
static constexpr bool equalWithinMask (Identifier lhs, Identifier rhs, Identifier mask)
 Compare the two identifiers only within the masked bits.
 
template<typename iterator_t >
static void sortAndCheckDuplicates (iterator_t beg, iterator_t end)
 Ensure identifier ordering and uniqueness.
 

Private Attributes

std::vector< Identifierm_ids
 
std::vector< Identifierm_masks
 
std::vector< Valuem_values
 

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.

Definition at line 62 of file GeometryHierarchyMap.hpp.

View newest version in sPHENIX GitHub at line 62 of file GeometryHierarchyMap.hpp

Member Typedef Documentation

template<typename value_t>
using Acts::GeometryHierarchyMap< value_t >::Identifier = GeometryIdentifier::Value
private

Definition at line 133 of file GeometryHierarchyMap.hpp.

View newest version in sPHENIX GitHub at line 133 of file GeometryHierarchyMap.hpp

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.

Definition at line 65 of file GeometryHierarchyMap.hpp.

View newest version in sPHENIX GitHub at line 65 of file GeometryHierarchyMap.hpp

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

Definition at line 66 of file GeometryHierarchyMap.hpp.

View newest version in sPHENIX GitHub at line 66 of file GeometryHierarchyMap.hpp

template<typename value_t>
using Acts::GeometryHierarchyMap< value_t >::Size = typename std::vector<value_t>::size_type

Definition at line 67 of file GeometryHierarchyMap.hpp.

View newest version in sPHENIX GitHub at line 67 of file GeometryHierarchyMap.hpp

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

Definition at line 68 of file GeometryHierarchyMap.hpp.

View newest version in sPHENIX GitHub at line 68 of file GeometryHierarchyMap.hpp

Constructor & Destructor Documentation

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

Construct the container from the given elements.

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

Definition at line 193 of file GeometryHierarchyMap.hpp.

View newest version in sPHENIX GitHub at line 193 of file GeometryHierarchyMap.hpp

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

Construct the container from an initializer list.

Parameters
elementsinput initializer list

Definition at line 200 of file GeometryHierarchyMap.hpp.

View newest version in sPHENIX GitHub at line 200 of file GeometryHierarchyMap.hpp

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

Member Function Documentation

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

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

Definition at line 88 of file GeometryHierarchyMap.hpp.

View newest version in sPHENIX GitHub at line 88 of file GeometryHierarchyMap.hpp

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

Check if any elements are stored.

Definition at line 92 of file GeometryHierarchyMap.hpp.

View newest version in sPHENIX GitHub at line 92 of file GeometryHierarchyMap.hpp

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

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

Definition at line 90 of file GeometryHierarchyMap.hpp.

View newest version in sPHENIX GitHub at line 90 of file GeometryHierarchyMap.hpp

Referenced by luupda(), Acts::CKFSourceLinkSelector::operator()(), pepsimainerhic(), pydump(), pylhef(), pyslha(), pyupda(), upevnt(), and upinit().

+ Here is the caller graph for this function:

template<typename value_t>
static constexpr bool Acts::GeometryHierarchyMap< value_t >::equalWithinMask ( Identifier  lhs,
Identifier  rhs,
Identifier  mask 
)
inlinestaticprivate

Compare the two identifiers only within the masked bits.

Definition at line 174 of file GeometryHierarchyMap.hpp.

View newest version in sPHENIX GitHub at line 174 of file GeometryHierarchyMap.hpp

template<typename value_t >
template<typename iterator_t >
void Acts::GeometryHierarchyMap< value_t >::fill ( iterator_t  beg,
iterator_t  end 
)
inlineprivate

Fill the container from the input elements.

This assumes that the elements are ordered and unique with respect to their identifiers.

Definition at line 224 of file GeometryHierarchyMap.hpp.

View newest version in sPHENIX GitHub at line 224 of file GeometryHierarchyMap.hpp

References n.

Referenced by pygdir().

+ Here is the caller graph for this function:

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

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 hierachy.

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

Definition at line 241 of file GeometryHierarchyMap.hpp.

View newest version in sPHENIX GitHub at line 241 of file GeometryHierarchyMap.hpp

References it, Acts::UnitConstants::u, and value.

Referenced by Acts::GeometryHierarchyMapJsonConverter< value_t >::fromJson(), and Acts::CKFSourceLinkSelector::operator()().

+ Here is the caller graph for this function:

template<typename value_t>
GeometryIdentifier Acts::GeometryHierarchyMap< value_t >::idAt ( Size  index) const
inline

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

Exceptions
std::out_of_rangefor invalid indices

Definition at line 99 of file GeometryHierarchyMap.hpp.

View newest version in sPHENIX GitHub at line 99 of file GeometryHierarchyMap.hpp

Referenced by Acts::GeometryHierarchyMapJsonConverter< value_t >::toJson().

+ Here is the caller graph for this function:

template<typename value_t>
static constexpr Identifier Acts::GeometryHierarchyMap< value_t >::makeHighestLevelMask ( )
inlinestaticprivate

Construct a mask where only the highest level is set.

Definition at line 170 of file GeometryHierarchyMap.hpp.

View newest version in sPHENIX GitHub at line 170 of file GeometryHierarchyMap.hpp

template<typename value_t>
static constexpr Identifier Acts::GeometryHierarchyMap< value_t >::makeLeadingLevelsMask ( GeometryIdentifier  id)
inlinestaticprivate

Construct a mask where all leading non-zero levels are set.

Definition at line 142 of file GeometryHierarchyMap.hpp.

View newest version in sPHENIX GitHub at line 142 of file GeometryHierarchyMap.hpp

Referenced by Acts::GeometryHierarchyMap< SourceLinkSelectorCuts >::makeHighestLevelMask().

+ Here is the caller graph for this function:

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

Return the number of stored elements.

Definition at line 94 of file GeometryHierarchyMap.hpp.

View newest version in sPHENIX GitHub at line 94 of file GeometryHierarchyMap.hpp

Referenced by Acts::GeometryHierarchyMapJsonConverter< value_t >::toJson().

+ Here is the caller graph for this function:

template<typename value_t >
template<typename iterator_t >
void Acts::GeometryHierarchyMap< value_t >::sortAndCheckDuplicates ( iterator_t  beg,
iterator_t  end 
)
inlinestaticprivate

Ensure identifier ordering and uniqueness.

Definition at line 207 of file GeometryHierarchyMap.hpp.

View newest version in sPHENIX GitHub at line 207 of file GeometryHierarchyMap.hpp

template<typename value_t>
const Value& Acts::GeometryHierarchyMap< value_t >::valueAt ( Size  index) const
inline

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

Exceptions
std::out_of_rangefor invalid indices

Definition at line 103 of file GeometryHierarchyMap.hpp.

View newest version in sPHENIX GitHub at line 103 of file GeometryHierarchyMap.hpp

Referenced by Acts::GeometryHierarchyMapJsonConverter< value_t >::toJson().

+ Here is the caller graph for this function:

Member Data Documentation

template<typename value_t>
std::vector<Identifier> Acts::GeometryHierarchyMap< value_t >::m_ids
private

Definition at line 136 of file GeometryHierarchyMap.hpp.

View newest version in sPHENIX GitHub at line 136 of file GeometryHierarchyMap.hpp

Referenced by Acts::GeometryHierarchyMap< SourceLinkSelectorCuts >::idAt().

template<typename value_t>
std::vector<Identifier> Acts::GeometryHierarchyMap< value_t >::m_masks
private

Definition at line 138 of file GeometryHierarchyMap.hpp.

View newest version in sPHENIX GitHub at line 138 of file GeometryHierarchyMap.hpp


The documentation for this class was generated from the following file: