diff --git a/MuonSpectrometer/MuonPhaseII/MuonDetDescr/MuonGeoModelR4/MuonGeoModelR4/TgcReadoutGeomTool.h b/MuonSpectrometer/MuonPhaseII/MuonDetDescr/MuonGeoModelR4/MuonGeoModelR4/TgcReadoutGeomTool.h index 0d5a1a9dfc3689aa57923aaab09b6e0017d8b4b9..20c3eb8f749f21fed7f21e69a777576f88951b2c 100644 --- a/MuonSpectrometer/MuonPhaseII/MuonDetDescr/MuonGeoModelR4/MuonGeoModelR4/TgcReadoutGeomTool.h +++ b/MuonSpectrometer/MuonPhaseII/MuonDetDescr/MuonGeoModelR4/MuonGeoModelR4/TgcReadoutGeomTool.h @@ -44,7 +44,6 @@ class TgcReadoutGeomTool : public AthAlgTool, double wirePitch{0.}; unsigned int gasGap{0}; }; - using StripLayerPtr = GeoModel::TransientConstSharedPtr<StripLayer>; struct FactoryCache { using ParamBookTable = std::map<std::string, wTgcTable>; ParamBookTable parameterBook{}; diff --git a/MuonSpectrometer/MuonPhaseII/MuonDetDescr/MuonReadoutGeometryR4/MuonReadoutGeometryR4/TgcReadoutElement.h b/MuonSpectrometer/MuonPhaseII/MuonDetDescr/MuonReadoutGeometryR4/MuonReadoutGeometryR4/TgcReadoutElement.h index f7468fb9eab285df13b4c13f998b93803a52f9b2..d395f53d20df943121105abf8a252059f8d8710a 100644 --- a/MuonSpectrometer/MuonPhaseII/MuonDetDescr/MuonReadoutGeometryR4/MuonReadoutGeometryR4/TgcReadoutElement.h +++ b/MuonSpectrometer/MuonPhaseII/MuonDetDescr/MuonReadoutGeometryR4/MuonReadoutGeometryR4/TgcReadoutElement.h @@ -18,7 +18,6 @@ class TgcReadoutElement : public MuonReadoutElement { public: /// Set of parameters to describe a Tgc chamber - using StripLayerPtr = GeoModel::TransientConstSharedPtr<StripLayer>; struct parameterBook { /// Describe the chamber dimensions /// Half thickness of the chamber @@ -72,6 +71,9 @@ class TgcReadoutElement : public MuonReadoutElement { double moduleHeight() const; /// Returns the thickness of the chamber double moduleThickness() const; + + /// Returns the number of readout channels + unsigned int numChannels(const IdentifierHash& measHash) const; /// Returns the number of strips for a given gasGap [1-3] unsigned int numStrips(unsigned int gasGap) const; /// Returns the number of wire gangs for a given gasGap [1-3] @@ -85,6 +87,8 @@ class TgcReadoutElement : public MuonReadoutElement { Amg::Vector3D channelPosition(const ActsGeometryContext& ctx, const Identifier& measId) const; Amg::Vector3D channelPosition(const ActsGeometryContext& ctx, const IdentifierHash& measHash) const; + /// Returns the pointer to the strip layer associated with the gas gap. + const StripLayerPtr& sensorLayout(const IdentifierHash& hash) const; /// Returns access to the wire group design of the given gasGap [1-3] /// If the gap does not have a wires an exception is thrown const WireGroupDesign& wireGangLayout(unsigned int gasGap) const; @@ -114,8 +118,6 @@ class TgcReadoutElement : public MuonReadoutElement { static unsigned int channelNumber(const IdentifierHash& measHash); static unsigned int gasGapNumber(const IdentifierHash& measHash); static bool isStrip(const IdentifierHash& measHash); - private: - const StripLayerPtr& sensorLayout(unsigned int gasGap, const bool isStrip) const; }; std::ostream& operator<<(std::ostream& ostr, const TgcReadoutElement::parameterBook& pars); } // namespace MuonGMR4 diff --git a/MuonSpectrometer/MuonPhaseII/MuonDetDescr/MuonReadoutGeometryR4/MuonReadoutGeometryR4/TgcReadoutElement.icc b/MuonSpectrometer/MuonPhaseII/MuonDetDescr/MuonReadoutGeometryR4/MuonReadoutGeometryR4/TgcReadoutElement.icc index 79e36d60d3e7abf30c5b76101ed1db7db647018a..112461ec5db29435823ebfb13d413799036d0dd8 100644 --- a/MuonSpectrometer/MuonPhaseII/MuonDetDescr/MuonReadoutGeometryR4/MuonReadoutGeometryR4/TgcReadoutElement.icc +++ b/MuonSpectrometer/MuonPhaseII/MuonDetDescr/MuonReadoutGeometryR4/MuonReadoutGeometryR4/TgcReadoutElement.icc @@ -73,36 +73,32 @@ inline Identifier TgcReadoutElement::measurementId(const IdentifierHash& measHas } inline unsigned int TgcReadoutElement::nGasGaps() const { return m_pars.nGasGaps; } +inline unsigned int TgcReadoutElement::numChannels(const IdentifierHash& measHash) const { + return isStrip(measHash) ? numStrips(gasGapNumber(measHash) + 1) + : numWireGangs(gasGapNumber(measHash) + 1); +} inline unsigned int TgcReadoutElement::numStrips(unsigned int gasGap) const { - const StripLayerPtr& sensor{sensorLayout(gasGap, true)}; + const StripLayerPtr& sensor{sensorLayout(constructHash(0, gasGap, true))}; return sensor ? sensor->design().numStrips() : 0; } inline unsigned int TgcReadoutElement::numWireGangs(unsigned int gasGap) const { - const StripLayerPtr& sensor{sensorLayout(gasGap, false)}; + const StripLayerPtr& sensor{sensorLayout(constructHash(0, gasGap, false))}; return sensor ? sensor->design().numStrips() : 0; } -inline const TgcReadoutElement::StripLayerPtr& TgcReadoutElement::sensorLayout(unsigned int gasGap, const bool isStrip) const { - const IdentifierHash layHash{constructHash(0, gasGap, isStrip)}; - const unsigned layIdx{static_cast<unsigned>(layHash)}; - return m_pars.sensorLayouts.at(layIdx); +inline const StripLayerPtr& TgcReadoutElement::sensorLayout(const IdentifierHash& measHash) const { + return m_pars.sensorLayouts.at(layerHash(measHash)); } inline const WireGroupDesign& TgcReadoutElement::wireGangLayout(unsigned int gasGap) const { - const StripLayerPtr& layerPtr = sensorLayout(gasGap, false); + const StripLayerPtr& layerPtr = sensorLayout(constructHash(0, gasGap, false)); if (!layerPtr) { - std::stringstream err_str{}; - err_str<<__FILE__<<":"<<__LINE__<<" Gas gap "<<gasGap<<" has no wire gangs in " - <<idHelperSvc()->toStringDetEl(identify())<<std::endl; - throw std::runtime_error(err_str.str()); + THROW_EXCEPTION(" Gas gap "<<gasGap<<" has no wire gangs in "<<idHelperSvc()->toStringDetEl(identify())); } return static_cast<const WireGroupDesign&>(layerPtr->design()); } inline const RadialStripDesign& TgcReadoutElement::stripLayout(unsigned int gasGap) const { - const StripLayerPtr& layerPtr = sensorLayout(gasGap, true); + const StripLayerPtr& layerPtr = sensorLayout(constructHash(0, gasGap, true)); if (!layerPtr) { - std::stringstream err_str{}; - err_str<<__FILE__<<":"<<__LINE__<<" Gas gap "<<gasGap<<" has no strips in " - <<idHelperSvc()->toStringDetEl(identify())<<std::endl; - throw std::runtime_error(err_str.str()); + THROW_EXCEPTION(" Gas gap "<<gasGap<<" has no strips in "<<idHelperSvc()->toStringDetEl(identify())); } return static_cast<const RadialStripDesign&>(layerPtr->design()); } diff --git a/MuonSpectrometer/MuonPhaseII/MuonDetDescr/MuonReadoutGeometryR4/src/TgcReadoutElement.cxx b/MuonSpectrometer/MuonPhaseII/MuonDetDescr/MuonReadoutGeometryR4/src/TgcReadoutElement.cxx index 3944d6b4be25f0209fcc749fb1dab996c1c6c90f..c693be9e940b8b8846ef7dd5b441c7f2faf8d20a 100644 --- a/MuonSpectrometer/MuonPhaseII/MuonDetDescr/MuonReadoutGeometryR4/src/TgcReadoutElement.cxx +++ b/MuonSpectrometer/MuonPhaseII/MuonDetDescr/MuonReadoutGeometryR4/src/TgcReadoutElement.cxx @@ -93,7 +93,7 @@ Amg::Transform3D TgcReadoutElement::fromGapToChamOrigin(const IdentifierHash& la return m_pars.sensorLayouts[layIdx]->toOrigin(); } Amg::Vector3D TgcReadoutElement::channelPosition(const ActsGeometryContext& ctx, const IdentifierHash& measHash) const { - const StripLayerPtr& layDesign{sensorLayout(gasGapNumber(measHash), isStrip(measHash))}; + const StripLayerPtr& layDesign{sensorLayout(measHash)}; if (!layDesign) { ATH_MSG_WARNING("The gasGap "<<gasGapNumber(measHash)<<" & strip:"<<isStrip(measHash)<<" is unknown"); return Amg::Vector3D::Zero();