diff --git a/MuonSpectrometer/MuonPhaseII/MuonDetDescr/MuonGeoModelR4/MuonGeoModelR4/sTgcReadoutGeomTool.h b/MuonSpectrometer/MuonPhaseII/MuonDetDescr/MuonGeoModelR4/MuonGeoModelR4/sTgcReadoutGeomTool.h index 9be7cc98c02a40a014c7223ddd337574fa307fde..f125b31a88623703f022ba2d646a4185c037bda7 100644 --- a/MuonSpectrometer/MuonPhaseII/MuonDetDescr/MuonGeoModelR4/MuonGeoModelR4/sTgcReadoutGeomTool.h +++ b/MuonSpectrometer/MuonPhaseII/MuonDetDescr/MuonGeoModelR4/MuonGeoModelR4/sTgcReadoutGeomTool.h @@ -66,6 +66,8 @@ class sTgcReadoutGeomTool : public AthAlgTool, double sPadLength{0.}; double gasTck{0.}; //gasTck + double lFrameWidth{0.}; //ylFrame + double sFrameWidth{0.}; //ysFrame }; struct FactoryCache { diff --git a/MuonSpectrometer/MuonPhaseII/MuonDetDescr/MuonGeoModelR4/src/sTgcReadoutGeomTool.cxx b/MuonSpectrometer/MuonPhaseII/MuonDetDescr/MuonGeoModelR4/src/sTgcReadoutGeomTool.cxx index f96d0e8e02b3d49133af5f6ed08f378f55d22b1e..bc89b5cb9a279906c3737197c56661633144256c 100644 --- a/MuonSpectrometer/MuonPhaseII/MuonDetDescr/MuonGeoModelR4/src/sTgcReadoutGeomTool.cxx +++ b/MuonSpectrometer/MuonPhaseII/MuonDetDescr/MuonGeoModelR4/src/sTgcReadoutGeomTool.cxx @@ -178,7 +178,9 @@ StatusCode sTgcReadoutGeomTool::loadDimensions(sTgcReadoutElement::defineArgs& d define.stripLayers.push_back(std::move(stripLayer)); if (!define.stripDesign) define.stripDesign = stripDesign; ///Pads - double beamlineRadius = define.physVol->getAbsoluteTransform().translation().perp(); + /// defining frameOffset to correct the beamlineRadius + double frameOffset = -0.5 * (paramBook.lFrameWidth - paramBook.sFrameWidth); + double beamlineRadius = frameOffset + define.physVol->getAbsoluteTransform().translation().perp(); padDesign->defineBeamlineRadius(beamlineRadius); ATH_MSG_DEBUG("The beamline radius is: " << beamlineRadius); StripLayer padLayer(gapVol.transform * Amg::getRotateY3D(180* Gaudi::Units::deg), padDesign, sTgcReadoutElement::createHash(gasGap, sTgcIdHelper::Pad, 0)); @@ -288,6 +290,8 @@ StatusCode sTgcReadoutGeomTool::readParameterBook(FactoryCache& cache) { parBook.sPadLength = record->getDouble("sPadWidth"); parBook.gasTck = record->getDouble("gasTck"); + parBook.lFrameWidth = record->getDouble("ylFrame"); + parBook.sFrameWidth = record->getDouble("ysFrame"); ATH_MSG_ALWAYS("Parameters of the chamber " << key << " are: " << " numStrips: " << parBook.numStrips @@ -311,7 +315,9 @@ StatusCode sTgcReadoutGeomTool::readParameterBook(FactoryCache& cache) { << " firstPadPhiDivision: " << parBook.firstPadPhiDivision << " lPadLength: " << parBook.lPadLength << " sPadLength: " << parBook.sPadLength - << " gasGapTck: " << parBook.gasTck); + << " gasGapTck: " << parBook.gasTck + << " lFrameWidth: " << parBook.lFrameWidth + << " sFrameWidth: " << parBook.sFrameWidth); } return StatusCode::SUCCESS; } diff --git a/MuonSpectrometer/MuonPhaseII/MuonDetDescr/MuonGeoModelTestR4/util/runsTgcGeoComparison.cxx b/MuonSpectrometer/MuonPhaseII/MuonDetDescr/MuonGeoModelTestR4/util/runsTgcGeoComparison.cxx index 6aff5f11f5490f375a0de62271ccce7c7da3812a..abec9a6cab62db87b63f30b8248326dda3ee03c3 100644 --- a/MuonSpectrometer/MuonPhaseII/MuonDetDescr/MuonGeoModelTestR4/util/runsTgcGeoComparison.cxx +++ b/MuonSpectrometer/MuonPhaseII/MuonDetDescr/MuonGeoModelTestR4/util/runsTgcGeoComparison.cxx @@ -460,7 +460,6 @@ std::set<sTgcChamber> readTreeDump(const std::string& inputFile) { newWireGroup.gasGap = (*wireGroupGasGap)[wg]; newWireGroup.channelNumber = (*wireGroupNum)[wg]; newWireGroup.channelType = 2; - if (newWireGroup.channelNumber > 0) continue; newchamber.channels.insert(std::move(newWireGroup)); } @@ -472,7 +471,6 @@ std::set<sTgcChamber> readTreeDump(const std::string& inputFile) { newStrip.gasGap = (*stripGasGap)[s]; newStrip.channelNumber = (*stripNum)[s]; newStrip.channelType = 1; - if (newStrip.channelNumber > 0 && newStrip.channelNumber < newchamber.numStrips) continue; newchamber.channels.insert(std::move(newStrip)); } @@ -496,7 +494,6 @@ std::set<sTgcChamber> readTreeDump(const std::string& inputFile) { newPad.gasGap = (*padGasGap)[p]; newPad.padEta = (*padEta)[p]; newPad.padPhi = (*padPhi)[p]; - if (newPad.padEta > 1 || newPad.padPhi > 2) continue; newchamber.pads.insert(std::move(newPad)); } @@ -709,7 +706,7 @@ int main( int argc, char** argv ) { } const sTgcPad& testPad{*pad_itr}; /// Local Pad position dump - const Amg::Vector2D diffLocalPadPos{testPad.localPosition - testPad.localPosition}; + const Amg::Vector2D diffLocalPadPos{testPad.localPosition - refPad.localPosition}; if (diffLocalPadPos.mag() > tolerance) { std::cerr<<"runsTgcGeoComparison() "<<__LINE__<<": in chamber "<<test<<" "<<"pad (gasGap/(padEta, padPhi)): " <<testPad.gasGap<<"/("<<testPad.padEta<<", "<<testPad.padPhi<<"), "<< " local position: " @@ -753,9 +750,9 @@ int main( int argc, char** argv ) { <<" displacement: "<<Amg::toString(diffLocalPadCornerTR,2)<<std::endl; chamberOkay = false; } - + /// Global Pad position dump - const Amg::Vector3D diffGlobalPadPos{testPad.globalPosition - testPad.globalPosition}; + const Amg::Vector3D diffGlobalPadPos{testPad.globalPosition - refPad.globalPosition}; if (diffGlobalPadPos.mag() > tolerance) { std::cerr<<"runsTgcGeoComparison() "<<__LINE__<<": in chamber "<<test<<" "<<"pad (gasGap/(padEta, padPhi)): " <<testPad.gasGap<<"/("<<testPad.padEta<<", "<<testPad.padPhi<<"), "<< " global position: " @@ -772,6 +769,7 @@ int main( int argc, char** argv ) { <<" displacement: "<<Amg::toString(diffGlobalPadCornerBL,2)<<std::endl; chamberOkay = false; } + /// bottom-right pad corner const Amg::Vector3D diffGlobalPadCornerBR{testPad.globalPadCornerBR - refPad.globalPadCornerBR}; if (diffGlobalPadCornerBR.mag() > tolerance) { diff --git a/MuonSpectrometer/MuonPhaseII/MuonDetDescr/MuonReadoutGeometryR4/MuonReadoutGeometryR4/PadDesign.icc b/MuonSpectrometer/MuonPhaseII/MuonDetDescr/MuonReadoutGeometryR4/MuonReadoutGeometryR4/PadDesign.icc index b7ae4a2ebd9958197dfa4750dc92581617bfa0ba..935f8548f82c463f2ae95e0ceb8764ad813aaf50 100644 --- a/MuonSpectrometer/MuonPhaseII/MuonDetDescr/MuonReadoutGeometryR4/MuonReadoutGeometryR4/PadDesign.icc +++ b/MuonSpectrometer/MuonPhaseII/MuonDetDescr/MuonReadoutGeometryR4/MuonReadoutGeometryR4/PadDesign.icc @@ -42,6 +42,7 @@ namespace MuonGMR4 { inline double PadDesign::beamlineRadius() const { return m_radius; } + using localCornerArray = std::array<Amg::Vector2D, 4>; inline localCornerArray PadDesign::padCorners(const int channel) const { return padCorners(padEtaPhi(channel)); diff --git a/MuonSpectrometer/MuonPhaseII/MuonDetDescr/MuonReadoutGeometryR4/src/padDesign.cxx b/MuonSpectrometer/MuonPhaseII/MuonDetDescr/MuonReadoutGeometryR4/src/padDesign.cxx index b772be749043dbcdfb4a6598ff9e6143a57cb177..8b50011aab63046647480c815d0b710ea3873e6c 100644 --- a/MuonSpectrometer/MuonPhaseII/MuonDetDescr/MuonReadoutGeometryR4/src/padDesign.cxx +++ b/MuonSpectrometer/MuonPhaseII/MuonDetDescr/MuonReadoutGeometryR4/src/padDesign.cxx @@ -95,12 +95,19 @@ namespace MuonGMR4{ double cosRight = botBase / std::hypot(botRightPoint, botBase); double cosLeft = botBase / std::hypot(botLeftPoint, botBase); /// Adjusting the four corners of the pads for staggering in x direction w.r.t. the chamber origin - /// Outer edges of the trapezoid do not undergo staggering. Hence the if condition. - if (padPhi > 1 && padPhi < numPadPhi()) { - botLeftPoint += padPhiShift() * cosLeft; - botRightPoint += padPhiShift() * cosRight; - topLeftPoint += padPhiShift() * cosLeft; - topRightPoint += padPhiShift() * cosRight; + botLeftPoint += padPhiShift() * cosLeft; + botRightPoint += padPhiShift() * cosRight; + topLeftPoint += padPhiShift() * cosLeft; + topRightPoint += padPhiShift() * cosRight; + /// Outer edges of the trapezoid do not undergo staggering. Hence the if conditions. + double adjHeight = /*yCutout()? 2 * halfWidth() - yCutout() :*/ 2 * halfWidth(); + if(padPhi == 1) { + botRightPoint = shortHalfHeight() + ((longHalfHeight() - shortHalfHeight()) * (botEdge - maxBottom) / adjHeight); + topRightPoint = shortHalfHeight() + ((longHalfHeight() - shortHalfHeight()) * (topEdge - maxBottom) / adjHeight); + } + if(padPhi == numPadPhi()) { + botLeftPoint = -shortHalfHeight() - ((longHalfHeight() - shortHalfHeight()) * (botEdge - maxBottom) / adjHeight); + topLeftPoint = -shortHalfHeight() - ((longHalfHeight() - shortHalfHeight()) * (topEdge - maxBottom) / adjHeight); } /// Adjusting the outer edges of the pads in diamond chambers (QL3) /// There are pads in the outer columns that may contain five vertices when the topEdge of the pad is above the diff --git a/MuonSpectrometer/MuonPhaseII/MuonDetDescr/MuonReadoutGeometryR4/src/sTgcReadoutElement.cxx b/MuonSpectrometer/MuonPhaseII/MuonDetDescr/MuonReadoutGeometryR4/src/sTgcReadoutElement.cxx index b7faba504c70d4e399ed94edb54c69be06ec2291..82141a760e85b2df963391cc7477e89d26e662c4 100644 --- a/MuonSpectrometer/MuonPhaseII/MuonDetDescr/MuonReadoutGeometryR4/src/sTgcReadoutElement.cxx +++ b/MuonSpectrometer/MuonPhaseII/MuonDetDescr/MuonReadoutGeometryR4/src/sTgcReadoutElement.cxx @@ -149,29 +149,22 @@ Amg::Vector2D sTgcReadoutElement::localChannelPosition(const IdentifierHash& mea return Amg::Vector2D::Zero(); } } + Amg::Vector3D sTgcReadoutElement::globalChannelPosition(const ActsGeometryContext& ctx, const IdentifierHash& measHash) const { const IdentifierHash lHash = layerHash(measHash); unsigned int layIdx = static_cast<unsigned int>(lHash); unsigned int gasGap = gasGapNumber(measHash); - if (chType(measHash) == ReadoutChannelType::Strip && gasGap < m_pars.stripLayers.size()) { - return localToGlobalTrans(ctx, lHash) * m_pars.stripLayers[gasGap].localStripPos(channelNumber(measHash)); - } - else if (chType(measHash) == ReadoutChannelType::Wire && gasGap < m_pars.wireGroupLayers.size()) { - Amg::Vector3D wireGrPos{Amg::Vector3D::Zero()}; - Amg::Vector2D localWireGroup = localChannelPosition(measHash); - wireGrPos.block<2,1>(0,0) = std::move(localWireGroup); - return localToGlobalTrans(ctx, lHash) * wireGrPos; - } - else if (chType(measHash) == ReadoutChannelType::Pad && gasGap < m_pars.padLayers.size()) { - Amg::Vector3D padPos{Amg::Vector3D::Zero()}; - Amg::Vector2D localPad = localChannelPosition(measHash); - padPos.block<2,1>(0,0) = std::move(localPad); - return localToGlobalTrans(ctx, lHash) * padPos; - } - ATH_MSG_WARNING(__FILE__<<":"<<__LINE__<<" The layer hash "<<layIdx - <<" is out of range. Maximum range "<<m_pars.stripLayers.size()); - return Amg::Vector3D::Zero(); + if((chType(measHash) < ReadoutChannelType::Pad || chType(measHash) > ReadoutChannelType::Wire) && gasGap < m_pars.padLayers.size()) { + ATH_MSG_WARNING(__FILE__<<":"<<__LINE__<<" The channel type "<<chType(measHash) + <<"with the layer hash "<<layIdx<<" is invalid. Maximum range "<<m_pars.stripLayers.size()); + return Amg::Vector3D::Zero(); + } + Amg::Vector3D channelPos{Amg::Vector3D::Zero()}; + Amg::Vector2D localChannel = localChannelPosition(measHash); + channelPos.block<2,1>(0,0) = std::move(localChannel); + return localToGlobalTrans(ctx, lHash) * channelPos; } + using localCornerArray = std::array<Amg::Vector2D, 4>; using globalCornerArray = std::array<Amg::Vector3D, 4>; globalCornerArray sTgcReadoutElement::globalPadCorners(const ActsGeometryContext& ctx, const IdentifierHash& measHash) const {