ATLAS Offline Software
MmReadoutElement.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 */
5 
6 
9 
11 #include <GaudiKernel/SystemOfUnits.h>
12 #include <optional>
13 
14 #ifndef SIMULATIONBASE
15 # include "Acts/Surfaces/Surface.hpp"
16 # include "Acts/Surfaces/TrapezoidBounds.hpp"
17 #endif
18 
19 using namespace ActsTrk;
20 
21 namespace MuonGMR4 {
23 std::ostream& operator<<(std::ostream& ostr, const parameterBook& pars) {
24  ostr<<"chamber shortWidth/longWidth/length [mm]: "<<(2.*pars.halfShortWidth)<<"/";
25  ostr<<(2.*pars.halfLongWidth)<<"/"<<(2.*pars.halfHeight)<<std::endl;
26  return ostr;
27 }
28 
29 MmReadoutElement::MmReadoutElement(defineArgs&& args):
30  MuonReadoutElement(std::move(args)),
31  m_pars{std::move(args)} {
32 }
33 
35 
37  ATH_MSG_DEBUG("Parameter book "<<parameterBook());
39 
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
48  90.*Gaudi::Units::deg)));
49 #endif
50  for (unsigned int layer = 0; layer < m_pars.layers.size(); ++layer) {
51  IdentifierHash layHash{layer};
52  if (m_pars.layers[layer]->hash() != layHash) {
53  ATH_MSG_FATAL("Layer "<<m_pars.layers[layer]<<" has a very strange hash. Expect "<<layer);
54  return StatusCode::FAILURE;
55  }
56  ATH_CHECK(insertTransform<MmReadoutElement>(layHash));
57 #ifndef SIMULATIONBASE
58  const StripDesign& design{m_pars.layers[layer]->design()};
59 
60  ATH_CHECK(planeSurfaceFactory(layHash, m_pars.layerBounds->make_bounds(design.shortHalfHeight(),
61  design.longHalfHeight(),
62  design.halfWidth(),
63  90.*Gaudi::Units::deg - design.stereoAngle())));
64 #endif
65  }
66 #ifndef SIMULATIONBASE
67  m_pars.layerBounds.reset();
68 #endif
69  return StatusCode::SUCCESS;
70 }
71 
72 Amg::Transform3D MmReadoutElement::fromGapToChamOrigin(const IdentifierHash& layHash) const {
73  return stripLayer(layHash).toOrigin();
74 }
75 
76 
77 Amg::Vector3D MmReadoutElement::stripPosition(const ActsGeometryContext& ctx, const IdentifierHash& measHash) const {
78  const IdentifierHash lHash = layerHash(measHash);
79  if (static_cast<unsigned int>(lHash) < m_pars.layers.size()) {
80  return localToGlobalTrans(ctx, lHash) * stripLayer(lHash).localStripPos(stripNumber(measHash));
81  }
82  ATH_MSG_WARNING(__FILE__<<":"<<__LINE__<<" The layer hash "<<static_cast<unsigned int>(lHash)
83  <<" is out of range. Maximum range "<<m_pars.layers.size());
84  return Amg::Vector3D::Zero();
85 }
86 
87 
88 Amg::Vector3D MmReadoutElement::leftStripEdge(const ActsGeometryContext& ctx, const IdentifierHash& measHash) const {
89  const IdentifierHash lHash = layerHash(measHash);
90  if (static_cast<unsigned int>(lHash) < m_pars.layers.size()) {
91  return localToGlobalTrans(ctx, lHash) * stripLayer(lHash).localStripLeftEdge(stripNumber(measHash));
92  }
93  ATH_MSG_WARNING(__FILE__<<":"<<__LINE__<<" The layer hash "<<static_cast<unsigned int>(lHash)
94  <<" is out of range. Maximum range "<<m_pars.layers.size());
95  return Amg::Vector3D::Zero();
96 }
97 
98 Amg::Vector3D MmReadoutElement::rightStripEdge(const ActsGeometryContext& ctx, const IdentifierHash& measHash) const{
99  const IdentifierHash lHash = layerHash(measHash);
100  if (static_cast<unsigned int>(lHash) < m_pars.layers.size()) {
101  return localToGlobalTrans(ctx, lHash) * stripLayer(lHash).localStripRightEdge(stripNumber(measHash));
102  }
103  ATH_MSG_WARNING(__FILE__<<":"<<__LINE__<<" The layer hash "<<static_cast<unsigned int>(lHash)
104  <<" is out of range. Maximum range "<<m_pars.layers.size());
105  return Amg::Vector3D::Zero();
106 }
107 
108 
109 }
make_hlt_rep.pars
pars
Definition: make_hlt_rep.py:90
MuonGMR4::parameterBook
MmReadoutElement::parameterBook parameterBook
Definition: MmReadoutElement.cxx:22
ATH_MSG_FATAL
#define ATH_MSG_FATAL(x)
Definition: AthMsgStreamMacros.h:34
MuonGMR4::MmReadoutElement::fromGapToChamOrigin
Amg::Transform3D fromGapToChamOrigin(const IdentifierHash &layerHash) const
Definition: MmReadoutElement.cxx:72
MuonGMR4::StripDesign
Definition: StripDesign.h:30
AthCheckMacros.h
MuonGMR4::MmReadoutElement::parameterBook
Set of parameters to describe a RPC chamber.
Definition: MmReadoutElement.h:24
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
deg
#define deg
Definition: SbPolyhedron.cxx:17
SurfaceBoundSet.h
MuonGMR4::MuonReadoutElement::createGeoTransform
StatusCode createGeoTransform()
Definition: MuonPhaseII/MuonDetDescr/MuonReadoutGeometryR4/src/MuonReadoutElement.cxx:36
MuonGMR4::MmReadoutElement::parameterBook::halfShortWidth
double halfShortWidth
width of the lower edge
Definition: MmReadoutElement.h:29
MuonGMR4
The ReadoutGeomCnvAlg converts the Run4 Readout geometry build from the GeoModelXML into the legacy M...
Definition: MdtCalibInput.h:20
MuonGMR4::MmReadoutElement::m_pars
parameterBook m_pars
Definition: MmReadoutElement.h:131
MuonGMR4::MmReadoutElement::stripPosition
Amg::Vector3D stripPosition(const ActsGeometryContext &ctx, const Identifier &measId) const
Returns the position of the strip center.
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
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
TRT::Hit::layer
@ layer
Definition: HitInfo.h:79
MuonGMR4::MmReadoutElement::stripNumber
static unsigned int stripNumber(const IdentifierHash &measHash)
MuonGMR4::MmReadoutElement::parameterBook::halfHeight
double halfHeight
length in the radial direction
Definition: MmReadoutElement.h:33
Amg::Transform3D
Eigen::Affine3d Transform3D
Definition: GeoPrimitives.h:46
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
ActsTrk::operator<<
MsgStream & operator<<(MsgStream &out, const ActsUtils::Stat &stat)
Definition: TrackToTruthAssociationAlg.cxx:25
MuonGMR4::MmReadoutElement::parameterBook::halfLongWidth
double halfLongWidth
width of the upper edge
Definition: MmReadoutElement.h:31
ActsGeometryContext
Include the GeoPrimitives which need to be put first.
Definition: ActsGeometryContext.h:27
MuonGMR4::MmReadoutElement::parameterBook::layers
std::vector< StripLayerPtr > layers
Pointers to the strip layers.
Definition: MmReadoutElement.h:39
MuonGMR4::MmReadoutElement::leftStripEdge
Amg::Vector3D leftStripEdge(const ActsGeometryContext &ctx, const Identifier &measId) const
Returns the global position of the strip edge.
MuonGMR4::MmReadoutElement::stripLayer
const StripLayer & stripLayer(const Identifier &measId) const
MuonGMR4::MmReadoutElement::getParameters
const parameterBook & getParameters() const
Definition: MmReadoutElement.cxx:34
MuonGMR4::StripLayer::localStripPos
Amg::Vector3D localStripPos(unsigned int stripum) const
Returns the position of the strip expressed in the local frame.
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::MuonReadoutElement::identify
Identifier identify() const override final
Return the athena identifier.
Amg::Vector3D
Eigen::Matrix< double, 3, 1 > Vector3D
Definition: GeoPrimitives.h:47
MuonGMR4::MuonReadoutElement::planeSurfaceFactory
StatusCode planeSurfaceFactory(const IdentifierHash &hash, std::shared_ptr< Acts::PlanarBounds > pBounds)
Definition: MuonPhaseII/MuonDetDescr/MuonReadoutGeometryR4/src/MuonReadoutElement.cxx:125
MuonGMR4::MmReadoutElement::layerHash
IdentifierHash layerHash(const Identifier &measId) const override final
MuonGMR4::MmReadoutElement::parameterBook::layerBounds
ActsTrk::SurfaceBoundSetPtr< Acts::TrapezoidBounds > layerBounds
Definition: MmReadoutElement.h:42
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
GeoPrimitivesHelpers.h
MuonGMR4::MmReadoutElement::rightStripEdge
Amg::Vector3D rightStripEdge(const ActsGeometryContext &ctx, const Identifier &measId) const
Returns the global position of the strip edge.
MuonGMR4::MmReadoutElement::initElement
StatusCode initElement() override final
Element initialization.
Definition: MmReadoutElement.cxx:36
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
MuonGMR4::StripLayer::localStripLeftEdge
Amg::Vector3D localStripLeftEdge(unsigned int stripNum) const
Returns the position of the left strip edge (positive local y) expressed in the local frame.
ActsTrk
The AlignStoreProviderAlg loads the rigid alignment corrections and pipes them through the readout ge...
Definition: MuonDetectorBuilderTool.cxx:49
MuonGMR4::StripLayer::localStripRightEdge
Amg::Vector3D localStripRightEdge(unsigned int stripNum) const
Returns the position of the right strip edge (negative local y) exoressed in the local frame.
python.CaloScaleNoiseConfig.args
args
Definition: CaloScaleNoiseConfig.py:80
MuonGMR4::MmReadoutElement::defineArgs
Definition: MmReadoutElement.h:49
MmReadoutElement.h
generate::Zero
void Zero(TH1D *hin)
Definition: generate.cxx:32