ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Tracking
Acts
ActsGPUEvent
ActsGPUEvent
GeometryIdMapping.h
Go to the documentation of this file.
1
// Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
2
#ifndef ACTSTRKEVENT_GEOMETRYIDMAPPING_H
3
#define ACTSTRKEVENT_GEOMETRYIDMAPPING_H
4
5
#include "Identifier/Identifier.h"
6
7
#include <cstdint>
8
#include <limits>
9
#include <optional>
10
#include <unordered_map>
11
#include <vector>
12
13
namespace
ActsTrk
{
14
31
32
class
GeometryIdMapping
{
33
public
:
34
using
detray_id_type
= std::uint64_t;
35
using
acts_id_type
= std::uint64_t;
36
37
GeometryIdMapping
() =
default
;
38
40
void
reserve
(std::size_t nSurfaces) {
41
m_detrayToActs
.reserve(nSurfaces);
42
m_detrayToAthena
.reserve(nSurfaces);
43
m_actsToDetray
.reserve(nSurfaces);
44
m_athenaToDetray
.reserve(nSurfaces);
45
}
46
50
void
addEntry
(
detray_id_type
detrayId,
acts_id_type
actsId,
51
std::optional<Identifier> athenaId = std::nullopt) {
52
53
54
m_detrayToActs
.emplace(detrayId,actsId);
55
m_actsToDetray
.emplace(actsId, detrayId);
56
57
if
(athenaId.has_value()) {
58
m_detrayToAthena
.emplace(detrayId,athenaId->get_compact());
59
m_athenaToDetray
.emplace(athenaId->get_compact(), detrayId);
60
}
61
}
62
65
std::optional<acts_id_type>
detrayToActs
(
detray_id_type
detrayId)
const
{
66
auto
it =
m_detrayToActs
.find(detrayId);
67
return
it ==
m_detrayToActs
.end() ? std::nullopt
68
: std::optional{it->second};
69
}
70
std::optional<detray_id_type>
actsToDetray
(
acts_id_type
actsId)
const
{
71
auto
it =
m_actsToDetray
.find(actsId);
72
return
it ==
m_actsToDetray
.end() ? std::nullopt
73
: std::optional{it->second};
74
}
75
76
79
std::optional<Identifier>
detrayToAthena
(
detray_id_type
detrayId)
const
{
80
auto
it =
m_detrayToAthena
.find(detrayId);
81
if
(it ==
m_detrayToAthena
.end())
return
std::nullopt;
82
return
Identifier
(it->second);
83
}
84
std::optional<detray_id_type>
athenaToDetray
(
const
Identifier
& athenaId)
const
{
85
auto
it =
m_athenaToDetray
.find(athenaId.
get_compact
());
86
return
it ==
m_athenaToDetray
.end() ? std::nullopt
87
: std::optional{it->second};
88
}
89
90
91
std::optional<Identifier>
actsToAthena
(
acts_id_type
actsId)
const
{
92
auto
d =
actsToDetray
(actsId);
93
return
d ?
detrayToAthena
(*d) : std::nullopt;
94
}
95
std::optional<acts_id_type>
athenaToActs
(
const
Identifier
& athenaId)
const
{
96
auto
d =
athenaToDetray
(athenaId);
97
return
d ?
detrayToActs
(*d) : std::nullopt;
98
}
99
100
std::size_t
size
()
const
{
return
m_detrayToActs
.size(); }
101
const
std::unordered_map<detray_id_type, Identifier::value_type>&
102
detrayToAthenaMap
()
const
{
return
m_detrayToAthena
; }
103
104
private
:
105
std::unordered_map<detray_id_type, acts_id_type>
m_detrayToActs
;
106
std::unordered_map<detray_id_type, Identifier::value_type>
m_detrayToAthena
;
107
108
std::unordered_map<acts_id_type, detray_id_type>
m_actsToDetray
;
109
std::unordered_map<Identifier::value_type, detray_id_type>
m_athenaToDetray
;
110
};
111
112
}
// namespace ActsTrk
113
114
// Needed to record/retrieve this via StoreGate
115
#include "
AthenaKernel/CLASS_DEF.h
"
116
117
CLASS_DEF
(
ActsTrk::GeometryIdMapping
, 263041249, 1)
118
119
#endif
// ACTSTRKEVENT_GEOMETRYIDMAPPING_H
CLASS_DEF.h
macros to associate a CLID to a type
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:67
ActsTrk::GeometryIdMapping
Lookup table between the three surface-identifier "worlds" used across the ACTS / Detray / Athena tra...
Definition
GeometryIdMapping.h:32
ActsTrk::GeometryIdMapping::m_actsToDetray
std::unordered_map< acts_id_type, detray_id_type > m_actsToDetray
Definition
GeometryIdMapping.h:108
ActsTrk::GeometryIdMapping::detrayToActs
std::optional< acts_id_type > detrayToActs(detray_id_type detrayId) const
Definition
GeometryIdMapping.h:65
ActsTrk::GeometryIdMapping::size
std::size_t size() const
Definition
GeometryIdMapping.h:100
ActsTrk::GeometryIdMapping::m_detrayToAthena
std::unordered_map< detray_id_type, Identifier::value_type > m_detrayToAthena
Definition
GeometryIdMapping.h:106
ActsTrk::GeometryIdMapping::acts_id_type
std::uint64_t acts_id_type
Definition
GeometryIdMapping.h:35
ActsTrk::GeometryIdMapping::detrayToAthenaMap
const std::unordered_map< detray_id_type, Identifier::value_type > & detrayToAthenaMap() const
Definition
GeometryIdMapping.h:102
ActsTrk::GeometryIdMapping::actsToDetray
std::optional< detray_id_type > actsToDetray(acts_id_type actsId) const
Definition
GeometryIdMapping.h:70
ActsTrk::GeometryIdMapping::athenaToActs
std::optional< acts_id_type > athenaToActs(const Identifier &athenaId) const
Definition
GeometryIdMapping.h:95
ActsTrk::GeometryIdMapping::m_detrayToActs
std::unordered_map< detray_id_type, acts_id_type > m_detrayToActs
Definition
GeometryIdMapping.h:105
ActsTrk::GeometryIdMapping::detrayToAthena
std::optional< Identifier > detrayToAthena(detray_id_type detrayId) const
Definition
GeometryIdMapping.h:79
ActsTrk::GeometryIdMapping::actsToAthena
std::optional< Identifier > actsToAthena(acts_id_type actsId) const
Definition
GeometryIdMapping.h:91
ActsTrk::GeometryIdMapping::athenaToDetray
std::optional< detray_id_type > athenaToDetray(const Identifier &athenaId) const
Definition
GeometryIdMapping.h:84
ActsTrk::GeometryIdMapping::m_athenaToDetray
std::unordered_map< Identifier::value_type, detray_id_type > m_athenaToDetray
Definition
GeometryIdMapping.h:109
ActsTrk::GeometryIdMapping::detray_id_type
std::uint64_t detray_id_type
Definition
GeometryIdMapping.h:34
ActsTrk::GeometryIdMapping::reserve
void reserve(std::size_t nSurfaces)
Reserve storage for nSurfaces detray surfaces.
Definition
GeometryIdMapping.h:40
ActsTrk::GeometryIdMapping::GeometryIdMapping
GeometryIdMapping()=default
ActsTrk::GeometryIdMapping::addEntry
void addEntry(detray_id_type detrayId, acts_id_type actsId, std::optional< Identifier > athenaId=std::nullopt)
Register one detray surface, it has to have a corresponding ACTS surface athenaId is optional,...
Definition
GeometryIdMapping.h:50
Identifier::get_compact
value_type get_compact() const
Get the compact id.
ActsTrk
The AlignStoreProviderAlg loads the rigid alignment corrections and pipes them through the readout ge...
Definition
MdtCalibInput.h:31
Identifier
Definition
IdentifierFieldParser.cxx:14
Generated on
for ATLAS Offline Software by
1.17.0