ATLAS Offline Software
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 
17 using namespace ActsTrk;
18 
19 
20 namespace MuonGMR4 {
22 std::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 }
30 TgcReadoutElement::~TgcReadoutElement() = default;
31 TgcReadoutElement::TgcReadoutElement(defineArgs&& args)
33  m_pars{std::move(args)} {
34 }
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  }
57  if (layHash != layPtr->hash()) {
58  THROW_EXCEPTION("Fart");
59  }
60  ATH_CHECK(insertTransform<TgcReadoutElement>(layHash));
61 #ifndef SIMULATIONBASE
62  const StripDesign& design{layPtr->design()};
63  const double rotAngle = isStrip(layPtr->hash()) ? 0. : 90.*Gaudi::Units::deg;
64  ATH_CHECK(planeSurfaceFactory(layHash, m_pars.layerBounds->makeBounds<Acts::TrapezoidBounds>(design.shortHalfHeight(),
65  design.longHalfHeight(),
66  design.halfWidth(), rotAngle)));
67 #endif
68  ATH_MSG_VERBOSE(idHelperSvc()->toStringDetEl(identify())<<" gasGap: "<<gasGapNumber(layPtr->hash())
69  <<" isStrip: "<<isStrip(layPtr->hash())<<" hash: "<<s);
70  hasSensor = true;
71  }
72  if (!hasSensor) {
73  ATH_MSG_FATAL("No active layer is defined for "<<idHelperSvc()->toStringDetEl(identify()));
74  return StatusCode::FAILURE;
75  }
76 #ifndef SIMULATIONBASE
78  m_pars.layerBounds->makeBounds<Acts::TrapezoidBounds>(m_pars.halfWidthShort,
80  m_pars.halfHeight)));
81  m_pars.layerBounds.reset();
82 #endif
83  const IdentifierHash firstLay = constructHash(0, 1, false);
84  const IdentifierHash secondLay = constructHash(0, 2, false);
85  ActsGeometryContext gctx{};
86  m_gasThickness = (center(gctx, firstLay) - center(gctx, secondLay)).mag();
87  return StatusCode::SUCCESS;
88 }
89 
90 Amg::Transform3D TgcReadoutElement::fromGapToChamOrigin(const IdentifierHash& layHash) const {
91  return sensorLayout(layHash)->toOrigin();
92 }
93 Amg::Vector3D TgcReadoutElement::channelPosition(const ActsGeometryContext& ctx, const IdentifierHash& measHash) const {
94  const StripLayerPtr& layDesign{sensorLayout(measHash)};
95  if (!layDesign) {
96  ATH_MSG_WARNING("The gasGap "<<gasGapNumber(measHash)<<" & strip:"<<isStrip(measHash)<<" is unknown");
97  return Amg::Vector3D::Zero();
98  }
99  return localToGlobalTrans(ctx, layerHash(measHash)) * layDesign->localStripPosition(channelNumber(measHash),
100  isStrip(measHash));
101 }
102 }
make_hlt_rep.pars
pars
Definition: make_hlt_rep.py:90
GeoModel::TransientConstSharedPtr
The TransientConstSharedPtr allows non-const access if the pointer itself is non-const but in the con...
Definition: TransientConstSharedPtr.h:13
MuonGMR4::parameterBook
MmReadoutElement::parameterBook parameterBook
Definition: MmReadoutElement.cxx:21
ATH_MSG_FATAL
#define ATH_MSG_FATAL(x)
Definition: AthMsgStreamMacros.h:34
MuonGMR4::StripDesign
Definition: StripDesign.h:30
MuonGMR4::TgcReadoutElement::fromGapToChamOrigin
Amg::Transform3D fromGapToChamOrigin(const IdentifierHash &layerHash) const
Definition: MuonPhaseII/MuonDetDescr/MuonReadoutGeometryR4/src/TgcReadoutElement.cxx:90
AthCheckMacros.h
python.CaloAddPedShiftConfig.args
args
Definition: CaloAddPedShiftConfig.py:47
MuonGMR4::TgcReadoutElement::channelPosition
Amg::Vector3D channelPosition(const ActsGeometryContext &ctx, const Identifier &measId) const
Returns the center of the measurement channel eta measurement: wire gang center phi measurement: stri...
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
MuonGMR4::MuonReadoutElement::createGeoTransform
StatusCode createGeoTransform()
Definition: MuonPhaseII/MuonDetDescr/MuonReadoutGeometryR4/src/MuonReadoutElement.cxx:36
MuonGMR4::TgcReadoutElement::parameterBook::layerBounds
std::shared_ptr< Acts::SurfaceBoundFactory > layerBounds
Set of surface boundaries.
Definition: MuonPhaseII/MuonDetDescr/MuonReadoutGeometryR4/MuonReadoutGeometryR4/TgcReadoutElement.h:40
ATH_MSG_VERBOSE
#define ATH_MSG_VERBOSE(x)
Definition: AthMsgStreamMacros.h:28
MuonGMR4::TgcReadoutElement::channelNumber
static unsigned channelNumber(const IdentifierHash &measHash)
Unpacks the channel number from the measurement hash.
MuonGMR4::TgcReadoutElement::isStrip
static bool isStrip(const IdentifierHash &measHash)
Unpacks whether the measurement hash is a strip.
MuonGMR4::TgcReadoutElement::initElement
StatusCode initElement() override final
Element initialization.
Definition: MuonPhaseII/MuonDetDescr/MuonReadoutGeometryR4/src/TgcReadoutElement.cxx:37
MuonGMR4
The ReadoutGeomCnvAlg converts the Run4 Readout geometry build from the GeoModelXML into the legacy M...
Definition: MdtCalibInput.h:19
MuonGMR4::TgcReadoutElement::getParameters
const parameterBook & getParameters() const
Definition: MuonPhaseII/MuonDetDescr/MuonReadoutGeometryR4/src/TgcReadoutElement.cxx:36
MuonGMR4::TgcReadoutElement::m_pars
parameterBook m_pars
Definition: MuonPhaseII/MuonDetDescr/MuonReadoutGeometryR4/MuonReadoutGeometryR4/TgcReadoutElement.h:105
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
Amg::Transform3D
Eigen::Affine3d Transform3D
Definition: GeoPrimitives.h:46
MuonGMR4::TgcReadoutElement::parameterBook::halfWidthLong
double halfWidthLong
Half length of the chamber long edge (Top)
Definition: MuonPhaseII/MuonDetDescr/MuonReadoutGeometryR4/MuonReadoutGeometryR4/TgcReadoutElement.h:33
MuonGMR4::TgcReadoutElement::parameterBook
Set of parameters to describe a Tgc chamber.
Definition: MuonPhaseII/MuonDetDescr/MuonReadoutGeometryR4/MuonReadoutGeometryR4/TgcReadoutElement.h:24
MuonGMR4::TgcReadoutElement::gasGapNumber
static unsigned gasGapNumber(const IdentifierHash &measHash)
Unpacks the gas gap number from the measurement hash.
MuonGMR4::MuonReadoutElement::center
Amg::Vector3D center(const ActsGeometryContext &ctx) const
Returns the detector center (Which is the same as the detector center of the first measurement layer)
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
ActsTrk::operator<<
MsgStream & operator<<(MsgStream &out, const ActsUtils::Stat &stat)
Definition: TrackToTruthAssociationAlg.cxx:25
MuonGMR4::TgcReadoutElement::parameterBook::halfWidthShort
double halfWidthShort
Half length of the chamber short edge (Bottom)
Definition: MuonPhaseII/MuonDetDescr/MuonReadoutGeometryR4/MuonReadoutGeometryR4/TgcReadoutElement.h:31
ActsGeometryContext
Include the GeoPrimitives which need to be put first.
Definition: ActsGeometryContext.h:27
MuonGMR4::TgcReadoutElement::defineArgs
Definition: MuonPhaseII/MuonDetDescr/MuonReadoutGeometryR4/MuonReadoutGeometryR4/TgcReadoutElement.h:45
MuonGMR4::TgcReadoutElement::layerHash
IdentifierHash layerHash(const Identifier &measId) const override final
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::TgcReadoutElement::sensorLayout
const StripLayerPtr & sensorLayout(const IdentifierHash &hash) const
Returns the pointer to the strip layer associated with the gas gap.
MuonGMR4::MuonReadoutElement::identify
Identifier identify() const override final
Return the athena identifier.
Amg::Vector3D
Eigen::Matrix< double, 3, 1 > Vector3D
Definition: GeoPrimitives.h:47
THROW_EXCEPTION
#define THROW_EXCEPTION(MESSAGE)
Definition: throwExcept.h:10
MuonGMR4::TgcReadoutElement::m_gasThickness
double m_gasThickness
Distance between 2 gas gaps (Z - direction)
Definition: MuonPhaseII/MuonDetDescr/MuonReadoutGeometryR4/MuonReadoutGeometryR4/TgcReadoutElement.h:108
MuonGMR4::TgcReadoutElement::parameterBook::halfHeight
double halfHeight
Half height of the chamber (Top - botom edge)
Definition: MuonPhaseII/MuonDetDescr/MuonReadoutGeometryR4/MuonReadoutGeometryR4/TgcReadoutElement.h:29
MuonGMR4::MuonReadoutElement::planeSurfaceFactory
StatusCode planeSurfaceFactory(const IdentifierHash &hash, std::shared_ptr< Acts::PlanarBounds > pBounds)
Definition: MuonPhaseII/MuonDetDescr/MuonReadoutGeometryR4/src/MuonReadoutElement.cxx:125
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
MuonGMR4::TgcReadoutElement::constructHash
static IdentifierHash constructHash(unsigned measCh, unsigned gasGap, const bool isStrip)
Constructs the Hash out of the Identifier fields (channel, gasGap, isStrip)
MuonGMR4::TgcReadoutElement::parameterBook::sensorLayouts
std::array< StripLayerPtr, 6 > sensorLayouts
We have maximum 3 gasgaps times eta / phi measurement.
Definition: MuonPhaseII/MuonDetDescr/MuonReadoutGeometryR4/MuonReadoutGeometryR4/TgcReadoutElement.h:37
python.SystemOfUnits.s
float s
Definition: SystemOfUnits.py:147
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:24
TgcReadoutElement.h
mag
Scalar mag() const
mag method
Definition: AmgMatrixBasePlugin.h:26
generate::Zero
void Zero(TH1D *hin)
Definition: generate.cxx:32