ATLAS Offline Software
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 
10 namespace 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
ActsTrk::DetectorElementToActsGeometryIdMap
Definition: DetectorElementToActsGeometryIdMap.h:31
Trk::u
@ u
Enums for curvilinear frames.
Definition: ParamDefs.h:77
python.CaloAddPedShiftConfig.type
type
Definition: CaloAddPedShiftConfig.py:42
ActsTrk::DETELEMENT_TYPE_SHIFT
constexpr unsigned int DETELEMENT_TYPE_SHIFT
Definition: DetectorElementToActsGeometryIdMap.h:20
ActsTrk::DETELEMENT_HASH_MASK
constexpr unsigned int DETELEMENT_HASH_MASK
Definition: DetectorElementToActsGeometryIdMap.h:21
ActsTrk::DetectorElementKey
unsigned int DetectorElementKey
Definition: DetectorElementToActsGeometryIdMap.h:19
ActsTrk::makeDetectorElementKey
DetectorElementKey makeDetectorElementKey(xAOD::UncalibMeasType meas_type, unsigned int identifier_hash)
Definition: DetectorElementToActsGeometryIdMap.h:23
ActsTrk::DetectorElementToActsGeometryIdMap::makeValue
static const Acts::GeometryIdentifier & makeValue(const Acts::GeometryIdentifier &geo_id)
Definition: DetectorElementToActsGeometryIdMap.h:33
ActsTrk::to_underlying
std::underlying_type_t< T > to_underlying(T val)
Definition: ActsInspectTruthContentAlg.cxx:14
MeasurementDefs.h
python.Dumpers.typename
def typename(t)
Definition: Dumpers.py:193
geo_id
Definition: geo_id.py:1
python.CaloAddPedShiftConfig.int
int
Definition: CaloAddPedShiftConfig.py:45
xAOD::UncalibMeasType
UncalibMeasType
Define the type of the uncalibrated measurement.
Definition: MeasurementDefs.h:25
ActsTrk
The AlignStoreProviderAlg loads the rigid alignment corrections and pipes them through the readout ge...
Definition: MdtCalibInput.h:31
value_type
Definition: EDM_MasterSearch.h:11
ActsTrk::DetectorElementToActsGeometryIdMap::getValue
static const Acts::GeometryIdentifier & getValue(const value_type &element)
Definition: DetectorElementToActsGeometryIdMap.h:36