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 
43 #include "AthenaKernel/CLASS_DEF.h"
44 #include "AthenaKernel/CondCont.h"
46 CONDCONT_DEF(ActsTrk::DetectorElementToActsGeometryIdMap, 14180);
47 
48 #endif
CondCont.h
Hold mappings of ranges to condition objects.
ActsTrk::DetectorElementToActsGeometryIdMap
Definition: DetectorElementToActsGeometryIdMap.h:31
CaloCellPos2Ntuple.int
int
Definition: CaloCellPos2Ntuple.py:24
ActsTrk::detail::to_underlying
constexpr std::underlying_type< T_EnumClass >::type to_underlying(T_EnumClass an_enum)
Helper to convert class enum into an integer.
Definition: HitSummaryDataUtils.h:25
CONDCONT_DEF
CONDCONT_DEF(ActsTrk::DetectorElementToActsGeometryIdMap, 14180)
Trk::u
@ u
Enums for curvilinear frames.
Definition: ParamDefs.h:77
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
MeasurementDefs.h
python.Dumpers.typename
def typename(t)
Definition: Dumpers.py:194
geo_id
Definition: geo_id.py:1
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
CLASS_DEF
#define CLASS_DEF(NAME, CID, VERSION)
associate a clid and a version to a type eg
Definition: Control/AthenaKernel/AthenaKernel/CLASS_DEF.h:64
xAOD::UncalibMeasType
UncalibMeasType
Define the type of the uncalibrated measurement.
Definition: MeasurementDefs.h:24
ActsTrk
The AlignStoreProviderAlg loads the rigid alignment corrections and pipes them through the readout ge...
Definition: MuonDetectorBuilderTool.cxx:54
value_type
Definition: EDM_MasterSearch.h:11
CLASS_DEF.h
macros to associate a CLID to a type
ActsTrk::DetectorElementToActsGeometryIdMap::getValue
static const Acts::GeometryIdentifier & getValue(const value_type &element)
Definition: DetectorElementToActsGeometryIdMap.h:36