ATLAS Offline Software
HGTD_DetectorElement.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3 */
4 
7 
8 #include "GeoModelKernel/GeoVFullPhysVol.h"
11 
13 
14 namespace InDetDD {
15 
16 // Constructor with parameters:
18  const HGTD_ModuleDesign *design,
19  const GeoVFullPhysVol *geophysvol,
20  const SiCommonItems * commonItems,
21  const GeoAlignmentStore* geoAlignStore) :
22  SolidStateDetectorElementBase(id, design, geophysvol, commonItems, geoAlignStore)
23 {
24  const HGTD_ID* hgtdId = dynamic_cast<const HGTD_ID *>(getIdHelper());
25  m_idHash = hgtdId->wafer_hash(m_id);
26 
27  if (!m_idHash.is_valid()) throw std::runtime_error("HGTD_DetectorElement: Unable to set IdentifierHash");
28 }
29 
30 // Destructor:
32 {
33 }
34 
37 {
38  Identifier id; // Will be initialized in an invalid state.
39  // If something fails it returns the id in an invalid state.
40  if (cellId.isValid()) {
41  const HGTD_ID * hgtdIdHelper = static_cast<const HGTD_ID *>(getIdHelper());
42  if (hgtdIdHelper) {
43  id = hgtdIdHelper->pixel_id(m_id, cellId.phiIndex(), cellId.etaIndex());
44  }
45  }
46 
47  return id;
48 }
49 
52 {
53  SiCellId cellId; // Initialized in invalid state.
54  // If something fails it returns the cellId in an invalid state.
55  if (identifier.is_valid()) {
56  const HGTD_ID * hgtdIdHelper = static_cast<const HGTD_ID *>(getIdHelper());
57  if (hgtdIdHelper) {
58  cellId = SiCellId(hgtdIdHelper->phi_index(identifier), hgtdIdHelper->eta_index(identifier));
59  }
60  }
61 
62  return cellId;
63 }
64 
65 const std::vector<const Trk::Surface*>& HGTD_DetectorElement::surfaces() const
66 {
67  // This method is needed to satisfy inheritance from TrkDetElementBase
68  // so just return the one surface
69  if (!m_surfaces.isValid()) {
70  std::vector<const Trk::Surface*> s;
71  // get this surface
72  s.push_back(&surface());
73  m_surfaces.set (std::move (s));
74  }
75 
76  // return the surfaces
77  return *m_surfaces.ptr();
78 }
79 
81 {
82  // Calculate z (endcap)
83  // Use center of sensor ((0,0,0) in local coordinates) for determining this.
84  return center().z();
85 }
86 
87 } // namespace InDetDD
GeoAlignmentStore
Ensure that the extensions for the Vector3D are properly loaded.
Definition: GeoAlignmentStore.h:24
python.SystemOfUnits.s
int s
Definition: SystemOfUnits.py:131
CxxUtils::CachedValue::ptr
const T * ptr() const
Return a pointer to the cached value.
InDetDD::HGTD_DetectorElement::~HGTD_DetectorElement
virtual ~HGTD_DetectorElement()
Destructor:
Definition: HGTD_DetectorElement.cxx:31
InDetDD::HGTD_DetectorElement::m_surfaces
CxxUtils::CachedValue< std::vector< const Trk::Surface * > > m_surfaces
Definition: HGTD_DetectorElement.h:113
InDetDD::HGTD_DetectorElement::cellIdFromIdentifier
SiCellId cellIdFromIdentifier(const Identifier &identifier) const override final
SiCellId from Identifier.
Definition: HGTD_DetectorElement.cxx:51
HGTD_ID::wafer_hash
IdentifierHash wafer_hash(Identifier wafer_id) const
wafer hash from id
Definition: HGTD_ID.h:404
InDetDD::SolidStateDetectorElementBase
Definition: SolidStateDetectorElementBase.h:132
InDetDD::SolidStateDetectorElementBase::m_idHash
IdentifierHash m_idHash
hash id of this detector element
Definition: SolidStateDetectorElementBase.h:649
CxxUtils::CachedValue::isValid
bool isValid() const
Test to see if the value is valid.
InDetDD::SolidStateDetectorElementBase::center
virtual const Amg::Vector3D & center() const override final
Center in global coordinates.
InDetDD::SiCellId::isValid
bool isValid() const
Test if its in a valid state.
Definition: SiCellId.h:136
InDetDD::SolidStateDetectorElementBase::surface
Trk::Surface & surface()
Element Surface.
HGTD_ID::eta_index
int eta_index(const Identifier &id) const
Definition: HGTD_ID.h:503
InDetDD::SiCellId::phiIndex
int phiIndex() const
Get phi index. Equivalent to strip().
Definition: SiCellId.h:122
xAOD::identifier
identifier
Definition: UncalibratedMeasurement_v1.cxx:15
InDetDD::HGTD_DetectorElement::surfaces
virtual const std::vector< const Trk::Surface * > & surfaces() const
Returns the full list of surfaces associated to this detector element.
Definition: HGTD_DetectorElement.cxx:65
InDetDD::SolidStateDetectorElementBase::getIdHelper
const AtlasDetectorID * getIdHelper() const
Returns the id helper (inline)
HGTD_ID::phi_index
int phi_index(const Identifier &id) const
Definition: HGTD_ID.h:496
AtlasDetectorID.h
This class provides an interface to generate or decode an identifier for the upper levels of the dete...
InDetDD::SiCellId::etaIndex
int etaIndex() const
Get eta index.
Definition: SiCellId.h:114
HGTD_DetectorElement.h
HGTD_ID
Definition: HGTD_ID.h:47
IdentifierHash::is_valid
bool is_valid() const
Check if id is in a valid state.
GeoAlignmentStore.h
id
SG::auxid_t id
Definition: Control/AthContainers/Root/debug.cxx:227
InDetDD::SiCommonItems
Definition: SiCommonItems.h:45
HGTD_ID.h
CxxUtils::CachedValue::set
void set(const T &val) const
Set the value, assuming it is currently invalid.
HGTD_ID::pixel_id
Identifier pixel_id(int endcap, int layer, int phi_module, int eta_module, int phi_index, int eta_index) const
For an individual pixel.
Definition: HGTD_ID.h:331
InDetDD::SiCellId
Definition: SiCellId.h:29
InDetDD::SolidStateDetectorElementBase::m_id
Identifier m_id
identifier of this detector element
Definition: SolidStateDetectorElementBase.h:623
InDetDD
Message Stream Member.
Definition: FakeTrackBuilder.h:8
InDetDD::HGTD_DetectorElement::HGTD_DetectorElement
HGTD_DetectorElement(const Identifier &id, const HGTD_ModuleDesign *design, const GeoVFullPhysVol *geophysvol, const SiCommonItems *commonItems, const GeoAlignmentStore *geoAlignStore=nullptr)
Constructor:
Definition: HGTD_DetectorElement.cxx:17
PlaneSurface.h
InDetDD::HGTD_ModuleDesign
Definition: HGTD_ModuleDesign.h:43
InDetDD::HGTD_DetectorElement::identifierFromCellId
Identifier identifierFromCellId(const SiCellId &cellId) const override final
Identifier from SiCellId (ie pixel eta_index,phi_index)
Definition: HGTD_DetectorElement.cxx:36
InDetDD::HGTD_DetectorElement::get_rz
double get_rz() const override final
Definition: HGTD_DetectorElement.cxx:80
Identifier
Definition: IdentifierFieldParser.cxx:14