From 26ffbb0422ad2eb47942baf4568ceab45d771745 Mon Sep 17 00:00:00 2001 From: jmcarcell Date: Fri, 1 Nov 2024 18:26:53 +0100 Subject: [PATCH] Fix service retrieval after deprecations in Gaudi v39r1 see https://gitlab.cern.ch/gaudi/Gaudi/-/merge_requests/1637 --- k4Gen/src/components/ConstPtParticleGun.cpp | 2 +- k4Gen/src/components/FlatSmearVertex.cpp | 2 +- k4Gen/src/components/GaussSmearVertex.cpp | 4 +--- k4Gen/src/components/MomentumRangeParticleGun.cpp | 2 +- k4Gen/src/components/PoissonPileUp.cpp | 2 +- 5 files changed, 5 insertions(+), 7 deletions(-) diff --git a/k4Gen/src/components/ConstPtParticleGun.cpp b/k4Gen/src/components/ConstPtParticleGun.cpp index 3b53907..3f2d1bc 100644 --- a/k4Gen/src/components/ConstPtParticleGun.cpp +++ b/k4Gen/src/components/ConstPtParticleGun.cpp @@ -22,7 +22,7 @@ StatusCode ConstPtParticleGun::initialize() { StatusCode sc = AlgTool::initialize(); if (!sc.isSuccess()) return sc; // initialize random number generator - IRndmGenSvc* randSvc = service("RndmGenSvc", true); + auto randSvc = service("RndmGenSvc", true); sc = m_flatGenerator.initialize(randSvc, Rndm::Flat(0., 1.)); if (!sc.isSuccess()) { error() << "Cannot initialize flat generator"; diff --git a/k4Gen/src/components/FlatSmearVertex.cpp b/k4Gen/src/components/FlatSmearVertex.cpp index f9d428e..009ee75 100644 --- a/k4Gen/src/components/FlatSmearVertex.cpp +++ b/k4Gen/src/components/FlatSmearVertex.cpp @@ -28,7 +28,7 @@ StatusCode FlatSmearVertex::initialize() { StatusCode sc = AlgTool::initialize(); if (sc.isFailure()) return sc; - IRndmGenSvc* randSvc = service("RndmGenSvc", true); + auto randSvc = service("RndmGenSvc", true); if (m_xmin > m_xmax) { error() << "xMin > xMax !"; return StatusCode::FAILURE; diff --git a/k4Gen/src/components/GaussSmearVertex.cpp b/k4Gen/src/components/GaussSmearVertex.cpp index c4784ce..54bc167 100644 --- a/k4Gen/src/components/GaussSmearVertex.cpp +++ b/k4Gen/src/components/GaussSmearVertex.cpp @@ -29,9 +29,7 @@ StatusCode GaussSmearVertex::initialize() { StatusCode sc = AlgTool::initialize(); if (sc.isFailure()) return sc; - IRndmGenSvc* randSvc = service("RndmGenSvc", true); - - + auto randSvc = service("RndmGenSvc", true); sc = m_gaussDist.initialize(randSvc, Rndm::Gauss(0., 1)); if (sc.isFailure()) return sc; diff --git a/k4Gen/src/components/MomentumRangeParticleGun.cpp b/k4Gen/src/components/MomentumRangeParticleGun.cpp index ebb9d96..dfb85f7 100644 --- a/k4Gen/src/components/MomentumRangeParticleGun.cpp +++ b/k4Gen/src/components/MomentumRangeParticleGun.cpp @@ -30,7 +30,7 @@ StatusCode MomentumRangeParticleGun::initialize() { StatusCode sc = AlgTool::initialize(); if (!sc.isSuccess()) return sc; - IRndmGenSvc* randSvc = service("RndmGenSvc", true); + auto randSvc = service("RndmGenSvc", true); sc = m_flatGenerator.initialize(randSvc, Rndm::Flat(0., 1.)); if (!sc.isSuccess()) { error() << "Cannot initialize flat generator"; diff --git a/k4Gen/src/components/PoissonPileUp.cpp b/k4Gen/src/components/PoissonPileUp.cpp index 1ce9616..53cb4f7 100644 --- a/k4Gen/src/components/PoissonPileUp.cpp +++ b/k4Gen/src/components/PoissonPileUp.cpp @@ -13,7 +13,7 @@ PoissonPileUp::~PoissonPileUp() { ; } StatusCode PoissonPileUp::initialize() { StatusCode sc = AlgTool::initialize(); if (sc.isFailure()) return sc; - IRndmGenSvc* randSvc = service("RndmGenSvc", true); + auto randSvc = service("RndmGenSvc", true); if (m_meanPileUpEvents < 0) { error() << "Number of Pileup events cannot be negative!"; return StatusCode::FAILURE;