ATLAS Offline Software
Loading...
Searching...
No Matches
DetectorElementToActsGeometryIdMap.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 */
4#ifndef ACTSTRK_DETECTORELEMENTTOACTSGEOMETRYIDMAP_H
5#define ACTSTRK_DETECTORELEMENTTOACTSGEOMETRYIDMAP_H
7#include "Acts/Geometry/GeometryIdentifier.hpp"
8#include <unordered_map>
9
10namespace ActsTrk {
11 namespace {
12 template <typename T_EnumClass >
13 inline
14 constexpr typename std::underlying_type<T_EnumClass>::type to_underlying(T_EnumClass an_enum) {
15 return static_cast<typename std::underlying_type<T_EnumClass>::type>(an_enum);
16 }
17 }
18
19 using DetectorElementKey=unsigned int;
20 constexpr unsigned int DETELEMENT_TYPE_SHIFT = 28;
21 constexpr unsigned int DETELEMENT_HASH_MASK = ~(1u<<31|1u<<30|1u<<29|1u<<28);
22 inline
23 DetectorElementKey makeDetectorElementKey(xAOD::UncalibMeasType meas_type, unsigned int identifier_hash) {
24 assert( sizeof(xAOD::UncalibMeasType) <= sizeof(std::size_t) );
25 assert( static_cast<std::size_t>( to_underlying(meas_type)&((~DETELEMENT_HASH_MASK)>>DETELEMENT_TYPE_SHIFT)) == static_cast<std::size_t>(meas_type));
26 assert( (identifier_hash & DETELEMENT_HASH_MASK) == identifier_hash);
27 return (to_underlying(meas_type) << DETELEMENT_TYPE_SHIFT) | (identifier_hash & DETELEMENT_HASH_MASK);
28 }
29 struct DetectorElementToActsGeometryIdMap : std::unordered_map<ActsTrk::DetectorElementKey,
30 Acts::GeometryIdentifier>
31 {
32 // utilities to abstract what is actually stored
33 static const Acts::GeometryIdentifier &makeValue(const Acts::GeometryIdentifier &geo_id) {
34 return geo_id;
35 }
36 static const Acts::GeometryIdentifier &getValue(const value_type &element) {
37 return element.second;
38 }
39 };
40}
41
42#endif
The AlignStoreProviderAlg loads the rigid alignment corrections and pipes them through the readout ge...
constexpr unsigned int DETELEMENT_HASH_MASK
std::underlying_type_t< T > to_underlying(T val)
constexpr unsigned int DETELEMENT_TYPE_SHIFT
DetectorElementKey makeDetectorElementKey(xAOD::UncalibMeasType meas_type, unsigned int identifier_hash)
UncalibMeasType
Define the type of the uncalibrated measurement.
static const Acts::GeometryIdentifier & makeValue(const Acts::GeometryIdentifier &geo_id)
static const Acts::GeometryIdentifier & getValue(const value_type &element)