2 Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
6 * @file SolidStateDetectorElementBase.icc
11 ///////////////////////////////////////////////////////////////////
13 ///////////////////////////////////////////////////////////////////
15 inline Trk::DetectorElemType SolidStateDetectorElementBase::detectorType() const{
16 return Trk::DetectorElemType::SolidState;
19 inline void SolidStateDetectorElementBase::invalidate()
24 inline const SiCommonItems* SolidStateDetectorElementBase::getCommonItems() const
29 inline Identifier SolidStateDetectorElementBase::identify() const
34 inline IdentifierHash SolidStateDetectorElementBase::identifyHash() const
39 inline const AtlasDetectorID* SolidStateDetectorElementBase::getIdHelper() const
41 return m_commonItems->getIdHelper();
44 inline Trk::Surface& SolidStateDetectorElementBase::surface()
49 inline const Trk::Surface& SolidStateDetectorElementBase::surface() const
54 inline const Trk::Surface& SolidStateDetectorElementBase::surface(const Identifier&) const
59 inline const Amg::Transform3D& SolidStateDetectorElementBase::transform() const
61 if (!m_cache.isValid()) {
64 return m_cache.ptr()->m_transform;
67 inline const Amg::Transform3D& SolidStateDetectorElementBase::transform(const Identifier&) const
72 inline double SolidStateDetectorElementBase::hitDepthDirection() const
74 return depthDirection() ? 1 : -1;
77 inline double SolidStateDetectorElementBase::hitPhiDirection() const
79 return phiDirection() ? 1 : -1;
82 inline double SolidStateDetectorElementBase::hitEtaDirection() const
84 return etaDirection() ? 1 : -1;
87 inline const Amg::Vector3D& SolidStateDetectorElementBase::normal() const
89 if (!m_cache.isValid()) {
92 return m_cache.ptr()->m_normal;
95 inline const Amg::Vector3D& SolidStateDetectorElementBase::center() const
97 if (!m_cache.isValid()) {
100 return m_cache.ptr()->m_center;
103 inline const Amg::Vector3D& SolidStateDetectorElementBase::normal(const Identifier&) const
108 inline const Amg::Vector3D& SolidStateDetectorElementBase::center(const Identifier&) const
113 inline const GeoTrf::Transform3D& SolidStateDetectorElementBase::transformHit() const
115 if (!m_cache.isValid()) {
118 return m_cache.ptr()->m_transformHit;
121 inline HepGeom::Point3D<double> SolidStateDetectorElementBase::globalPositionHit(const HepGeom::Point3D<double>& simulationLocalPos) const
123 return Amg::EigenTransformToCLHEP(transformHit())*simulationLocalPos;
126 inline Amg::Vector3D SolidStateDetectorElementBase::globalPositionHit(const Amg::Vector3D& simulationLocalPos) const
128 return transformHit() * simulationLocalPos;
131 inline HepGeom::Point3D<double> SolidStateDetectorElementBase::globalPosition(const HepGeom::Point3D<double>& localPos) const
133 return transformCLHEP() * localPos;
136 inline Amg::Vector3D SolidStateDetectorElementBase::globalPosition(const Amg::Vector3D& localPos) const
138 return transform() * localPos;
140 //NB - these methods use "origin" not "center" - these are equivalent for most cases
141 //For ITk Strip endcaps they differ because of the local sensor frame being defined with respect to the beamline, due to the sensor shape
142 //Therefore, "local" positions for these elements will have large r components
144 inline Amg::Vector3D SolidStateDetectorElementBase::globalPosition(const Amg::Vector2D& localPos) const
146 if (!m_cache.isValid()) updateCache();
147 const CachedVals& cache = *m_cache.ptr();
148 return cache.m_origin + localPos[Trk::distEta] * cache.m_etaAxis + localPos[Trk::distPhi] * cache.m_phiAxis;
151 inline Amg::Vector2D SolidStateDetectorElementBase::localPosition(const HepGeom::Point3D<double>& globalPosition) const
153 if (!m_cache.isValid()) updateCache();
154 const CachedVals& cache = *m_cache.ptr();
155 HepGeom::Vector3D<double> relativePos = globalPosition - cache.m_centerCLHEP;
156 return Amg::Vector2D(relativePos.dot(cache.m_phiAxisCLHEP), relativePos.dot(cache.m_etaAxisCLHEP));
159 inline Amg::Vector2D SolidStateDetectorElementBase::localPosition(const Amg::Vector3D& globalPosition) const
161 if (!m_cache.isValid()) updateCache();
162 const CachedVals& cache = *m_cache.ptr();
163 Amg::Vector3D relativePos = globalPosition - cache.m_center;
164 return Amg::Vector2D(relativePos.dot(cache.m_phiAxis), relativePos.dot(cache.m_etaAxis));
167 inline double SolidStateDetectorElementBase::rMin() const
169 if (!m_cache.isValid()) updateCache();
170 return m_cache.ptr()->m_minR;
173 inline double SolidStateDetectorElementBase::rMax() const
175 if (!m_cache.isValid()) updateCache();
176 return m_cache.ptr()->m_maxR;
179 inline double SolidStateDetectorElementBase::zMin() const
181 if (!m_cache.isValid()) updateCache();
182 return m_cache.ptr()->m_minZ;
185 inline double SolidStateDetectorElementBase::zMax() const
187 if (!m_cache.isValid()) updateCache();
188 return m_cache.ptr()->m_maxZ;
191 inline double SolidStateDetectorElementBase::phiMin() const
193 if (!m_cache.isValid()) updateCache();
194 return m_cache.ptr()->m_minPhi;
197 inline double SolidStateDetectorElementBase::phiMax() const
199 if (!m_cache.isValid()) updateCache();
200 return m_cache.ptr()->m_maxPhi;
203 inline const DetectorDesign& SolidStateDetectorElementBase::design() const
208 inline const Trk::SurfaceBounds& SolidStateDetectorElementBase::bounds(const Identifier&) const
213 inline double SolidStateDetectorElementBase::width() const
215 return m_design->width();
218 inline double SolidStateDetectorElementBase::minWidth() const
220 return m_design->minWidth();
223 inline double SolidStateDetectorElementBase::maxWidth() const
225 return m_design->maxWidth();
228 inline double SolidStateDetectorElementBase::length() const
230 return m_design->length();
233 inline double SolidStateDetectorElementBase::thickness() const
235 return m_design->thickness();
238 inline double SolidStateDetectorElementBase::etaPitch() const
240 return m_design->etaPitch();
243 inline double SolidStateDetectorElementBase::phiPitch() const
245 return m_design->phiPitch();
248 inline InDetDD::CarrierType SolidStateDetectorElementBase::carrierType() const
250 return m_design->carrierType();
253 inline bool SolidStateDetectorElementBase::swapPhiReadoutDirection() const
255 bool dir = phiDirection();
256 // equivalent to (m_design->swapHitPhiReadoutDirection() xor !m_phiDirection)
257 return (!m_design->swapHitPhiReadoutDirection() && !dir)
258 || (m_design->swapHitPhiReadoutDirection() && dir);
261 inline bool SolidStateDetectorElementBase::swapEtaReadoutDirection() const
263 bool dir = etaDirection();
264 // equivalent to (m_design->swapHitEtaReadoutDirection() xor !m_etaDirection)
265 return ((!m_design->swapHitEtaReadoutDirection() && !dir)
266 || (m_design->swapHitEtaReadoutDirection() && dir));
269 inline MsgStream& SolidStateDetectorElementBase::msg(MSG::Level lvl) const
271 return m_commonItems->msg(lvl);
274 inline bool SolidStateDetectorElementBase::msgLvl(MSG::Level lvl) const
276 return m_commonItems->msgLvl(lvl);
279 inline bool SolidStateDetectorElementBase::depthDirection() const
281 if (!m_axisDir.isValid()) updateCache();
282 return m_axisDir.ptr()->m_depthDirection;
285 inline bool SolidStateDetectorElementBase::etaDirection() const
287 if (!m_axisDir.isValid()) updateCache();
288 return m_axisDir.ptr()->m_etaDirection;
291 inline bool SolidStateDetectorElementBase::phiDirection() const
293 if (!m_axisDir.isValid()) updateCache();
294 return m_axisDir.ptr()->m_phiDirection;
297 inline double SolidStateDetectorElementBase::depthAngle() const
299 if (!m_axisDir.isValid()) updateCache();
300 return m_axisDir.ptr()->m_depthAngle;
303 inline double SolidStateDetectorElementBase::etaAngle() const
305 if (!m_axisDir.isValid()) updateCache();
306 return m_axisDir.ptr()->m_etaAngle;
309 inline double SolidStateDetectorElementBase::phiAngle() const
311 if (!m_axisDir.isValid()) updateCache();
312 return m_axisDir.ptr()->m_phiAngle;
315 } // namespace InDetDD