ATLAS Offline Software
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
16 using namespace ActsTrk;
17 
18 namespace MuonGMR4 {
20 std::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 }
27 RpcReadoutElement::~RpcReadoutElement() = default;
28 RpcReadoutElement::RpcReadoutElement(defineArgs&& args)
30  m_pars{std::move(args)} {
31 }
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_CHECK(insertTransform<RpcReadoutElement>(layHash));
56 #ifndef SIMULATIONBASE
57  const StripDesign& design{sensorLayout(layHash).design()};
59  m_pars.layerBounds->makeBounds<Acts::RectangleBounds>(design.halfWidth(),
60  design.shortHalfHeight())));
61 #endif
62  }
64  chamberStripPos(createHash(1, 1, doubletPhi(), false))).mag();
65 #ifndef SIMULATIONBASE
66  m_pars.layerBounds.reset();
67 #endif
68  return StatusCode::SUCCESS;
69 }
70 
72  return sensorLayout(hash).toOrigin();
73 }
74 
75 #if defined(FLATTEN) && defined(__GNUC__)
76 // We compile this function with optimization, even in debug builds; otherwise,
77 // the heavy use of Eigen makes it too slow. However, from here we may call
78 // to out-of-line Eigen code that is linked from other DSOs; in that case,
79 // it would not be optimized. Avoid this by forcing all Eigen code
80 // to be inlined here if possible.
81 [[gnu::flatten]]
82 #endif
83 Amg::Vector3D RpcReadoutElement::stripPosition(const ActsGeometryContext& ctx, const IdentifierHash& measHash) const {
84  return localToGlobalTrans(ctx, layerHash(measHash)) *
85  sensorLayout(measHash).localStripPosition(stripNumber(measHash));
86 }
87 #if defined(FLATTEN) && defined(__GNUC__)
88 // We compile this function with optimization, even in debug builds; otherwise,
89 // the heavy use of Eigen makes it too slow. However, from here we may call
90 // to out-of-line Eigen code that is linked from other DSOs; in that case,
91 // it would not be optimized. Avoid this by forcing all Eigen code
92 // to be inlined here if possible.
93 [[gnu::flatten]]
94 #endif
95 Amg::Vector3D RpcReadoutElement::rightStripEdge(const ActsGeometryContext& ctx, const IdentifierHash& measHash) const{
96  return localToGlobalTrans(ctx, layerHash(measHash)) *
97  sensorLayout(measHash).localStripLeftEdge(stripNumber(measHash));
98 }
99 #if defined(FLATTEN) && defined(__GNUC__)
100 // We compile this function with optimization, even in debug builds; otherwise,
101 // the heavy use of Eigen makes it too slow. However, from here we may call
102 // to out-of-line Eigen code that is linked from other DSOs; in that case,
103 // it would not be optimized. Avoid this by forcing all Eigen code
104 // to be inlined here if possible.
105 [[gnu::flatten]]
106 #endif
107 Amg::Vector3D RpcReadoutElement::leftStripEdge(const ActsGeometryContext& ctx, const IdentifierHash& measHash) const {
108  return localToGlobalTrans(ctx, layerHash(measHash)) *
109  sensorLayout(measHash).localStripRightEdge(stripNumber(measHash));
110 }
111 
112 Amg::Vector3D RpcReadoutElement::chamberStripPos(const IdentifierHash& measHash) const {
113  const StripLayer& layout{sensorLayout(measHash)};
114  return layout.toOrigin() * layout.localStripPosition(stripNumber(measHash));
115 }
116 
117 double RpcReadoutElement::distanceToEdge(const IdentifierHash& layerHash,
118  const Amg::Vector2D& posInStripPlane,
119  const EdgeSide side) const {
122  const double refPoint{design.longHalfHeight() * (side == EdgeSide::readOut ? -1. : 1.) * m_pars.readoutSide};
123  return std::abs(refPoint - posInStripPlane.y());
124 }
125 
126 
127 }
make_hlt_rep.pars
pars
Definition: make_hlt_rep.py:90
MuonGMR4::parameterBook
MmReadoutElement::parameterBook parameterBook
Definition: MmReadoutElement.cxx:21
MuonGMR4::RpcReadoutElement::createHash
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
MuonGMR4::RpcReadoutElement::parameterBook::halfWidth
double halfWidth
Elongation within the sector
Definition: MuonPhaseII/MuonDetDescr/MuonReadoutGeometryR4/MuonReadoutGeometryR4/RpcReadoutElement.h:29
ATH_MSG_FATAL
#define ATH_MSG_FATAL(x)
Definition: AthMsgStreamMacros.h:34
MuonGMR4::StripDesign
Definition: StripDesign.h:30
MuonGMR4::RpcReadoutElement::measuresPhi
static bool measuresPhi(const IdentifierHash &measHash)
MuonGMR4::RpcReadoutElement::defineArgs
Definition: MuonPhaseII/MuonDetDescr/MuonReadoutGeometryR4/MuonReadoutGeometryR4/RpcReadoutElement.h:48
AthCheckMacros.h
python.CaloAddPedShiftConfig.args
args
Definition: CaloAddPedShiftConfig.py:47
Amg::Vector2D
Eigen::Matrix< double, 2, 1 > Vector2D
Definition: GeoPrimitives.h:48
MuonGMR4::RpcReadoutElement::m_pars
parameterBook m_pars
Definition: MuonPhaseII/MuonDetDescr/MuonReadoutGeometryR4/MuonReadoutGeometryR4/RpcReadoutElement.h:158
MuonGMR4::RpcReadoutElement::parameterBook::layers
std::vector< StripLayerPtr > layers
Definition: MuonPhaseII/MuonDetDescr/MuonReadoutGeometryR4/MuonReadoutGeometryR4/RpcReadoutElement.h:36
MuonGMR4::StripLayer::toOrigin
const Amg::Transform3D & toOrigin() const
Returns the transformation to go from the strip layer center to the origin of the Strip chamber.
MuonGMR4::MuonReadoutElement
The MuonReadoutElement is an abstract class representing the geometry representing the muon detector.
Definition: MuonPhaseII/MuonDetDescr/MuonReadoutGeometryR4/MuonReadoutGeometryR4/MuonReadoutElement.h:38
MuonGMR4::MuonReadoutElement::createGeoTransform
StatusCode createGeoTransform()
Definition: MuonPhaseII/MuonDetDescr/MuonReadoutGeometryR4/src/MuonReadoutElement.cxx:36
MuonGMR4::RpcReadoutElement::parameterBook::etaDesign
StripDesignPtr etaDesign
Definition: MuonPhaseII/MuonDetDescr/MuonReadoutGeometryR4/MuonReadoutGeometryR4/RpcReadoutElement.h:39
MuonGMR4::RpcReadoutElement::rightStripEdge
Amg::Vector3D rightStripEdge(const ActsGeometryContext &ctx, const Identifier &measId) const
Returns the global position of the strip edge at negative local Y.
ATH_MSG_VERBOSE
#define ATH_MSG_VERBOSE(x)
Definition: AthMsgStreamMacros.h:28
MuonGMR4::StripLayer::localStripRightEdge
Amg::Vector3D localStripRightEdge(unsigned int stripNum, bool phiView=false) const
Returns the position of the right strip edge at (negative y in the strip design description) in the l...
MuonGMR4::RpcReadoutElement::EdgeSide
EdgeSide
Definition: MuonPhaseII/MuonDetDescr/MuonReadoutGeometryR4/MuonReadoutGeometryR4/RpcReadoutElement.h:109
MuonGMR4::RpcReadoutElement::parameterBook::layerBounds
std::shared_ptr< Acts::SurfaceBoundFactory > layerBounds
Definition: MuonPhaseII/MuonDetDescr/MuonReadoutGeometryR4/MuonReadoutGeometryR4/RpcReadoutElement.h:43
MuonGMR4::RpcReadoutElement::getParameters
const parameterBook & getParameters() const
Definition: MuonPhaseII/MuonDetDescr/MuonReadoutGeometryR4/src/RpcReadoutElement.cxx:33
MuonGMR4::RpcReadoutElement::parameterBook
Set of parameters to describe a RPC chamber.
Definition: MuonPhaseII/MuonDetDescr/MuonReadoutGeometryR4/MuonReadoutGeometryR4/RpcReadoutElement.h:21
TRT::Hit::side
@ side
Definition: HitInfo.h:83
MuonGMR4
The ReadoutGeomCnvAlg converts the Run4 Readout geometry build from the GeoModelXML into the legacy M...
Definition: MdtCalibInput.h:19
MuonGMR4::RpcReadoutElement::parameterBook::phiDesign
StripDesignPtr phiDesign
Definition: MuonPhaseII/MuonDetDescr/MuonReadoutGeometryR4/MuonReadoutGeometryR4/RpcReadoutElement.h:38
MuonGMR4::MuonReadoutElement::idHelperSvc
const Muon::IMuonIdHelperSvc * idHelperSvc() const
Returns the pointer to the muonIdHelperSvc.
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
MuonGMR4::StripLayer::localStripPosition
Amg::Vector3D localStripPosition(unsigned int stripum, bool phiView=false) const
Returns the position of the strip centre expressed in the frame of the local readout plane.
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
MuonGMR4::RpcReadoutElement::parameterBook::halfLength
double halfLength
RPC panel dimensions.
Definition: MuonPhaseII/MuonDetDescr/MuonReadoutGeometryR4/MuonReadoutGeometryR4/RpcReadoutElement.h:25
TRT::Hit::layer
@ layer
Definition: HitInfo.h:79
MuonGMR4::RpcReadoutElement::doubletPhi
int doubletPhi() const
Returns the doublet Phi field of the MuonReadoutElement identifier.
Amg::Transform3D
Eigen::Affine3d Transform3D
Definition: GeoPrimitives.h:46
MuonGMR4::RpcReadoutElement::stripPosition
Amg::Vector3D stripPosition(const ActsGeometryContext &ctx, const Identifier &measId) const
Returns the position of the strip center.
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
ActsTrk::operator<<
MsgStream & operator<<(MsgStream &out, const ActsUtils::Stat &stat)
Definition: TrackToTruthAssociationAlg.cxx:25
MuonGMR4::StripLayer::localStripLeftEdge
Amg::Vector3D localStripLeftEdge(unsigned int stripNum, bool phiView=false) const
Returns the position of the strip edge at (positive y in the strip design description) in the local c...
MuonGMR4::RpcReadoutElement::initElement
StatusCode initElement() override final
Element initialization.
Definition: MuonPhaseII/MuonDetDescr/MuonReadoutGeometryR4/src/RpcReadoutElement.cxx:35
MuonGMR4::RpcReadoutElement::stripNumber
static unsigned stripNumber(const IdentifierHash &measHash)
ActsGeometryContext
Include the GeoPrimitives which need to be put first.
Definition: ActsGeometryContext.h:27
MuonGMR4::StripLayer::design
const StripDesign & design(bool phiView=false) const
Returns the underlying strip design.
TileTB.layout
layout
Definition: TileTB.py:76
MuonGMR4::MuonReadoutElement::geoTransformHash
static IdentifierHash geoTransformHash()
Returns the hash that is associated with the surface cache holding the transformation that is placing...
Definition: MuonPhaseII/MuonDetDescr/MuonReadoutGeometryR4/src/MuonReadoutElement.cxx:44
MuonGMR4::RpcReadoutElement::sensorLayout
const StripLayer & sensorLayout(const IdentifierHash &measHash) const
Access to the StripLayer associated to a given measurement Hash.
MuonGMR4::RpcReadoutElement::m_gasThickness
double m_gasThickness
Distance between 2 gas gaps (Radial direction)
Definition: MuonPhaseII/MuonDetDescr/MuonReadoutGeometryR4/MuonReadoutGeometryR4/RpcReadoutElement.h:170
MuonGMR4::RpcReadoutElement::layerHash
IdentifierHash layerHash(const Identifier &measId) const override final
MuonGMR4::MuonReadoutElement::identify
Identifier identify() const override final
Return the athena identifier.
Amg::Vector3D
Eigen::Matrix< double, 3, 1 > Vector3D
Definition: GeoPrimitives.h:47
RpcReadoutElement.h
MuonGMR4::RpcReadoutElement::parameterBook::readoutSide
double readoutSide
at which side is the readout plane of the strip
Definition: MuonPhaseII/MuonDetDescr/MuonReadoutGeometryR4/MuonReadoutGeometryR4/RpcReadoutElement.h:41
MuonGMR4::StripLayer
The StripLayer interfaces the 2D description of the strip plane layout with the 3D description of the...
Definition: StripLayer.h:19
MuonGMR4::RpcReadoutElement::leftStripEdge
Amg::Vector3D leftStripEdge(const ActsGeometryContext &ctx, const Identifier &measId) const
Returns the global posiition of the strip edge at positive local Y.
MuonGMR4::RpcReadoutElement::chamberStripPos
Amg::Vector3D chamberStripPos(const IdentifierHash &measHash) const
Returns the local strip position w.r.t. to the chamber origin.
Definition: MuonPhaseII/MuonDetDescr/MuonReadoutGeometryR4/src/RpcReadoutElement.cxx:112
CaloCondBlobAlgs_fillNoiseFromASCII.hash
dictionary hash
Definition: CaloCondBlobAlgs_fillNoiseFromASCII.py:108
MuonGMR4::MuonReadoutElement::planeSurfaceFactory
StatusCode planeSurfaceFactory(const IdentifierHash &hash, std::shared_ptr< Acts::PlanarBounds > pBounds)
Definition: MuonPhaseII/MuonDetDescr/MuonReadoutGeometryR4/src/MuonReadoutElement.cxx:125
GeoPrimitivesHelpers.h
MuonGMR4::MuonReadoutElement::localToGlobalTrans
const Amg::Transform3D & localToGlobalTrans(const ActsGeometryContext &ctx) const
Returns the local to global transformation into the ATLAS coordinate system.
Definition: MuonPhaseII/MuonDetDescr/MuonReadoutGeometryR4/src/MuonReadoutElement.cxx:81
ActsTrk
The AlignStoreProviderAlg loads the rigid alignment corrections and pipes them through the readout ge...
Definition: MSTrackingVolumeBuilder.cxx:25
MuonGMR4::RpcReadoutElement::EdgeSide::readOut
@ readOut
MuonGMR4::RpcReadoutElement::distanceToEdge
double distanceToEdge(const IdentifierHash &measHash, const Amg::Vector2D &posInStripPlane, const EdgeSide side) const
Returns the disance to the readout.
Definition: MuonPhaseII/MuonDetDescr/MuonReadoutGeometryR4/src/RpcReadoutElement.cxx:117
MuonGMR4::RpcReadoutElement::fromGapToChamOrigin
Amg::Transform3D fromGapToChamOrigin(const IdentifierHash &layerHash) const
Definition: MuonPhaseII/MuonDetDescr/MuonReadoutGeometryR4/src/RpcReadoutElement.cxx:71
mag
Scalar mag() const
mag method
Definition: AmgMatrixBasePlugin.h:26