diff --git a/CMakeLists.txt b/CMakeLists.txt index e02c610f39..e6a597b685 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -116,6 +116,9 @@ find_package(podio REQUIRED) find_package(EDM4HEP REQUIRED) find_package(EDM4EIC 2.1 REQUIRED) +# Guidelines Support Library +find_package(Microsoft.GSL CONFIG) + # Remove PODIO_JSON_OUTPUT (ref: https://github.com/AIDASoft/podio/issues/475) get_target_property(EDM4HEP_INTERFACE_COMPILE_DEFINITIONS EDM4HEP::edm4hep INTERFACE_COMPILE_DEFINITIONS) if(EDM4HEP_INTERFACE_COMPILE_DEFINITIONS) diff --git a/src/algorithms/calorimetry/CalorimeterHitReco.cc b/src/algorithms/calorimetry/CalorimeterHitReco.cc index 5c893f3e69..bd28ff754f 100644 --- a/src/algorithms/calorimetry/CalorimeterHitReco.cc +++ b/src/algorithms/calorimetry/CalorimeterHitReco.cc @@ -15,9 +15,9 @@ using namespace dd4hep; namespace eicrecon { -void CalorimeterHitReco::init(const dd4hep::Detector* detector, std::shared_ptr& logger) { +void CalorimeterHitReco::init(const dd4hep::Detector* detector, const dd4hep::rec::CellIDPositionConverter* converter, std::shared_ptr& logger) { m_detector = detector; - m_converter = std::make_shared(const_cast(*detector)); + m_converter = converter; m_log = logger; // threshold for firing diff --git a/src/algorithms/calorimetry/CalorimeterHitReco.h b/src/algorithms/calorimetry/CalorimeterHitReco.h index 3593cafb22..c6ff35e5cc 100644 --- a/src/algorithms/calorimetry/CalorimeterHitReco.h +++ b/src/algorithms/calorimetry/CalorimeterHitReco.h @@ -24,7 +24,7 @@ namespace eicrecon { class CalorimeterHitReco : public WithPodConfig { public: - void init(const dd4hep::Detector* detector, std::shared_ptr& logger); + void init(const dd4hep::Detector* detector, const dd4hep::rec::CellIDPositionConverter* converter, std::shared_ptr& logger); std::unique_ptr process(const edm4hep::RawCalorimeterHitCollection &rawhits); private: @@ -46,7 +46,7 @@ namespace eicrecon { private: const dd4hep::Detector* m_detector; - std::shared_ptr m_converter; + const dd4hep::rec::CellIDPositionConverter* m_converter; std::shared_ptr m_log; }; diff --git a/src/algorithms/calorimetry/CalorimeterHitsMerger.cc b/src/algorithms/calorimetry/CalorimeterHitsMerger.cc index 2767f331e0..d29fc3a696 100644 --- a/src/algorithms/calorimetry/CalorimeterHitsMerger.cc +++ b/src/algorithms/calorimetry/CalorimeterHitsMerger.cc @@ -12,9 +12,9 @@ namespace eicrecon { -void CalorimeterHitsMerger::init(const dd4hep::Detector* detector, std::shared_ptr& logger) { +void CalorimeterHitsMerger::init(const dd4hep::Detector* detector, const dd4hep::rec::CellIDPositionConverter* converter, std::shared_ptr& logger) { m_detector = detector; - m_converter = std::make_shared(const_cast(*detector)); + m_converter = converter; m_log = logger; if (m_cfg.readout.empty()) { diff --git a/src/algorithms/calorimetry/CalorimeterHitsMerger.h b/src/algorithms/calorimetry/CalorimeterHitsMerger.h index 3eb180420c..809b97d1a9 100644 --- a/src/algorithms/calorimetry/CalorimeterHitsMerger.h +++ b/src/algorithms/calorimetry/CalorimeterHitsMerger.h @@ -31,7 +31,7 @@ namespace eicrecon { class CalorimeterHitsMerger : public WithPodConfig { public: - void init(const dd4hep::Detector* detector, std::shared_ptr& logger); + void init(const dd4hep::Detector* detector, const dd4hep::rec::CellIDPositionConverter* converter, std::shared_ptr& logger); std::unique_ptr process(const edm4eic::CalorimeterHitCollection &input); private: @@ -39,7 +39,7 @@ namespace eicrecon { private: const dd4hep::Detector* m_detector; - std::shared_ptr m_converter; + const dd4hep::rec::CellIDPositionConverter* m_converter; std::shared_ptr m_log; }; diff --git a/src/algorithms/digi/PhotoMultiplierHitDigi.cc b/src/algorithms/digi/PhotoMultiplierHitDigi.cc index f3d0822bc7..5676c92d3f 100644 --- a/src/algorithms/digi/PhotoMultiplierHitDigi.cc +++ b/src/algorithms/digi/PhotoMultiplierHitDigi.cc @@ -18,12 +18,12 @@ //------------------------ // AlgorithmInit //------------------------ -void eicrecon::PhotoMultiplierHitDigi::AlgorithmInit(dd4hep::Detector *detector, std::shared_ptr& logger) +void eicrecon::PhotoMultiplierHitDigi::AlgorithmInit(const dd4hep::Detector* detector, const dd4hep::rec::CellIDPositionConverter* converter, std::shared_ptr& logger) { // services m_detector = detector; - m_cellid_converter = std::make_shared(*detector); - m_log=logger; + m_converter = converter; + m_log = logger; // print the configuration parameters m_cfg.Print(m_log, spdlog::level::debug); @@ -132,7 +132,7 @@ eicrecon::PhotoMultiplierHitDigiResult eicrecon::PhotoMultiplierHitDigi::Algorit // cell time, signal amplitude double amp = m_cfg.speMean + m_rngNorm()*m_cfg.speError; TimeType time = m_cfg.noiseTimeWindow*m_rngUni() / dd4hep::ns; - dd4hep::Position pos_hit_global = m_cellid_converter->position(id); + dd4hep::Position pos_hit_global = m_converter->position(id); // insert in `hit_groups`, or if the pixel already has a hit, update `npe` and `signal` this->InsertHit( diff --git a/src/algorithms/digi/PhotoMultiplierHitDigi.h b/src/algorithms/digi/PhotoMultiplierHitDigi.h index 8d8b399879..757655eaf5 100644 --- a/src/algorithms/digi/PhotoMultiplierHitDigi.h +++ b/src/algorithms/digi/PhotoMultiplierHitDigi.h @@ -41,7 +41,7 @@ class PhotoMultiplierHitDigi : public WithPodConfig& logger); + void AlgorithmInit(const dd4hep::Detector* detector, const dd4hep::rec::CellIDPositionConverter* converter, std::shared_ptr& logger); void AlgorithmChangeRun(); PhotoMultiplierHitDigiResult AlgorithmProcess( const edm4hep::SimTrackerHitCollection* sim_hits @@ -106,10 +106,10 @@ class PhotoMultiplierHitDigi : public WithPodConfig m_log; - std::shared_ptr m_cellid_converter; // std::default_random_engine generator; // TODO: need something more appropriate here // std::normal_distribution m_normDist; // defaults to mean=0, sigma=1 diff --git a/src/algorithms/fardetectors/MatrixTransferStatic.cc b/src/algorithms/fardetectors/MatrixTransferStatic.cc index f2faea5056..382ad1f4d3 100644 --- a/src/algorithms/fardetectors/MatrixTransferStatic.cc +++ b/src/algorithms/fardetectors/MatrixTransferStatic.cc @@ -5,13 +5,13 @@ #include "MatrixTransferStatic.h" -void eicrecon::MatrixTransferStatic::init(std::shared_ptr id_conv, - const dd4hep::Detector* det, +void eicrecon::MatrixTransferStatic::init(const dd4hep::Detector* det, + const dd4hep::rec::CellIDPositionConverter* id_conv, std::shared_ptr &logger) { - m_log = logger; - m_detector = det; - m_cellid_converter = id_conv; + m_log = logger; + m_detector = det; + m_converter = id_conv; //Calculate inverse of static transfer matrix std::vector> aX(m_cfg.aX); std::vector> aY(m_cfg.aY); @@ -64,7 +64,7 @@ std::unique_ptr eicrecon::MatrixTransf auto cellID = h.getCellID(); // The actual hit position in Global Coordinates - auto gpos = m_cellid_converter->position(cellID); + auto gpos = m_converter->position(cellID); // local positions auto volman = m_detector->volumeManager(); auto local = volman.lookupDetElement(cellID); diff --git a/src/algorithms/fardetectors/MatrixTransferStatic.h b/src/algorithms/fardetectors/MatrixTransferStatic.h index 46a4dadf7a..9cf4725467 100644 --- a/src/algorithms/fardetectors/MatrixTransferStatic.h +++ b/src/algorithms/fardetectors/MatrixTransferStatic.h @@ -26,7 +26,7 @@ namespace eicrecon { double aYinv[2][2] = {{0.0, 0.0}, {0.0, 0.0}}; - void init(const std::shared_ptr,const dd4hep::Detector* det,std::shared_ptr &logger); + void init(const dd4hep::Detector* det, const dd4hep::rec::CellIDPositionConverter* id_conv, std::shared_ptr &logger); std::unique_ptr produce(const edm4hep::SimTrackerHitCollection &inputhits); @@ -35,7 +35,7 @@ namespace eicrecon { /** algorithm logger */ std::shared_ptr m_log; const dd4hep::Detector* m_detector{nullptr}; - std::shared_ptr m_cellid_converter = nullptr; + const dd4hep::rec::CellIDPositionConverter* m_converter{nullptr}; }; } diff --git a/src/algorithms/tracking/ActsGeometryProvider.cc b/src/algorithms/tracking/ActsGeometryProvider.cc index 0d337e7372..c917690c16 100644 --- a/src/algorithms/tracking/ActsGeometryProvider.cc +++ b/src/algorithms/tracking/ActsGeometryProvider.cc @@ -72,7 +72,7 @@ void draw_surfaces(std::shared_ptr trk_geo, const } -void ActsGeometryProvider::initialize(dd4hep::Detector *dd4hep_geo, +void ActsGeometryProvider::initialize(const dd4hep::Detector* dd4hep_geo, std::string material_file, std::shared_ptr log, std::shared_ptr init_log) { diff --git a/src/algorithms/tracking/ActsGeometryProvider.h b/src/algorithms/tracking/ActsGeometryProvider.h index e432503a25..d983cf61ea 100644 --- a/src/algorithms/tracking/ActsGeometryProvider.h +++ b/src/algorithms/tracking/ActsGeometryProvider.h @@ -32,7 +32,6 @@ namespace dd4hep { class Detector; } namespace dd4hep::rec { - class CellIDPositionConverter; class Surface; } @@ -47,12 +46,12 @@ class ActsGeometryProvider { ActsGeometryProvider() {} using VolumeSurfaceMap = std::unordered_map; - virtual void initialize(dd4hep::Detector* dd4hep_geo, + virtual void initialize(const dd4hep::Detector* dd4hep_geo, std::string material_file, std::shared_ptr log, std::shared_ptr init_log) final; - dd4hep::Detector* dd4hepDetector() const {return m_dd4hepDetector; } + const dd4hep::Detector* dd4hepDetector() const { return m_dd4hepDetector; } /** Gets the ACTS tracking geometry. */ @@ -85,7 +84,7 @@ class ActsGeometryProvider { * This is the main dd4hep detector handle. * See DD4hep Detector documentation */ - dd4hep::Detector *m_dd4hepDetector = nullptr; + const dd4hep::Detector* m_dd4hepDetector = nullptr; /// DD4hep surface map std::map m_surfaceMap; @@ -105,12 +104,6 @@ class ActsGeometryProvider { /// ACTS surface lookup container for hit surfaces that generate smeared hits VolumeSurfaceMap m_surfaces; - /** DD4hep CellID tool. - * Use to lookup geometry information for a hit with cellid number (int64_t). - * See DD4hep CellIDPositionConverter documentation - */ - std::shared_ptr m_cellid_converter = nullptr; - /// Acts magnetic field std::shared_ptr m_magneticField = nullptr; diff --git a/src/algorithms/tracking/DD4hepBField.h b/src/algorithms/tracking/DD4hepBField.h index 0627f0f7bd..9e2e193d1b 100644 --- a/src/algorithms/tracking/DD4hepBField.h +++ b/src/algorithms/tracking/DD4hepBField.h @@ -8,6 +8,7 @@ #pragma once +#include #include #include @@ -35,7 +36,7 @@ namespace eicrecon::BField { */ class DD4hepBField final : public Acts::MagneticFieldProvider { public: - dd4hep::Detector* m_det; + gsl::not_null m_det; public: struct Cache { @@ -51,7 +52,7 @@ namespace eicrecon::BField { * * @param [in] DD4hep detector instance */ - explicit DD4hepBField(dd4hep::Detector* det) : m_det(det) {} + explicit DD4hepBField(gsl::not_null det) : m_det(det) {} /** retrieve magnetic field value. * diff --git a/src/algorithms/tracking/TrackerHitReconstruction.cc b/src/algorithms/tracking/TrackerHitReconstruction.cc index 17839ded71..fab70dfabd 100644 --- a/src/algorithms/tracking/TrackerHitReconstruction.cc +++ b/src/algorithms/tracking/TrackerHitReconstruction.cc @@ -16,12 +16,11 @@ namespace { } } // namespace -void TrackerHitReconstruction::init(const dd4hep::Detector* detector, std::shared_ptr& logger) { +void TrackerHitReconstruction::init(const dd4hep::rec::CellIDPositionConverter* converter, std::shared_ptr& logger) { m_log = logger; - // Create CellID converter - m_cellid_converter = std::make_shared(const_cast(*detector)); + m_converter = converter; } std::unique_ptr TrackerHitReconstruction::process(const edm4eic::RawTrackerHitCollection& raw_hits) { @@ -34,8 +33,8 @@ std::unique_ptr TrackerHitReconstruction::process auto id = raw_hit.getCellID(); // Get position and dimension - auto pos = m_cellid_converter->position(id); - auto dim = m_cellid_converter->cellDimensions(id); + auto pos = m_converter->position(id); + auto dim = m_converter->cellDimensions(id); // >oO trace if(m_log->level() == spdlog::level::trace) { diff --git a/src/algorithms/tracking/TrackerHitReconstruction.h b/src/algorithms/tracking/TrackerHitReconstruction.h index 0d9642dd97..0913bfa896 100644 --- a/src/algorithms/tracking/TrackerHitReconstruction.h +++ b/src/algorithms/tracking/TrackerHitReconstruction.h @@ -10,7 +10,6 @@ #include "TrackerHitReconstructionConfig.h" #include "algorithms/interfaces/WithPodConfig.h" -#include #include namespace eicrecon { @@ -22,7 +21,7 @@ namespace eicrecon { public: /// Once in a lifetime initialization - void init(const dd4hep::Detector *detector, std::shared_ptr& logger); + void init(const dd4hep::rec::CellIDPositionConverter* converter, std::shared_ptr& logger); /// Processes RawTrackerHit and produces a TrackerHit std::unique_ptr process(const edm4eic::RawTrackerHitCollection& raw_hits); @@ -35,6 +34,6 @@ namespace eicrecon { std::shared_ptr m_log; /// Cell ID position converter - std::shared_ptr m_cellid_converter; + const dd4hep::rec::CellIDPositionConverter* m_converter; }; } diff --git a/src/algorithms/tracking/TrackerSourceLinker.cc b/src/algorithms/tracking/TrackerSourceLinker.cc index 31f208b7fa..91d67553d6 100644 --- a/src/algorithms/tracking/TrackerSourceLinker.cc +++ b/src/algorithms/tracking/TrackerSourceLinker.cc @@ -24,13 +24,14 @@ #include -void eicrecon::TrackerSourceLinker::init(std::shared_ptr cellid_converter, +void eicrecon::TrackerSourceLinker::init(const dd4hep::Detector* detector, + const dd4hep::rec::CellIDPositionConverter* converter, std::shared_ptr acts_context, std::shared_ptr logger) { - m_cellid_converter = std::move(cellid_converter); + m_dd4hepGeo = detector; + m_converter = converter; m_log = std::move(logger); m_acts_context = std::move(acts_context); - m_dd4hepGeo = m_acts_context->dd4hepDetector(); m_detid_b0tracker = m_dd4hepGeo->constant("B0Tracker_Station_1_ID"); } @@ -57,7 +58,7 @@ eicrecon::TrackerSourceLinkerResult *eicrecon::TrackerSourceLinker::produce(std: cov(1, 1) = hit->getPositionError().yy * mm_acts * mm_acts; - const auto* vol_ctx = m_cellid_converter->findContext(hit->getCellID()); + const auto* vol_ctx = m_converter->findContext(hit->getCellID()); auto vol_id = vol_ctx->identifier; diff --git a/src/algorithms/tracking/TrackerSourceLinker.h b/src/algorithms/tracking/TrackerSourceLinker.h index ce66181e8e..cb0c1e2860 100644 --- a/src/algorithms/tracking/TrackerSourceLinker.h +++ b/src/algorithms/tracking/TrackerSourceLinker.h @@ -21,7 +21,8 @@ namespace eicrecon { class TrackerSourceLinker { public: - void init(std::shared_ptr cellid_converter, + void init(const dd4hep::Detector* detector, + const dd4hep::rec::CellIDPositionConverter* converter, std::shared_ptr acts_context, std::shared_ptr logger); @@ -30,13 +31,12 @@ namespace eicrecon { private: std::shared_ptr m_log; - /// Cell ID position converter - std::shared_ptr m_cellid_converter; + /// Geometry and Cell ID position converter + const dd4hep::Detector* m_dd4hepGeo; + const dd4hep::rec::CellIDPositionConverter* m_converter; std::shared_ptr m_acts_context; - dd4hep::Detector* m_dd4hepGeo; - /// Detector-specific information int m_detid_b0tracker; }; diff --git a/src/benchmarks/reconstruction/femc_studies/femc_studiesProcessor.cc b/src/benchmarks/reconstruction/femc_studies/femc_studiesProcessor.cc index cece01e7f0..69809b3977 100644 --- a/src/benchmarks/reconstruction/femc_studies/femc_studiesProcessor.cc +++ b/src/benchmarks/reconstruction/femc_studies/femc_studiesProcessor.cc @@ -16,7 +16,6 @@ #include #include -#include // Include appropriate class headers. e.g. #include @@ -207,8 +206,7 @@ void femc_studiesProcessor::Init() { } std::cout << __PRETTY_FUNCTION__ << " " << __LINE__ << std::endl; - dd4hep::Detector* detector = dd4hep_service->detector(); - dd4hep::rec::CellIDPositionConverter cellid_converter(*detector); + auto detector = dd4hep_service->detector(); std::cout << "--------------------------\nID specification:\n"; try { m_decoder = detector->readout("EcalEndcapPHits").idSpec().decoder(); diff --git a/src/benchmarks/reconstruction/lfhcal_studies/lfhcal_studiesProcessor.cc b/src/benchmarks/reconstruction/lfhcal_studies/lfhcal_studiesProcessor.cc index c6604ae39a..796c49bdae 100644 --- a/src/benchmarks/reconstruction/lfhcal_studies/lfhcal_studiesProcessor.cc +++ b/src/benchmarks/reconstruction/lfhcal_studies/lfhcal_studiesProcessor.cc @@ -16,7 +16,6 @@ #include #include -#include // Include appropriate class headers. e.g. #include @@ -243,8 +242,7 @@ void lfhcal_studiesProcessor::Init() { } std::cout << __PRETTY_FUNCTION__ << " " << __LINE__ << std::endl; - dd4hep::Detector* detector = dd4hep_service->detector(); - dd4hep::rec::CellIDPositionConverter cellid_converter(*detector); + auto detector = dd4hep_service->detector(); std::cout << "--------------------------\nID specification:\n"; try { m_decoder = detector->readout("LFHCALHits").idSpec().decoder(); diff --git a/src/factories/calorimetry/CalorimeterClusterRecoCoG_factoryT.h b/src/factories/calorimetry/CalorimeterClusterRecoCoG_factoryT.h index 143532fb00..371f353bce 100644 --- a/src/factories/calorimetry/CalorimeterClusterRecoCoG_factoryT.h +++ b/src/factories/calorimetry/CalorimeterClusterRecoCoG_factoryT.h @@ -42,7 +42,7 @@ class CalorimeterClusterRecoCoG_factoryT : // Use DD4hep_service to get dd4hep::Detector auto geoSvc = app->template GetService(); - m_detector = geoSvc->detector(); + auto detector = geoSvc->detector(); // SpdlogMixin logger initialization, sets m_log InitLogger(app, GetPrefix(), "info"); @@ -58,7 +58,7 @@ class CalorimeterClusterRecoCoG_factoryT : app->SetDefaultParameter(param_prefix + ":enableEtaBounds", cfg.enableEtaBounds); m_algo.applyConfig(cfg); - m_algo.init(m_detector, logger()); + m_algo.init(detector, logger()); } //------------------------------------------ @@ -81,7 +81,6 @@ class CalorimeterClusterRecoCoG_factoryT : } private: - const dd4hep::Detector* m_detector; eicrecon::CalorimeterClusterRecoCoG m_algo; }; diff --git a/src/factories/calorimetry/CalorimeterHitReco_factoryT.h b/src/factories/calorimetry/CalorimeterHitReco_factoryT.h index 49d5133d89..a714118c1b 100644 --- a/src/factories/calorimetry/CalorimeterHitReco_factoryT.h +++ b/src/factories/calorimetry/CalorimeterHitReco_factoryT.h @@ -60,7 +60,7 @@ class CalorimeterHitReco_factoryT : app->SetDefaultParameter(param_prefix + ":localDetFields", cfg.localDetFields); m_algo.applyConfig(cfg); - m_algo.init(geoSvc->detector(), logger()); + m_algo.init(geoSvc->detector(), geoSvc->converter(), logger()); } void Process(const std::shared_ptr &event) override { diff --git a/src/factories/calorimetry/CalorimeterHitsMerger_factoryT.h b/src/factories/calorimetry/CalorimeterHitsMerger_factoryT.h index 9e104139ba..d2f932d356 100644 --- a/src/factories/calorimetry/CalorimeterHitsMerger_factoryT.h +++ b/src/factories/calorimetry/CalorimeterHitsMerger_factoryT.h @@ -49,7 +49,7 @@ class CalorimeterHitsMerger_factoryT : app->SetDefaultParameter(param_prefix + ":refs", cfg.refs); m_algo.applyConfig(cfg); - m_algo.init(geoSvc->detector(), logger()); + m_algo.init(geoSvc->detector(), geoSvc->converter(), logger()); } void Process(const std::shared_ptr &event) override { diff --git a/src/factories/fardetectors/MatrixTransferStatic_factoryT.h b/src/factories/fardetectors/MatrixTransferStatic_factoryT.h index e500442e1f..fc1605efc9 100644 --- a/src/factories/fardetectors/MatrixTransferStatic_factoryT.h +++ b/src/factories/fardetectors/MatrixTransferStatic_factoryT.h @@ -46,7 +46,7 @@ namespace eicrecon { m_geoSvc = app->GetService(); m_reco_algo.applyConfig(cfg); - m_reco_algo.init(m_geoSvc->cellIDPositionConverter(),m_geoSvc->detector(),logger()); + m_reco_algo.init(m_geoSvc->detector(), m_geoSvc->converter(), logger()); } diff --git a/src/factories/tracking/TrackerHitReconstruction_factoryT.h b/src/factories/tracking/TrackerHitReconstruction_factoryT.h index 68327927e3..3a52504e98 100644 --- a/src/factories/tracking/TrackerHitReconstruction_factoryT.h +++ b/src/factories/tracking/TrackerHitReconstruction_factoryT.h @@ -48,7 +48,7 @@ namespace eicrecon { app->SetDefaultParameter(param_prefix + ":timeResolution", cfg.timeResolution); m_algo.applyConfig(cfg); - m_algo.init(geoSvc->detector(), logger()); + m_algo.init(geoSvc->converter(), logger()); } void Process(const std::shared_ptr &event) override { diff --git a/src/global/digi/PhotoMultiplierHitDigi_factory.cc b/src/global/digi/PhotoMultiplierHitDigi_factory.cc index f381a14702..6e14d2cb77 100644 --- a/src/global/digi/PhotoMultiplierHitDigi_factory.cc +++ b/src/global/digi/PhotoMultiplierHitDigi_factory.cc @@ -48,7 +48,7 @@ void eicrecon::PhotoMultiplierHitDigi_factory::Init() { // Initialize digitization algorithm m_digi_algo.applyConfig(cfg); - m_digi_algo.AlgorithmInit(geo_service->detector(), m_log); + m_digi_algo.AlgorithmInit(geo_service->detector(), geo_service->converter(), m_log); // Initialize richgeo ReadoutGeo and set random CellID visitor lambda (if a RICH) if(use_richgeo) { diff --git a/src/global/tracking/TrackerSourceLinker_factory.cc b/src/global/tracking/TrackerSourceLinker_factory.cc index 2784c9555c..4a85b1888b 100644 --- a/src/global/tracking/TrackerSourceLinker_factory.cc +++ b/src/global/tracking/TrackerSourceLinker_factory.cc @@ -39,11 +39,11 @@ namespace eicrecon { // Get ACTS context from ACTSGeo service auto acts_service = GetApplication()->GetService(); - auto dd4hp_service = GetApplication()->GetService(); + // Get DD4hep geometry from DD4hep service + auto dd4hep_service = GetApplication()->GetService(); // Initialize algorithm - auto cellid_converter = std::make_shared(*dd4hp_service->detector()); - m_source_linker.init(cellid_converter, acts_service->actsGeoProvider(), m_log); + m_source_linker.init(dd4hep_service->detector(), dd4hep_service->converter(), acts_service->actsGeoProvider(), m_log); } diff --git a/src/services/geometry/acts/ACTSGeo_service.h b/src/services/geometry/acts/ACTSGeo_service.h index b3ede02d34..37f066f3e1 100644 --- a/src/services/geometry/acts/ACTSGeo_service.h +++ b/src/services/geometry/acts/ACTSGeo_service.h @@ -28,7 +28,7 @@ class ACTSGeo_service : public JService std::once_flag m_init_flag; JApplication *m_app = nullptr; - dd4hep::Detector* m_dd4hepGeo = nullptr; + const dd4hep::Detector* m_dd4hepGeo = nullptr; std::shared_ptr m_acts_provider; // General acts log diff --git a/src/services/geometry/dd4hep/DD4hep_service.cc b/src/services/geometry/dd4hep/DD4hep_service.cc index 8a21e4625e..214fcc455d 100644 --- a/src/services/geometry/dd4hep/DD4hep_service.cc +++ b/src/services/geometry/dd4hep/DD4hep_service.cc @@ -1,6 +1,5 @@ -// Copyright 2022, David Lawrence -// Subject to the terms in the LICENSE file found in the top-level directory. -// +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (C) 2022, 2023 Whitney Armstrong, Wouter Deconinck, David Lawrence // #include @@ -30,21 +29,22 @@ DD4hep_service::~DD4hep_service(){ /// Return pointer to the dd4hep::Detector object. /// Call Initialize if needed. //---------------------------------------------------------------- -dd4hep::Detector* DD4hep_service::detector() { +gsl::not_null +DD4hep_service::detector() { std::call_once(init_flag, &DD4hep_service::Initialize, this); - return (m_dd4hepGeo); + return m_dd4hepGeo.get(); } //---------------------------------------------------------------- -// cellIDPositionConverter +// converter // /// Return pointer to the cellIDPositionConverter object. /// Call Initialize if needed. //---------------------------------------------------------------- -std::shared_ptr -DD4hep_service::cellIDPositionConverter() { +gsl::not_null +DD4hep_service::converter() { std::call_once(init_flag, &DD4hep_service::Initialize, this); - return (m_cellid_converter); + return m_cellid_converter.get(); } //---------------------------------------------------------------- @@ -57,12 +57,10 @@ DD4hep_service::cellIDPositionConverter() { //---------------------------------------------------------------- void DD4hep_service::Initialize() { - if( m_dd4hepGeo ) { + if (m_dd4hepGeo) { LOG_WARN(default_cout_logger) << "DD4hep_service already initialized!" << LOG_END; } - m_dd4hepGeo = &(dd4hep::Detector::getInstance()); - // The current recommended way of getting the XML file is to use the environment variables // DETECTOR_PATH and DETECTOR_CONFIG or DETECTOR(deprecated). // Look for those first, so we can use it for the default @@ -104,6 +102,7 @@ void DD4hep_service::Initialize() { app->SetTicker( false ); // load geometry + auto detector = dd4hep::Detector::make_unique(""); try { dd4hep::setPrintLevel(static_cast(print_level)); LOG << "Loading DD4hep geometry from " << m_xml_files.size() << " files" << LOG_END; @@ -113,17 +112,18 @@ void DD4hep_service::Initialize() { LOG << " - loading geometry file: '" << resolved_filename << "' (patience ....)" << LOG_END; try { - m_dd4hepGeo->fromCompact(resolved_filename); + detector->fromCompact(resolved_filename); } catch(std::runtime_error &e) { // dd4hep throws std::runtime_error, no way to detail further throw JException(e.what()); } } - m_dd4hepGeo->volumeManager(); - m_dd4hepGeo->apply("DD4hepVolumeManager", 0, nullptr); - m_cellid_converter = std::make_shared(*m_dd4hepGeo); + detector->volumeManager(); + detector->apply("DD4hepVolumeManager", 0, nullptr); + m_cellid_converter = std::make_unique(*detector); + m_dd4hepGeo = std::move(detector); // const LOG << "Geometry successfully loaded." << LOG_END; - }catch(std::exception &e){ + } catch(std::exception &e) { LOG_ERROR(default_cerr_logger)<< "Problem loading geometry: " << e.what() << LOG_END; throw std::runtime_error(fmt::format("Problem loading geometry: {}", e.what())); } diff --git a/src/services/geometry/dd4hep/DD4hep_service.h b/src/services/geometry/dd4hep/DD4hep_service.h index eeb2005e5f..89562c3366 100644 --- a/src/services/geometry/dd4hep/DD4hep_service.h +++ b/src/services/geometry/dd4hep/DD4hep_service.h @@ -1,25 +1,12 @@ -// -// -// TODO: Fix the following: -// This class inspired by and benefited from the work done here at the following -// links. A couple of lines were outright copied. -// -// https://eicweb.phy.anl.gov/EIC/juggler/-/blob/master/JugBase/src/components/GeoSvc.h -// https://eicweb.phy.anl.gov/EIC/juggler/-/blob/master/JugBase/src/components/GeoSvc.cpp -// -// Copyright carried by that code: // SPDX-License-Identifier: LGPL-3.0-or-later -// Copyright (C) 2022 Whitney Armstrong, Wouter Deconinck -// Copyright 2022, David Lawrence -// Subject to the terms in the LICENSE file found in the top-level directory. -// +// Copyright (C) 2022, 2023 Whitney Armstrong, Wouter Deconinck, David Lawrence // - #pragma once -#include +#include #include +#include #include #include @@ -33,8 +20,9 @@ class DD4hep_service : public JService DD4hep_service( JApplication *app ) : app(app) {} virtual ~DD4hep_service(); - virtual dd4hep::Detector* detector(); - virtual std::shared_ptr cellIDPositionConverter(); + virtual gsl::not_null detector(); + virtual gsl::not_null converter(); + protected: void Initialize(); @@ -43,8 +31,8 @@ class DD4hep_service : public JService std::once_flag init_flag; JApplication *app = nullptr; - dd4hep::Detector* m_dd4hepGeo = nullptr; - std::shared_ptr m_cellid_converter = nullptr; + std::unique_ptr m_dd4hepGeo = nullptr; + std::unique_ptr m_cellid_converter = nullptr; std::vector m_xml_files; /// Ensures there is a geometry file that should be opened diff --git a/src/services/geometry/richgeo/ActsGeo.cc b/src/services/geometry/richgeo/ActsGeo.cc index 67f96d3a25..97a0d90e69 100644 --- a/src/services/geometry/richgeo/ActsGeo.cc +++ b/src/services/geometry/richgeo/ActsGeo.cc @@ -9,7 +9,7 @@ #include // constructor -richgeo::ActsGeo::ActsGeo(std::string detName_, dd4hep::Detector *det_, std::shared_ptr log_) +richgeo::ActsGeo::ActsGeo(std::string detName_, gsl::not_null det_, std::shared_ptr log_) : m_detName(detName_), m_det(det_), m_log(log_) { // capitalize m_detName diff --git a/src/services/geometry/richgeo/ActsGeo.h b/src/services/geometry/richgeo/ActsGeo.h index a7402d811d..a1ad0b8395 100644 --- a/src/services/geometry/richgeo/ActsGeo.h +++ b/src/services/geometry/richgeo/ActsGeo.h @@ -4,9 +4,10 @@ // bind IRT and DD4hep geometries for the RICHes #pragma once -#include #include +#include #include +#include // DD4Hep #include @@ -28,7 +29,7 @@ namespace richgeo { public: // constructor and destructor - ActsGeo(std::string detName_, dd4hep::Detector *det_, std::shared_ptr log_); + ActsGeo(std::string detName_, gsl::not_null det_, std::shared_ptr log_); ~ActsGeo() {} // generate list ACTS disc surfaces, for a given radiator @@ -40,7 +41,7 @@ namespace richgeo { protected: std::string m_detName; - dd4hep::Detector *m_det; + gsl::not_null m_det; std::shared_ptr m_log; private: diff --git a/src/services/geometry/richgeo/IrtGeo.cc b/src/services/geometry/richgeo/IrtGeo.cc index 4a85b2c373..3e8ff9f882 100644 --- a/src/services/geometry/richgeo/IrtGeo.cc +++ b/src/services/geometry/richgeo/IrtGeo.cc @@ -4,8 +4,8 @@ #include "IrtGeo.h" // constructor: creates IRT-DD4hep bindings using main `Detector` handle `*det_` -richgeo::IrtGeo::IrtGeo(std::string detName_, dd4hep::Detector *det_, std::shared_ptr log_) : - m_detName(detName_), m_det(det_), m_log(log_) +richgeo::IrtGeo::IrtGeo(std::string detName_, gsl::not_null det_, gsl::not_null conv_, std::shared_ptr log_) : + m_detName(detName_), m_det(det_), m_converter(conv_), m_log(log_) { Bind(); } @@ -20,9 +20,6 @@ void richgeo::IrtGeo::Bind() { // IRT geometry handles m_irtDetectorCollection = new CherenkovDetectorCollection(); m_irtDetector = m_irtDetectorCollection->AddNewDetector(m_detName.c_str()); - - // cellID conversion - m_cellid_converter = std::make_shared(*m_det); } // ------------------------------------------------ @@ -32,13 +29,13 @@ void richgeo::IrtGeo::SetReadoutIDToPositionLambda() { m_irtDetector->m_ReadoutIDToPosition = [ &m_log = this->m_log, // capture logger by reference // capture instance members by value, so those owned by `this` are not mutable here - cell_mask = this->m_irtDetector->GetReadoutCellMask(), - cellid_converter = this->m_cellid_converter, - sensor_info = this->m_sensor_info + cell_mask = this->m_irtDetector->GetReadoutCellMask(), + converter = this->m_converter, + sensor_info = this->m_sensor_info ] (auto cell_id) { // decode cell ID to get the sensor ID and pixel volume centroid auto sensor_id = cell_id & cell_mask; - auto pixel_volume_centroid = (1/dd4hep::mm) * cellid_converter->position(cell_id); + auto pixel_volume_centroid = (1/dd4hep::mm) * converter->position(cell_id); // get sensor info auto sensor_info_it = sensor_info.find(sensor_id); if(sensor_info_it == sensor_info.end()) { diff --git a/src/services/geometry/richgeo/IrtGeo.h b/src/services/geometry/richgeo/IrtGeo.h index d120872dfd..adb03ca33c 100644 --- a/src/services/geometry/richgeo/IrtGeo.h +++ b/src/services/geometry/richgeo/IrtGeo.h @@ -13,6 +13,9 @@ #include #include +// GSL +#include + // IRT #include #include @@ -28,7 +31,7 @@ namespace richgeo { public: // constructor: creates IRT-DD4hep bindings using main `Detector` handle `*det_` - IrtGeo(std::string detName_, dd4hep::Detector *det_, std::shared_ptr log_); + IrtGeo(std::string detName_, gsl::not_null det_, gsl::not_null conv_, std::shared_ptr log_); virtual ~IrtGeo(); // access the full IRT geometry @@ -50,12 +53,12 @@ namespace richgeo { std::string m_detName; // DD4hep geometry handles - dd4hep::Detector *m_det; + gsl::not_null m_det; dd4hep::DetElement m_detRich; dd4hep::Position m_posRich; // cell ID conversion - std::shared_ptr m_cellid_converter; + gsl::not_null m_converter; std::unordered_map m_sensor_info; // sensor ID -> sensor info // IRT geometry handles diff --git a/src/services/geometry/richgeo/IrtGeoDRICH.h b/src/services/geometry/richgeo/IrtGeoDRICH.h index 9e29730297..b2c10e36b0 100644 --- a/src/services/geometry/richgeo/IrtGeoDRICH.h +++ b/src/services/geometry/richgeo/IrtGeoDRICH.h @@ -10,8 +10,8 @@ namespace richgeo { class IrtGeoDRICH : public IrtGeo { public: - IrtGeoDRICH(dd4hep::Detector *det_, std::shared_ptr log_) : - IrtGeo("DRICH",det_,log_) { DD4hep_to_IRT(); } + IrtGeoDRICH(gsl::not_null det_, gsl::not_null conv_, std::shared_ptr log_) : + IrtGeo("DRICH",det_,conv_,log_) { DD4hep_to_IRT(); } ~IrtGeoDRICH(); protected: diff --git a/src/services/geometry/richgeo/IrtGeoPFRICH.h b/src/services/geometry/richgeo/IrtGeoPFRICH.h index 5a3e99cca1..af0cf4e98c 100644 --- a/src/services/geometry/richgeo/IrtGeoPFRICH.h +++ b/src/services/geometry/richgeo/IrtGeoPFRICH.h @@ -10,8 +10,8 @@ namespace richgeo { class IrtGeoPFRICH : public IrtGeo { public: - IrtGeoPFRICH(dd4hep::Detector *det_, std::shared_ptr log_) : - IrtGeo("PFRICH",det_,log_) { DD4hep_to_IRT(); } + IrtGeoPFRICH(gsl::not_null det_, gsl::not_null conv_, std::shared_ptr log_) : + IrtGeo("PFRICH",det_,conv_,log_) { DD4hep_to_IRT(); } ~IrtGeoPFRICH(); protected: diff --git a/src/services/geometry/richgeo/ReadoutGeo.cc b/src/services/geometry/richgeo/ReadoutGeo.cc index c55ea109c8..f82b1dc29e 100644 --- a/src/services/geometry/richgeo/ReadoutGeo.cc +++ b/src/services/geometry/richgeo/ReadoutGeo.cc @@ -6,8 +6,8 @@ #include "ReadoutGeo.h" // constructor -richgeo::ReadoutGeo::ReadoutGeo(std::string detName_, dd4hep::Detector *det_, std::shared_ptr log_) - : m_detName(detName_), m_det(det_), m_log(log_) +richgeo::ReadoutGeo::ReadoutGeo(std::string detName_, gsl::not_null det_, gsl::not_null conv_, std::shared_ptr log_) + : m_detName(detName_), m_det(det_), m_conv(conv_), m_log(log_) { // capitalize m_detName std::transform(m_detName.begin(), m_detName.end(), m_detName.begin(), ::toupper); @@ -22,10 +22,9 @@ richgeo::ReadoutGeo::ReadoutGeo(std::string detName_, dd4hep::Detector *det_, st m_rngCellIDs = [] (std::function lambda, float p) { return; }; // common objects - m_readoutCoder = m_det->readout(m_detName+"Hits").idSpec().decoder(); - m_detRich = m_det->detector(m_detName); - m_systemID = m_detRich.id(); - m_cellid_converter = std::make_shared(*m_det); + m_readoutCoder = m_det->readout(m_detName+"Hits").idSpec().decoder(); + m_detRich = m_det->detector(m_detName); + m_systemID = m_detRich.id(); // dRICH readout -------------------------------------------------------------------- if(m_detName=="DRICH") { @@ -101,7 +100,7 @@ richgeo::ReadoutGeo::ReadoutGeo(std::string detName_, dd4hep::Detector *det_, st // pixel gap mask // FIXME: generalize; this assumes the segmentation is `CartesianGridXY` bool richgeo::ReadoutGeo::PixelGapMask(CellIDType cellID, dd4hep::Position pos_hit_global) { - auto pos_pixel_global = m_cellid_converter->position(cellID); + auto pos_pixel_global = m_conv->position(cellID); auto pos_pixel_local = GetSensorLocalPosition(cellID, pos_pixel_global); auto pos_hit_local = GetSensorLocalPosition(cellID, pos_hit_global); return ! ( @@ -116,7 +115,7 @@ bool richgeo::ReadoutGeo::PixelGapMask(CellIDType cellID, dd4hep::Position pos_h dd4hep::Position richgeo::ReadoutGeo::GetSensorLocalPosition(CellIDType cellID, dd4hep::Position pos) { // get the VolumeManagerContext for this sensitive detector - auto context = m_cellid_converter->findContext(cellID); + auto context = m_conv->findContext(cellID); // transformation vector buffers double xyz_l[3], xyz_e[3], xyz_g[3]; @@ -153,7 +152,7 @@ dd4hep::Position richgeo::ReadoutGeo::GetSensorLocalPosition(CellIDType cellID, print_pos("input position", pos); print_pos("sensor position", pos_sensor); print_pos("output position", pos_transformed); - // auto dim = m_cellid_converter->cellDimensions(cellID); + // auto dim = m_conv->cellDimensions(cellID); // for (std::size_t j = 0; j < std::size(dim); ++j) // m_log->trace(" - dimension {:<5} size: {:.2}", j, dim[j]); } diff --git a/src/services/geometry/richgeo/ReadoutGeo.h b/src/services/geometry/richgeo/ReadoutGeo.h index 5db918c0b4..c0799ffe56 100644 --- a/src/services/geometry/richgeo/ReadoutGeo.h +++ b/src/services/geometry/richgeo/ReadoutGeo.h @@ -6,6 +6,7 @@ #pragma once +#include #include #include #include @@ -26,7 +27,7 @@ namespace richgeo { public: // constructor - ReadoutGeo(std::string detName_, dd4hep::Detector *det_, std::shared_ptr log_); + ReadoutGeo(std::string detName_, gsl::not_null det_, gsl::not_null conv_, std::shared_ptr log_); ~ReadoutGeo() {} // define cellID encoding @@ -66,10 +67,10 @@ namespace richgeo { // common objects std::shared_ptr m_log; std::string m_detName; - dd4hep::Detector* m_det; + gsl::not_null m_det; + gsl::not_null m_conv; dd4hep::DetElement m_detRich; dd4hep::BitFieldCoder* m_readoutCoder; - std::shared_ptr m_cellid_converter; int m_systemID; int m_num_sec; int m_num_pdus; diff --git a/src/services/geometry/richgeo/RichGeo_service.cc b/src/services/geometry/richgeo/RichGeo_service.cc index d806eaeb3f..3c16463959 100644 --- a/src/services/geometry/richgeo/RichGeo_service.cc +++ b/src/services/geometry/richgeo/RichGeo_service.cc @@ -17,6 +17,7 @@ void RichGeo_service::acquire_services(JServiceLocator *srv_locator) { // DD4Hep geometry service auto dd4hep_service = srv_locator->get(); m_dd4hepGeo = dd4hep_service->detector(); + m_converter = dd4hep_service->converter(); } // IrtGeo ----------------------------------------------------------- @@ -30,8 +31,8 @@ richgeo::IrtGeo *RichGeo_service::GetIrtGeo(std::string detector_name) { // instantiate IrtGeo-derived object, depending on detector auto which_rich = detector_name; std::transform(which_rich.begin(), which_rich.end(), which_rich.begin(), ::toupper); - if ( which_rich=="DRICH" ) m_irtGeo = new richgeo::IrtGeoDRICH(m_dd4hepGeo, m_log); - else if( which_rich=="PFRICH" ) m_irtGeo = new richgeo::IrtGeoPFRICH(m_dd4hepGeo, m_log); + if ( which_rich=="DRICH" ) m_irtGeo = new richgeo::IrtGeoDRICH(m_dd4hepGeo, m_converter, m_log); + else if( which_rich=="PFRICH" ) m_irtGeo = new richgeo::IrtGeoPFRICH(m_dd4hepGeo, m_converter, m_log); else throw JException(fmt::format("IrtGeo is not defined for detector '{}'",detector_name)); }; std::call_once(m_init_irt, initialize); @@ -67,7 +68,7 @@ std::shared_ptr RichGeo_service::GetReadoutGeo(std::string m_log->debug("Call RichGeo_service::GetReadoutGeo initializer"); auto initialize = [this,&detector_name] () { if(!m_dd4hepGeo) throw JException("RichGeo_service m_dd4hepGeo==null which should never be!"); - m_readoutGeo = std::make_shared(detector_name, m_dd4hepGeo, m_log); + m_readoutGeo = std::make_shared(detector_name, m_dd4hepGeo, m_converter, m_log); }; std::call_once(m_init_readout, initialize); } diff --git a/src/services/geometry/richgeo/RichGeo_service.h b/src/services/geometry/richgeo/RichGeo_service.h index 3b9ed4a726..ff31d63fc6 100644 --- a/src/services/geometry/richgeo/RichGeo_service.h +++ b/src/services/geometry/richgeo/RichGeo_service.h @@ -30,7 +30,7 @@ class RichGeo_service : public JService { virtual ~RichGeo_service(); // return pointer to the main DD4hep Detector - virtual dd4hep::Detector *GetDD4hepGeo() { return m_dd4hepGeo; }; + virtual const dd4hep::Detector* GetDD4hepGeo() { return m_dd4hepGeo; }; // return pointers to geometry bindings; initializes the bindings upon the first time called virtual richgeo::IrtGeo *GetIrtGeo(std::string detector_name); @@ -45,7 +45,8 @@ class RichGeo_service : public JService { std::once_flag m_init_acts; std::once_flag m_init_readout; JApplication *m_app = nullptr; - dd4hep::Detector *m_dd4hepGeo = nullptr; + const dd4hep::Detector* m_dd4hepGeo = nullptr; + const dd4hep::rec::CellIDPositionConverter* m_converter = nullptr; richgeo::IrtGeo *m_irtGeo = nullptr; richgeo::ActsGeo *m_actsGeo = nullptr; std::shared_ptr m_readoutGeo; diff --git a/src/tests/algorithms_test/calorimetry_CalorimeterHitDigi.cc b/src/tests/algorithms_test/calorimetry_CalorimeterHitDigi.cc index 24cb26309c..5477cb2525 100644 --- a/src/tests/algorithms_test/calorimetry_CalorimeterHitDigi.cc +++ b/src/tests/algorithms_test/calorimetry_CalorimeterHitDigi.cc @@ -6,6 +6,8 @@ #include #include +#include + #include "algorithms/calorimetry/CalorimeterHitDigi.h" using eicrecon::CalorimeterHitDigi; @@ -17,6 +19,8 @@ TEST_CASE( "the clustering algorithm runs", "[CalorimeterHitDigi]" ) { std::shared_ptr logger = spdlog::default_logger()->clone("CalorimeterHitDigi"); logger->set_level(spdlog::level::trace); + auto detector = dd4hep::Detector::make_unique(""); + CalorimeterHitDigiConfig cfg; cfg.threshold = 0. /* GeV */; cfg.corrMeanScale = 1.; @@ -32,7 +36,7 @@ TEST_CASE( "the clustering algorithm runs", "[CalorimeterHitDigi]" ) { cfg.pedMeanADC = 123; cfg.resolutionTDC = 1.0 * dd4hep::ns; algo.applyConfig(cfg); - algo.init(nullptr, logger); + algo.init(detector.get(), logger); edm4hep::CaloHitContributionCollection calohits; edm4hep::SimCalorimeterHitCollection simhits; diff --git a/src/tests/algorithms_test/calorimetry_CalorimeterIslandCluster.cc b/src/tests/algorithms_test/calorimetry_CalorimeterIslandCluster.cc index 9fdeee2d34..f532124595 100644 --- a/src/tests/algorithms_test/calorimetry_CalorimeterIslandCluster.cc +++ b/src/tests/algorithms_test/calorimetry_CalorimeterIslandCluster.cc @@ -7,6 +7,8 @@ #include #include +#include + #include "algorithms/calorimetry/CalorimeterIslandCluster.h" using eicrecon::CalorimeterIslandCluster; @@ -22,11 +24,13 @@ TEST_CASE( "the clustering algorithm runs", "[CalorimeterIslandCluster]" ) { cfg.minClusterHitEdep = 0. * dd4hep::GeV; cfg.minClusterCenterEdep = 0. * dd4hep::GeV; + auto detector = dd4hep::Detector::make_unique(""); + SECTION( "without splitting" ) { cfg.splitCluster = false; cfg.localDistXY = {1 * dd4hep::mm, 1 * dd4hep::mm}; algo.applyConfig(cfg); - algo.init(nullptr, logger); + algo.init(detector.get(), logger); SECTION( "on a single cell" ) { edm4eic::CalorimeterHitCollection hits_coll; @@ -129,7 +133,7 @@ TEST_CASE( "the clustering algorithm runs", "[CalorimeterIslandCluster]" ) { } cfg.localDistXY = {1 * dd4hep::mm, 1 * dd4hep::mm}; algo.applyConfig(cfg); - algo.init(nullptr, logger); + algo.init(detector.get(), logger); edm4eic::CalorimeterHitCollection hits_coll; hits_coll.create(