diff --git a/SimG4Fast/src/components/SimG4ParticleSmearSimple.cpp b/SimG4Fast/src/components/SimG4ParticleSmearSimple.cpp index 1a5a616..b824a68 100644 --- a/SimG4Fast/src/components/SimG4ParticleSmearSimple.cpp +++ b/SimG4Fast/src/components/SimG4ParticleSmearSimple.cpp @@ -1,9 +1,5 @@ #include "SimG4ParticleSmearSimple.h" -// Gaudi - -#include "GaudiKernel/IRndmGenSvc.h" - // CLHEP #include "CLHEP/Vector/ThreeVector.h" @@ -18,11 +14,14 @@ SimG4ParticleSmearSimple::SimG4ParticleSmearSimple(const std::string& type, cons SimG4ParticleSmearSimple::~SimG4ParticleSmearSimple() {} StatusCode SimG4ParticleSmearSimple::initialize() { - if (AlgTool::initialize().isFailure()) { + + m_randSvc = service("RndmGenSvc", false); + if (!m_randSvc) { + error() << "Couldn't get RndmGenSvc" << endmsg; return StatusCode::FAILURE; } - if (service("RndmGenSvc", m_randSvc).isFailure()) { - error() << "Couldn't get RndmGenSvc" << endmsg; + + if (AlgTool::initialize().isFailure()) { return StatusCode::FAILURE; } m_gauss.initialize(m_randSvc, Rndm::Gauss(1, m_sigma)).ignore(); diff --git a/SimG4Fast/src/components/SimG4ParticleSmearSimple.h b/SimG4Fast/src/components/SimG4ParticleSmearSimple.h index 5b2850e..beba9b2 100644 --- a/SimG4Fast/src/components/SimG4ParticleSmearSimple.h +++ b/SimG4Fast/src/components/SimG4ParticleSmearSimple.h @@ -4,7 +4,7 @@ // Gaudi #include "GaudiKernel/AlgTool.h" #include "GaudiKernel/RndmGenerators.h" -class IRndmGenSvc; +#include "GaudiKernel/IRndmGenSvc.h" // FCCSW #include "SimG4Interface/ISimG4ParticleSmearTool.h" @@ -51,7 +51,7 @@ class SimG4ParticleSmearSimple : public AlgTool, virtual public ISimG4ParticleSm private: /// Random Number Service - IRndmGenSvc* m_randSvc; + SmartIF m_randSvc; /// Gaussian random number generator used for smearing with a constant resolution (m_sigma) Rndm::Numbers m_gauss; /// Constant resolution for the smearing (set by job options)