From 37d992472f5d1c246eb94b8b8f02d7b62fe6f283 Mon Sep 17 00:00:00 2001 From: Frank Winklmeier <frank.winklmeier@cern.ch> Date: Mon, 21 Oct 2024 13:16:37 +0200 Subject: [PATCH] SCT_ConditionsTools: service pointer migration (ATEAM-1020) --- .../SCT_ConditionsTools/src/SCT_ReadoutTool.cxx | 11 ++++------- .../SCT_ConditionsTools/src/SCT_ReadoutTool.h | 3 +-- .../test/SCT_RODVetoTool_test.cxx | 16 ++++++++-------- 3 files changed, 13 insertions(+), 17 deletions(-) diff --git a/InnerDetector/InDetConditions/SCT_ConditionsTools/src/SCT_ReadoutTool.cxx b/InnerDetector/InDetConditions/SCT_ConditionsTools/src/SCT_ReadoutTool.cxx index a22968b61677..92770569f12c 100644 --- a/InnerDetector/InDetConditions/SCT_ConditionsTools/src/SCT_ReadoutTool.cxx +++ b/InnerDetector/InDetConditions/SCT_ConditionsTools/src/SCT_ReadoutTool.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration */ #include "SCT_ReadoutTool.h" @@ -12,8 +12,7 @@ // Constructor SCT_ReadoutTool::SCT_ReadoutTool(const std::string& type, const std::string& name, const IInterface* parent): base_class(type, name, parent), - m_sctId{nullptr}, - m_msgSvc{nullptr} + m_sctId{nullptr} { } @@ -26,9 +25,7 @@ StatusCode SCT_ReadoutTool::initialize() { } // Retrieve SCT helper ATH_CHECK(detStore()->retrieve(m_sctId, "SCT_ID")); - // Get MessageSvc for SCT_ReadoutData - ISvcLocator* svcLocator{Gaudi::svcLocator()}; - ATH_CHECK(svcLocator->service("MessageSvc", m_msgSvc)); + return StatusCode::SUCCESS; } @@ -82,7 +79,7 @@ StatusCode SCT_ReadoutTool::determineReadout(const Identifier& moduleId, std::ve return StatusCode::SUCCESS; } - SCT_ReadoutData data(m_msgSvc); + SCT_ReadoutData data(msgSvc()); // Set the chips and sort in order of ID data.setChips(chips); diff --git a/InnerDetector/InDetConditions/SCT_ConditionsTools/src/SCT_ReadoutTool.h b/InnerDetector/InDetConditions/SCT_ConditionsTools/src/SCT_ReadoutTool.h index b8cf553b47bf..b62c3b7ce3a6 100644 --- a/InnerDetector/InDetConditions/SCT_ConditionsTools/src/SCT_ReadoutTool.h +++ b/InnerDetector/InDetConditions/SCT_ConditionsTools/src/SCT_ReadoutTool.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration */ /** @@ -48,7 +48,6 @@ class SCT_ReadoutTool : public extends<AthAlgTool, ISCT_ReadoutTool> { /** Private data*/ const SCT_ID* m_sctId; //!< ID helper for SCT - IMessageSvc* m_msgSvc; ToolHandle<ISCT_CablingTool> m_cablingTool{this, "SCT_CablingTool", "SCT_CablingTool", "Tool to retrieve SCT Cabling"}; }; diff --git a/InnerDetector/InDetConditions/SCT_ConditionsTools/test/SCT_RODVetoTool_test.cxx b/InnerDetector/InDetConditions/SCT_ConditionsTools/test/SCT_RODVetoTool_test.cxx index 4255165791b6..5fe7a47e3c97 100644 --- a/InnerDetector/InDetConditions/SCT_ConditionsTools/test/SCT_RODVetoTool_test.cxx +++ b/InnerDetector/InDetConditions/SCT_ConditionsTools/test/SCT_RODVetoTool_test.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration */ /** @@ -74,8 +74,8 @@ protected: m_svcMgr = m_appMgr; ASSERT_TRUE( m_svcMgr.isValid() ); - m_sg = nullptr; - ASSERT_TRUE( m_svcLoc->service ("StoreGateSvc", m_sg).isSuccess() ); + m_sg = m_svcLoc->service ("StoreGateSvc"); + ASSERT_TRUE( m_sg.isValid() ); m_evtSel = m_svcLoc->service("EventSelector"); ASSERT_TRUE( m_evtSel.isValid() ); @@ -104,8 +104,8 @@ protected: ASSERT_TRUE( detStore->record(pHelper, "SCT_ID").isSuccess() ); } } - StoreGateSvc* conditionStore = nullptr; - ASSERT_TRUE( m_svcLoc->service ("StoreGateSvc/ConditionStore", conditionStore).isSuccess() ); + SmartIF<StoreGateSvc> conditionStore{m_svcLoc->service ("StoreGateSvc/ConditionStore")}; + ASSERT_TRUE( conditionStore.isValid() ); } @@ -122,7 +122,7 @@ protected: SmartIF<IToolSvc> m_toolSvc; SmartIF<IEvtSelector> m_evtSel; SmartIF<IProperty> m_propMgr; - StoreGateSvc* m_sg{nullptr}; + SmartIF<StoreGateSvc> m_sg; Athena_test::DummyRCUSvc m_rcu; }; @@ -189,8 +189,8 @@ TEST_F(SCT_RODVetoTool_test, isGood_Id) { EventIDBase eid (1, 0, 0, 0, 20); ctx.setEventID (eid); - StoreGateSvc* conditionStore = nullptr; - ASSERT_TRUE( m_svcLoc->service ("StoreGateSvc/ConditionStore", conditionStore).isSuccess() ); + SmartIF<StoreGateSvc> conditionStore{m_svcLoc->service ("StoreGateSvc/ConditionStore")}; + ASSERT_TRUE( conditionStore.isValid() ); std::unique_ptr<IdentifierSet> dummyData{std::make_unique<IdentifierSet>()}; DataObjID id2 ("BadSCTModuleIds_RODVeto"); -- GitLab