From 23506f8dfae51070f6182c7dbff8e6859317247b Mon Sep 17 00:00:00 2001 From: Juan Miguel Carceller <22276694+jmcarcell@users.noreply.github.com> Date: Fri, 8 Nov 2024 18:47:21 +0100 Subject: [PATCH] Fix another deprecated service retrieval instance (#43) --- k4Gen/src/components/HepMCHistograms.cpp | 3 ++- k4Gen/src/components/HepMCHistograms.h | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/k4Gen/src/components/HepMCHistograms.cpp b/k4Gen/src/components/HepMCHistograms.cpp index afc6635..dfc61f1 100644 --- a/k4Gen/src/components/HepMCHistograms.cpp +++ b/k4Gen/src/components/HepMCHistograms.cpp @@ -13,7 +13,8 @@ HepMCHistograms::HepMCHistograms(const std::string& name, ISvcLocator* svcLoc) : StatusCode HepMCHistograms::initialize() { if (Gaudi::Algorithm::initialize().isFailure()) return StatusCode::FAILURE; - if (service("THistSvc", m_ths).isFailure()) { + m_ths = service("THistSvc", true); + if (!m_ths) { error() << "Couldn't get THistSvc" << endmsg; return StatusCode::FAILURE; } diff --git a/k4Gen/src/components/HepMCHistograms.h b/k4Gen/src/components/HepMCHistograms.h index 6e04a4f..870d418 100644 --- a/k4Gen/src/components/HepMCHistograms.h +++ b/k4Gen/src/components/HepMCHistograms.h @@ -24,7 +24,7 @@ class HepMCHistograms : public Gaudi::Algorithm { /// Handle for the HepMC to be read mutable DataHandle m_hepmchandle{"HepMC", Gaudi::DataHandle::Reader, this}; - ITHistSvc* m_ths{nullptr}; ///< THistogram service + SmartIF m_ths; ///< THistogram service TH1F* m_pt{nullptr}; ///< histogram for pT of particles TH1F* m_eta{nullptr}; ///< histogram for pseudorapidity of particles