ATLAS Offline Software
Loading...
Searching...
No Matches
DetectorElementToActsGeometryIdMap.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2026 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 "Acts/Utilities/Helpers.hpp"
9#include <unordered_map>
10
11namespace Acts {
12 class Surface;
13}
14
15namespace ActsTrk {
16 using DetectorElementKey=unsigned int;
17 constexpr unsigned int DETELEMENT_TYPE_SHIFT = 28;
18 constexpr unsigned int DETELEMENT_HASH_MASK = ~(1u<<31|1u<<30|1u<<29|1u<<28);
19 inline
20 DetectorElementKey makeDetectorElementKey(xAOD::UncalibMeasType meas_type, unsigned int identifier_hash) {
21 assert( sizeof(xAOD::UncalibMeasType) <= sizeof(std::size_t) );
22 assert( static_cast<std::size_t>( Acts::toUnderlying(meas_type)&((~DETELEMENT_HASH_MASK)>>DETELEMENT_TYPE_SHIFT)) == static_cast<std::size_t>(meas_type));
23 assert( (identifier_hash & DETELEMENT_HASH_MASK) == identifier_hash);
24 return (Acts::toUnderlying(meas_type) << DETELEMENT_TYPE_SHIFT) | (identifier_hash & DETELEMENT_HASH_MASK);
25 }
26
29 Acts::GeometryIdentifier geoId{};
30 const Acts::Surface* surface{nullptr};
31 };
32
33 struct DetectorElementToActsGeometryIdMap : std::unordered_map<ActsTrk::DetectorElementKey,
34 DetectorElementGeoInfo>
35 {
36 // utilities to abstract what is actually stored
37 static DetectorElementGeoInfo makeValue(const Acts::GeometryIdentifier &geo_id,
38 const Acts::Surface *surface = nullptr) {
39 return DetectorElementGeoInfo{geo_id, surface};
40 }
41 static const Acts::GeometryIdentifier &getValue(const value_type &element) {
42 return element.second.geoId;
43 }
44
45 static const Acts::Surface *getSurface(const value_type &element) {
46 return element.second.surface;
47 }
48 };
49}
50
51#endif
The AlignStoreProviderAlg loads the rigid alignment corrections and pipes them through the readout ge...
constexpr unsigned int DETELEMENT_HASH_MASK
constexpr unsigned int DETELEMENT_TYPE_SHIFT
DetectorElementKey makeDetectorElementKey(xAOD::UncalibMeasType meas_type, unsigned int identifier_hash)
UncalibMeasType
Define the type of the uncalibrated measurement.
Geometry identifier and surface of a detector element.
static DetectorElementGeoInfo makeValue(const Acts::GeometryIdentifier &geo_id, const Acts::Surface *surface=nullptr)
static const Acts::GeometryIdentifier & getValue(const value_type &element)
static const Acts::Surface * getSurface(const value_type &element)
Surface of the detector element, or nullptr if none was stored.