Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix service retrieval after deprecations in Gaudi v39r1 #37

Merged
merged 1 commit into from
Nov 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions ARCdigi/include/ARCdigitizer.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@

// EDM4HEP
#include "edm4hep/SimTrackerHitCollection.h"
#include "edm4hep/TrackCollection.h"
#if __has_include("edm4hep/TrackerHit3DCollection.h")
#include "edm4hep/TrackerHit3DCollection.h"
#else
Expand Down Expand Up @@ -63,7 +62,7 @@ class ARCdigitizer : public Gaudi::Algorithm {
// Detector geometry
dd4hep::Detector* m_detector;
// Random Number Service
IRndmGenSvc* m_randSvc;
SmartIF<IRndmGenSvc> m_randSvc;
// Uniform random number generator used for the SiPM quantum efficiency
Rndm::Numbers m_uniform;
};
3 changes: 2 additions & 1 deletion ARCdigi/src/ARCdigitizer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ StatusCode ARCdigitizer::initialize() {
return StatusCode::FAILURE;
}
// Initialize random number service
if (service("RndmGenSvc", m_randSvc).isFailure()) {
m_randSvc = service("RndmGenSvc", false);
if (!m_randSvc) {
error() << "Couldn't get RndmGenSvc!" << endmsg;
return StatusCode::FAILURE;
}
Expand Down
3 changes: 1 addition & 2 deletions DCHdigi/include/DCHsimpleDigitizer.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@

// EDM4HEP
#include "edm4hep/SimTrackerHitCollection.h"
#include "edm4hep/TrackCollection.h"
#if __has_include("edm4hep/TrackerHit3DCollection.h")
#include "edm4hep/TrackerHit3DCollection.h"
#else
Expand Down Expand Up @@ -75,7 +74,7 @@ class DCHsimpleDigitizer : public Gaudi::Algorithm {
FloatProperty m_xy_resolution{this, "xyResolution", 0.1, "Spatial resolution in the xy direction [mm]"};

// Random Number Service
IRndmGenSvc* m_randSvc;
SmartIF<IRndmGenSvc> m_randSvc;
// Gaussian random number generator used for the smearing of the z position
Rndm::Numbers m_gauss_z;
// Gaussian random number generator used for the smearing of the xy position
Expand Down
2 changes: 1 addition & 1 deletion DCHdigi/include/DCHsimpleDigitizerExtendedEdm.h
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ class DCHsimpleDigitizerExtendedEdm : public Gaudi::Algorithm {
mutable DataHandle<podio::UserDataCollection<double>> m_rightHitSimHitDeltaLocalZ{"rightHitSimHitDeltaLocalZ", Gaudi::DataHandle::Writer, this}; // mm

// Random Number Service
IRndmGenSvc* m_randSvc;
SmartIF<IRndmGenSvc> m_randSvc;
// Gaussian random number generator used for the smearing of the z position
Rndm::Numbers m_gauss_z;
// Gaussian random number generator used for the smearing of the xy position
Expand Down
3 changes: 2 additions & 1 deletion DCHdigi/src/DCHsimpleDigitizer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ DCHsimpleDigitizer::~DCHsimpleDigitizer() {}

StatusCode DCHsimpleDigitizer::initialize() {
// Initialize random services
if (service("RndmGenSvc", m_randSvc).isFailure()) {
m_randSvc = service("RndmGenSvc", false);
if (!m_randSvc) {
error() << "Couldn't get RndmGenSvc!" << endmsg;
return StatusCode::FAILURE;
}
Expand Down
3 changes: 2 additions & 1 deletion DCHdigi/src/DCHsimpleDigitizerExtendedEdm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ DCHsimpleDigitizerExtendedEdm::~DCHsimpleDigitizerExtendedEdm() {}

StatusCode DCHsimpleDigitizerExtendedEdm::initialize() {
// Initialize random services
if (service("RndmGenSvc", m_randSvc).isFailure()) {
m_randSvc = service("RndmGenSvc", false);
if (!m_randSvc) {
error() << "Couldn't get RndmGenSvc!" << endmsg;
return StatusCode::FAILURE;
}
Expand Down
2 changes: 1 addition & 1 deletion VTXdigi/include/VTXdigitizer.h
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ class VTXdigitizer : public Gaudi::Algorithm {
BooleanProperty m_forceHitsOntoSurface{this, "forceHitsOntoSurface", false, "Project hits onto the surface in case they are not yet on the surface (default: false"};

// Random Number Service
IRndmGenSvc* m_randSvc;
SmartIF<IRndmGenSvc> m_randSvc;

// Gaussian random number generator used for smearing
std::vector<Rndm::Numbers> m_gauss_x_vec;
Expand Down
3 changes: 2 additions & 1 deletion VTXdigi/src/VTXdigitizer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ VTXdigitizer::~VTXdigitizer() {}

StatusCode VTXdigitizer::initialize() {
// Initialize random services
if (service("RndmGenSvc", m_randSvc).isFailure()) {
m_randSvc = service("RndmGenSvc", false);
if (!m_randSvc) {
error() << "Couldn't get RndmGenSvc!" << endmsg;
return StatusCode::FAILURE;
}
Expand Down
Loading