ATLAS Offline Software
IdentityHelper.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
3 */
4 
6 
10 
11 #include <stdexcept>
13  : m_elem(elem)
14 {
15  if ( m_elem->isPixel() ) {
16  m_helper = static_cast<const PixelID*>(m_elem->getIdHelper());
17  } else if ( m_elem->isSCT()) {
18  m_helper = static_cast<const SCT_ID*>(m_elem->getIdHelper());
19  } else {
20  throw std::invalid_argument("ActsInterop IdentityHelper can only bes ued fro SCT & Pixel det elements");
21  }
22 }
23 
24 
25 const PixelID*
27 {
28  return std::get<const PixelID*>(m_helper);
29 }
30 const SCT_ID*
32 {
33  return std::get<const SCT_ID*>(m_helper);
34 }
35 
36 int
38 {
39  auto id = m_elem->identify();
40  if (m_elem->isPixel()) {
41  return getPixelIDHelper()->barrel_ec(id);
42  }
43  else {
44  return getSCTIDHelper()->barrel_ec(id);
45  }
46 }
47 
48 int
50 {
51  auto id = m_elem->identify();
52  if (m_elem->isPixel()) {
53  return getPixelIDHelper()->layer_disk(id);
54  }
55  else {
56  return getSCTIDHelper()->layer_disk(id);
57  }
58 }
59 
60 int
62 {
63  auto id = m_elem->identify();
64  if (m_elem->isPixel()) {
65  return getPixelIDHelper()->phi_module(id);
66  }
67  else {
68  return getSCTIDHelper()->phi_module(id);
69  }
70 }
71 
72 int
74 {
75  auto id = m_elem->identify();
76  if (m_elem->isPixel()) {
77  return getPixelIDHelper()->eta_module(id);
78  }
79  else {
80  return getSCTIDHelper()->eta_module(id);
81  }
82 }
83 
84 int
86 {
87  auto id = m_elem->identify();
88  if (m_elem->isPixel()) {
89  return 0;
90  }
91  else {
92  return getSCTIDHelper()->side(id);
93  }
94 }
95 
96 int
98 {
99  auto id = m_elem->identify();
100  if (m_elem->isPixel()) {
101  return getPixelIDHelper()->phi_module_max(id);
102  }
103  else {
104  return getSCTIDHelper()->phi_module_max(id);
105  }
106 }
107 
108 int
110 {
111  auto id = m_elem->identify();
112  if (m_elem->isPixel()) {
113  return getPixelIDHelper()->eta_module_max(id);
114  }
115  else {
116  return getSCTIDHelper()->eta_module_max(id);
117  }
118 }
PixelID.h
This is an Identifier helper class for the Pixel subdetector. This class is a factory for creating co...
IdentityHelper::phi_module
int phi_module() const
Definition: IdentityHelper.cxx:61
SCT_ID.h
This is an Identifier helper class for the SCT subdetector. This class is a factory for creating comp...
PixelID::barrel_ec
int barrel_ec(const Identifier &id) const
Values of different levels (failure returns 0)
Definition: PixelID.h:619
IdentityHelper.h
IdentityHelper::layer_disk
int layer_disk() const
Definition: IdentityHelper.cxx:49
IdentityHelper::phi_module_max
int phi_module_max() const
Definition: IdentityHelper.cxx:97
SCT_ID::eta_module_max
int eta_module_max(const Identifier &id) const
Definition: SCT_ID.cxx:182
SCT_ID::barrel_ec
int barrel_ec(const Identifier &id) const
Values of different levels (failure returns 0)
Definition: SCT_ID.h:728
SCT_ID::phi_module
int phi_module(const Identifier &id) const
Definition: SCT_ID.h:740
SCT_ID::phi_module_max
int phi_module_max(const Identifier &id) const
Definition: SCT_ID.cxx:204
PixelID::eta_module_max
int eta_module_max(const Identifier &id) const
Definition: PixelID.cxx:80
InDetDD::SolidStateDetectorElementBase::getIdHelper
const AtlasDetectorID * getIdHelper() const
Returns the id helper (inline)
IdentityHelper::getPixelIDHelper
const PixelID * getPixelIDHelper() const
Definition: IdentityHelper.cxx:26
IdentityHelper::side
int side() const
Definition: IdentityHelper.cxx:85
IdentityHelper::m_helper
std::variant< const PixelID *, const SCT_ID * > m_helper
Definition: IdentityHelper.h:30
IdentityHelper::m_elem
const InDetDD::SiDetectorElement * m_elem
Definition: IdentityHelper.h:29
PixelID::phi_module_max
int phi_module_max(const Identifier &id) const
Definition: PixelID.cxx:124
InDetDD::SiDetectorElement::isPixel
bool isPixel() const
PixelID::layer_disk
int layer_disk(const Identifier &id) const
Definition: PixelID.h:626
PixelID::eta_module
int eta_module(const Identifier &id) const
Definition: PixelID.h:651
IdentityHelper::eta_module
int eta_module() const
Definition: IdentityHelper.cxx:73
SCT_ID::layer_disk
int layer_disk(const Identifier &id) const
Definition: SCT_ID.h:734
InDetDD::SiDetectorElement
Definition: SiDetectorElement.h:109
SiDetectorElement.h
IdentityHelper::bec
int bec() const
Definition: IdentityHelper.cxx:37
IdentityHelper::eta_module_max
int eta_module_max() const
Definition: IdentityHelper.cxx:109
IdentityHelper::IdentityHelper
IdentityHelper(const InDetDD::SiDetectorElement *detElem)
Definition: IdentityHelper.cxx:12
SCT_ID
Definition: SCT_ID.h:68
SCT_ID::eta_module
int eta_module(const Identifier &id) const
Definition: SCT_ID.h:746
SCT_ID::side
int side(const Identifier &id) const
Definition: SCT_ID.h:752
InDetDD::SiDetectorElement::isSCT
bool isSCT() const
IdentityHelper::getSCTIDHelper
const SCT_ID * getSCTIDHelper() const
Definition: IdentityHelper.cxx:31
PixelID::phi_module
int phi_module(const Identifier &id) const
Definition: PixelID.h:644
PixelID
Definition: PixelID.h:67
InDetDD::SolidStateDetectorElementBase::identify
virtual Identifier identify() const override final
identifier of this detector element (inline)