ATLAS Offline Software
Loading...
Searching...
No Matches
MuonPhaseII/MuonDetDescr/MuonReadoutGeometryR4/src/TgcReadoutElement.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3*/
4
6
8#include <GaudiKernel/SystemOfUnits.h>
9#include <optional>
10
11#ifndef SIMULATIONBASE
12# include "Acts/Surfaces/TrapezoidBounds.hpp"
13# include "Acts/Surfaces/Surface.hpp"
14#endif
15
16
17using namespace ActsTrk;
18
19
20namespace MuonGMR4 {
22std::ostream& operator<<(std::ostream& ostr, const parameterBook& pars) {
23 ostr<<"chamber dimensions --- ";
24 ostr<<"thickness: "<<pars.halfThickness<<" ";
25 ostr<<"height: "<<pars.halfHeight<<" ";
26 ostr<<"shortWidth: "<<pars.halfWidthShort<<" ";
27 ostr<<"longWidth: "<<pars.halfWidthLong<<" --- ";
28 return ostr;
29}
35
38
41 bool hasSensor{false};
42 for (std::size_t s = 0; s < m_pars.sensorLayouts.size(); ++s) {
43 const StripLayerPtr& layPtr{m_pars.sensorLayouts[s]};
44 if (!layPtr) continue;
45 if (layPtr->hash() != s) {
46 ATH_MSG_FATAL("Layer "<<(*layPtr)<<" has an unexpected hash "<<s);
47 return StatusCode::FAILURE;
48 }
49 const IdentifierHash layHash = layerHash(layPtr->hash());
54 if (isStrip(layPtr->hash())) {
55 m_pars.sensorLayouts[static_cast<unsigned>(layHash)] = layPtr;
56 continue;
57 }
59#ifndef SIMULATIONBASE
60 const StripDesign& design{layPtr->design()};
61 const double rotAngle = isStrip(layPtr->hash()) ? 0. : 90.*Gaudi::Units::deg;
62 ATH_CHECK(planeSurfaceFactory(layHash, m_pars.layerBounds->makeBounds<Acts::TrapezoidBounds>(design.shortHalfHeight(),
63 design.longHalfHeight(),
64 design.halfWidth(), rotAngle)));
65#endif
66 ATH_MSG_VERBOSE(idHelperSvc()->toStringDetEl(identify())<<" gasGap: "<<gasGapNumber(layPtr->hash())
67 <<" isStrip: "<<isStrip(layPtr->hash())<<" hash: "<<s);
68 hasSensor = true;
69 }
70 if (!hasSensor) {
71 ATH_MSG_FATAL("No active layer is defined for "<<idHelperSvc()->toStringDetEl(identify()));
72 return StatusCode::FAILURE;
73 }
74#ifndef SIMULATIONBASE
76 m_pars.layerBounds->makeBounds<Acts::TrapezoidBounds>(m_pars.halfWidthShort,
77 m_pars.halfWidthLong,
78 m_pars.halfHeight)));
79 m_pars.layerBounds.reset();
80#endif
81 const IdentifierHash firstLay = constructHash(0, 1, false);
82 const IdentifierHash secondLay = constructHash(0, 2, false);
84 m_gasThickness = (center(gctx, firstLay) - center(gctx, secondLay)).mag();
85 return StatusCode::SUCCESS;
86}
87
89 return sensorLayout(layHash)->toOrigin();
90}
92 const StripLayerPtr& layDesign{sensorLayout(measHash)};
93 if (!layDesign) {
94 ATH_MSG_WARNING("The gasGap "<<gasGapNumber(measHash)<<" & strip:"<<isStrip(measHash)<<" is unknown");
95 return Amg::Vector3D::Zero();
96 }
97 return localToGlobalTransform(ctx, layerHash(measHash)) * layDesign->localStripPosition(channelNumber(measHash),
98 isStrip(measHash));
99}
100}
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_WARNING(x)
This is a "hash" representation of an Identifier.
const Amg::Transform3D & localToGlobalTransform(const ActsTrk::GeometryContext &ctx) const
Returns the transformation from the local coordinate system of the readout element into the global AT...
Amg::Vector3D center(const ActsTrk::GeometryContext &ctx) const
Returns the geometrical center point of the readout element.
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 TransformCacheDetEle corresponding the generic local -> global transformation of the read...
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.
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 shortHalfHeight() const
Returns the shorter half height of the panel.
double longHalfHeight() const
Returns the longer half height of the panel.
const StripLayerPtr & sensorLayout(const IdentifierHash &hash) const
Returns the pointer to the strip layer associated with the gas gap.
StatusCode initElement() override final
Initialization of the readout elements.
Amg::Transform3D fromGapToChamOrigin(const IdentifierHash &layerHash) const
Amg::Vector3D channelPosition(const ActsTrk::GeometryContext &ctx, const Identifier &measId) const
Returns the center of the measurement channel eta measurement: wire gang center phi measurement: stri...
static bool isStrip(const IdentifierHash &measHash)
Unpacks whether the measurement hash is a strip.
static unsigned channelNumber(const IdentifierHash &measHash)
Unpacks the channel number from the measurement hash.
static unsigned gasGapNumber(const IdentifierHash &measHash)
Unpacks the gas gap number from the measurement hash.
static IdentifierHash constructHash(unsigned measCh, unsigned gasGap, const bool isStrip)
Constructs the Hash out of the Identifier fields (channel, gasGap, isStrip)
IdentifierHash layerHash(const Identifier &measId) const override final
The layer hash removes the bits from the IdentifierHash corresponding to the measurement's channel nu...
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.