ATLAS Offline Software
MuonPhaseII/MuonDetDescr/MuonReadoutGeometryR4/src/TgcReadoutElement.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 */
4 
6 
7 
10 #include <GaudiKernel/SystemOfUnits.h>
11 #include <optional>
12 
13 #ifndef SIMULATIONBASE
14 # include "Acts/Surfaces/TrapezoidBounds.hpp"
15 # include "Acts/Surfaces/Surface.hpp"
16 
17 #endif
18 
19 
20 using namespace ActsTrk;
21 
22 
23 namespace MuonGMR4 {
25 std::ostream& operator<<(std::ostream& ostr, const parameterBook& pars) {
26  ostr<<"chamber dimensions --- ";
27  ostr<<"thickness: "<<pars.halfThickness<<" ";
28  ostr<<"height: "<<pars.halfHeight<<" ";
29  ostr<<"shortWidth: "<<pars.halfWidthShort<<" ";
30  ostr<<"longWidth: "<<pars.halfWidthLong<<" --- ";
31  return ostr;
32 }
33 TgcReadoutElement::~TgcReadoutElement() = default;
34 TgcReadoutElement::TgcReadoutElement(defineArgs&& args)
36  m_pars{std::move(args)} {
37 }
38 
41 
44  bool hasSensor{false};
45  for (size_t s = 0; s < m_pars.sensorLayouts.size(); ++s) {
46  const StripLayerPtr& layPtr{m_pars.sensorLayouts[s]};
47  if (!layPtr) continue;
48  if (layPtr->hash() != s) {
49  ATH_MSG_FATAL("Layer "<<(*layPtr)<<" has an unexpected hash "<<s);
50  return StatusCode::FAILURE;
51  }
52  ATH_MSG_VERBOSE(idHelperSvc()->toStringDetEl(identify())<<" gasGap: "<<gasGapNumber(layPtr->hash())
53  <<" isStrip: "<<isStrip(layPtr->hash())<<" hash: "<<s);
54  hasSensor = true;
55  }
56  if (!hasSensor) {
57  ATH_MSG_FATAL("No active layer is defined for "<<idHelperSvc()->toStringDetEl(identify()));
58  return StatusCode::FAILURE;
59  }
60 #ifndef SIMULATIONBASE
64  m_pars.halfHeight)));
65 #endif
66  for (unsigned int gap = 1; gap <= nGasGaps(); ++gap) {
67  if (numWireGangs(gap)) {
68  const IdentifierHash layHash{constructHash(0, gap, false)};
69  ATH_CHECK(insertTransform<TgcReadoutElement>(layHash));
70 #ifndef SIMULATIONBASE
71  const StripDesign& layout{wireGangLayout(gap)};
72  ATH_CHECK(planeSurfaceFactory(layHash, m_pars.layerBounds->make_bounds(layout.shortHalfHeight(),
73  layout.longHalfHeight(),
74  layout.halfWidth(),
75  90.* Gaudi::Units::deg)));
76 #endif
77  }
78  if (numStrips(gap)) {
79  const IdentifierHash layHash{constructHash(0, gap, true)};
80  ATH_CHECK(insertTransform<TgcReadoutElement>(layHash));
81 #ifndef SIMULATIONBASE
82  const StripDesign& layout{stripLayout(gap)};
84  ATH_CHECK(planeSurfaceFactory(layHash, m_pars.layerBounds->make_bounds(layout.shortHalfHeight(),
85  layout.longHalfHeight(),
86  layout.halfWidth())));
87 #endif
88  }
89  }
90 #ifndef SIMULATIONBASE
91  m_pars.layerBounds.reset();
92 #endif
93  const IdentifierHash firstLay = constructHash(0, 1, false);
94  const IdentifierHash secondLay = constructHash(0, 2, false);
95  ActsGeometryContext gctx{};
96  m_gasThickness =(center(gctx, firstLay) - center(gctx, secondLay)).mag();
97  return StatusCode::SUCCESS;
98 }
99 
100 Amg::Transform3D TgcReadoutElement::fromGapToChamOrigin(const IdentifierHash& layHash) const {
101  const unsigned layIdx{static_cast<unsigned>(layHash)};
102  return m_pars.sensorLayouts[layIdx]->toOrigin();
103 }
104 Amg::Vector3D TgcReadoutElement::channelPosition(const ActsGeometryContext& ctx, const IdentifierHash& measHash) const {
105  const StripLayerPtr& layDesign{sensorLayout(measHash)};
106  if (!layDesign) {
107  ATH_MSG_WARNING("The gasGap "<<gasGapNumber(measHash)<<" & strip:"<<isStrip(measHash)<<" is unknown");
108  return Amg::Vector3D::Zero();
109  }
110  return localToGlobalTrans(ctx, layerHash(measHash)) * layDesign->localStripPos(channelNumber(measHash));
111 }
112 }
make_hlt_rep.pars
pars
Definition: make_hlt_rep.py:90
MuonGMR4::TgcReadoutElement::numWireGangs
unsigned int numWireGangs(unsigned int gasGap) const
Returns the number of wire gangs for a given gasGap [1-3].
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:22
MuonGMR4::TgcReadoutElement::wireGangLayout
const WireGroupDesign & wireGangLayout(unsigned int gasGap) const
Returns access to the wire group design of the given gasGap [1-3] If the gap does not have a wires an...
ATH_MSG_FATAL
#define ATH_MSG_FATAL(x)
Definition: AthMsgStreamMacros.h:34
MuonGMR4::StripDesign
Definition: StripDesign.h:30
python.SystemOfUnits.s
int s
Definition: SystemOfUnits.py:131
MuonGMR4::TgcReadoutElement::fromGapToChamOrigin
Amg::Transform3D fromGapToChamOrigin(const IdentifierHash &layerHash) const
Definition: MuonPhaseII/MuonDetDescr/MuonReadoutGeometryR4/src/TgcReadoutElement.cxx:100
AthCheckMacros.h
MuonGMR4::TgcReadoutElement::gasGapNumber
static unsigned int gasGapNumber(const IdentifierHash &measHash)
MuonGMR4::TgcReadoutElement::nGasGaps
unsigned int nGasGaps() const
Returns the number of gasgaps described by this ReadOutElement (usally 2 or 3)
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
SurfaceBoundSet.h
MuonGMR4::MuonReadoutElement::createGeoTransform
StatusCode createGeoTransform()
Definition: MuonPhaseII/MuonDetDescr/MuonReadoutGeometryR4/src/MuonReadoutElement.cxx:36
ATH_MSG_VERBOSE
#define ATH_MSG_VERBOSE(x)
Definition: AthMsgStreamMacros.h:28
CaloSwCorrections.gap
def gap(flags, cells_name, *args, **kw)
Definition: CaloSwCorrections.py:212
MuonGMR4::TgcReadoutElement::constructHash
static IdentifierHash constructHash(unsigned int measCh, unsigned int gasGap, const bool isStrip)
Constructs the Hash out of the Identifier fields (channel, gasGap, isStrip)
MuonGMR4::TgcReadoutElement::isStrip
static bool isStrip(const IdentifierHash &measHash)
MuonGMR4::TgcReadoutElement::initElement
StatusCode initElement() override final
Element initialization.
Definition: MuonPhaseII/MuonDetDescr/MuonReadoutGeometryR4/src/TgcReadoutElement.cxx:40
MuonGMR4::TgcReadoutElement::numStrips
unsigned int numStrips(unsigned int gasGap) const
Returns the number of strips for a given gasGap [1-3].
MuonGMR4::TgcReadoutElement::stripLayout
const RadialStripDesign & stripLayout(unsigned int gasGap) const
Returns access to the strip design of the given gasGap [1-3] If the gap does not have strips an excep...
MuonGMR4
The ReadoutGeomCnvAlg converts the Run4 Readout geometry build from the GeoModelXML into the legacy M...
Definition: MdtCalibInput.h:20
MuonGMR4::TgcReadoutElement::getParameters
const parameterBook & getParameters() const
Definition: MuonPhaseII/MuonDetDescr/MuonReadoutGeometryR4/src/TgcReadoutElement.cxx:39
MuonGMR4::TgcReadoutElement::m_pars
parameterBook m_pars
Definition: MuonPhaseII/MuonDetDescr/MuonReadoutGeometryR4/MuonReadoutGeometryR4/TgcReadoutElement.h:107
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::parameterBook::layerBounds
ActsTrk::SurfaceBoundSetPtr< Acts::TrapezoidBounds > layerBounds
Set of surface boundaries.
Definition: MuonPhaseII/MuonDetDescr/MuonReadoutGeometryR4/MuonReadoutGeometryR4/TgcReadoutElement.h:40
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
MuonGMR4::TgcReadoutElement::m_gasThickness
double m_gasThickness
Distance between 2 gas gaps (Z - direction)
Definition: MuonPhaseII/MuonDetDescr/MuonReadoutGeometryR4/MuonReadoutGeometryR4/TgcReadoutElement.h:110
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::parameterBook::sensorLayouts
std::array< StripLayerPtr, 6 > sensorLayouts
We have maximum 3 gasgaps times eta / phi measurement.
Definition: MuonPhaseII/MuonDetDescr/MuonReadoutGeometryR4/MuonReadoutGeometryR4/TgcReadoutElement.h:37
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::TgcReadoutElement::channelNumber
static unsigned int channelNumber(const IdentifierHash &measHash)
ActsTrk
The AlignStoreProviderAlg loads the rigid alignment corrections and pipes them through the readout ge...
Definition: MuonDetectorBuilderTool.cxx:54
TgcReadoutElement.h
mag
Scalar mag() const
mag method
Definition: AmgMatrixBasePlugin.h:26
python.CaloScaleNoiseConfig.args
args
Definition: CaloScaleNoiseConfig.py:80
generate::Zero
void Zero(TH1D *hin)
Definition: generate.cxx:32