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 <cstddef>
8
#include <cstdint>
9
#include <optional>
10
#include <unordered_map>
11
12
namespace
ActsTrk
{
13
30
31
class
GeometryIdMapping
{
32
public
:
33
using
detray_id_type
= std::uint64_t;
34
using
acts_id_type
= std::uint64_t;
35
36
GeometryIdMapping
() =
default
;
37
39
void
reserve
(std::size_t nSurfaces) {
40
m_detrayToActs
.reserve(nSurfaces);
41
m_detrayToAthena
.reserve(nSurfaces);
42
m_actsToDetray
.reserve(nSurfaces);
43
m_athenaToDetray
.reserve(nSurfaces);
44
}
45
49
void
addEntry
(
detray_id_type
detrayId,
acts_id_type
actsId,
50
std::optional<Identifier> athenaId = std::nullopt) {
51
52
53
m_detrayToActs
.emplace(detrayId,actsId);
54
m_actsToDetray
.emplace(actsId, detrayId);
55
56
if
(athenaId.has_value()) {
57
m_detrayToAthena
.emplace(detrayId,athenaId->get_compact());
58
m_athenaToDetray
.emplace(athenaId->get_compact(), detrayId);
59
}
60
}
61
62
void
addDetDescIndex
(
detray_id_type
detray_id,
unsigned
int
index
) {
63
m_detrayToDetDescIndex
[detray_id] =
index
;
64
}
65
68
std::optional<acts_id_type>
detrayToActs
(
detray_id_type
detrayId)
const
{
69
auto
it =
m_detrayToActs
.find(detrayId);
70
return
it ==
m_detrayToActs
.end() ? std::nullopt
71
: std::optional{it->second};
72
}
73
std::optional<detray_id_type>
actsToDetray
(
acts_id_type
actsId)
const
{
74
auto
it =
m_actsToDetray
.find(actsId);
75
return
it ==
m_actsToDetray
.end() ? std::nullopt
76
: std::optional{it->second};
77
}
78
79
82
std::optional<Identifier>
detrayToAthena
(
detray_id_type
detrayId)
const
{
83
auto
it =
m_detrayToAthena
.find(detrayId);
84
if
(it ==
m_detrayToAthena
.end())
return
std::nullopt;
85
return
Identifier
(it->second);
86
}
87
std::optional<detray_id_type>
athenaToDetray
(
const
Identifier
& athenaId)
const
{
88
auto
it =
m_athenaToDetray
.find(athenaId.
get_compact
());
89
return
it ==
m_athenaToDetray
.end() ? std::nullopt
90
: std::optional{it->second};
91
}
92
93
94
std::optional<Identifier>
actsToAthena
(
acts_id_type
actsId)
const
{
95
auto
d =
actsToDetray
(actsId);
96
return
d ?
detrayToAthena
(*d) : std::nullopt;
97
}
98
std::optional<acts_id_type>
athenaToActs
(
const
Identifier
& athenaId)
const
{
99
auto
d =
athenaToDetray
(athenaId);
100
return
d ?
detrayToActs
(*d) : std::nullopt;
101
}
102
103
std::size_t
size
()
const
{
return
m_detrayToActs
.size(); }
104
const
std::unordered_map<detray_id_type, Identifier::value_type>&
105
detrayToAthenaMap
()
const
{
return
m_detrayToAthena
; }
106
107
std::optional<size_t>
detrayToDetDescIndex
(
detray_id_type
detray_id)
const
{
108
auto
it =
m_detrayToDetDescIndex
.find(detray_id);
109
return
it ==
m_detrayToDetDescIndex
.end() ? std::nullopt : std::optional(it->second);
110
}
111
112
private
:
113
std::unordered_map<detray_id_type, acts_id_type>
m_detrayToActs
;
114
std::unordered_map<detray_id_type, Identifier::value_type>
m_detrayToAthena
;
115
116
std::unordered_map<acts_id_type, detray_id_type>
m_actsToDetray
;
117
std::unordered_map<Identifier::value_type, detray_id_type>
m_athenaToDetray
;
118
119
std::unordered_map<detray_id_type, size_t>
m_detrayToDetDescIndex
;
120
};
121
122
}
// namespace ActsTrk
123
124
// Needed to record/retrieve this via StoreGate
125
#include "
AthenaKernel/CLASS_DEF.h
"
126
127
CLASS_DEF
(
ActsTrk::GeometryIdMapping
, 263041249, 1)
128
129
#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:31
ActsTrk::GeometryIdMapping::m_actsToDetray
std::unordered_map< acts_id_type, detray_id_type > m_actsToDetray
Definition
GeometryIdMapping.h:116
ActsTrk::GeometryIdMapping::detrayToActs
std::optional< acts_id_type > detrayToActs(detray_id_type detrayId) const
Definition
GeometryIdMapping.h:68
ActsTrk::GeometryIdMapping::size
std::size_t size() const
Definition
GeometryIdMapping.h:103
ActsTrk::GeometryIdMapping::m_detrayToAthena
std::unordered_map< detray_id_type, Identifier::value_type > m_detrayToAthena
Definition
GeometryIdMapping.h:114
ActsTrk::GeometryIdMapping::acts_id_type
std::uint64_t acts_id_type
Definition
GeometryIdMapping.h:34
ActsTrk::GeometryIdMapping::m_detrayToDetDescIndex
std::unordered_map< detray_id_type, size_t > m_detrayToDetDescIndex
Definition
GeometryIdMapping.h:119
ActsTrk::GeometryIdMapping::detrayToAthenaMap
const std::unordered_map< detray_id_type, Identifier::value_type > & detrayToAthenaMap() const
Definition
GeometryIdMapping.h:105
ActsTrk::GeometryIdMapping::actsToDetray
std::optional< detray_id_type > actsToDetray(acts_id_type actsId) const
Definition
GeometryIdMapping.h:73
ActsTrk::GeometryIdMapping::athenaToActs
std::optional< acts_id_type > athenaToActs(const Identifier &athenaId) const
Definition
GeometryIdMapping.h:98
ActsTrk::GeometryIdMapping::m_detrayToActs
std::unordered_map< detray_id_type, acts_id_type > m_detrayToActs
Definition
GeometryIdMapping.h:113
ActsTrk::GeometryIdMapping::detrayToAthena
std::optional< Identifier > detrayToAthena(detray_id_type detrayId) const
Definition
GeometryIdMapping.h:82
ActsTrk::GeometryIdMapping::actsToAthena
std::optional< Identifier > actsToAthena(acts_id_type actsId) const
Definition
GeometryIdMapping.h:94
ActsTrk::GeometryIdMapping::detrayToDetDescIndex
std::optional< size_t > detrayToDetDescIndex(detray_id_type detray_id) const
Definition
GeometryIdMapping.h:107
ActsTrk::GeometryIdMapping::addDetDescIndex
void addDetDescIndex(detray_id_type detray_id, unsigned int index)
Definition
GeometryIdMapping.h:62
ActsTrk::GeometryIdMapping::athenaToDetray
std::optional< detray_id_type > athenaToDetray(const Identifier &athenaId) const
Definition
GeometryIdMapping.h:87
ActsTrk::GeometryIdMapping::m_athenaToDetray
std::unordered_map< Identifier::value_type, detray_id_type > m_athenaToDetray
Definition
GeometryIdMapping.h:117
ActsTrk::GeometryIdMapping::detray_id_type
std::uint64_t detray_id_type
Definition
GeometryIdMapping.h:33
ActsTrk::GeometryIdMapping::reserve
void reserve(std::size_t nSurfaces)
Reserve storage for nSurfaces detray surfaces.
Definition
GeometryIdMapping.h:39
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:49
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
index
Definition
index.py:1
Generated on
for ATLAS Offline Software by
1.17.0