ATLAS Offline Software
Loading...
Searching...
No Matches
MmReadoutElement.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2026 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/Surface.hpp"
15# include "Acts/Surfaces/TrapezoidBounds.hpp"
16#endif
17
18using namespace ActsTrk;
19
20namespace MuonGMR4 {
22std::ostream& operator<<(std::ostream& ostr, const parameterBook& pars) {
23 ostr<<"chamber shortWidth/longWidth/length [mm]: "<<(2.*pars.halfShortWidth)<<"/";
24 ostr<<(2.*pars.halfLongWidth)<<"/"<<(2.*pars.halfHeight)<<std::endl;
25 return ostr;
26}
27
32
34
36 ATH_MSG_DEBUG("Parameter book "<<parameterBook());
38
39 if (m_pars.layers.empty()) {
40 ATH_MSG_FATAL("The readout element "<<idHelperSvc()->toStringDetEl(identify())<<" doesn't have any layers defined");
41 return StatusCode::FAILURE;
42 }
43#ifndef SIMULATIONBASE
45 m_pars.layerBounds->makeBounds<Acts::TrapezoidBounds>(m_pars.halfShortWidth,
46 m_pars.halfLongWidth,
47 m_pars.halfHeight)));
48#endif
49 for (unsigned int layer = 0; layer < m_pars.layers.size(); ++layer) {
50 IdentifierHash layHash{layer};
51 if (m_pars.layers[layer]->hash() != layHash) {
52 ATH_MSG_FATAL("Layer "<<m_pars.layers[layer]<<" has a very strange hash. Expect "<<layer);
53 return StatusCode::FAILURE;
54 }
56#ifndef SIMULATIONBASE
57 const StripDesign& design{m_pars.layers[layer]->design()};
58
60 m_pars.layerBounds->makeBounds<Acts::TrapezoidBounds>(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
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 const IdentifierHash lHash = layerHash(measHash);
87 if (static_cast<unsigned int>(lHash) < m_pars.layers.size()) {
88 return localToGlobalTransform(ctx, lHash) * stripLayer(lHash).localStripPosition(stripNumber(measHash));
89 }
90 ATH_MSG_WARNING(__FILE__<<":"<<__LINE__<<" The layer hash "<<static_cast<unsigned int>(lHash)
91 <<" is out of range. Maximum range "<<m_pars.layers.size());
92 return Amg::Vector3D::Zero();
93}
94
95
96#if defined(FLATTEN) && defined(__GNUC__)
97// We compile this function with optimization, even in debug builds; otherwise,
98// the heavy use of Eigen makes it too slow. However, from here we may call
99// to out-of-line Eigen code that is linked from other DSOs; in that case,
100// it would not be optimized. Avoid this by forcing all Eigen code
101// to be inlined here if possible.
102[[gnu::flatten]]
103#endif
105 const IdentifierHash lHash = layerHash(measHash);
106 if (static_cast<unsigned int>(lHash) < m_pars.layers.size()) {
107 return localToGlobalTransform(ctx, lHash) * stripLayer(lHash).localStripLeftEdge(stripNumber(measHash));
108 }
109 ATH_MSG_WARNING(__FILE__<<":"<<__LINE__<<" The layer hash "<<static_cast<unsigned int>(lHash)
110 <<" is out of range. Maximum range "<<m_pars.layers.size());
111 return Amg::Vector3D::Zero();
112}
113
114#if defined(FLATTEN) && defined(__GNUC__)
115// We compile this function with optimization, even in debug builds; otherwise,
116// the heavy use of Eigen makes it too slow. However, from here we may call
117// to out-of-line Eigen code that is linked from other DSOs; in that case,
118// it would not be optimized. Avoid this by forcing all Eigen code
119// to be inlined here if possible.
120[[gnu::flatten]]
121#endif
123 const IdentifierHash lHash = layerHash(measHash);
124 if (static_cast<unsigned int>(lHash) < m_pars.layers.size()) {
125 return localToGlobalTransform(ctx, lHash) * stripLayer(lHash).localStripRightEdge(stripNumber(measHash));
126 }
127 ATH_MSG_WARNING(__FILE__<<":"<<__LINE__<<" The layer hash "<<static_cast<unsigned int>(lHash)
128 <<" is out of range. Maximum range "<<m_pars.layers.size());
129 return Amg::Vector3D::Zero();
130}
131
132
133}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_FATAL(x)
#define ATH_MSG_WARNING(x)
#define ATH_MSG_DEBUG(x)
This is a "hash" representation of an Identifier.
const StripLayer & stripLayer(const Identifier &measId) const
StatusCode initElement() override final
Initialization of the readout elements.
MmReadoutElement(defineArgs &&args)
const parameterBook & getParameters() const
static unsigned int stripNumber(const IdentifierHash &measHash)
Amg::Transform3D fromGapToChamOrigin(const IdentifierHash &layerHash) const
IdentifierHash layerHash(const Identifier &measId) const override final
The layer hash removes the bits from the IdentifierHash corresponding to the measurement's channel nu...
Amg::Vector3D leftStripEdge(const ActsTrk::GeometryContext &ctx, const Identifier &measId) const
Returns the global position of the strip edge.
Amg::Vector3D stripPosition(const ActsTrk::GeometryContext &ctx, const Identifier &measId) const
Returns the position of the strip center.
Amg::Vector3D rightStripEdge(const ActsTrk::GeometryContext &ctx, const Identifier &measId) const
Returns the global position of the strip edge.
StatusCode planeSurfaceFactory(const IdentifierHash &hash, std::shared_ptr< const Acts::PlanarBounds > pBounds)
Invokes the factory to create plane surfaces && to associate them with the particular transform cache...
Identifier identify() const override final
Return the ATLAS identifier.
const Muon::IMuonIdHelperSvc * idHelperSvc() const
Returns the pointer to the muonIdHelperSvc.
StatusCode createGeoTransform()
Creates the ReadoutSurfacePositioning corresponding the generic local -> global transformation of the...
StatusCode insertTransform(const IdentifierHash &hash)
Constructs the TransformDetEleCache associated with the hash of the given Mdt tube or strip layer.
MuonReadoutElement(const defineArgs &args)
Constructor taking the basic define arguments.
const Amg::Transform3D & localToGlobalTransform(const ActsTrk::GeometryContext &ctx) const override final
Returns the transformation from the local coordinate system of the readout element into the global AT...
static IdentifierHash geoTransformHash()
Returns the hash that is associated with the surface cache holding the transformation that is placing...
double halfWidth() const
Returns the half height of the strip panel.
double stereoAngle() const
Returns the value of the stereo angle.
double shortHalfHeight() const
Returns the shorter half height of the panel.
double longHalfHeight() const
Returns the longer half height of the panel.
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...
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.
const Amg::Transform3D & toOrigin() const
Returns the transformation to go from the strip layer center to the origin of the Strip chamber.
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...
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:18
MmReadoutElement::parameterBook parameterBook
STL namespace.
Set of parameters to describe a RPC chamber.