diff --git a/MuonSpectrometer/MuonCnv/MuonSTGC_CnvTools/src/sTgcRdoToPrepDataToolMT.cxx b/MuonSpectrometer/MuonCnv/MuonSTGC_CnvTools/src/sTgcRdoToPrepDataToolMT.cxx index b1600b8c8482b1cb72b230cea9869a754a345e95..97132c1a72ac2ce9dcd963f54552510f7464bdd6 100644 --- a/MuonSpectrometer/MuonCnv/MuonSTGC_CnvTools/src/sTgcRdoToPrepDataToolMT.cxx +++ b/MuonSpectrometer/MuonCnv/MuonSTGC_CnvTools/src/sTgcRdoToPrepDataToolMT.cxx @@ -135,7 +135,7 @@ StatusCode Muon::sTgcRdoToPrepDataToolMT::processCollection(const EventContext& bool getLocalPos = detEl->stripPosition(rdoId, localPos); if ( !getLocalPos ) { - ATH_MSG_ERROR("Could not get the local strip position for sTgc"); + ATH_MSG_ERROR("Could not get the local strip position for "<<m_idHelperSvc->toString(rdoId)); return StatusCode::FAILURE; } diff --git a/MuonSpectrometer/MuonDetDescr/MuonReadoutGeometry/MuonReadoutGeometry/sTgcReadoutElement.h b/MuonSpectrometer/MuonDetDescr/MuonReadoutGeometry/MuonReadoutGeometry/sTgcReadoutElement.h index 86c12607378dbad23a7593b38f04a19205bc3673..3fc6a7a48bfff69056ebd44f65b80e27d75f41d8 100644 --- a/MuonSpectrometer/MuonDetDescr/MuonReadoutGeometry/MuonReadoutGeometry/sTgcReadoutElement.h +++ b/MuonSpectrometer/MuonDetDescr/MuonReadoutGeometry/MuonReadoutGeometry/sTgcReadoutElement.h @@ -14,6 +14,7 @@ #include "MuonReadoutGeometry/MuonDetectorManager.h" #include "MuonReadoutGeometry/MuonPadDesign.h" #include "GeoModelInterfaces/IGeoDbTagSvc.h" +#include "GeoPrimitives/GeoPrimitivesToStringConverter.h" class MuonReadoutGeomCnvAlg; @@ -212,9 +213,6 @@ namespace MuonGM { std::array<MuonChannelDesign,4> m_etaDesign{}; std::array<MuonPadDesign,4> m_padDesign{}; - std::array<int, 4> m_nStrips{}; - std::array<int, 4> m_nWires{}; - std::array<int, 4> m_nPads{}; static constexpr int m_nlayers{4}; int m_ml{0}; double m_offset{0.}; @@ -228,15 +226,6 @@ namespace MuonGM { const BLinePar* m_BLinePar{nullptr}; Amg::Transform3D m_delta{Amg::Transform3D::Identity()}; - // surface dimensions for strips - std::array<double, 4> m_halfX{}; - std::array<double, 4> m_minHalfY{}; - std::array<double, 4> m_maxHalfY{}; - // surface dimensions for pads and wires - std::array<double, 4> m_PadhalfX{}; - std::array<double, 4> m_PadminHalfY{}; - std::array<double, 4> m_PadmaxHalfY{}; - // transforms (RE->layer) std::array<Amg::Transform3D, 4> m_Xlg{make_array<Amg::Transform3D, 4>(Amg::Transform3D::Identity())}; @@ -268,7 +257,7 @@ namespace MuonGM { }; inline int sTgcReadoutElement::surfaceHash(const Identifier& id) const { - return surfaceHash(manager()->stgcIdHelper()->gasGap(id), manager()->stgcIdHelper()->channelType(id)); + return surfaceHash(m_idHelper.gasGap(id), m_idHelper.channelType(id)); } inline int sTgcReadoutElement::surfaceHash(int gasGap, int channelType) const { @@ -280,28 +269,28 @@ namespace MuonGM { } inline int sTgcReadoutElement::boundaryHash(const Identifier& id) const { - int iphi = manager()->stgcIdHelper()->channelType(id) != sTgcIdHelper::sTgcChannelTypes::Strip; // wires and pads have locX oriented along phi - if (std::abs(getStationEta()) < 3) iphi += 2 * (manager()->stgcIdHelper()->gasGap(id) - 1); + int iphi = m_idHelper.channelType(id) != sTgcIdHelper::sTgcChannelTypes::Strip; // wires and pads have locX oriented along phi + if (std::abs(getStationEta()) < 3) iphi += 2 * (m_idHelper.gasGap(id) - 1); return iphi; } inline bool sTgcReadoutElement::measuresPhi(const Identifier& id) const { - return (manager()->stgcIdHelper()->channelType(id) != sTgcIdHelper::sTgcChannelTypes::Strip); + return (m_idHelper.channelType(id) != sTgcIdHelper::sTgcChannelTypes::Strip); } inline const MuonChannelDesign* sTgcReadoutElement::getDesign(const Identifier& id) const { - if (manager()->stgcIdHelper()->channelType(id) == sTgcIdHelper::sTgcChannelTypes::Strip) return &(m_etaDesign[manager()->stgcIdHelper()->gasGap(id) - 1]); - if (manager()->stgcIdHelper()->channelType(id) == sTgcIdHelper::sTgcChannelTypes::Wire) return &(m_phiDesign[manager()->stgcIdHelper()->gasGap(id) - 1]); + if (m_idHelper.channelType(id) == sTgcIdHelper::sTgcChannelTypes::Strip) return &(m_etaDesign[m_idHelper.gasGap(id) - 1]); + if (m_idHelper.channelType(id) == sTgcIdHelper::sTgcChannelTypes::Wire) return &(m_phiDesign[m_idHelper.gasGap(id) - 1]); return nullptr; } inline const MuonPadDesign* sTgcReadoutElement::getPadDesign(const Identifier& id) const { - if (manager()->stgcIdHelper()->channelType(id) == sTgcIdHelper::sTgcChannelTypes::Pad) return &(m_padDesign[manager()->stgcIdHelper()->gasGap(id) - 1]); + if (m_idHelper.channelType(id) == sTgcIdHelper::sTgcChannelTypes::Pad) return &(m_padDesign[m_idHelper.gasGap(id) - 1]); return nullptr; } inline MuonPadDesign* sTgcReadoutElement::getPadDesign(const Identifier& id) { - if (manager()->stgcIdHelper()->channelType(id) == sTgcIdHelper::sTgcChannelTypes::Pad) return &(m_padDesign[manager()->stgcIdHelper()->gasGap(id) - 1]); + if (m_idHelper.channelType(id) == sTgcIdHelper::sTgcChannelTypes::Pad) return &(m_padDesign[m_idHelper.gasGap(id) - 1]); return nullptr; } @@ -320,19 +309,26 @@ namespace MuonGM { } inline int sTgcReadoutElement::stripNumber(const Amg::Vector2D& pos, const Identifier& id) const { - if (manager()->stgcIdHelper()->channelType(id) == sTgcIdHelper::sTgcChannelTypes::Pad) return padNumber(pos, id); + if (m_idHelper.channelType(id) == sTgcIdHelper::sTgcChannelTypes::Pad) return padNumber(pos, id); const MuonChannelDesign* design = getDesign(id); - if (!design) return -1; + if (!design) { + ATH_MSG_WARNING("Cannot associate the strip number for "<<Amg::toString(pos)<<" in layer " + <<idHelperSvc()->toStringGasGap(id)); + return -1; + } return design->channelNumber(pos); } inline bool sTgcReadoutElement::stripPosition(const Identifier& id, Amg::Vector2D& pos) const { - if (manager()->stgcIdHelper()->channelType(id) == sTgcIdHelper::sTgcChannelTypes::Pad) return padPosition(id, pos); + if (m_idHelper.channelType(id) == sTgcIdHelper::sTgcChannelTypes::Pad) return padPosition(id, pos); const MuonChannelDesign* design = getDesign(id); - if (!design) return 0; - return design->center(manager()->stgcIdHelper()->channel(id), pos); + if (!design) { + ATH_MSG_WARNING("Cannot determine the strip postion for "<<idHelperSvc()->toString(id)); + return false; + } + return design->center(m_idHelper.channel(id), pos); } inline bool sTgcReadoutElement::stripGlobalPosition(const Identifier& id, Amg::Vector3D& gpos) const { @@ -344,10 +340,12 @@ namespace MuonGM { inline bool sTgcReadoutElement::padPosition(const Identifier& id, Amg::Vector2D& pos) const { const MuonPadDesign* design = getPadDesign(id); - if (!design) return false; - - int padEta = manager()->stgcIdHelper()->padEta(id); - int padPhi = manager()->stgcIdHelper()->padPhi(id); + if (!design){ + ATH_MSG_WARNING("Cannot determine the pad position for "<<idHelperSvc()->toString(id)); + return false; + } + int padEta = m_idHelper.padEta(id); + int padPhi = m_idHelper.padPhi(id); return design->channelPosition(std::make_pair(padEta, padPhi), pos); } @@ -361,10 +359,12 @@ namespace MuonGM { inline bool sTgcReadoutElement::padCorners(const Identifier& id, std::array<Amg::Vector2D, 4>& corners) const { const MuonPadDesign* design = getPadDesign(id); - if (!design) return false; - - int padEta = manager()->stgcIdHelper()->padEta(id); - int padPhi = manager()->stgcIdHelper()->padPhi(id); + if (!design) { + ATH_MSG_WARNING("Cannot find the pad corners for "<<idHelperSvc()->toString(id)); + return false; + } + int padEta = m_idHelper.padEta(id); + int padPhi = m_idHelper.padPhi(id); return design->channelCorners(std::make_pair(padEta, padPhi), corners); } @@ -382,23 +382,23 @@ namespace MuonGM { // This function returns true if we are in the eta 0 region of QL1/QS1 inline bool sTgcReadoutElement::isEtaZero(const Identifier& id, const Amg::Vector2D& localPosition) const { - const sTgcIdHelper* idHelper = manager()->stgcIdHelper(); - // False if not a QL1 or QS1 quadruplet - if (std::abs(idHelper->stationEta(id)) != 1) return false; - - const MuonChannelDesign* - wireDesign = (idHelper->channelType(id) == sTgcIdHelper::sTgcChannelTypes::Wire) ? - getDesign(id) : - getDesign(idHelper->channelID(id, - idHelper->multilayer(id), - idHelper->gasGap(id), - sTgcIdHelper::sTgcChannelTypes::Wire, - 1)); - if (!wireDesign) return false; + if (std::abs(m_idHelper.stationEta(id)) != 1) return false; + const MuonChannelDesign* wireDesign = (m_idHelper.channelType(id) == sTgcIdHelper::sTgcChannelTypes::Wire) ? + getDesign(id) : + getDesign(m_idHelper.channelID(id, + m_idHelper.multilayer(id), + m_idHelper.gasGap(id), + sTgcIdHelper::sTgcChannelTypes::Wire, + 1)); + if (!wireDesign) { + ATH_MSG_WARNING("Cannot determine whether the pos "<<Amg::toString(localPosition)<<" is etaZero() for " + <<idHelperSvc()->toString(id)); + return false; + } // Require the x coordinate for strips, and the y coordinate for wires and pads - double lpos = (idHelper->channelType(id) == sTgcIdHelper::sTgcChannelTypes::Strip) ? + double lpos = (m_idHelper.channelType(id) == sTgcIdHelper::sTgcChannelTypes::Strip) ? localPosition.x() : localPosition.y(); if (lpos < 0.5 * wireDesign->xSize() - wireDesign->wireCutout) return true; @@ -408,20 +408,19 @@ namespace MuonGM { inline int sTgcReadoutElement::numberOfLayers(bool) const { return m_nlayers; } inline int sTgcReadoutElement::numberOfStrips(const Identifier& layerId) const { - return numberOfStrips(manager()->stgcIdHelper()->gasGap(layerId) - 1, - manager()->stgcIdHelper()->channelType(layerId) == sTgcIdHelper::sTgcChannelTypes::Wire); + return numberOfStrips(m_idHelper.gasGap(layerId) - 1, + m_idHelper.channelType(layerId) == sTgcIdHelper::sTgcChannelTypes::Wire); } inline int sTgcReadoutElement::numberOfStrips(int lay, bool measPhi) const { - if (lay > -1 && lay < m_nlayers) { return measPhi ? m_nWires[lay] : m_nStrips[lay]; } + if (lay > -1 && lay < m_nlayers) { return !measPhi ? m_etaDesign[lay].nch : m_phiDesign[lay].nGroups; } return -1; } inline int sTgcReadoutElement::numberOfPads(const Identifier& layerId) const { const MuonPadDesign* design = getPadDesign(layerId); if (!design) { - MsgStream log(Athena::getMessageSvc(), "sTgcReadoutElement"); - log << MSG::WARNING << "no pad design found when trying to get the number of pads" << endmsg; + ATH_MSG_WARNING("no pad design found when trying to get the number of pads "<<idHelperSvc()->toString(layerId)); return 0; } return design->nPadColumns * design->nPadH; @@ -430,23 +429,21 @@ namespace MuonGM { inline int sTgcReadoutElement::maxPadNumber(const Identifier& layerId) const { const MuonPadDesign* design = getPadDesign(layerId); if (!design) { - MsgStream log(Athena::getMessageSvc(), "sTgcReadoutElement"); - log << MSG::WARNING << "no pad design found when trying to get the largest pad number" << endmsg; + ATH_MSG_WARNING("no pad design found when trying to get the largest pad number "<<idHelperSvc()->toString(layerId)); return 0; } - return (design->nPadColumns - 1) * manager()->stgcIdHelper()->padEtaMax() + design->nPadH; + return (design->nPadColumns - 1) * m_idHelper.padEtaMax() + design->nPadH; } inline bool sTgcReadoutElement::spacePointPosition(const Identifier& phiId, const Identifier& etaId, Amg::Vector2D& pos) const { - Amg::Vector2D phiPos; - Amg::Vector2D etaPos; + Amg::Vector2D phiPos{Amg::Vector2D::Zero()}, etaPos{Amg::Vector2D::Zero()}; if (!stripPosition(phiId, phiPos) || !stripPosition(etaId, etaPos)) return false; spacePointPosition(phiPos, etaPos, pos); return true; } inline bool sTgcReadoutElement::spacePointPosition(const Identifier& phiId, const Identifier& etaId, Amg::Vector3D& pos) const { - Amg::Vector2D lpos; + Amg::Vector2D lpos{Amg::Vector2D::Zero()}; spacePointPosition(phiId, etaId, lpos); surface(phiId).localToGlobal(lpos, pos, pos); return true; diff --git a/MuonSpectrometer/MuonDetDescr/MuonReadoutGeometry/src/sTgcReadoutElement.cxx b/MuonSpectrometer/MuonDetDescr/MuonReadoutGeometry/src/sTgcReadoutElement.cxx index 533a5c5b070c42165c34244545b96933d20da7ce..6b9c704b150cfe8712e4e19317641a73d4c1d0a5 100644 --- a/MuonSpectrometer/MuonDetDescr/MuonReadoutGeometry/src/sTgcReadoutElement.cxx +++ b/MuonSpectrometer/MuonDetDescr/MuonReadoutGeometry/src/sTgcReadoutElement.cxx @@ -196,12 +196,6 @@ namespace MuonGM { m_etaDesign[il].setFirstPos(m_diamondShape ? -(m_etaDesign[il].xSize()- yCutout) + m_etaDesign[il].firstPitch : -0.5 * m_etaDesign[il].xSize()+ m_etaDesign[il].firstPitch); m_etaDesign[il].nch = nStrips; - - m_nStrips[il] = m_etaDesign[il].nch; - - m_halfX[il] = 0.5*m_etaDesign[il].xSize(); - m_minHalfY[il] = 0.5*sStripWidth; - m_maxHalfY[il] = 0.5*lStripWidth; } //------------------- @@ -229,7 +223,6 @@ namespace MuonGM { m_phiDesign[il].wireCutout = wireCutout[il]; // Size of "active" wire region for digits m_phiDesign[il].nch = nWires[il]; - m_nWires[il] = m_phiDesign[il].nGroups; // number of nWireGroups } //------------------- @@ -251,11 +244,7 @@ namespace MuonGM { m_padDesign[il].lPadWidth = lPadWidth; m_padDesign[il].nPadColumns = nPadPhi[il]; - - m_PadhalfX[il] = 0.5*m_padDesign[il].Size; - m_PadminHalfY[il] = 0.5*sPadWidth; - m_PadmaxHalfY[il] = 0.5*lPadWidth; - + // The C side of the NSW is mirrored instead of rotated // We should be using the same values for the pads for both A and C // It is easier for us to simply read the same correct value once @@ -340,13 +329,7 @@ namespace MuonGM { m_etaDesign[il].setFirstPos((m_diamondShape) ? -(m_etaDesign[il].xSize()- yCutout) + m_etaDesign[il].firstPitch : -0.5 * m_etaDesign[il].xSize()+ m_etaDesign[il].firstPitch); m_etaDesign[il].nch = roParam.nStrips; - - m_nStrips[il] = m_etaDesign[il].nch; - - m_halfX[il] = 0.5*m_etaDesign[il].xSize(); - m_minHalfY[il] = 0.5*roParam.sStripWidth; - m_maxHalfY[il] = 0.5*roParam.lStripWidth; - + ATH_MSG_DEBUG("initDesign:" << getStationName() << " layer " << il << ", strip pitch " << m_etaDesign[il].inputPitch << ", nstrips " << m_etaDesign[il].nch @@ -377,7 +360,6 @@ namespace MuonGM { m_phiDesign[il].nGroups = roParam.nWireGroups[il]; // Number of Wire Groups m_phiDesign[il].wireCutout = roParam.wireCutout[il]; // Size of "active" wire region for digits m_phiDesign[il].nch = roParam.nWires[il]; - m_nWires[il] = m_phiDesign[il].nGroups; // number of nWireGroups ATH_MSG_DEBUG( "initDesign:" << getStationName() << " layer " << il << ", wireGang pitch " << m_phiDesign[il].inputPitch << ", nWireGangs " << m_phiDesign[il].nch ); @@ -402,10 +384,6 @@ namespace MuonGM { m_padDesign[il].lPadWidth = roParam.lPadWidth; m_padDesign[il].nPadColumns = roParam.nPadPhi[il]; - m_PadhalfX[il] = 0.5*m_padDesign[il].Size; - m_PadminHalfY[il] = 0.5*roParam.sPadWidth; - m_PadmaxHalfY[il] = 0.5*roParam.lPadWidth; - // The C side of the NSW is mirrored instead of rotated // We should be using the same values for the pads for both A and C // It is easier for us to simply read the same correct value once @@ -498,16 +476,27 @@ namespace MuonGM { //------------------- if (m_diamondShape) { - m_surfaceData->m_surfBounds.push_back(std::make_unique<Trk::RotatedDiamondBounds>( - m_minHalfY[layer], m_maxHalfY[layer], m_maxHalfY[layer], m_halfX[layer] - m_etaDesign[layer].yCutout() / 2, m_etaDesign[layer].yCutout() / 2)); // strips - m_surfaceData->m_surfBounds.push_back(std::make_unique<Trk::DiamondBounds>( - m_PadminHalfY[layer], m_PadmaxHalfY[layer], m_PadmaxHalfY[layer], m_PadhalfX[layer] - m_padDesign[layer].yCutout / 2, m_padDesign[layer].yCutout / 2)); // pad and wires - + m_surfaceData->m_surfBounds.push_back(std::make_unique<Trk::RotatedDiamondBounds>(m_etaDesign[layer].minYSize() / 2., + m_etaDesign[layer].maxYSize() / 2., + m_etaDesign[layer].maxYSize() / 2., + m_etaDesign[layer].xSize() / 2. - m_etaDesign[layer].yCutout() / 2, + m_etaDesign[layer].yCutout() / 2)); // strips + + m_surfaceData->m_surfBounds.push_back(std::make_unique<Trk::DiamondBounds>(m_padDesign[layer].sPadWidth / 2., + m_padDesign[layer].lPadWidth / 2., + m_padDesign[layer].lPadWidth / 2., + m_padDesign[layer].Size / 2. - m_padDesign[layer].yCutout / 2, m_padDesign[layer].yCutout / 2)); // pad and wires + } else { - m_surfaceData->m_surfBounds.push_back( - std::make_unique<Trk::RotatedTrapezoidBounds>(m_halfX[layer], m_minHalfY[layer], m_maxHalfY[layer])); // strips - m_surfaceData->m_surfBounds.push_back( - std::make_unique<Trk::TrapezoidBounds>(m_PadminHalfY[layer], m_PadmaxHalfY[layer], m_PadhalfX[layer])); + m_surfaceData->m_surfBounds.push_back(std::make_unique<Trk::RotatedTrapezoidBounds>(m_etaDesign[layer].xSize() / 2., + m_etaDesign[layer].minYSize() / 2., + m_etaDesign[layer].maxYSize() / 2.)); // strips + + m_surfaceData->m_surfBounds.push_back(std::make_unique<Trk::TrapezoidBounds>(m_padDesign[layer].sPadWidth /2., + m_padDesign[layer].lPadWidth / 2., + m_padDesign[layer].Size / 2.)); + + } //------------------- @@ -577,10 +566,13 @@ namespace MuonGM { if (gasgap < 1 || gasgap > m_nlayers) return false; int strip = m_idHelper.channel(id); - if (m_idHelper.channelType(id) == sTgcIdHelper::sTgcChannelTypes::Strip && (strip < 1 || strip > m_nStrips[gasgap - 1])) return false; - if (m_idHelper.channelType(id) == sTgcIdHelper::sTgcChannelTypes::Wire && (strip < 1 || strip > m_nWires[gasgap - 1])) return false; - if (m_idHelper.channelType(id) == sTgcIdHelper::sTgcChannelTypes::Pad && (strip < 1 || strip > m_nPads[gasgap - 1])) return false; - + if (strip < 1) return false; + if (m_idHelper.channelType(id) == sTgcIdHelper::sTgcChannelTypes::Strip && strip > m_etaDesign[gasgap - 1].nch) return false; + if (m_idHelper.channelType(id) == sTgcIdHelper::sTgcChannelTypes::Wire && strip > m_phiDesign[gasgap -1].nGroups) return false; + if (m_idHelper.channelType(id) == sTgcIdHelper::sTgcChannelTypes::Pad) { + const auto [etaId, phiId] = m_padDesign[gasgap -1].etaPhiId(strip); + if (etaId < 0 || phiId < 0) return false; + } return true; } @@ -731,7 +723,6 @@ namespace MuonGM { // The origin of the rotation axes is at the center of the active area // in the z (radial) direction. Account for this shift in the definition // of m_delta so that it can be applied on chamber frame coordinates. - Amg::Translation3D t(0., 0., m_offset); m_ALinePar = &aline; m_delta = Amg::getTranslateZ3D(m_offset)*m_delta*Amg::getTranslateZ3D(-m_offset); refreshCache(); diff --git a/MuonSpectrometer/MuonPhaseII/MuonCnv/MuonGeometryCnv/src/MuonReadoutGeomCnvAlg.cxx b/MuonSpectrometer/MuonPhaseII/MuonCnv/MuonGeometryCnv/src/MuonReadoutGeomCnvAlg.cxx index 0ba84a1030c5992eec639c6b52dfc9a5f9332f80..b266eb85d589241876e34dd9ab978fd5d6c90efc 100644 --- a/MuonSpectrometer/MuonPhaseII/MuonCnv/MuonGeometryCnv/src/MuonReadoutGeomCnvAlg.cxx +++ b/MuonSpectrometer/MuonPhaseII/MuonCnv/MuonGeometryCnv/src/MuonReadoutGeomCnvAlg.cxx @@ -13,10 +13,13 @@ #include <MuonReadoutGeometryR4/MuonChamber.h> #include <MuonAlignmentDataR4/MdtAlignmentStore.h> +#include <MuonAlignmentDataR4/sTgcAlignmentStore.h> #include <MuonReadoutGeometry/MuonStation.h> #include <MuonReadoutGeometry/MdtReadoutElement.h> #include <MuonReadoutGeometry/RpcReadoutElement.h> +#include <MuonReadoutGeometry/sTgcReadoutElement.h> +#include <MuonReadoutGeometry/MuonChannelDesign.h> #include <AthenaKernel/IOVInfiniteRange.h> #include <GaudiKernel/SystemOfUnits.h> @@ -88,6 +91,7 @@ StatusCode MuonReadoutGeomCnvAlg::execute(const EventContext& ctx) const { detMgr->addTreeTop(world); ATH_CHECK(buildMdt(geoContext, detMgr.get(), world)); ATH_CHECK(buildRpc(geoContext, detMgr.get(), world)); + ATH_CHECK(buildSTGC(geoContext, detMgr.get(), world)); ATH_CHECK(writeHandle.record(std::move(detMgr))); return StatusCode::SUCCESS; @@ -288,6 +292,90 @@ StatusCode MuonReadoutGeomCnvAlg::dumpAndCompare(const ActsGeometryContext& gctx } return StatusCode::SUCCESS; } +StatusCode MuonReadoutGeomCnvAlg::buildSTGC(const ActsGeometryContext& gctx, + MuonGM::MuonDetectorManager* mgr, + PVLink world) const{ + using SubDetAlignment = ActsGeometryContext::AlignmentStorePtr; + SubDetAlignment alignItr = gctx.getStore(ActsTrk::DetectorType::sTgc); + auto alignStore = alignItr ? static_cast<const sTgcAlignmentStore*>(alignItr->internalAlignment.get()) : nullptr; + + const std::vector<const MuonGMR4::sTgcReadoutElement*> sTgcReadOuts{m_detMgr->getAllsTgcReadoutElements()}; + for (const MuonGMR4::sTgcReadoutElement* copyMe : sTgcReadOuts) { + const Identifier reId = copyMe->identify(); + GeoIntrusivePtr<const GeoVFullPhysVol> readOutVol{copyMe->getMaterialGeom()}; + PVLink clonedVol{cloneVolume(const_pointer_cast<GeoVFullPhysVol>(readOutVol))}; + GeoIntrusivePtr<GeoFullPhysVol> physVol{dynamic_pointer_cast<GeoFullPhysVol>(clonedVol)}; + world->add(make_intrusive<GeoTransform>(copyMe->localToGlobalTrans(gctx))); + world->add(physVol); + + auto newRE = std::make_unique<MuonGM::sTgcReadoutElement>(physVol, + m_idHelperSvc->stationNameString(reId), + copyMe->stationEta(), + copyMe->stationPhi(), + copyMe->multilayer(), mgr); + + if (alignStore && alignStore->getBLine(reId)) { + newRE->setBLinePar(*alignStore->getBLine(reId)); + } + for (unsigned int layer = 1; layer < copyMe->numLayers(); ++layer) { + using channelType = MuonGMR4::sTgcReadoutElement::ReadoutChannelType; + using ChannelDesign = MuonGM::MuonChannelDesign; + const IdentifierHash layerHash = MuonGMR4::sTgcReadoutElement::createHash(layer,channelType::Strip,0); + newRE->m_Xlg[layer -1] = Amg::getTranslate3D(copyMe->globalToLocalTrans(gctx) * + copyMe->center(gctx, layerHash)); + + const MuonGMR4::StripDesign& copyEtaDesign{copyMe->stripDesign(layerHash)}; + /// Initialize the eta design + ChannelDesign& etaDesign{newRE->m_etaDesign[layer-1]}; + etaDesign.type = ChannelDesign::ChannelType::etaStrip; + etaDesign.detType = ChannelDesign::DetType::STGC; + if (copyMe->yCutout()) { + etaDesign.defineDiamond(copyEtaDesign.shortHalfHeight(), + copyEtaDesign.longHalfHeight(), + copyEtaDesign.halfWidth(), + copyMe->yCutout()); + } else { + etaDesign.defineTrapezoid(copyEtaDesign.shortHalfHeight(), + copyEtaDesign.longHalfHeight(), + copyEtaDesign.halfWidth()); + } + etaDesign.inputPitch = copyEtaDesign.stripPitch(); + etaDesign.inputWidth = copyEtaDesign.stripWidth(); + etaDesign.nch = copyEtaDesign.numStrips(); + etaDesign.setFirstPos( (*copyEtaDesign.center(1)).x()); + /// Initialize the phi design + + const MuonGMR4::WireGroupDesign& copyPhiDesign{copyMe->wireDesign(layerHash)}; + + ChannelDesign& phiDesign{newRE->m_phiDesign[layer-1]}; + phiDesign.type = ChannelDesign::ChannelType::phiStrip; + phiDesign.detType = ChannelDesign::DetType::STGC; + if (copyMe->yCutout() == 0.) { + phiDesign.defineTrapezoid(copyPhiDesign.shortHalfHeight(), + copyPhiDesign.longHalfHeight(), + copyPhiDesign.halfWidth()); + } else { + phiDesign.defineDiamond(copyPhiDesign.shortHalfHeight(), + copyPhiDesign.longHalfHeight(), + copyPhiDesign.halfWidth(), + copyMe->yCutout()); + } + phiDesign.inputPitch = copyPhiDesign.stripPitch(); + phiDesign.inputWidth = 0.015; + phiDesign.setFirstPos((*copyPhiDesign.center(1)).x()); // Position of 1st wire, accounts for staggering + // phiDesign.firstPitch = firstWireGroup[il]; // Number of Wires in 1st group, group staggering + //phiDesign.groupWidth = wireGroupWidth; // Number of Wires normal group + phiDesign.nGroups = copyPhiDesign.numStrips(); // Number of Wire Groups + phiDesign.wireCutout = copyMe->yCutout(); // Size of "active" wire region for digits + phiDesign.nch = copyPhiDesign.nAllWires(); + } + + mgr->addsTgcReadoutElement(std::move(newRE)); + } + + + return StatusCode::SUCCESS; +} StatusCode MuonReadoutGeomCnvAlg::buildMdt(const ActsGeometryContext& gctx, MuonGM::MuonDetectorManager* mgr, PVLink world) const { diff --git a/MuonSpectrometer/MuonPhaseII/MuonCnv/MuonGeometryCnv/src/MuonReadoutGeomCnvAlg.h b/MuonSpectrometer/MuonPhaseII/MuonCnv/MuonGeometryCnv/src/MuonReadoutGeomCnvAlg.h index 8fdd7f567c6c8e53cc625a67a058cc30287b7990..c474f428f95517f8c528448f0765aa36464ee7aa 100644 --- a/MuonSpectrometer/MuonPhaseII/MuonCnv/MuonGeometryCnv/src/MuonReadoutGeomCnvAlg.h +++ b/MuonSpectrometer/MuonPhaseII/MuonCnv/MuonGeometryCnv/src/MuonReadoutGeomCnvAlg.h @@ -44,6 +44,11 @@ class MuonReadoutGeomCnvAlg : public AthReentrantAlgorithm { MuonGM::MuonDetectorManager* mgr, PVLink world) const; + StatusCode buildSTGC(const ActsGeometryContext& gctx, + MuonGM::MuonDetectorManager* mgr, + PVLink world) const; + + StatusCode dumpAndCompare(const ActsGeometryContext& gctx, const MuonGMR4::RpcReadoutElement& refEle, const MuonGM::RpcReadoutElement& testEle) const; diff --git a/MuonSpectrometer/MuonPhaseII/MuonDetDescr/MuonGeoModelTestR4/src/GeoModelsTgcTest.cxx b/MuonSpectrometer/MuonPhaseII/MuonDetDescr/MuonGeoModelTestR4/src/GeoModelsTgcTest.cxx index 706b20784ab29eb82679b15c192c86d8ab3d9296..7e5ea235aa8566b6f26ed83ea9a143ae3bad40fc 100644 --- a/MuonSpectrometer/MuonPhaseII/MuonDetDescr/MuonGeoModelTestR4/src/GeoModelsTgcTest.cxx +++ b/MuonSpectrometer/MuonPhaseII/MuonDetDescr/MuonGeoModelTestR4/src/GeoModelsTgcTest.cxx @@ -98,7 +98,7 @@ StatusCode GeoModelsTgcTest::execute() { } } const sTgcIdHelper& id_helper{m_idHelperSvc->stgcIdHelper()}; - for (int layer = 1; layer <= reElement->numLayers(); ++layer) { + for (unsigned int layer = 1; layer <= reElement->numLayers(); ++layer) { for (int chType = sTgcIdHelper::sTgcChannelTypes::Pad; chType <= sTgcIdHelper::sTgcChannelTypes::Wire; ++chType) { unsigned int numChannel = 0; bool isValidLay{false}; @@ -190,7 +190,7 @@ StatusCode GeoModelsTgcTest::dumpToTree(const EventContext& ctx, const Amg::Transform3D& transform{reElement->localToGlobalTrans(gctx)}; m_readoutTransform = transform; const sTgcIdHelper& id_helper{m_idHelperSvc->stgcIdHelper()}; - for (int layer = 1; layer <= reElement->numLayers(); ++layer) { + for (unsigned int layer = 1; layer <= reElement->numLayers(); ++layer) { for (int chType = sTgcIdHelper::sTgcChannelTypes::Pad; chType <= sTgcIdHelper::sTgcChannelTypes::Wire; ++chType) { unsigned int numWireGroup = 0; /// Use idHelper to get the identifier diff --git a/MuonSpectrometer/MuonPhaseII/MuonDetDescr/MuonReadoutGeometryR4/MuonReadoutGeometryR4/sTgcReadoutElement.h b/MuonSpectrometer/MuonPhaseII/MuonDetDescr/MuonReadoutGeometryR4/MuonReadoutGeometryR4/sTgcReadoutElement.h index b6b8e6c41f07d57e2715dc490ba5bdc6284e9189..ecfbde2c2a9faffb7505d8ddb0f2496b160db2bf 100644 --- a/MuonSpectrometer/MuonPhaseII/MuonDetDescr/MuonReadoutGeometryR4/MuonReadoutGeometryR4/sTgcReadoutElement.h +++ b/MuonSpectrometer/MuonPhaseII/MuonDetDescr/MuonReadoutGeometryR4/MuonReadoutGeometryR4/sTgcReadoutElement.h @@ -107,7 +107,7 @@ class sTgcReadoutElement : public MuonReadoutElement { /// Returns the multilayer of the sTgcReadoutElement int multilayer() const; /// Returns the number of gas gap layers - int numLayers() const; + unsigned int numLayers() const; /// Returns the thickness of the gas gap double gasGapThickness() const; /// Returns the yCutout value of the chamber diff --git a/MuonSpectrometer/MuonPhaseII/MuonDetDescr/MuonReadoutGeometryR4/MuonReadoutGeometryR4/sTgcReadoutElement.icc b/MuonSpectrometer/MuonPhaseII/MuonDetDescr/MuonReadoutGeometryR4/MuonReadoutGeometryR4/sTgcReadoutElement.icc index 9d1f5943e67f53cfc4a75818d989cca77378be25..cf8496bd67afc93a97670a9e37fcee1c8feca962 100644 --- a/MuonSpectrometer/MuonPhaseII/MuonDetDescr/MuonReadoutGeometryR4/MuonReadoutGeometryR4/sTgcReadoutElement.icc +++ b/MuonSpectrometer/MuonPhaseII/MuonDetDescr/MuonReadoutGeometryR4/MuonReadoutGeometryR4/sTgcReadoutElement.icc @@ -32,7 +32,8 @@ inline double sTgcReadoutElement::thickness() const { return 2.* m_pars.halfCham inline double sTgcReadoutElement::sFrameWidth() const { return m_pars.sFrameWidth; } inline double sTgcReadoutElement::lFrameWidth() const { return m_pars.lFrameWidth; } inline int sTgcReadoutElement::multilayer() const { return m_multiLayer; } -inline int sTgcReadoutElement::numLayers() const { return m_pars.numLayers; } + +inline unsigned int sTgcReadoutElement::numLayers() const { return m_pars.numLayers; } inline unsigned int sTgcReadoutElement::nChTypes() const { return m_pars.nChTypes; } inline double sTgcReadoutElement::gasGapThickness() const { return m_pars.gasTck; } inline double sTgcReadoutElement::gasGapPitch() const { return m_gasGapPitch; }