From 98824afafa26b6988a5c84f121a335032912b0e0 Mon Sep 17 00:00:00 2001 From: Patrick Scholer <pscholer@atlmuonsw1.dyndns.cern.ch> Date: Thu, 20 Mar 2025 18:57:35 +0100 Subject: [PATCH 1/8] rename stgc as built model: cpp part --- .../MuonAlignmentData/NswAsBuiltDbData.h | 4 -- .../{sTGCAsBuiltData2.h => sTGCAsBuiltData.h} | 10 ++-- ...GCAsBuiltData2.cxx => sTGCAsBuiltData.cxx} | 8 +-- .../MuonCondAlg/NswAsBuiltCondAlg.h | 3 -- ...AsBuiltCondAlg2.h => sTGCAsBuiltCondAlg.h} | 16 +++--- .../MuonCondAlg/src/NswAsBuiltCondAlg.cxx | 41 +-------------- .../src/components/MuonCondAlg_entries.cxx | 4 +- ...iltCondAlg2.cxx => sTGCAsBuiltCondAlg.cxx} | 18 +++---- .../MuonReadoutGeometry/MuonDetectorManager.h | 13 ++--- .../src/MuonDetectorManager.cxx | 4 +- .../src/sTgcReadoutElement.cxx | 50 ++++--------------- 11 files changed, 45 insertions(+), 126 deletions(-) rename MuonSpectrometer/MuonAlignment/MuonAlignmentData/MuonAlignmentData/{sTGCAsBuiltData2.h => sTGCAsBuiltData.h} (87%) rename MuonSpectrometer/MuonAlignment/MuonAlignmentData/src/{sTGCAsBuiltData2.cxx => sTGCAsBuiltData.cxx} (84%) rename MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondAlg/MuonCondAlg/{sTGCAsBuiltCondAlg2.h => sTGCAsBuiltCondAlg.h} (70%) rename MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondAlg/src/{sTGCAsBuiltCondAlg2.cxx => sTGCAsBuiltCondAlg.cxx} (87%) diff --git a/MuonSpectrometer/MuonAlignment/MuonAlignmentData/MuonAlignmentData/NswAsBuiltDbData.h b/MuonSpectrometer/MuonAlignment/MuonAlignmentData/MuonAlignmentData/NswAsBuiltDbData.h index 850a37484de2..9e914c32e35d 100644 --- a/MuonSpectrometer/MuonAlignment/MuonAlignmentData/MuonAlignmentData/NswAsBuiltDbData.h +++ b/MuonSpectrometer/MuonAlignment/MuonAlignmentData/MuonAlignmentData/NswAsBuiltDbData.h @@ -20,15 +20,11 @@ public: #ifndef SIMULATIONBASE /// Storage to the micromega as built calculator using MmAsBuiltPtr = GeoModel::TransientConstSharedPtr<NswAsBuilt::StripCalculator>; - using sTgcAsBuiltPtr = GeoModel::TransientConstSharedPtr<NswAsBuilt::StgcStripCalculator>; #else /// Define a dummy pointer object if the project is AthSimulation using MmAsBuiltPtr = char; - using sTgcAsBuiltPtr = char; #endif MmAsBuiltPtr microMegaData{}; - /// Storage to the stgc as built calculator - sTgcAsBuiltPtr sTgcData{}; NswAsBuiltDbData() = default; ~NswAsBuiltDbData() = default; diff --git a/MuonSpectrometer/MuonAlignment/MuonAlignmentData/MuonAlignmentData/sTGCAsBuiltData2.h b/MuonSpectrometer/MuonAlignment/MuonAlignmentData/MuonAlignmentData/sTGCAsBuiltData.h similarity index 87% rename from MuonSpectrometer/MuonAlignment/MuonAlignmentData/MuonAlignmentData/sTGCAsBuiltData2.h rename to MuonSpectrometer/MuonAlignment/MuonAlignmentData/MuonAlignmentData/sTGCAsBuiltData.h index 94e0ab791861..192e093d91aa 100644 --- a/MuonSpectrometer/MuonAlignment/MuonAlignmentData/MuonAlignmentData/sTGCAsBuiltData2.h +++ b/MuonSpectrometer/MuonAlignment/MuonAlignmentData/MuonAlignmentData/sTGCAsBuiltData.h @@ -12,7 +12,7 @@ #include "GeoPrimitives/GeoPrimitives.h" /** - * @class sTGCAsBuiltData2 + * @class sTGCAsBuiltData * * @brief Class holding the sTGC as built conditions data and applying it. The model consists of four parameters: * - offset: shift of the strip layer in the precission coordinate @@ -24,9 +24,9 @@ * */ -class sTGCAsBuiltData2: public AthMessaging { +class sTGCAsBuiltData: public AthMessaging { public: - sTGCAsBuiltData2(const Muon::IMuonIdHelperSvc* idHelperSvc); + sTGCAsBuiltData(const Muon::IMuonIdHelperSvc* idHelperSvc); // returns the local positon corrected for the as built parameters Amg::Vector2D correctPosition(const Identifier& channelId, const Amg::Vector2D& pos) const; // Set the parameters of the as build model (shift, rotation, scale) @@ -47,6 +47,6 @@ class sTGCAsBuiltData2: public AthMessaging { ParMap m_asBuiltData{}; }; -CLASS_DEF( sTGCAsBuiltData2 , 189786421 , 1 ); -CONDCONT_DEF( sTGCAsBuiltData2 , 15989615 ); +CLASS_DEF( sTGCAsBuiltData , 154485394 , 1 ); +CONDCONT_DEF( sTGCAsBuiltData , 66070092 ); #endif diff --git a/MuonSpectrometer/MuonAlignment/MuonAlignmentData/src/sTGCAsBuiltData2.cxx b/MuonSpectrometer/MuonAlignment/MuonAlignmentData/src/sTGCAsBuiltData.cxx similarity index 84% rename from MuonSpectrometer/MuonAlignment/MuonAlignmentData/src/sTGCAsBuiltData2.cxx rename to MuonSpectrometer/MuonAlignment/MuonAlignmentData/src/sTGCAsBuiltData.cxx index 75e4c7424ece..273fbdb92da0 100644 --- a/MuonSpectrometer/MuonAlignment/MuonAlignmentData/src/sTGCAsBuiltData2.cxx +++ b/MuonSpectrometer/MuonAlignment/MuonAlignmentData/src/sTGCAsBuiltData.cxx @@ -1,16 +1,16 @@ /* Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration */ -#include "MuonAlignmentData/sTGCAsBuiltData2.h" +#include "MuonAlignmentData/sTGCAsBuiltData.h" #include "GeoPrimitives/GeoPrimitivesToStringConverter.h" -sTGCAsBuiltData2::sTGCAsBuiltData2(const Muon::IMuonIdHelperSvc* idHelperSvc): +sTGCAsBuiltData::sTGCAsBuiltData(const Muon::IMuonIdHelperSvc* idHelperSvc): AthMessaging{"sTGCAsBuiltData2"}, m_idHelperSvc{idHelperSvc} {} -Amg::Vector2D sTGCAsBuiltData2::correctPosition(const Identifier& channelId, const Amg::Vector2D& pos) const { +Amg::Vector2D sTGCAsBuiltData::correctPosition(const Identifier& channelId, const Amg::Vector2D& pos) const { ParMap::const_iterator par_itr = m_asBuiltData.find(m_idHelperSvc->gasGapId(channelId)); if(par_itr == m_asBuiltData.end()){ ATH_MSG_WARNING("Missing as built parameters for gas gap " << m_idHelperSvc->toString(channelId)); @@ -29,7 +29,7 @@ Amg::Vector2D sTGCAsBuiltData2::correctPosition(const Identifier& channelId, con } -StatusCode sTGCAsBuiltData2::setParameters(const Identifier& channelId, const Parameters& pars){ +StatusCode sTGCAsBuiltData::setParameters(const Identifier& channelId, const Parameters& pars){ const Identifier gasGapId = m_idHelperSvc->gasGapId(channelId); auto insert_itr = m_asBuiltData.insert(std::make_pair(gasGapId, pars)); if (!insert_itr.second) { diff --git a/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondAlg/MuonCondAlg/NswAsBuiltCondAlg.h b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondAlg/MuonCondAlg/NswAsBuiltCondAlg.h index 44a8c6cdcc29..f09fb9291e14 100644 --- a/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondAlg/MuonCondAlg/NswAsBuiltCondAlg.h +++ b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondAlg/MuonCondAlg/NswAsBuiltCondAlg.h @@ -23,11 +23,8 @@ public: private: SG::ReadCondHandleKey<CondAttrListCollection> m_readMmAsBuiltParamsKey{this, "ReadMmAsBuiltParamsKey", "/MUONALIGN/ASBUILTPARAMS/MM", "Key of MM/ASBUILTPARAMS input condition data"}; - SG::ReadCondHandleKey<CondAttrListCollection> m_readSTgcAsBuiltParamsKey{this, "ReadSTgcAsBuiltParamsKey", "/MUONALIGN/ASBUILTPARAMS/STGC", - "Key of sTGC/ASBUILTPARAMS input condition data"}; Gaudi::Property<std::string> m_MmJsonPath{this,"MicroMegaJSON", "", "Pass As-Built parameters for MM chambers from an Ascii file"}; - Gaudi::Property<std::string> m_StgcJsonPath{this, "sTgcJSON", "", "Pass As-Built parameters for sTGC chambers from an Ascii file"}; SG::WriteCondHandleKey<NswAsBuiltDbData> m_writeNswAsBuiltKey{this, "WriteNswAsBuiltKey", "NswAsBuiltDbData", "Key of output muon alignment MM+STGC/AsBuilt condition data"}; diff --git a/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondAlg/MuonCondAlg/sTGCAsBuiltCondAlg2.h b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondAlg/MuonCondAlg/sTGCAsBuiltCondAlg.h similarity index 70% rename from MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondAlg/MuonCondAlg/sTGCAsBuiltCondAlg2.h rename to MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondAlg/MuonCondAlg/sTGCAsBuiltCondAlg.h index c2fbd3e817e0..71112250bc43 100644 --- a/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondAlg/MuonCondAlg/sTGCAsBuiltCondAlg2.h +++ b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondAlg/MuonCondAlg/sTGCAsBuiltCondAlg.h @@ -2,13 +2,13 @@ Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration */ -#ifndef MUONCONDALG_sTGCAsBuiltCondAlg2_H -#define MUONCONDALG_sTGCAsBuiltCondAlg2_H +#ifndef MUONCONDALG_sTGCAsBuiltCondAlg_H +#define MUONCONDALG_sTGCAsBuiltCondAlg_H // Athena includes #include "AthenaBaseComps/AthReentrantAlgorithm.h" #include "AthenaPoolUtilities/CondAttrListCollection.h" -#include "MuonAlignmentData/sTGCAsBuiltData2.h" +#include "MuonAlignmentData/sTGCAsBuiltData.h" #include "MuonIdHelpers/IMuonIdHelperSvc.h" #include "StoreGate/ReadCondHandleKey.h" #include "StoreGate/WriteCondHandleKey.h" @@ -18,10 +18,10 @@ /** * Conditions algorithm to load the alternativ sTGC as built constants. */ -class sTGCAsBuiltCondAlg2 : public AthReentrantAlgorithm { +class sTGCAsBuiltCondAlg : public AthReentrantAlgorithm { public: - sTGCAsBuiltCondAlg2(const std::string& name, ISvcLocator* svc); - virtual ~sTGCAsBuiltCondAlg2() = default; + sTGCAsBuiltCondAlg(const std::string& name, ISvcLocator* svc); + virtual ~sTGCAsBuiltCondAlg() = default; virtual StatusCode initialize() override; virtual StatusCode execute(const EventContext& ctx) const override; virtual bool isReEntrant() const override { return false; } @@ -29,14 +29,14 @@ public: private: /// Parse efficiency data from COOL StatusCode parseDataFromJSON(const nlohmann::json& lines, - sTGCAsBuiltData2& effiData) const; + sTGCAsBuiltData& effiData) const; ServiceHandle<Muon::IMuonIdHelperSvc> m_idHelperSvc{this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"}; /// Load the gasGap efficiencies from a JSON file Gaudi::Property<std::string> m_readFromJSON{this, "readFromJSON", "" }; - SG::WriteCondHandleKey<sTGCAsBuiltData2> m_writeKey{this, "WriteKey", "sTGCAsBuilt2", "Key of the efficiency data in the CondStore"}; + SG::WriteCondHandleKey<sTGCAsBuiltData> m_writeKey{this, "WriteKey", "sTGCAsBuilt2", "Key of the efficiency data in the CondStore"}; SG::ReadCondHandleKey<CondAttrListCollection> m_readKeyDb{this, "ReadKey", "", "Folder of the STGC efficiencies as they're stored in COOL"}; }; diff --git a/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondAlg/src/NswAsBuiltCondAlg.cxx b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondAlg/src/NswAsBuiltCondAlg.cxx index 403200ceb338..f77e69678f5a 100644 --- a/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondAlg/src/NswAsBuiltCondAlg.cxx +++ b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondAlg/src/NswAsBuiltCondAlg.cxx @@ -14,14 +14,10 @@ } StatusCode NswAsBuiltCondAlg::initialize() { ATH_CHECK(m_readMmAsBuiltParamsKey.initialize(m_MmJsonPath.value().empty() && !m_readMmAsBuiltParamsKey.empty())); - ATH_CHECK(m_readSTgcAsBuiltParamsKey.initialize(m_StgcJsonPath.value().empty() && !m_readSTgcAsBuiltParamsKey.empty())); ATH_CHECK(m_writeNswAsBuiltKey.initialize()); if (!m_MmJsonPath.value().empty()) ATH_MSG_INFO("Load MicroMega as-built from external JSON "<< m_MmJsonPath); else if (!m_readMmAsBuiltParamsKey.empty()) ATH_MSG_INFO("Load MicroMega as-built from COOL <"<<m_readMmAsBuiltParamsKey.key()<<">"); else ATH_MSG_INFO("MicroMega as-built is deactiviated"); - if (!m_StgcJsonPath.value().empty()) ATH_MSG_INFO("Load sTGC as-built from external JSON "<<m_StgcJsonPath); - else if (!m_readSTgcAsBuiltParamsKey.empty()) ATH_MSG_INFO("Load sTGC as-built from COOL <"<<m_readSTgcAsBuiltParamsKey.key()<<">"); - else ATH_MSG_INFO("sTGC as-built is deactiviated"); return StatusCode::SUCCESS; } @@ -73,42 +69,7 @@ StatusCode NswAsBuiltCondAlg::execute(const EventContext& ctx) const { writeCdo->microMegaData->parseJSON(buffer.str()); } - if (!m_readSTgcAsBuiltParamsKey.empty()) { - SG::ReadCondHandle<CondAttrListCollection> readHandle{m_readSTgcAsBuiltParamsKey, ctx}; - if (!readHandle.isValid()) { - ATH_MSG_ERROR("Null pointer to the read STGC/ASBUILTPARAMS conditions object"); - return StatusCode::FAILURE; - } - writeHandle.addDependency(readHandle); - ATH_MSG_INFO("Size of STGC/ASBUILTPARAMS CondAttrListCollection " << readHandle.fullKey() - << " ->size()= " << readHandle->size()); - unsigned int nLines{0}; - for( CondAttrListCollection::const_iterator itr = readHandle->begin(); itr != readHandle->end(); ++itr) { - const coral::AttributeList& atr = itr->second; - const std::string data{*(static_cast<const std::string*>((atr["data"]).addressOfData()))}; - ATH_MSG_DEBUG(__FILE__<<":"<<__LINE__<<" data load is " << data << " FINISHED HERE "); - writeCdo->sTgcData = std::make_unique<NswAsBuilt::StgcStripCalculator>(); - writeCdo->sTgcData->parseJSON(data); - ++nLines; - } - if(nLines>1) { - ATH_MSG_FATAL(nLines << " data objects were loaded for STGC/ASBUILTPARAMS! Expected only one for this validity range!"); - return StatusCode::FAILURE; - } - } - if (!m_StgcJsonPath.value().empty()){ - ATH_MSG_INFO("Load micromega as-built constants from a JSON file"); - std::ifstream thefile{PathResolverFindCalibFile(m_StgcJsonPath)}; - if (!thefile.good()) { - ATH_MSG_FATAL("No such file or directory "<<m_StgcJsonPath); - return StatusCode::FAILURE; - } - std::stringstream buffer; - buffer << thefile.rdbuf(); - writeCdo->sTgcData = std::make_unique<NswAsBuilt::StgcStripCalculator>(); - writeCdo->sTgcData->parseJSON(buffer.str()); - } - if (!writeCdo->sTgcData && !writeCdo->microMegaData) { + if (!writeCdo->microMegaData) { ATH_MSG_ERROR("No AsBuilt constants were loaded. Please check the algorithm configucration"); return StatusCode::FAILURE; } diff --git a/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondAlg/src/components/MuonCondAlg_entries.cxx b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondAlg/src/components/MuonCondAlg_entries.cxx index 33ab0bebe095..a169236d0d2a 100644 --- a/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondAlg/src/components/MuonCondAlg_entries.cxx +++ b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondAlg/src/components/MuonCondAlg_entries.cxx @@ -20,7 +20,7 @@ #include "MuonCondAlg/NswAsBuiltCondAlg.h" #include "MuonCondAlg/MdtAsBuiltCondAlg.h" #include "MuonCondAlg/CscILinesCondAlg.h" -#include "MuonCondAlg/sTGCAsBuiltCondAlg2.h" +#include "MuonCondAlg/sTGCAsBuiltCondAlg.h" #include "MuonCondAlg/MmCTPCondDbAlg.h" @@ -43,5 +43,5 @@ DECLARE_COMPONENT(NswAsBuiltCondAlg) DECLARE_COMPONENT(MdtAsBuiltCondAlg) DECLARE_COMPONENT(CscILinesCondAlg) DECLARE_COMPONENT(NswUncertDbAlg) -DECLARE_COMPONENT(sTGCAsBuiltCondAlg2) +DECLARE_COMPONENT(sTGCAsBuiltCondAlg) DECLARE_COMPONENT(MmCTPCondDbAlg) \ No newline at end of file diff --git a/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondAlg/src/sTGCAsBuiltCondAlg2.cxx b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondAlg/src/sTGCAsBuiltCondAlg.cxx similarity index 87% rename from MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondAlg/src/sTGCAsBuiltCondAlg2.cxx rename to MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondAlg/src/sTGCAsBuiltCondAlg.cxx index 2c3c7718ae6d..009f8d823cf6 100644 --- a/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondAlg/src/sTGCAsBuiltCondAlg2.cxx +++ b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondAlg/src/sTGCAsBuiltCondAlg.cxx @@ -2,18 +2,18 @@ Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration */ -#include "MuonCondAlg/sTGCAsBuiltCondAlg2.h" +#include "MuonCondAlg/sTGCAsBuiltCondAlg.h" #include <StoreGate/WriteCondHandle.h> #include <AthenaKernel/IOVInfiniteRange.h> #include <PathResolver/PathResolver.h> #include <fstream> -sTGCAsBuiltCondAlg2::sTGCAsBuiltCondAlg2(const std::string& name, ISvcLocator* pSvcLocator) : +sTGCAsBuiltCondAlg::sTGCAsBuiltCondAlg(const std::string& name, ISvcLocator* pSvcLocator) : AthReentrantAlgorithm(name, pSvcLocator) {} // Initialize -StatusCode sTGCAsBuiltCondAlg2::initialize() { +StatusCode sTGCAsBuiltCondAlg::initialize() { ATH_MSG_DEBUG("initializing " << name()); ATH_CHECK(m_idHelperSvc.retrieve()); ATH_CHECK(m_writeKey.initialize()); @@ -30,10 +30,10 @@ StatusCode sTGCAsBuiltCondAlg2::initialize() { } // execute -StatusCode sTGCAsBuiltCondAlg2::execute(const EventContext& ctx) const { +StatusCode sTGCAsBuiltCondAlg::execute(const EventContext& ctx) const { ATH_MSG_DEBUG("execute " << name()); // launching Write Cond Handle - SG::WriteCondHandle<sTGCAsBuiltData2> writeHandle{m_writeKey, ctx}; + SG::WriteCondHandle<sTGCAsBuiltData> writeHandle{m_writeKey, ctx}; if (writeHandle.isValid()) { ATH_MSG_DEBUG("CondHandle " << writeHandle.fullKey() << " is already valid." << " In theory this should not be called, but may happen" @@ -41,7 +41,7 @@ StatusCode sTGCAsBuiltCondAlg2::execute(const EventContext& ctx) const { return StatusCode::SUCCESS; } writeHandle.addDependency(EventIDRange(IOVInfiniteRange::infiniteTime())); - std::unique_ptr<sTGCAsBuiltData2> writeCdo{std::make_unique<sTGCAsBuiltData2>(m_idHelperSvc.get())}; + std::unique_ptr<sTGCAsBuiltData> writeCdo{std::make_unique<sTGCAsBuiltData>(m_idHelperSvc.get())}; if (!m_readKeyDb.empty()) { SG::ReadCondHandle<CondAttrListCollection> readHandle{m_readKeyDb, ctx}; if (!readHandle.isValid()) { @@ -69,8 +69,8 @@ StatusCode sTGCAsBuiltCondAlg2::execute(const EventContext& ctx) const { ATH_MSG_DEBUG("Recorded new " << writeHandle.key() << " with range " << writeHandle.getRange() << " into Conditions Store"); return StatusCode::SUCCESS; } -StatusCode sTGCAsBuiltCondAlg2::parseDataFromJSON(const nlohmann::json& lines, - sTGCAsBuiltData2& effiData) const { +StatusCode sTGCAsBuiltCondAlg::parseDataFromJSON(const nlohmann::json& lines, + sTGCAsBuiltData& effiData) const { for (auto& corr : lines.items()) { nlohmann::json line = corr.value(); /// Station Component identification @@ -88,7 +88,7 @@ StatusCode sTGCAsBuiltCondAlg2::parseDataFromJSON(const nlohmann::json& lines, return StatusCode::FAILURE; } - sTGCAsBuiltData2::Parameters pars; + sTGCAsBuiltData::Parameters pars; pars.offset = line["offset"]; pars.rotation = line["rotation"]; pars.scale = line["scale"]; diff --git a/MuonSpectrometer/MuonDetDescr/MuonReadoutGeometry/MuonReadoutGeometry/MuonDetectorManager.h b/MuonSpectrometer/MuonDetDescr/MuonReadoutGeometry/MuonReadoutGeometry/MuonDetectorManager.h index 360e1f0bfab6..80e13f8b26b6 100644 --- a/MuonSpectrometer/MuonDetDescr/MuonReadoutGeometry/MuonReadoutGeometry/MuonDetectorManager.h +++ b/MuonSpectrometer/MuonDetDescr/MuonReadoutGeometry/MuonReadoutGeometry/MuonDetectorManager.h @@ -17,7 +17,7 @@ #include "GeoModelKernel/GeoVDetectorManager.h" #include "MuonAlignmentData/CorrContainer.h" #include "MuonAlignmentData/NswAsBuiltDbData.h" -#include "MuonAlignmentData/sTGCAsBuiltData2.h" +#include "MuonAlignmentData/sTGCAsBuiltData.h" #include "MuonIdHelpers/IMuonIdHelperSvc.h" #include "MuonReadoutGeometry/GenericRPCCache.h" #include "MuonReadoutGeometry/GenericTGCCache.h" @@ -207,17 +207,14 @@ namespace MuonGM { StatusCode updateCSCInternalAlignmentMap(const ALineContainer& cscIntAline); void setNswAsBuilt(const NswAsBuiltDbData* nswAsBuiltData); - void setsTGCAsBuilt2(const sTGCAsBuiltData2* stgcAsBuilt2); + void setsTGCAsBuilt(const sTGCAsBuiltData* stgcAsBuilt); #ifndef SIMULATIONBASE const NswAsBuilt::StripCalculator* getMMAsBuiltCalculator() const { return m_nswAsBuilt ? m_nswAsBuilt->microMegaData.get() : nullptr; } - const NswAsBuilt::StgcStripCalculator* getStgcAsBuiltCalculator() const { - return m_nswAsBuilt ? m_nswAsBuilt->sTgcData.get() : nullptr; ; - } #endif - const sTGCAsBuiltData2* getsTGCAsBuilt2() const { - return m_stgcAsBuildData2; + const sTGCAsBuiltData* getsTGCAsBuilt() const { + return m_stgcAsBuildData; } // map the RPC station indices (0-NRpcStatType) back to the RpcIdHelper stationNames @@ -283,7 +280,7 @@ namespace MuonGM { const NswAsBuiltDbData* m_nswAsBuilt{nullptr}; - const sTGCAsBuiltData2* m_stgcAsBuildData2 {nullptr}; + const sTGCAsBuiltData* m_stgcAsBuildData {nullptr}; /// RPC name caches std::map<int, int> m_rpcStatToIdx; diff --git a/MuonSpectrometer/MuonDetDescr/MuonReadoutGeometry/src/MuonDetectorManager.cxx b/MuonSpectrometer/MuonDetDescr/MuonReadoutGeometry/src/MuonDetectorManager.cxx index 28aa093ad1f3..d2225ca70463 100644 --- a/MuonSpectrometer/MuonDetDescr/MuonReadoutGeometry/src/MuonDetectorManager.cxx +++ b/MuonSpectrometer/MuonDetDescr/MuonReadoutGeometry/src/MuonDetectorManager.cxx @@ -627,8 +627,8 @@ namespace MuonGM { m_nswAsBuilt = nswAsBuiltData; } - void MuonDetectorManager::setsTGCAsBuilt2(const sTGCAsBuiltData2* stgcAsBuilt2) { - m_stgcAsBuildData2 = stgcAsBuilt2; + void MuonDetectorManager::setsTGCAsBuilt(const sTGCAsBuiltData* stgcAsBuilt) { + m_stgcAsBuildData = stgcAsBuilt; } const MdtReadoutElement* MuonDetectorManager::getMdtReadoutElement(const IdentifierHash& id) const { diff --git a/MuonSpectrometer/MuonDetDescr/MuonReadoutGeometry/src/sTgcReadoutElement.cxx b/MuonSpectrometer/MuonDetDescr/MuonReadoutGeometry/src/sTgcReadoutElement.cxx index 5734cde0fc10..4d379f29d48d 100644 --- a/MuonSpectrometer/MuonDetDescr/MuonReadoutGeometry/src/sTgcReadoutElement.cxx +++ b/MuonSpectrometer/MuonDetDescr/MuonReadoutGeometry/src/sTgcReadoutElement.cxx @@ -947,50 +947,18 @@ namespace MuonGM { //********************* // As-Built (MuonNswAsBuilt is not included in AthSimulation) //********************* - const NswAsBuilt::StgcStripCalculator* sc = manager()->getStgcAsBuiltCalculator(); - if(manager()->getsTGCAsBuilt2() && design->type == MuonChannelDesign::ChannelType::etaStrip){ - pos.head(2) = manager()->getsTGCAsBuilt2()->correctPosition(layerId, pos.head(2)); - - } else if (sc && design->type == MuonChannelDesign::ChannelType::etaStrip) { - - Amg::Vector2D lpos(locXpos, locYpos); - - // express the local position w.r.t. the nearest active strip - Amg::Vector2D rel_pos; - int istrip = design->positionRelativeToStrip(lpos, rel_pos); - if (istrip < 0) { - MsgStream log(Athena::getMessageSvc(), "sTgcReadoutElement"); - log << MSG::WARNING << "As-built corrections are provided only for eta strips within the active area. Returning." << endmsg; - return; - } - - // setup strip calculator - NswAsBuilt::stripIdentifier_t strip_id; - strip_id.quadruplet = { (largeSector() ? NswAsBuilt::quadrupletIdentifier_t::STL : NswAsBuilt::quadrupletIdentifier_t::STS), getStationEta(), getStationPhi(), m_ml }; - strip_id.ilayer = manager()->stgcIdHelper()->gasGap(layerId); - strip_id.istrip = istrip; - - // get the position coordinates, in the chamber frame, from NswAsBuilt. - // applying the 10um shift along the beam axis for strips (see fillCache()). - NswAsBuilt::StgcStripCalculator::position_t calcPos = sc->getPositionAlongStgcStrip(NswAsBuilt::Element::ParameterClass::CORRECTION, strip_id, rel_pos.y(), rel_pos.x()); - - if (calcPos.isvalid == NswAsBuilt::StgcStripCalculator::IsValid::VALID) { - pos = calcPos.pos; - pos[0] += (strip_id.ilayer%2) ? 0.01 : -0.01; // 1st layer gets +0.01; layer numbering starts from 1 - - // signal that pos is now in the chamber reference frame - // (don't go back to the layer frame yet, since we may apply b-lines later on) - trfToML = m_delta.inverse()*absTransform().inverse()*transform(layerId); - conditionsApplied = true; - } + if(manager()->getsTGCAsBuilt() && design->type == MuonChannelDesign::ChannelType::etaStrip){ + pos.head(2) = manager()->getsTGCAsBuilt()->correctPosition(layerId, pos.head(2)); + #ifndef NDEBUG - else { - MsgStream log(Athena::getMessageSvc(), "sTgcReadoutElement"); - if (log.level() <= MSG::DEBUG) { - log << MSG::DEBUG << "No as-built corrections provided for stEta: "<<getStationEta() << " stPhi: "<<getStationPhi()<<" ml: "<<m_ml<<" layer: "<<strip_id.ilayer<< endmsg; - } + } + else { + MsgStream log(Athena::getMessageSvc(), "sTgcReadoutElement"); + if (log.level() <= MSG::DEBUG) { + log << MSG::DEBUG << "No as-built corrections provided for stEta: "<<getStationEta() << " stPhi: "<<getStationPhi()<<" ml: "<<m_ml<<" layer: "<<strip_id.ilayer<< endmsg; } + } #endif } #endif -- GitLab From 3680d31c3f8ebbbbb378398dff25a8e32aadc6fa Mon Sep 17 00:00:00 2001 From: Patrick Scholer <pscholer@atlmuonsw1.dyndns.cern.ch> Date: Fri, 21 Mar 2025 12:18:16 +0100 Subject: [PATCH 2/8] cond alg + python config --- .../MuonConfig/python/MuonConfigFlags.py | 2 +- .../MuonConfig/python/MuonGeometryConfig.py | 17 ++++++++--------- .../MuonGeoModel/MuonDetectorCondAlg.h | 6 +++--- .../MuonGeoModel/src/MuonDetectorCondAlg.cxx | 16 ++++++++-------- 4 files changed, 20 insertions(+), 21 deletions(-) diff --git a/MuonSpectrometer/MuonConfig/python/MuonConfigFlags.py b/MuonSpectrometer/MuonConfig/python/MuonConfigFlags.py index d4445154382b..a01387c02a3b 100644 --- a/MuonSpectrometer/MuonConfig/python/MuonConfigFlags.py +++ b/MuonSpectrometer/MuonConfig/python/MuonConfigFlags.py @@ -132,7 +132,7 @@ def createMuonConfigFlags(): mcf.addFlag("Muon.Align.UseBLines", lambda prevFlags: 'all' if _muonAlignMode(prevFlags) else 'none') # Can be ['none','all','barrel','endcaps'] mcf.addFlag("Muon.Align.UseILines", lambda prevFlags: (_muonAlignMode(prevFlags))) mcf.addFlag("Muon.Align.UseAsBuilt", lambda prevFlags: (_muonAlignMode(prevFlags))) - mcf.addFlag("Muon.Align.UsesTGCAsBuild2",False) + mcf.addFlag("Muon.Align.UsesTGCAsBuild",False) # Muon Trigger Flags mcf.addFlag("Muon.MuonTrigger", False) diff --git a/MuonSpectrometer/MuonConfig/python/MuonGeometryConfig.py b/MuonSpectrometer/MuonConfig/python/MuonGeometryConfig.py index fa8b240eff81..078f8b139193 100644 --- a/MuonSpectrometer/MuonConfig/python/MuonGeometryConfig.py +++ b/MuonSpectrometer/MuonConfig/python/MuonGeometryConfig.py @@ -125,11 +125,10 @@ def MuonAlignmentCondAlgCfg(flags, name="MuonAlignmentCondAlg", **kwargs): pass else : acc.merge(MdtAsBuiltCondAlgCfg(flags)) - if(flags.Muon.Align.UsesTGCAsBuild2): - acc.merge(sTGCAsBuiltCondAlg2Cfg(flags)) - acc.merge(NswAsBuiltCondAlgCfg(flags,sTgcJSON="",ReadSTgcAsBuiltParamsKey="")) # make sure regular sTGC as built is disabled - else: - acc.merge(NswAsBuiltCondAlgCfg(flags)) + acc.merge(NswAsBuiltCondAlgCfg(flags)) + + if(flags.Muon.Align.UsesTGCAsBuild): + acc.merge(sTGCAsBuiltCondAlgCfg(flags)) kwargs.setdefault("ParlineFolders", ParlineFolders) MuonAlign = CompFactory.MuonAlignmentCondAlg(name, **kwargs) @@ -165,17 +164,17 @@ def NswAsBuiltCondAlgCfg(flags, name = "NswAsBuiltCondAlg", **kwargs): result.addCondAlgo(the_alg, primary = True) return result -def sTGCAsBuiltCondAlg2Cfg(flags, name = "sTGCAsBuiltCondAlg2", **kwargs): +def sTGCAsBuiltCondAlgCfg(flags, name = "sTGCAsBuiltCondAlg", **kwargs): result = ComponentAccumulator() #### Do not apply the as-built correction if not activated - if flags.GeoModel.Run < LHCPeriod.Run3 or not flags.Muon.Align.UsesTGCAsBuild2: + if flags.GeoModel.Run < LHCPeriod.Run3 or not flags.Muon.Align.UsesTGCAsBuild: return result kwargs.setdefault("readFromJSON","") if not kwargs["readFromJSON"]: kwargs.setdefault("ReadKey","/MUONALIGN/ASBUILTPARAMS/STGC") from IOVDbSvc.IOVDbSvcConfig import addFolders result.merge(addFolders( flags, kwargs["ReadKey"], 'MUONALIGN_OFL', className='CondAttrListCollection')) - the_alg = CompFactory.sTGCAsBuiltCondAlg2(name,**kwargs) + the_alg = CompFactory.sTGCAsBuiltCondAlg(name,**kwargs) result.addCondAlgo(the_alg, primary=True) return result @@ -222,7 +221,7 @@ def MuonDetectorCondAlgCfg(flags, name = "MuonDetectorCondAlg", **kwargs): kwargs.setdefault("applyBLines", len([alg for alg in result.getCondAlgos() if alg.name == "MuonAlignmentCondAlg"])>0) kwargs.setdefault("applyILines", len([alg for alg in result.getCondAlgos() if alg.name == "CscILinesCondAlg"])>0) kwargs.setdefault("applyNswAsBuilt", len([alg for alg in result.getCondAlgos() if alg.name == "NswAsBuiltCondAlg"])>0) - kwargs.setdefault("applysTGCAsBuilt2", len([alg for alg in result.getCondAlgos() if alg.name == "sTGCAsBuiltCondAlg2"])>0) + kwargs.setdefault("applysTGCAsBuilt", len([alg for alg in result.getCondAlgos() if alg.name == "sTGCAsBuiltCondAlg"])>0) kwargs.setdefault("applyMdtAsBuilt", len([alg for alg in result.getCondAlgos() if alg.name == "MdtAsBuiltCondAlg"])>0) diff --git a/MuonSpectrometer/MuonGeoModel/MuonGeoModel/MuonDetectorCondAlg.h b/MuonSpectrometer/MuonGeoModel/MuonGeoModel/MuonDetectorCondAlg.h index e749285b5ea6..8a095ec73b66 100644 --- a/MuonSpectrometer/MuonGeoModel/MuonGeoModel/MuonDetectorCondAlg.h +++ b/MuonSpectrometer/MuonGeoModel/MuonGeoModel/MuonDetectorCondAlg.h @@ -9,7 +9,7 @@ #include "GaudiKernel/ToolHandle.h" #include "MuonAlignmentData/CorrContainer.h" #include "MuonAlignmentData/NswAsBuiltDbData.h" -#include "MuonAlignmentData/sTGCAsBuiltData2.h" +#include "MuonAlignmentData/sTGCAsBuiltData.h" #include "MuonGeoModel/MuonDetectorTool.h" #include "MuonReadoutGeometry/MuonDetectorManager.h" #include "MuonAlignmentData/NswPassivationDbData.h" @@ -37,7 +37,7 @@ class MuonDetectorCondAlg : public AthReentrantAlgorithm { Gaudi::Property<bool> m_applyNswAsBuilt{this, "applyNswAsBuilt", true, "Toggles the application of the Nsw as-built parameters"}; - Gaudi::Property<bool> m_applysTGCAsBuilt2{this, "applysTGCAsBuilt2", false, + Gaudi::Property<bool> m_applysTGCAsBuilt{this, "applysTGCAsBuilt", false, "Toggles the application of the alternative sTGC as-built parameters"}; Gaudi::Property<bool> m_applyMdtAsBuilt{this, "applyMdtAsBuilt", true, @@ -59,7 +59,7 @@ class MuonDetectorCondAlg : public AthReentrantAlgorithm { "Key of input muon alignment CSC/ILine condition data"}; SG::ReadCondHandleKey<MdtAsBuiltContainer> m_readMdtAsBuiltKey{this, "ReadMdtAsBuiltKey", "MdtAsBuiltContainer", "Key of output muon alignment MDT/AsBuilt condition data"}; SG::ReadCondHandleKey<NswAsBuiltDbData> m_readNswAsBuiltKey{this, "ReadNswAsBuiltKey", "NswAsBuiltDbData", "Key of NswAsBuiltDbData object containing conditions data for NSW as-built params!"}; - SG::ReadCondHandleKey<sTGCAsBuiltData2> m_readsTGCAsBuilt2Key{this, "ReadsTGCAsBuilt2Key", "sTGCAsBuilt2", "Key of sTGCAsBuiltData2 object containing conditions data for alternative sTGC as-built model!"}; + SG::ReadCondHandleKey<sTGCAsBuiltData> m_readsTGCAsBuiltKey{this, "ReadsTGCAsBuiltKey", "sTGCAsBuilt", "Key of sTGCAsBuiltData object containing conditions data for the sTGC as-built model!"}; SG::ReadCondHandleKey<NswPassivationDbData> m_condMmPassivKey {this, "condMmPassivKey", "NswPassivationDbData", "Key of NswPassivationDbData object containing passivation data for MMs"}; // Write Handle diff --git a/MuonSpectrometer/MuonGeoModel/src/MuonDetectorCondAlg.cxx b/MuonSpectrometer/MuonGeoModel/src/MuonDetectorCondAlg.cxx index d85ef423094f..2381bf9e8ca0 100644 --- a/MuonSpectrometer/MuonGeoModel/src/MuonDetectorCondAlg.cxx +++ b/MuonSpectrometer/MuonGeoModel/src/MuonDetectorCondAlg.cxx @@ -29,14 +29,14 @@ StatusCode MuonDetectorCondAlg::initialize() { ATH_CHECK(m_readILineKey.initialize(m_applyILines)); ATH_CHECK(m_readMdtAsBuiltKey.initialize(m_applyMdtAsBuilt)); ATH_CHECK(m_readNswAsBuiltKey.initialize(m_applyNswAsBuilt)); - ATH_CHECK(m_readsTGCAsBuilt2Key.initialize(m_applysTGCAsBuilt2)); + ATH_CHECK(m_readsTGCAsBuiltKey.initialize(m_applysTGCAsBuilt)); ATH_CHECK(m_condMmPassivKey.initialize(m_applyMmPassivation)); ATH_CHECK(m_idHelperSvc.retrieve()); ATH_CHECK(m_writeDetectorManagerKey.initialize()); ATH_CHECK(m_worldWriteKey.initialize()); ATH_MSG_INFO("Initialize successful -- "<<m_applyALines<<", "<<m_applyBLines<<"," <<m_applyILines<<","<<m_applyMdtAsBuilt<<"," - <<m_applyNswAsBuilt<<","<<m_applyMmPassivation << "," << m_applysTGCAsBuilt2); + <<m_applyNswAsBuilt<<","<<m_applyMmPassivation << "," << m_applysTGCAsBuilt); return StatusCode::SUCCESS; } @@ -133,14 +133,14 @@ StatusCode MuonDetectorCondAlg::execute(const EventContext& ctx) const { MuonMgrData->setNswAsBuilt(*readNswAsBuilt); } - if(!m_readsTGCAsBuilt2Key.empty()){ - SG::ReadCondHandle<sTGCAsBuiltData2> readsTGCAsBuilt2{m_readsTGCAsBuilt2Key, ctx}; - if(!readsTGCAsBuilt2.isValid()){ - ATH_MSG_ERROR("Cannot find conditions data container for sTGC as-built 2"); + if(!m_readsTGCAsBuiltKey.empty()){ + SG::ReadCondHandle<sTGCAsBuiltData> readsTGCAsBuilt{m_readsTGCAsBuiltKey, ctx}; + if(!readsTGCAsBuilt.isValid()){ + ATH_MSG_ERROR("Cannot find conditions data container for sTGC as-built"); return StatusCode::FAILURE; } - writeHandle.addDependency(readsTGCAsBuilt2); - MuonMgrData->setsTGCAsBuilt2(*readsTGCAsBuilt2); + writeHandle.addDependency(readsTGCAsBuilt); + MuonMgrData->setsTGCAsBuilt(*readsTGCAsBuilt); } -- GitLab From 3e9ff68926b1366f3d0c7374298a523a9876eeb6 Mon Sep 17 00:00:00 2001 From: Patrick Scholer <pscholer@atlmuonsw1.dyndns.cern.ch> Date: Fri, 21 Mar 2025 14:15:30 +0100 Subject: [PATCH 3/8] clean up stgc ro element --- .../src/sTgcReadoutElement.cxx | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/MuonSpectrometer/MuonDetDescr/MuonReadoutGeometry/src/sTgcReadoutElement.cxx b/MuonSpectrometer/MuonDetDescr/MuonReadoutGeometry/src/sTgcReadoutElement.cxx index 4d379f29d48d..028530b1d0f2 100644 --- a/MuonSpectrometer/MuonDetDescr/MuonReadoutGeometry/src/sTgcReadoutElement.cxx +++ b/MuonSpectrometer/MuonDetDescr/MuonReadoutGeometry/src/sTgcReadoutElement.cxx @@ -940,9 +940,6 @@ namespace MuonGM { return; } - bool conditionsApplied{false}; - Amg::Transform3D trfToML{Amg::Transform3D::Identity()}; - #ifndef SIMULATIONBASE //********************* // As-Built (MuonNswAsBuilt is not included in AthSimulation) @@ -968,10 +965,16 @@ namespace MuonGM { // B-Lines //********************* if (has_BLines()) { + // go to the muultilayer frame + Amg::Transform3D trfToML = m_delta.inverse()*absTransform().inverse()*transform(layerId); + pos = trfToML*pos; + posOnDefChamber(pos); + // back to the layer reference frame from where we started + pos = trfToML.inverse()*pos; + + // go to the multilayer reference frame if we are not already there if (!conditionsApplied) { - trfToML = m_delta.inverse()*absTransform().inverse()*transform(layerId); - pos = trfToML*pos; // signal that pos is now in the multilayer reference frame conditionsApplied = true; @@ -980,7 +983,7 @@ namespace MuonGM { } // back to the layer reference frame from where we started - if (conditionsApplied) pos = trfToML.inverse()*pos; + if (conditionsApplied) } } // namespace MuonGM -- GitLab From 3838c40d6839521f6b4299115ca85af260d39b5a Mon Sep 17 00:00:00 2001 From: Patrick Scholer <pscholer@atlmuonsw1.dyndns.cern.ch> Date: Fri, 21 Mar 2025 18:31:37 +0100 Subject: [PATCH 4/8] more cleanup --- .../MuonAlignmentData/sTGCAsBuiltData.h | 2 ++ .../MuonAlignmentData/src/sTGCAsBuiltData.cxx | 7 +++++++ .../MuonCondAlg/MuonCondAlg/sTGCAsBuiltCondAlg.h | 2 +- .../MuonConfig/python/MuonGeometryConfig.py | 6 +----- .../MuonReadoutGeometry/src/sTgcReadoutElement.cxx | 14 ++------------ 5 files changed, 13 insertions(+), 18 deletions(-) diff --git a/MuonSpectrometer/MuonAlignment/MuonAlignmentData/MuonAlignmentData/sTGCAsBuiltData.h b/MuonSpectrometer/MuonAlignment/MuonAlignmentData/MuonAlignmentData/sTGCAsBuiltData.h index 192e093d91aa..e70e9a0a6ae6 100644 --- a/MuonSpectrometer/MuonAlignment/MuonAlignmentData/MuonAlignmentData/sTGCAsBuiltData.h +++ b/MuonSpectrometer/MuonAlignment/MuonAlignmentData/MuonAlignmentData/sTGCAsBuiltData.h @@ -47,6 +47,8 @@ class sTGCAsBuiltData: public AthMessaging { ParMap m_asBuiltData{}; }; +std::ostream& operator<<(std::ostream& ostr, const sTGCAsBuiltData::Parameters& par); + CLASS_DEF( sTGCAsBuiltData , 154485394 , 1 ); CONDCONT_DEF( sTGCAsBuiltData , 66070092 ); #endif diff --git a/MuonSpectrometer/MuonAlignment/MuonAlignmentData/src/sTGCAsBuiltData.cxx b/MuonSpectrometer/MuonAlignment/MuonAlignmentData/src/sTGCAsBuiltData.cxx index 273fbdb92da0..8042f5ed74fd 100644 --- a/MuonSpectrometer/MuonAlignment/MuonAlignmentData/src/sTGCAsBuiltData.cxx +++ b/MuonSpectrometer/MuonAlignment/MuonAlignmentData/src/sTGCAsBuiltData.cxx @@ -4,6 +4,12 @@ #include "MuonAlignmentData/sTGCAsBuiltData.h" #include "GeoPrimitives/GeoPrimitivesToStringConverter.h" + +std::ostream& operator<<(std::ostream& ostr, const sTGCAsBuiltData::Parameters& par){ + return ostr << "Offset " << par.offset << " rotxy " << par.rotation << " scale " << par.scale << " nonPara " << par.nonPara; +} + + sTGCAsBuiltData::sTGCAsBuiltData(const Muon::IMuonIdHelperSvc* idHelperSvc): AthMessaging{"sTGCAsBuiltData2"}, m_idHelperSvc{idHelperSvc} {} @@ -23,6 +29,7 @@ Amg::Vector2D sTGCAsBuiltData::correctPosition(const Identifier& channelId, cons // For the QL3 modules described by the legacy (Run 3) geometry EDM the origin of the local frame is shifted with respect to the actual center of the gap. // Therefore a shift is introduced which stabilizes the as built fit which must also be applied here since the parameters are expressed using the actual center of the gap. float shift = (std::fabs(m_idHelperSvc->stationEta(channelId)) == 3 && m_idHelperSvc->stationNameString(channelId) == "STL" ? 24.74 : 0.0); + ATH_MSG_VERBOSE("applying as built parameters " << pars); correctedPos.x() = pos.x() + (pars.offset * convScale + pars.rotation *convScale * pos.y() + pars.scale*convScale*(pos.x() + shift ) + pars.nonPara * convScale * convScale * (pos.x() + shift )*pos.y()); return correctedPos; diff --git a/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondAlg/MuonCondAlg/sTGCAsBuiltCondAlg.h b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondAlg/MuonCondAlg/sTGCAsBuiltCondAlg.h index 71112250bc43..2a2aaaf734b6 100644 --- a/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondAlg/MuonCondAlg/sTGCAsBuiltCondAlg.h +++ b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondAlg/MuonCondAlg/sTGCAsBuiltCondAlg.h @@ -36,7 +36,7 @@ private: /// Load the gasGap efficiencies from a JSON file Gaudi::Property<std::string> m_readFromJSON{this, "readFromJSON", "" }; - SG::WriteCondHandleKey<sTGCAsBuiltData> m_writeKey{this, "WriteKey", "sTGCAsBuilt2", "Key of the efficiency data in the CondStore"}; + SG::WriteCondHandleKey<sTGCAsBuiltData> m_writeKey{this, "WriteKey", "sTGCAsBuilt", "Key of the efficiency data in the CondStore"}; SG::ReadCondHandleKey<CondAttrListCollection> m_readKeyDb{this, "ReadKey", "", "Folder of the STGC efficiencies as they're stored in COOL"}; }; diff --git a/MuonSpectrometer/MuonConfig/python/MuonGeometryConfig.py b/MuonSpectrometer/MuonConfig/python/MuonGeometryConfig.py index 078f8b139193..49bf3a1e5035 100644 --- a/MuonSpectrometer/MuonConfig/python/MuonGeometryConfig.py +++ b/MuonSpectrometer/MuonConfig/python/MuonGeometryConfig.py @@ -149,12 +149,8 @@ def NswAsBuiltCondAlgCfg(flags, name = "NswAsBuiltCondAlg", **kwargs): if flags.GeoModel.Run < LHCPeriod.Run3: return result kwargs.setdefault("MicroMegaJSON","") - kwargs.setdefault("sTgcJSON","") kwargs.setdefault("ReadMmAsBuiltParamsKey","/MUONALIGN/ASBUILTPARAMS/MM") - #kwargs.setdefault("ReadSTgcAsBuiltParamsKey","/MUONALIGN/ASBUILTPARAMS/STGC") # This is the folder that sould be used once the as builts are validated, so keep it here but commented out - kwargs.setdefault("ReadSTgcAsBuiltParamsKey","") # disable the stgc part of NswAsBuilt, proper code cleanup will follow - ##TODO: remove hard-coded tag once the global tag is ready from IOVDbSvc.IOVDbSvcConfig import addFolders @@ -173,7 +169,7 @@ def sTGCAsBuiltCondAlgCfg(flags, name = "sTGCAsBuiltCondAlg", **kwargs): if not kwargs["readFromJSON"]: kwargs.setdefault("ReadKey","/MUONALIGN/ASBUILTPARAMS/STGC") from IOVDbSvc.IOVDbSvcConfig import addFolders - result.merge(addFolders( flags, kwargs["ReadKey"], 'MUONALIGN_OFL', className='CondAttrListCollection')) + result.merge(addFolders( flags, kwargs["ReadKey"], 'MUONALIGN_OFL', className='CondAttrListCollection', tag = 'MUONALIGN_STG_IntAl_alCons_noQL3_v01')) the_alg = CompFactory.sTGCAsBuiltCondAlg(name,**kwargs) result.addCondAlgo(the_alg, primary=True) return result diff --git a/MuonSpectrometer/MuonDetDescr/MuonReadoutGeometry/src/sTgcReadoutElement.cxx b/MuonSpectrometer/MuonDetDescr/MuonReadoutGeometry/src/sTgcReadoutElement.cxx index 028530b1d0f2..5a1a1128bed5 100644 --- a/MuonSpectrometer/MuonDetDescr/MuonReadoutGeometry/src/sTgcReadoutElement.cxx +++ b/MuonSpectrometer/MuonDetDescr/MuonReadoutGeometry/src/sTgcReadoutElement.cxx @@ -44,6 +44,7 @@ #include "RDBAccessSvc/IRDBRecord.h" #include "RDBAccessSvc/IRDBRecordset.h" #include "GeoModelInterfaces/IGeoDbTagSvc.h" +#include "GeoPrimitives/GeoPrimitivesToStringConverter.h" namespace MuonGM { @@ -971,19 +972,8 @@ namespace MuonGM { posOnDefChamber(pos); // back to the layer reference frame from where we started pos = trfToML.inverse()*pos; - - - // go to the multilayer reference frame if we are not already there - if (!conditionsApplied) { - - // signal that pos is now in the multilayer reference frame - conditionsApplied = true; - } - posOnDefChamber(pos); + } - - // back to the layer reference frame from where we started - if (conditionsApplied) } } // namespace MuonGM -- GitLab From 9fd2524ae1fea1baf256fc2a11cb161dbfc7fa72 Mon Sep 17 00:00:00 2001 From: Patrick Scholer <pscholer@atlmuonsw1.dyndns.cern.ch> Date: Fri, 21 Mar 2025 19:51:26 +0100 Subject: [PATCH 5/8] fix R4 alignment store --- .../MuonAlignmentDataR4/sTgcAlignmentStore.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/MuonSpectrometer/MuonPhaseII/MuonConditions/MuonAlignmentDataR4/MuonAlignmentDataR4/sTgcAlignmentStore.h b/MuonSpectrometer/MuonPhaseII/MuonConditions/MuonAlignmentDataR4/MuonAlignmentDataR4/sTgcAlignmentStore.h index 5ab8213f75c5..e9844174578e 100644 --- a/MuonSpectrometer/MuonPhaseII/MuonConditions/MuonAlignmentDataR4/MuonAlignmentDataR4/sTgcAlignmentStore.h +++ b/MuonSpectrometer/MuonPhaseII/MuonConditions/MuonAlignmentDataR4/MuonAlignmentDataR4/sTgcAlignmentStore.h @@ -7,6 +7,7 @@ #include <MuonAlignmentData/BLinePar.h> #include <MuonAlignmentData/NswAsBuiltDbData.h> +#include <MuonAlignmentData/sTGCAsBuiltData.h> #include <ActsGeometryInterfaces/AlignmentStore.h> /* Alignment store to additionally ship the sTgc as-built parameters and * B-Line deformation parameters through the Acts geometry context. @@ -16,8 +17,7 @@ class sTgcAlignmentStore: public ActsTrk::AlignmentStore { sTgcAlignmentStore() = default; /// @brief Pointer to the collection of passivation parameters /// if the project is not AthSimulation. Otherwise, it's a char - using sTgcAsBuiltPtr = NswAsBuiltDbData::sTgcAsBuiltPtr; - sTgcAsBuiltPtr asBuiltPars{}; + sTGCAsBuiltData* asBuiltPars{}; /// Caches the micromega BLine parameter. void cacheBLine(const Identifier& detElId, const BLinePar& bline); -- GitLab From 7ee3438b84af98ac6fba792099f49569665313f9 Mon Sep 17 00:00:00 2001 From: Patrick Scholer <patrick.scholer@cern.ch> Date: Fri, 21 Mar 2025 19:12:24 +0000 Subject: [PATCH 6/8] Apply 1 suggestion(s) to 1 file(s) Co-authored-by: Johannes Junggeburth <johannes.josef.junggeburth@cern.ch> --- .../MuonAlignment/MuonAlignmentData/src/sTGCAsBuiltData.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/MuonSpectrometer/MuonAlignment/MuonAlignmentData/src/sTGCAsBuiltData.cxx b/MuonSpectrometer/MuonAlignment/MuonAlignmentData/src/sTGCAsBuiltData.cxx index 8042f5ed74fd..bc5acd536020 100644 --- a/MuonSpectrometer/MuonAlignment/MuonAlignmentData/src/sTGCAsBuiltData.cxx +++ b/MuonSpectrometer/MuonAlignment/MuonAlignmentData/src/sTGCAsBuiltData.cxx @@ -11,7 +11,7 @@ std::ostream& operator<<(std::ostream& ostr, const sTGCAsBuiltData::Parameters& sTGCAsBuiltData::sTGCAsBuiltData(const Muon::IMuonIdHelperSvc* idHelperSvc): - AthMessaging{"sTGCAsBuiltData2"}, + AthMessaging{"sTGCAsBuiltData"}, m_idHelperSvc{idHelperSvc} {} -- GitLab From e3b260df764c94d3daba6a3be4926f3ece25aab2 Mon Sep 17 00:00:00 2001 From: Patrick Scholer <patrick.scholer@cern.ch> Date: Sat, 22 Mar 2025 11:11:21 +0000 Subject: [PATCH 7/8] Apply 1 suggestion(s) to 1 file(s) Co-authored-by: Johannes Junggeburth <johannes.josef.junggeburth@cern.ch> --- .../MuonCondAlg/MuonCondAlg/sTGCAsBuiltCondAlg.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondAlg/MuonCondAlg/sTGCAsBuiltCondAlg.h b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondAlg/MuonCondAlg/sTGCAsBuiltCondAlg.h index 2a2aaaf734b6..ab490e9eb02d 100644 --- a/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondAlg/MuonCondAlg/sTGCAsBuiltCondAlg.h +++ b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondAlg/MuonCondAlg/sTGCAsBuiltCondAlg.h @@ -20,7 +20,7 @@ */ class sTGCAsBuiltCondAlg : public AthReentrantAlgorithm { public: - sTGCAsBuiltCondAlg(const std::string& name, ISvcLocator* svc); + using AthReentrantAlgorithm::AthReentrantAlgorithm; virtual ~sTGCAsBuiltCondAlg() = default; virtual StatusCode initialize() override; virtual StatusCode execute(const EventContext& ctx) const override; -- GitLab From e68f454ff8791ca7447ddf9bd7c05c812f7c41da Mon Sep 17 00:00:00 2001 From: Patrick Scholer <pscholer@atlmuonsw1.dyndns.cern.ch> Date: Sat, 22 Mar 2025 16:18:42 +0100 Subject: [PATCH 8/8] fix R4 --- .../MuonCondAlg/src/sTGCAsBuiltCondAlg.cxx | 2 -- .../MuonAlignmentDataR4/sTgcAlignmentStore.h | 2 +- .../src/ActsMuonAlignCondAlg.cxx | 19 ++++++++++++------- .../MuonCondAlgR4/src/ActsMuonAlignCondAlg.h | 4 ++++ 4 files changed, 17 insertions(+), 10 deletions(-) diff --git a/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondAlg/src/sTGCAsBuiltCondAlg.cxx b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondAlg/src/sTGCAsBuiltCondAlg.cxx index 009f8d823cf6..597fcaa7ded7 100644 --- a/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondAlg/src/sTGCAsBuiltCondAlg.cxx +++ b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondAlg/src/sTGCAsBuiltCondAlg.cxx @@ -9,8 +9,6 @@ #include <PathResolver/PathResolver.h> #include <fstream> -sTGCAsBuiltCondAlg::sTGCAsBuiltCondAlg(const std::string& name, ISvcLocator* pSvcLocator) : - AthReentrantAlgorithm(name, pSvcLocator) {} // Initialize StatusCode sTGCAsBuiltCondAlg::initialize() { diff --git a/MuonSpectrometer/MuonPhaseII/MuonConditions/MuonAlignmentDataR4/MuonAlignmentDataR4/sTgcAlignmentStore.h b/MuonSpectrometer/MuonPhaseII/MuonConditions/MuonAlignmentDataR4/MuonAlignmentDataR4/sTgcAlignmentStore.h index e9844174578e..f1653d67bfdb 100644 --- a/MuonSpectrometer/MuonPhaseII/MuonConditions/MuonAlignmentDataR4/MuonAlignmentDataR4/sTgcAlignmentStore.h +++ b/MuonSpectrometer/MuonPhaseII/MuonConditions/MuonAlignmentDataR4/MuonAlignmentDataR4/sTgcAlignmentStore.h @@ -17,7 +17,7 @@ class sTgcAlignmentStore: public ActsTrk::AlignmentStore { sTgcAlignmentStore() = default; /// @brief Pointer to the collection of passivation parameters /// if the project is not AthSimulation. Otherwise, it's a char - sTGCAsBuiltData* asBuiltPars{}; + const sTGCAsBuiltData* asBuiltPars{}; /// Caches the micromega BLine parameter. void cacheBLine(const Identifier& detElId, const BLinePar& bline); diff --git a/MuonSpectrometer/MuonPhaseII/MuonConditions/MuonCondAlgR4/src/ActsMuonAlignCondAlg.cxx b/MuonSpectrometer/MuonPhaseII/MuonConditions/MuonCondAlgR4/src/ActsMuonAlignCondAlg.cxx index 4ea58b0fd5e4..cae93187d80d 100644 --- a/MuonSpectrometer/MuonPhaseII/MuonConditions/MuonCondAlgR4/src/ActsMuonAlignCondAlg.cxx +++ b/MuonSpectrometer/MuonPhaseII/MuonConditions/MuonCondAlgR4/src/ActsMuonAlignCondAlg.cxx @@ -184,9 +184,9 @@ StatusCode ActsMuonAlignCondAlg::loadMmDeformPars(const EventContext& ctx, StatusCode ActsMuonAlignCondAlg::loadStgcDeformPars(const EventContext& ctx, ActsTrk::RawGeomAlignStore& store) const{ std::unique_ptr<sTgcAlignmentStore> trkAlignment = std::make_unique<sTgcAlignmentStore>(); - if (m_applyNswAsBuilt) { - CREATE_READHANDLE(NswAsBuiltDbData, m_readNswAsBuiltKey); - trkAlignment->asBuiltPars = readHandle->sTgcData; + if (m_applyNswAsBuilt && !m_readsTgcAsBuiltKey.empty()) { + CREATE_READHANDLE(sTGCAsBuiltData, m_readsTgcAsBuiltKey); + trkAlignment->asBuiltPars = *readHandle; } if (m_applyBLines) { CREATE_READHANDLE(BLineContainer, m_readKeyBLines); @@ -213,10 +213,11 @@ StatusCode ActsMuonAlignCondAlg::declareDependencies(const EventContext& ctx, CREATE_READHANDLE(ALineContainer, m_readKeyALines); writeHandle.addDependency(readHandle); } - const bool isNsw = detType == ActsTrk::DetectorType::sTgc || - detType == ActsTrk::DetectorType::Mm; + const bool issTGC = detType == ActsTrk::DetectorType::sTgc; + const bool isMm = detType == ActsTrk::DetectorType::Mm; const bool isMdt = detType == ActsTrk::DetectorType::Mdt; - if (m_applyBLines&& (isNsw || isMdt)) { + + if (m_applyBLines&& (issTGC || isMm || isMdt)) { CREATE_READHANDLE(BLineContainer, m_readKeyBLines); writeHandle.addDependency(readHandle); } @@ -228,10 +229,14 @@ StatusCode ActsMuonAlignCondAlg::declareDependencies(const EventContext& ctx, CREATE_READHANDLE(NswPassivationDbData, m_readNswPassivKey); writeHandle.addDependency(readHandle); } - if (m_applyNswAsBuilt && isNsw) { + if (m_applyNswAsBuilt && isMm) { CREATE_READHANDLE(NswAsBuiltDbData, m_readNswAsBuiltKey); writeHandle.addDependency(readHandle); } + if(m_applyNswAsBuilt && issTGC && !m_readsTgcAsBuiltKey.empty()){ + CREATE_READHANDLE(sTGCAsBuiltData, m_readsTgcAsBuiltKey); + writeHandle.addDependency(readHandle); + } return StatusCode::SUCCESS; } diff --git a/MuonSpectrometer/MuonPhaseII/MuonConditions/MuonCondAlgR4/src/ActsMuonAlignCondAlg.h b/MuonSpectrometer/MuonPhaseII/MuonConditions/MuonCondAlgR4/src/ActsMuonAlignCondAlg.h index c0aa85c8af00..cf9c53894b5e 100644 --- a/MuonSpectrometer/MuonPhaseII/MuonConditions/MuonCondAlgR4/src/ActsMuonAlignCondAlg.h +++ b/MuonSpectrometer/MuonPhaseII/MuonConditions/MuonCondAlgR4/src/ActsMuonAlignCondAlg.h @@ -18,6 +18,8 @@ #include <MuonAlignmentDataR4/MmAlignmentStore.h> #include <MuonAlignmentDataR4/sTgcAlignmentStore.h> +#include <MuonAlignmentData/sTGCAsBuiltData.h> + #include <map> #include <set> #include <unordered_map> @@ -77,6 +79,8 @@ private: "Key of output muon alignment MDT/AsBuilt condition data"}; SG::ReadCondHandleKey<NswAsBuiltDbData> m_readNswAsBuiltKey{this, "ReadNswAsBuiltKey", "NswAsBuiltDbData", "Key of NswAsBuiltDbData object containing conditions data for NSW as-built params!"}; + SG::ReadCondHandleKey<sTGCAsBuiltData> m_readsTgcAsBuiltKey{this, "ReadsTgcAsBuiltKey", "", + "Key of sTGCAsBuiltDbData object containing conditions data for sTgc as-built params!"}; SG::ReadCondHandleKey<NswPassivationDbData> m_readNswPassivKey {this, "dMmPassivationKey", "NswPassivationDbData", "Key of NswPassivationDbData object containing passivation data for MMs"}; -- GitLab