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