ATLAS Offline Software
Loading...
Searching...
No Matches
MuonPhaseII/MuonDetDescr/MuonReadoutGeometryR4/src/RpcReadoutElement.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3*/
5
6
8
10#include <GaudiKernel/SystemOfUnits.h>
11#include <optional>
12
13#ifndef SIMULATIONBASE
14# include "Acts/Surfaces/RectangleBounds.hpp"
15#endif
16using namespace ActsTrk;
17
18namespace MuonGMR4 {
20std::ostream& operator<<(std::ostream& ostr, const parameterBook& pars) {
21 ostr<<"chamber width/length/thickness [mm]: "<<(2.*pars.halfWidth)<<"/";
22 ostr<<(2.*pars.halfLength)<<"/"<<(2.*pars.halfThickness)<<std::endl;
23 if (pars.etaDesign) ostr<<"Eta strips: "<<(*pars.etaDesign)<<std::endl;
24 if (pars.phiDesign) ostr<<"Phi strips: "<<(*pars.phiDesign)<<std::endl;
25 return ostr;
26}
32
34
38
39 ATH_MSG_DEBUG("Parameter book "<<parameterBook());
40 if (m_pars.layers.empty()) {
41 ATH_MSG_FATAL("The readout element "<<idHelperSvc()->toStringDetEl(identify())<<" doesn't have any layers defined");
42 return StatusCode::FAILURE;
43 }
44#ifndef SIMULATIONBASE
46 m_pars.layerBounds->makeBounds<Acts::RectangleBounds>(m_pars.halfWidth,
47 m_pars.halfLength)));
48#endif
49 for (unsigned int layer = 0; layer < m_pars.layers.size(); ++layer) {
50 IdentifierHash layHash{layer};
51 if (!m_pars.layers[layer]) {
52 ATH_MSG_VERBOSE("Layer "<<layer <<" has not sensor layout associated.");
53 continue;
54 }
55 ATH_MSG_VERBOSE("New layer "<<layHash<<", doubletPhi: "<<doubletPhiNumber(layHash)
56 <<", gasGap: "<<gasGapNumber(layHash)<<", measPhi: "<<measuresPhi(layHash));
58#ifndef SIMULATIONBASE
59 const StripDesign& design{sensorLayout(layHash)->design()};
61 m_pars.layerBounds->makeBounds<Acts::RectangleBounds>(design.halfWidth(),
62 design.shortHalfHeight())));
63#endif
64 }
66 chamberStripPos(createHash(1, 1, doubletPhi(), false))).mag();
67#ifndef SIMULATIONBASE
68 m_pars.layerBounds.reset();
69#endif
70 return StatusCode::SUCCESS;
71}
72
74 return sensorLayout(hash)->toOrigin();
75}
76
77#if defined(FLATTEN) && defined(__GNUC__)
78// We compile this function with optimization, even in debug builds; otherwise,
79// the heavy use of Eigen makes it too slow. However, from here we may call
80// to out-of-line Eigen code that is linked from other DSOs; in that case,
81// it would not be optimized. Avoid this by forcing all Eigen code
82// to be inlined here if possible.
83[[gnu::flatten]]
84#endif
86 return localToGlobalTrans(ctx, layerHash(measHash)) *
87 sensorLayout(measHash)->localStripPosition(stripNumber(measHash), measuresPhi(measHash));
88}
89#if defined(FLATTEN) && defined(__GNUC__)
90// We compile this function with optimization, even in debug builds; otherwise,
91// the heavy use of Eigen makes it too slow. However, from here we may call
92// to out-of-line Eigen code that is linked from other DSOs; in that case,
93// it would not be optimized. Avoid this by forcing all Eigen code
94// to be inlined here if possible.
95[[gnu::flatten]]
96#endif
98 return localToGlobalTrans(ctx, layerHash(measHash)) *
99 sensorLayout(measHash)->localStripLeftEdge(stripNumber(measHash), measuresPhi(measHash));
100}
101#if defined(FLATTEN) && defined(__GNUC__)
102// We compile this function with optimization, even in debug builds; otherwise,
103// the heavy use of Eigen makes it too slow. However, from here we may call
104// to out-of-line Eigen code that is linked from other DSOs; in that case,
105// it would not be optimized. Avoid this by forcing all Eigen code
106// to be inlined here if possible.
107[[gnu::flatten]]
108#endif
110 return localToGlobalTrans(ctx, layerHash(measHash)) *
111 sensorLayout(measHash)->localStripRightEdge(stripNumber(measHash), measuresPhi(measHash));
112}
113
115 const StripLayerPtr& layout{sensorLayout(measHash)};
116 return layout->toOrigin() * layout->localStripPosition(stripNumber(measHash), measuresPhi(measHash));
117}
118
120 const Amg::Vector3D& posInStripPlane,
121 const EdgeSide side) const {
122 const StripLayerPtr& layout{sensorLayout(measHeash)};
123 const StripDesign& design{layout->design(measuresPhi(measHeash))};
125 const double refPoint{design.longHalfHeight() * (side == EdgeSide::readOut ? -1. : 1.) * m_pars.readoutSide};
128 return std::abs(refPoint - layout->to2D(posInStripPlane, measuresPhi(measHeash)).y());
129}
130
131
132}
Scalar mag() const
mag method
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_FATAL(x)
#define ATH_MSG_VERBOSE(x)
#define ATH_MSG_DEBUG(x)
#define y
This is a "hash" representation of an Identifier.
const Amg::Transform3D & localToGlobalTrans(const ActsTrk::GeometryContext &ctx) const
Returns the local to global transformation into the ATLAS coordinate system.
StatusCode planeSurfaceFactory(const IdentifierHash &hash, std::shared_ptr< const Acts::PlanarBounds > pBounds)
Identifier identify() const override final
Return the athena identifier.
const Muon::IMuonIdHelperSvc * idHelperSvc() const
Returns the pointer to the muonIdHelperSvc.
StatusCode insertTransform(const IdentifierHash &hash)
Inserts a transfomration for caching.
static IdentifierHash geoTransformHash()
Returns the hash that is associated with the surface cache holding the transformation that is placing...
Amg::Vector3D leftStripEdge(const ActsTrk::GeometryContext &ctx, const Identifier &measId) const
Returns the global posiition of the strip edge at positive local Y.
int doubletPhi() const
Returns the doublet Phi field of the MuonReadoutElement identifier.
static bool measuresPhi(const IdentifierHash &measHash)
double distanceToEdge(const IdentifierHash &measHash, const Amg::Vector3D &posInStripPlane, const EdgeSide side) const
Returns the disance to the readout.
Amg::Transform3D fromGapToChamOrigin(const IdentifierHash &layerHash) const
IdentifierHash layerHash(const Identifier &measId) const override final
static unsigned stripNumber(const IdentifierHash &measHash)
Amg::Vector3D rightStripEdge(const ActsTrk::GeometryContext &ctx, const Identifier &measId) const
Returns the global position of the strip edge at negative local Y.
const StripLayerPtr & sensorLayout(const IdentifierHash &measHash) const
Access to the StripLayer associated to a given measurement Hash.
static IdentifierHash createHash(const unsigned strip, const unsigned gasGap, const unsigned doubPhi, const bool measPhi)
Constructs an Identifier hash from the Identifier fields controlled by this readout element.
Amg::Vector3D chamberStripPos(const IdentifierHash &measHash) const
Returns the local strip position w.r.t. to the chamber origin.
Amg::Vector3D stripPosition(const ActsTrk::GeometryContext &ctx, const Identifier &measId) const
Returns the position of the strip center.
static unsigned doubletPhiNumber(const IdentifierHash &measHash)
static unsigned gasGapNumber(const IdentifierHash &measHash)
double halfWidth() const
Returns the half height of the strip panel.
double shortHalfHeight() const
Returns the shorter half height of the panel.
double longHalfHeight() const
Returns the longer half height of the panel.
The AlignStoreProviderAlg loads the rigid alignment corrections and pipes them through the readout ge...
Eigen::Affine3d Transform3D
Eigen::Matrix< double, 3, 1 > Vector3D
The ReadoutGeomCnvAlg converts the Run4 Readout geometry build from the GeoModelXML into the legacy M...
std::ostream & operator<<(std::ostream &ostr, const Chamber::defineArgs &args)
Definition Chamber.cxx:14
GeoModel::TransientConstSharedPtr< StripLayer > StripLayerPtr
Definition StripLayer.h:100
MmReadoutElement::parameterBook parameterBook
STL namespace.