From 030eb3d26e3a016800d202607691d642a94a415b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20K=C3=B6hler?= <nicolas.koehler@cern.ch> Date: Sat, 13 Jun 2020 16:22:30 +0200 Subject: [PATCH] remove MuonDetectorManager calls from MuonAlignmentCondAlg --- .../MuonCondAlg/MuonAlignmentCondAlg.h | 21 +--- .../MuonCondAlg/src/MuonAlignmentCondAlg.cxx | 114 ++---------------- 2 files changed, 17 insertions(+), 118 deletions(-) diff --git a/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondAlg/MuonCondAlg/MuonAlignmentCondAlg.h b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondAlg/MuonCondAlg/MuonAlignmentCondAlg.h index bfe6c5deac12..7de384b4a995 100644 --- a/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondAlg/MuonCondAlg/MuonAlignmentCondAlg.h +++ b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondAlg/MuonCondAlg/MuonAlignmentCondAlg.h @@ -1,27 +1,22 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #ifndef MUONCONDALG_MUONALIGNMENTCONDALG_H #define MUONCONDALG_MUONALIGNMENTCONDALG_H #include "AthenaBaseComps/AthAlgorithm.h" +#include "GaudiKernel/ServiceHandle.h" + #include "StoreGate/ReadCondHandleKey.h" #include "StoreGate/CondHandleKeyArray.h" #include "GaudiKernel/ICondSvc.h" #include "AthenaPoolUtilities/CondAttrListCollection.h" -// typedefs for A/BLineMapContainer #include "MuonAlignmentData/CorrContainer.h" -#include "GaudiKernel/ServiceHandle.h" #include "MuonIdHelpers/IMuonIdHelperSvc.h" -class StoreGateSvc; -class StatusCode; - -namespace MuonGM -{ - class MuonDetectorManager; -} +#include <string> +#include <vector> class MuonAlignmentCondAlg: public AthAlgorithm { @@ -31,9 +26,6 @@ class MuonAlignmentCondAlg: public AthAlgorithm { virtual ~MuonAlignmentCondAlg() = default; virtual StatusCode initialize() override; virtual StatusCode execute() override; - virtual StatusCode finalize() override; - - //std::vector<std::string> parlineFolder() { return m_parlineFolder; } Gaudi::Property<std::vector<std::string>> m_parlineFolder {this, "ParlineFolders", std::vector<std::string>(), "Database folders", "OrderedSet<std::string>"}; @@ -76,11 +68,10 @@ class MuonAlignmentCondAlg: public AthAlgorithm { "Key of output muon alignment MDT/AsBuilt condition data"}; ServiceHandle<Muon::IMuonIdHelperSvc> m_idHelperSvc {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"}; - const MuonGM::MuonDetectorManager* m_muonDetMgrDS; + ServiceHandle<ICondSvc> m_condSvc; std::string m_geometryVersion; - //std::vector<std::string> m_parlineFolder; bool m_dumpALines; bool m_dumpBLines; bool m_dumpILines; diff --git a/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondAlg/src/MuonAlignmentCondAlg.cxx b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondAlg/src/MuonAlignmentCondAlg.cxx index d7a5291aed6d..a52eca63887d 100644 --- a/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondAlg/src/MuonAlignmentCondAlg.cxx +++ b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondAlg/src/MuonAlignmentCondAlg.cxx @@ -2,27 +2,21 @@ Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ -#include "GaudiKernel/MsgStream.h" +#include "MuonCondAlg/MuonAlignmentCondAlg.h" -#include "StoreGate/StoreGateSvc.h" #include "SGTools/TransientAddress.h" #include "CoralBase/Attribute.h" #include "CoralBase/AttributeListSpecification.h" #include "AthenaPoolUtilities/AthenaAttributeList.h" #include "AthenaPoolUtilities/CondAttrListCollection.h" - -#include "MuonReadoutGeometry/MuonDetectorManager.h" #include "MuonReadoutGeometry/GlobalUtilities.h" - #include "PathResolver/PathResolver.h" +#include "MuonCondSvc/MdtStringUtils.h" +#include "MuonReadoutGeometry/MuonDetectorManager.h" + #include <fstream> -#include <string> #include <map> -#include "MuonCondAlg/MuonAlignmentCondAlg.h" - -#include "MuonCondSvc/MdtStringUtils.h" - MuonAlignmentCondAlg::MuonAlignmentCondAlg(const std::string& name, ISvcLocator* pSvcLocator) : AthAlgorithm(name, pSvcLocator), @@ -86,63 +80,25 @@ StatusCode MuonAlignmentCondAlg::initialize(){ ATH_MSG_FATAL("unable to register WriteCondHandle " << m_writeAsBuiltKey.fullKey() << " with CondSvc"); return StatusCode::FAILURE; } - - //================= - // Initialize geometry and Id Helpers. Initialization of the pointer to the MuonDetectorManager from the detector store. - // !!!!!!!!!!! It was called in the loadParameters before. !!!!!!!!!! - //================= - - if (InitializeGeometryAndIdHelpers().isFailure()) { - ATH_MSG_FATAL("Error in InitializeGeometryAndIdHelpers"); - return StatusCode::FAILURE; - } - - - return StatusCode::SUCCESS; + ATH_CHECK(InitializeGeometryAndIdHelpers()); + return StatusCode::SUCCESS; } StatusCode MuonAlignmentCondAlg::execute(){ - - StatusCode sc = StatusCode::SUCCESS; - ATH_MSG_DEBUG( "execute " << name() ); - - sc = loadParameters(); - - return sc; -} - - -StatusCode MuonAlignmentCondAlg::finalize(){ - - ATH_MSG_DEBUG( "finalize " << name() ); + ATH_CHECK(loadParameters()); return StatusCode::SUCCESS; } StatusCode MuonAlignmentCondAlg::InitializeGeometryAndIdHelpers(){ - - //================= - // Initialize pointer to the MuonDetectorManager from the detector store - //================= - - if (StatusCode::SUCCESS != detStore()->retrieve(m_muonDetMgrDS)) { - ATH_MSG_FATAL("Couldn't load MuonDetectorManager"); + const MuonGM::MuonDetectorManager* muDetMgrDS=nullptr; + if (StatusCode::SUCCESS != detStore()->retrieve(muDetMgrDS)) { + ATH_MSG_FATAL("Couldn't retrieve the MuonDetectorManager from the detectorStore"); return StatusCode::FAILURE; } - - //================= - // Initialize geometry - //================= - - m_geometryVersion = m_muonDetMgrDS->geometryVersion(); + m_geometryVersion = muDetMgrDS->geometryVersion(); ATH_MSG_INFO("geometry version from the MuonDetectorManager = " << m_geometryVersion); - - //================= - // Initialize Helpers - //================= - ATH_CHECK(m_idHelperSvc.retrieve()); - return StatusCode::SUCCESS; } @@ -229,18 +185,6 @@ StatusCode MuonAlignmentCondAlg::loadAlignABLines() { } } - // >>>>>>>>>>>> START: This code should be REMOVED after MuonDetectorManger in MuonEventTPCnv moves to Conditions Store >>>>>>>>>>>> - // ======================= - // FIRST Update the MuonDetectorManager and THEN record the ALine. - // ======================= - - // FIXME: const_cast - if (const_cast<MuonGM::MuonDetectorManager*>(m_muonDetMgrDS)->updateAlignment(*writeALineCdo).isFailure()) ATH_MSG_ERROR("Unable to updateAlignment" ); - else ATH_MSG_DEBUG("updateAlignment DONE" ); - // if (m_muonDetMgrDS->updateAlignment(writeALineCdo.get()).isFailure()) ATH_MSG_ERROR("Unable to updateAlignment" ); - // else ATH_MSG_DEBUG("updateAlignment DONE" ); - // <<<<<<<<<<<<< END: This code should be REMOVED after MuonDetectorManger in MuonEventTPCnv moves to Conditions Store <<<<<<<<<<<<< - if (writeALineHandle.record(rangeALineW, std::move(writeALineCdo)).isFailure()) { ATH_MSG_FATAL("Could not record ALineMapContainer " << writeALineHandle.key() << " with EventRange " << rangeALineW @@ -249,18 +193,6 @@ StatusCode MuonAlignmentCondAlg::loadAlignABLines() { } ATH_MSG_INFO("recorded new " << writeALineHandle.key() << " with range " << rangeALineW << " into Conditions Store"); - // >>>>>>>>>>>> START: This code should be REMOVED after MuonDetectorManger in MuonEventTPCnv moves to Conditions Store >>>>>>>>>>>> - // ======================= - // FIRST Update the MuonDetectorManager and THEN record the BLine. - // ======================= - - // FIXME: const_cast - if (const_cast<MuonGM::MuonDetectorManager*>(m_muonDetMgrDS)->updateDeformations(*writeBLineCdo).isFailure()) ATH_MSG_ERROR("Unable to updateDeformations" ); - else ATH_MSG_DEBUG("updateDeformations DONE" ); - // if (m_muonDetMgrDS->updateDeformations(writeBLineCdo.get()).isFailure()) ATH_MSG_ERROR("Unable to updateDeformations" ); - // else ATH_MSG_DEBUG("updateDeformations DONE" ); - // <<<<<<<<<<<<< END: This code should be REMOVED after MuonDetectorManger in MuonEventTPCnv moves to Conditions Store <<<<<<<<<<<<< - if (writeBLineHandle.record(rangeBLineW, std::move(writeBLineCdo)).isFailure()) { ATH_MSG_FATAL("Could not record BLineMapContainer " << writeBLineHandle.key() << " with EventRange " << rangeBLineW @@ -884,18 +816,6 @@ StatusCode MuonAlignmentCondAlg::loadAlignILines(std::string folderName) // dump I-lines to log file TBA if (m_dumpILines && (int)writeCdo->size()>0) dumpILines(folderName, writeCdo.get()); - // >>>>>>>>>>>> START: This code should be REMOVED after MuonDetectorManger in MuonEventTPCnv moves to Conditions Store >>>>>>>>>>>> - // ======================= - // FIRST update MuonDetectorManager and THEN record the output cond object. - // ======================= - - // FIXME: const_cast - if (const_cast<MuonGM::MuonDetectorManager*>(m_muonDetMgrDS)->updateCSCInternalAlignmentMap(*writeCdo).isFailure()) ATH_MSG_ERROR("Unable to updateCSCInternalAlignmentMap" ); - else ATH_MSG_DEBUG("updateCSCInternalAlignmentMap DONE" ); - // if (m_muonDetMgrDS->updateCSCInternalAlignmentMap(writeCdo.get()).isFailure()) ATH_MSG_ERROR("Unable to updateCSCInternalAlignmentMap" ); - // else ATH_MSG_DEBUG("updateCSCInternalAlignmentMap DONE" ); - // <<<<<<<<<<<<< END: This code should be REMOVED after MuonDetectorManger in MuonEventTPCnv moves to Conditions Store <<<<<<<<<<<<< - if (writeHandle.record(rangeCscILinesW, std::move(writeCdo)).isFailure()) { ATH_MSG_FATAL("Could not record CscInternalAlignmentMapContainer " << writeHandle.key() << " with EventRange " << rangeCscILinesW @@ -1019,18 +939,6 @@ StatusCode MuonAlignmentCondAlg::loadAlignAsBuilt(std::string folderName) // !!!!!!!!!!!!!! In the MuonAlignmentDbTool this was in loadAlignABLines. I moved it here if ( m_asBuiltFile!="" ) setAsBuiltFromAscii(writeCdo.get()); - // >>>>>>>>>>>> START: This code should be REMOVED after MuonDetectorManger in MuonEventTPCnv moves to Conditions Store >>>>>>>>>>>> - // ======================= - // FIRST update MuonDetectorManager and THEN record the output cond object. - // ======================= - - // FIXME: const_cast - if (const_cast<MuonGM::MuonDetectorManager*>(m_muonDetMgrDS)->updateAsBuiltParams(*writeCdo).isFailure()) ATH_MSG_ERROR("Unable to updateAsBuiltParams" ); - else ATH_MSG_DEBUG("updateAsBuiltParams DONE" ); - // if (m_muonDetMgrDS->updateAsBuiltParams(writeCdo.get()).isFailure()) ATH_MSG_ERROR("Unable to updateAsBuiltParams" ); - // else ATH_MSG_DEBUG("updateAsBuiltParams DONE" ); - // <<<<<<<<<<<<< END: This code should be REMOVED after MuonDetectorManger in MuonEventTPCnv moves to Conditions Store <<<<<<<<<<<<< - if (writeHandle.record(rangeMdtAsBuiltW, std::move(writeCdo)).isFailure()) { ATH_MSG_FATAL("Could not record MdtAsBuiltMapContainer " << writeHandle.key() << " with EventRange " << rangeMdtAsBuiltW -- GitLab