ATLAS Offline Software
Loading...
Searching...
No Matches
IdentityHelper.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3*/
4
6
7#include <stdexcept>
8
17 : m_elem(elem), m_isInDet(false) {
18 if (const auto* siElem = dynamic_cast<const InDetDD::SiDetectorElement*>(m_elem)) {
19 m_isInDet = true;
20 if (siElem->isPixel()) {
21 m_helper = static_cast<const PixelID*>(siElem->getIdHelper());
22 } else if (siElem->isSCT()) {
23 m_helper = static_cast<const SCT_ID*>(siElem->getIdHelper());
24 }
25 } else if (const auto* hgtdElem = dynamic_cast<const InDetDD::HGTD_DetectorElement*>(m_elem)) {
26 m_helper = static_cast<const HGTD_ID*>(hgtdElem->getIdHelper());
27 } else {
28 throw std::invalid_argument(
29 "ActsInterop IdentityHelper constructed with "
30 "SolidStateDetectorElementBase... can only be used for Pixel, SCT and "
31 "HGTD det elements");
32 }
33}
34
35const PixelID*
37{
38 return std::get<const PixelID*>(m_helper);
39}
40const SCT_ID*
42{
43 return std::get<const SCT_ID*>(m_helper);
44}
45
46const HGTD_ID*
48{
49 return std::get<const HGTD_ID*>(m_helper);
50}
51
52int
54{
55 auto id = m_elem->identify();
56 if (m_isInDet) {
57 const InDetDD::SiDetectorElement* thisElement =
58 static_cast<const InDetDD::SiDetectorElement*>(m_elem);
59 if (thisElement->isPixel()) {
60 return getPixelIDHelper()->barrel_ec(id);
61 } else {
62 return getSCTIDHelper()->barrel_ec(id);
63 }
64 } else {
65 return getHgtdIdHelper()->endcap(id);
66 }
67}
68
69int
71{
72 auto id = m_elem->identify();
73 if (m_isInDet) {
74 const InDetDD::SiDetectorElement* thisElement =
75 static_cast<const InDetDD::SiDetectorElement*>(m_elem);
76 if (thisElement->isPixel()) {
77 return getPixelIDHelper()->layer_disk(id);
78 } else {
79 return getSCTIDHelper()->layer_disk(id);
80 }
81 } else {
82 return getHgtdIdHelper()->layer(id);
83 }
84}
85
86int
88{
89 auto id = m_elem->identify();
90 if (m_isInDet) {
91 const InDetDD::SiDetectorElement* thisElement =
92 static_cast<const InDetDD::SiDetectorElement*>(m_elem);
93 if (thisElement->isPixel()) {
94 return getPixelIDHelper()->phi_module(id);
95 } else {
96 return getSCTIDHelper()->phi_module(id);
97 }
98 } else {
99 return getHgtdIdHelper()->phi_module(id);
100 }
101}
102
103int
105{
106 auto id = m_elem->identify();
107 if (m_isInDet) {
108 const InDetDD::SiDetectorElement* thisElement =
109 static_cast<const InDetDD::SiDetectorElement*>(m_elem);
110 if (thisElement->isPixel()) {
111 return getPixelIDHelper()->eta_module(id);
112 } else {
113 return getSCTIDHelper()->eta_module(id);
114 }
115 } else {
116 return getHgtdIdHelper()->eta_module(id);
117 }
118}
119
120int
122{
123 auto id = m_elem->identify();
124 if (m_isInDet) {
125 const InDetDD::SiDetectorElement* thisElement =
126 static_cast<const InDetDD::SiDetectorElement*>(m_elem);
127 if (thisElement->isPixel()) {
128 return 0;
129 } else {
130 return getSCTIDHelper()->side(id);
131 }
132 } else {
133 return 0;
134 }
135}
136
137int
139{
140 auto id = m_elem->identify();
141 if (m_isInDet) {
142 const InDetDD::SiDetectorElement* thisElement =
143 static_cast<const InDetDD::SiDetectorElement*>(m_elem);
144 if (thisElement->isPixel()) {
145 return getPixelIDHelper()->phi_module_max(id);
146 } else {
147 return getSCTIDHelper()->phi_module_max(id);
148 }
149 } else {
150 return getHgtdIdHelper()->phi_module_max(id);
151 }
152}
153
154int
156{
157 auto id = m_elem->identify();
158 if (m_isInDet) {
159 const InDetDD::SiDetectorElement* thisElement =
160 static_cast<const InDetDD::SiDetectorElement*>(m_elem);
161 if (thisElement->isPixel()) {
162 return getPixelIDHelper()->eta_module_max(id);
163 } else {
164 return getSCTIDHelper()->eta_module_max(id);
165 }
166 } else {
167 return getHgtdIdHelper()->eta_module_max(id);
168 }
169}
This is an Identifier helper class for the Pixel subdetector.
This is an Identifier helper class for the SCT subdetector.
This is an Identifier helper class for the HGTD subdetector.
Definition HGTD_ID.h:47
int eta_module(const Identifier &id) const
Definition HGTD_ID.h:491
int phi_module_max(const Identifier &id) const
Definition HGTD_ID.cxx:101
int eta_module_max(const Identifier &id) const
Definition HGTD_ID.cxx:120
int layer(const Identifier &id) const
Definition HGTD_ID.h:477
int endcap(const Identifier &id) const
Values of different levels (failure returns 0).
Definition HGTD_ID.h:470
int phi_module(const Identifier &id) const
Definition HGTD_ID.h:484
IdentityHelper(const InDetDD::SolidStateDetectorElementBase *detElement)
const HGTD_ID * getHgtdIdHelper() const
const InDetDD::SolidStateDetectorElementBase * m_elem
int phi_module() const
int eta_module_max() const
const SCT_ID * getSCTIDHelper() const
int eta_module() const
const PixelID * getPixelIDHelper() const
int layer_disk() const
int phi_module_max() const
std::variant< const PixelID *, const SCT_ID *, const HGTD_ID * > m_helper
Class to hold geometrical description of an HGTD detector element.
Class to hold geometrical description of a silicon detector element.
Class to hold geometrical description of a solid state detector element.
This is an Identifier helper class for the Pixel subdetector.
Definition PixelID.h:69
int layer_disk(const Identifier &id) const
Definition PixelID.h:602
int eta_module_max(const Identifier &id) const
Definition PixelID.cxx:80
int barrel_ec(const Identifier &id) const
Values of different levels (failure returns 0).
Definition PixelID.h:595
int eta_module(const Identifier &id) const
Definition PixelID.h:627
int phi_module(const Identifier &id) const
Definition PixelID.h:620
int phi_module_max(const Identifier &id) const
Definition PixelID.cxx:124
This is an Identifier helper class for the SCT subdetector.
Definition SCT_ID.h:68
int phi_module_max(const Identifier &id) const
Definition SCT_ID.cxx:205
int layer_disk(const Identifier &id) const
Definition SCT_ID.h:687
int side(const Identifier &id) const
Definition SCT_ID.h:705
int phi_module(const Identifier &id) const
Definition SCT_ID.h:693
int barrel_ec(const Identifier &id) const
Values of different levels (failure returns 0).
Definition SCT_ID.h:681
int eta_module_max(const Identifier &id) const
Definition SCT_ID.cxx:183
int eta_module(const Identifier &id) const
Definition SCT_ID.h:699