diff --git a/src/algorithms/calorimetry/CalorimeterHitDigi.cc b/src/algorithms/calorimetry/CalorimeterHitDigi.cc index 27cfc77c0d..fc82b76ce6 100644 --- a/src/algorithms/calorimetry/CalorimeterHitDigi.cc +++ b/src/algorithms/calorimetry/CalorimeterHitDigi.cc @@ -14,7 +14,6 @@ #include "CalorimeterHitDigi.h" #include -#include #include #include using namespace dd4hep; @@ -116,29 +115,21 @@ void CalorimeterHitDigi::AlgorithmChangeRun() { //------------------------ // AlgorithmProcess //------------------------ -void CalorimeterHitDigi::AlgorithmProcess() { - - // Delete any output objects left from last event. - // (Should already have been done for us, but just to be bullet-proof.) - for( auto h : rawhits ) delete h; - rawhits.clear(); - +std::unique_ptr CalorimeterHitDigi::AlgorithmProcess(const edm4hep::SimCalorimeterHitCollection &simhits) { if (merge_hits) { - signal_sum_digi(); + return std::move(signal_sum_digi(simhits)); } else { - single_hits_digi(); + return std::move(single_hits_digi(simhits)); } } -//------------------------ -// single_hits_digi -//------------------------ -void CalorimeterHitDigi::single_hits_digi(){ +std::unique_ptr CalorimeterHitDigi::single_hits_digi(const edm4hep::SimCalorimeterHitCollection &simhits) { + std::unique_ptr rawhits { std::make_unique() }; // Create output collections for ( auto ahit : simhits ) { // Note: juggler internal unit of energy is dd4hep::GeV - const double eDep = ahit->getEnergy(); + const double eDep = ahit.getEnergy(); // apply additional calorimeter noise to corrected energy deposit const double eResRel = (eDep > m_threshold) @@ -157,7 +148,7 @@ void CalorimeterHitDigi::single_hits_digi(){ const long long adc = std::llround(ped + eDep * (m_corrMeanScale + eResRel) / m_dyRangeADC * m_capADC); double time = std::numeric_limits::max(); - for (const auto& c : ahit->getContributions()) { + for (const auto& c : ahit.getContributions()) { if (c.getTime() <= time) { time = c.getTime(); } @@ -166,36 +157,29 @@ void CalorimeterHitDigi::single_hits_digi(){ const long long tdc = std::llround((time + m_normDist(generator) * tRes) * stepTDC); - if (eDep> 1.e-3) m_log->trace("E sim {} \t adc: {} \t time: {}\t maxtime: {} \t tdc: {} \t cell ID {}", eDep, adc, time, m_capTime, tdc, ahit->getCellID()); - auto rawhit = new edm4hep::RawCalorimeterHit( - ahit->getCellID(), + if (eDep> 1.e-3) m_log->trace("E sim {} \t adc: {} \t time: {}\t maxtime: {} \t tdc: {} \t cell ID {}", eDep, adc, time, m_capTime, tdc, ahit.getCellID()); + rawhits->create( + ahit.getCellID(), (adc > m_capADC ? m_capADC : adc), tdc ); - rawhits.push_back(rawhit); } + + return std::move(rawhits); } -//------------------------ -// signal_sum_digi -//------------------------ -void CalorimeterHitDigi::signal_sum_digi( void ){ +std::unique_ptr CalorimeterHitDigi::signal_sum_digi(const edm4hep::SimCalorimeterHitCollection &simhits) { + std::unique_ptr rawhits { std::make_unique() }; // find the hits that belong to the same group (for merging) std::unordered_map> merge_map; for (auto ahit : simhits) { - int64_t hid = ahit->getCellID() & id_mask; + int64_t hid = ahit.getCellID() & id_mask; - m_log->trace("org cell ID in {:s}: {:#064b}", m_readout, ahit->getCellID()); + m_log->trace("org cell ID in {:s}: {:#064b}", m_readout, ahit.getCellID()); m_log->trace("new cell ID in {:s}: {:#064b}", m_readout, hid); - auto it = merge_map.find(hid); - - if (it == merge_map.end()) { - merge_map[hid] = {ahit}; - } else { - it->second.push_back(ahit); - } + merge_map[hid].push_back(&ahit); } // signal sum @@ -251,11 +235,12 @@ void CalorimeterHitDigi::signal_sum_digi( void ){ unsigned long long tdc = std::llround((time + m_normDist(generator) * tRes) * stepTDC); if (edep> 1.e-3) m_log->trace("E sim {} \t adc: {} \t time: {}\t maxtime: {} \t tdc: {}", edep, adc, time, m_capTime, tdc); - auto rawhit = new edm4hep::RawCalorimeterHit( + rawhits->create( mid, (adc > m_capADC ? m_capADC : adc), tdc ); - rawhits.push_back(rawhit); } + + return std::move(rawhits); } diff --git a/src/algorithms/calorimetry/CalorimeterHitDigi.h b/src/algorithms/calorimetry/CalorimeterHitDigi.h index d9971664bd..4e7909fe92 100644 --- a/src/algorithms/calorimetry/CalorimeterHitDigi.h +++ b/src/algorithms/calorimetry/CalorimeterHitDigi.h @@ -13,12 +13,13 @@ #pragma once +#include #include #include -#include -#include +#include +#include #include class CalorimeterHitDigi { @@ -27,10 +28,9 @@ class CalorimeterHitDigi { public: CalorimeterHitDigi() = default; - ~CalorimeterHitDigi(){for( auto h : rawhits ) delete h;} // better to use smart pointer? virtual void AlgorithmInit(std::shared_ptr& logger); virtual void AlgorithmChangeRun() ; - virtual void AlgorithmProcess() ; + virtual std::unique_ptr AlgorithmProcess(const edm4hep::SimCalorimeterHitCollection &simhits) ; //-------- Configuration Parameters ------------ //instantiate new spdlog logger @@ -78,14 +78,10 @@ class CalorimeterHitDigi { std::shared_ptr m_geoSvc; uint64_t id_mask{0}; - // inputs/outputs - std::vector simhits; - std::vector rawhits; - private: std::default_random_engine generator; // TODO: need something more appropriate here std::normal_distribution m_normDist; // defaults to mean=0, sigma=1 - void single_hits_digi(); - void signal_sum_digi(); + std::unique_ptr single_hits_digi(const edm4hep::SimCalorimeterHitCollection &simhits); + std::unique_ptr signal_sum_digi(const edm4hep::SimCalorimeterHitCollection &simhits); }; diff --git a/src/detectors/B0ECAL/RawCalorimeterHit_factory_B0ECalRawHits.h b/src/detectors/B0ECAL/RawCalorimeterHit_factory_B0ECalRawHits.h index c315962b01..f829bb534f 100644 --- a/src/detectors/B0ECAL/RawCalorimeterHit_factory_B0ECalRawHits.h +++ b/src/detectors/B0ECAL/RawCalorimeterHit_factory_B0ECalRawHits.h @@ -80,15 +80,14 @@ class RawCalorimeterHit_factory_B0ECalRawHits : public eicrecon::JFactoryPodioT< //------------------------------------------ // Process void Process(const std::shared_ptr &event) override { - // Prefill inputs - simhits = event->Get(m_input_tag); + // Get input collection + auto simhits_coll = static_cast(event->GetCollectionBase(m_input_tag)); // Call Process for generic algorithm - AlgorithmProcess(); + auto rawhits_coll = AlgorithmProcess(*simhits_coll); - // Hand owner of algorithm objects over to JANA - Set(rawhits); - rawhits.clear(); // not really needed, but better to not leave dangling pointers around + // Hand algorithm objects over to JANA + SetCollection(std::move(rawhits_coll)); } }; diff --git a/src/detectors/BEMC/RawCalorimeterHit_factory_EcalBarrelImagingRawHits.h b/src/detectors/BEMC/RawCalorimeterHit_factory_EcalBarrelImagingRawHits.h index 3e0e9dc7a3..7ee6f169c6 100644 --- a/src/detectors/BEMC/RawCalorimeterHit_factory_EcalBarrelImagingRawHits.h +++ b/src/detectors/BEMC/RawCalorimeterHit_factory_EcalBarrelImagingRawHits.h @@ -75,15 +75,14 @@ class RawCalorimeterHit_factory_EcalBarrelImagingRawHits : public eicrecon::JFac //------------------------------------------ // Process void Process(const std::shared_ptr &event) override { - // Prefill inputs - simhits = event->Get(m_input_tag); + // Get input collection + auto simhits_coll = static_cast(event->GetCollectionBase(m_input_tag)); // Call Process for generic algorithm - AlgorithmProcess(); + auto rawhits_coll = AlgorithmProcess(*simhits_coll); - // Hand owner of algorithm objects over to JANA - Set(rawhits); - rawhits.clear(); // not really needed, but better to not leave dangling pointers around + // Hand algorithm objects over to JANA + SetCollection(std::move(rawhits_coll)); } }; diff --git a/src/detectors/BEMC/RawCalorimeterHit_factory_EcalBarrelScFiRawHits.h b/src/detectors/BEMC/RawCalorimeterHit_factory_EcalBarrelScFiRawHits.h index d0f07eef0c..6e88f7980b 100644 --- a/src/detectors/BEMC/RawCalorimeterHit_factory_EcalBarrelScFiRawHits.h +++ b/src/detectors/BEMC/RawCalorimeterHit_factory_EcalBarrelScFiRawHits.h @@ -77,15 +77,14 @@ class RawCalorimeterHit_factory_EcalBarrelScFiRawHits : public eicrecon::JFactor //------------------------------------------ // Process void Process(const std::shared_ptr &event) override { - // Prefill inputs - simhits = event->Get(m_input_tag); + // Get input collection + auto simhits_coll = static_cast(event->GetCollectionBase(m_input_tag)); // Call Process for generic algorithm - AlgorithmProcess(); + auto rawhits_coll = AlgorithmProcess(*simhits_coll); - // Hand owner of algorithm objects over to JANA - Set(rawhits); - rawhits.clear(); // not really needed, but better to not leave dangling pointers around + // Hand algorithm objects over to JANA + SetCollection(std::move(rawhits_coll)); } }; diff --git a/src/detectors/BEMC/RawCalorimeterHit_factory_EcalBarrelSciGlassRawHits.h b/src/detectors/BEMC/RawCalorimeterHit_factory_EcalBarrelSciGlassRawHits.h index dbba38039a..d26fae8c42 100644 --- a/src/detectors/BEMC/RawCalorimeterHit_factory_EcalBarrelSciGlassRawHits.h +++ b/src/detectors/BEMC/RawCalorimeterHit_factory_EcalBarrelSciGlassRawHits.h @@ -80,15 +80,14 @@ class RawCalorimeterHit_factory_EcalBarrelSciGlassRawHits : public eicrecon::JFa //------------------------------------------ // Process void Process(const std::shared_ptr &event) override { - // Prefill inputs - simhits = event->Get(m_input_tag); + // Get input collection + auto simhits_coll = static_cast(event->GetCollectionBase(m_input_tag)); // Call Process for generic algorithm - AlgorithmProcess(); + auto rawhits_coll = AlgorithmProcess(*simhits_coll); - // Hand owner of algorithm objects over to JANA - Set(rawhits); - rawhits.clear(); // not really needed, but better to not leave dangling pointers around + // Hand algorithm objects over to JANA + SetCollection(std::move(rawhits_coll)); } }; diff --git a/src/detectors/BHCAL/RawCalorimeterHit_factory_HcalBarrelRawHits.h b/src/detectors/BHCAL/RawCalorimeterHit_factory_HcalBarrelRawHits.h index e764c20e91..84030c98f6 100644 --- a/src/detectors/BHCAL/RawCalorimeterHit_factory_HcalBarrelRawHits.h +++ b/src/detectors/BHCAL/RawCalorimeterHit_factory_HcalBarrelRawHits.h @@ -79,15 +79,14 @@ class RawCalorimeterHit_factory_HcalBarrelRawHits : public eicrecon::JFactoryPod //------------------------------------------ // Process void Process(const std::shared_ptr &event) override { - // Prefill inputs - simhits = event->Get(m_input_tag); + // Get input collection + auto simhits_coll = static_cast(event->GetCollectionBase(m_input_tag)); // Call Process for generic algorithm - AlgorithmProcess(); + auto rawhits_coll = AlgorithmProcess(*simhits_coll); - // Hand owner of algorithm objects over to JANA - Set(rawhits); - rawhits.clear(); // not really needed, but better to not leave dangling pointers around + // Hand algorithm objects over to JANA + SetCollection(std::move(rawhits_coll)); } }; diff --git a/src/detectors/EEMC/RawCalorimeterHit_factory_EcalEndcapNRawHits.h b/src/detectors/EEMC/RawCalorimeterHit_factory_EcalEndcapNRawHits.h index 1d8cbd1d7c..d12e2fcbc1 100644 --- a/src/detectors/EEMC/RawCalorimeterHit_factory_EcalEndcapNRawHits.h +++ b/src/detectors/EEMC/RawCalorimeterHit_factory_EcalEndcapNRawHits.h @@ -80,15 +80,14 @@ class RawCalorimeterHit_factory_EcalEndcapNRawHits : public eicrecon::JFactoryPo //------------------------------------------ // Process void Process(const std::shared_ptr &event) override { - // Prefill inputs - simhits = event->Get(m_input_tag); + // Get input collection + auto simhits_coll = static_cast(event->GetCollectionBase(m_input_tag)); // Call Process for generic algorithm - AlgorithmProcess(); + auto rawhits_coll = AlgorithmProcess(*simhits_coll); - // Hand owner of algorithm objects over to JANA - Set(rawhits); - rawhits.clear(); // not really needed, but better to not leave dangling pointers around + // Hand algorithm objects over to JANA + SetCollection(std::move(rawhits_coll)); } }; diff --git a/src/detectors/EHCAL/RawCalorimeterHit_factory_HcalEndcapNRawHits.h b/src/detectors/EHCAL/RawCalorimeterHit_factory_HcalEndcapNRawHits.h index d0b4dd15e3..3d2a37e0ec 100644 --- a/src/detectors/EHCAL/RawCalorimeterHit_factory_HcalEndcapNRawHits.h +++ b/src/detectors/EHCAL/RawCalorimeterHit_factory_HcalEndcapNRawHits.h @@ -78,15 +78,14 @@ class RawCalorimeterHit_factory_HcalEndcapNRawHits : public eicrecon::JFactoryPo //------------------------------------------ // Process void Process(const std::shared_ptr &event) override { - // Prefill inputs - simhits = event->Get(m_input_tag); + // Get input collection + auto simhits_coll = static_cast(event->GetCollectionBase(m_input_tag)); // Call Process for generic algorithm - AlgorithmProcess(); + auto rawhits_coll = AlgorithmProcess(*simhits_coll); - // Hand owner of algorithm objects over to JANA - Set(rawhits); - rawhits.clear(); // not really needed, but better to not leave dangling pointers around + // Hand algorithm objects over to JANA + SetCollection(std::move(rawhits_coll)); } }; diff --git a/src/detectors/FEMC/RawCalorimeterHit_factory_EcalEndcapPInsertRawHits.h b/src/detectors/FEMC/RawCalorimeterHit_factory_EcalEndcapPInsertRawHits.h index 4dd7b4a8ab..b4753d520c 100644 --- a/src/detectors/FEMC/RawCalorimeterHit_factory_EcalEndcapPInsertRawHits.h +++ b/src/detectors/FEMC/RawCalorimeterHit_factory_EcalEndcapPInsertRawHits.h @@ -77,15 +77,14 @@ class RawCalorimeterHit_factory_EcalEndcapPInsertRawHits : public eicrecon::JFac //------------------------------------------ // Process void Process(const std::shared_ptr &event) override { - // Prefill inputs - simhits = event->Get(m_input_tag); + // Get input collection + auto simhits_coll = static_cast(event->GetCollectionBase(m_input_tag)); // Call Process for generic algorithm - AlgorithmProcess(); + auto rawhits_coll = AlgorithmProcess(*simhits_coll); - // Hand owner of algorithm objects over to JANA - Set(rawhits); - rawhits.clear(); // not really needed, but better to not leave dangling pointers around + // Hand algorithm objects over to JANA + SetCollection(std::move(rawhits_coll)); } }; diff --git a/src/detectors/FEMC/RawCalorimeterHit_factory_EcalEndcapPRawHits.h b/src/detectors/FEMC/RawCalorimeterHit_factory_EcalEndcapPRawHits.h index 6c3d854f2a..4317cd342f 100644 --- a/src/detectors/FEMC/RawCalorimeterHit_factory_EcalEndcapPRawHits.h +++ b/src/detectors/FEMC/RawCalorimeterHit_factory_EcalEndcapPRawHits.h @@ -82,15 +82,14 @@ class RawCalorimeterHit_factory_EcalEndcapPRawHits : public eicrecon::JFactoryPo //------------------------------------------ // Process void Process(const std::shared_ptr &event) override { - // Prefill inputs - simhits = event->Get(m_input_tag); + // Get input collection + auto simhits_coll = static_cast(event->GetCollectionBase(m_input_tag)); // Call Process for generic algorithm - AlgorithmProcess(); + auto rawhits_coll = AlgorithmProcess(*simhits_coll); - // Hand owner of algorithm objects over to JANA - Set(rawhits); - rawhits.clear(); // not really needed, but better to not leave dangling pointers around + // Hand algorithm objects over to JANA + SetCollection(std::move(rawhits_coll)); } }; diff --git a/src/detectors/FHCAL/RawCalorimeterHit_factory_HcalEndcapPInsertRawHits.h b/src/detectors/FHCAL/RawCalorimeterHit_factory_HcalEndcapPInsertRawHits.h index cfcf5e060d..5ac6b9e21b 100644 --- a/src/detectors/FHCAL/RawCalorimeterHit_factory_HcalEndcapPInsertRawHits.h +++ b/src/detectors/FHCAL/RawCalorimeterHit_factory_HcalEndcapPInsertRawHits.h @@ -76,15 +76,14 @@ class RawCalorimeterHit_factory_HcalEndcapPInsertRawHits : public eicrecon::JFac //------------------------------------------ // Process void Process(const std::shared_ptr &event) override { - // Prefill inputs - simhits = event->Get(m_input_tag); + // Get input collection + auto simhits_coll = static_cast(event->GetCollectionBase(m_input_tag)); // Call Process for generic algorithm - AlgorithmProcess(); + auto rawhits_coll = AlgorithmProcess(*simhits_coll); - // Hand owner of algorithm objects over to JANA - Set(rawhits); - rawhits.clear(); // not really needed, but better to not leave dangling pointers around + // Hand algorithm objects over to JANA + SetCollection(std::move(rawhits_coll)); } }; diff --git a/src/detectors/FHCAL/RawCalorimeterHit_factory_HcalEndcapPRawHits.h b/src/detectors/FHCAL/RawCalorimeterHit_factory_HcalEndcapPRawHits.h index add04e45e0..478e94ffd7 100644 --- a/src/detectors/FHCAL/RawCalorimeterHit_factory_HcalEndcapPRawHits.h +++ b/src/detectors/FHCAL/RawCalorimeterHit_factory_HcalEndcapPRawHits.h @@ -78,15 +78,14 @@ class RawCalorimeterHit_factory_HcalEndcapPRawHits : public eicrecon::JFactoryPo //------------------------------------------ // Process void Process(const std::shared_ptr &event) override { - // Prefill inputs - simhits = event->Get(m_input_tag); + // Get input collection + auto simhits_coll = static_cast(event->GetCollectionBase(m_input_tag)); // Call Process for generic algorithm - AlgorithmProcess(); + auto rawhits_coll = AlgorithmProcess(*simhits_coll); - // Hand owner of algorithm objects over to JANA - Set(rawhits); - rawhits.clear(); // not really needed, but better to not leave dangling pointers around + // Hand algorithm objects over to JANA + SetCollection(std::move(rawhits_coll)); } }; diff --git a/src/detectors/FHCAL/RawCalorimeterHit_factory_LFHCALRawHits.h b/src/detectors/FHCAL/RawCalorimeterHit_factory_LFHCALRawHits.h index 1f1ffddb62..d47fd6094b 100644 --- a/src/detectors/FHCAL/RawCalorimeterHit_factory_LFHCALRawHits.h +++ b/src/detectors/FHCAL/RawCalorimeterHit_factory_LFHCALRawHits.h @@ -79,15 +79,14 @@ class RawCalorimeterHit_factory_LFHCALRawHits : public eicrecon::JFactoryPodioT< //------------------------------------------ // Process void Process(const std::shared_ptr &event) override { - // Prefill inputs - simhits = event->Get(m_input_tag); + // Get input collection + auto simhits_coll = static_cast(event->GetCollectionBase(m_input_tag)); // Call Process for generic algorithm - AlgorithmProcess(); + auto rawhits_coll = AlgorithmProcess(*simhits_coll); - // Hand owner of algorithm objects over to JANA - Set(rawhits); - rawhits.clear(); // not really needed, but better to not leave dangling pointers around + // Hand algorithm objects over to JANA + SetCollection(std::move(rawhits_coll)); } }; diff --git a/src/detectors/LUMISPECCAL/RawCalorimeterHit_factory_EcalLumiSpecRawHits.h b/src/detectors/LUMISPECCAL/RawCalorimeterHit_factory_EcalLumiSpecRawHits.h index ade1afa3b6..e268313a46 100644 --- a/src/detectors/LUMISPECCAL/RawCalorimeterHit_factory_EcalLumiSpecRawHits.h +++ b/src/detectors/LUMISPECCAL/RawCalorimeterHit_factory_EcalLumiSpecRawHits.h @@ -79,15 +79,14 @@ class RawCalorimeterHit_factory_EcalLumiSpecRawHits : public eicrecon::JFactoryP //------------------------------------------ // Process void Process(const std::shared_ptr &event) override { - // Prefill inputs - simhits = event->Get(m_input_tag); + // Get input collection + auto simhits_coll = static_cast(event->GetCollectionBase(m_input_tag)); // Call Process for generic algorithm - AlgorithmProcess(); + auto rawhits_coll = AlgorithmProcess(*simhits_coll); - // Hand owner of algorithm objects over to JANA - Set(rawhits); - rawhits.clear(); // not really needed, but better to not leave dangling pointers around + // Hand algorithm objects over to JANA + SetCollection(std::move(rawhits_coll)); } }; diff --git a/src/detectors/ZDC/RawCalorimeterHit_factory_ZDCEcalRawHits.h b/src/detectors/ZDC/RawCalorimeterHit_factory_ZDCEcalRawHits.h index 7ca9e42ba8..05d38f9c67 100644 --- a/src/detectors/ZDC/RawCalorimeterHit_factory_ZDCEcalRawHits.h +++ b/src/detectors/ZDC/RawCalorimeterHit_factory_ZDCEcalRawHits.h @@ -78,15 +78,14 @@ class RawCalorimeterHit_factory_ZDCEcalRawHits : public eicrecon::JFactoryPodioT //------------------------------------------ // Process void Process(const std::shared_ptr &event) override { - // Prefill inputs - simhits = event->Get(m_input_tag); + // Get input collection + auto simhits_coll = static_cast(event->GetCollectionBase(m_input_tag)); // Call Process for generic algorithm - AlgorithmProcess(); + auto rawhits_coll = AlgorithmProcess(*simhits_coll); - // Hand owner of algorithm objects over to JANA - Set(rawhits); - rawhits.clear(); // not really needed, but better to not leave dangling pointers around + // Hand algorithm objects over to JANA + SetCollection(std::move(rawhits_coll)); } }; diff --git a/src/tests/algorithms_test/calorimetry_CalorimeterHitDigi.cc b/src/tests/algorithms_test/calorimetry_CalorimeterHitDigi.cc index 61dd7c5b0f..ed07451db9 100644 --- a/src/tests/algorithms_test/calorimetry_CalorimeterHitDigi.cc +++ b/src/tests/algorithms_test/calorimetry_CalorimeterHitDigi.cc @@ -30,11 +30,12 @@ TEST_CASE( "the clustering algorithm runs", "[CalorimeterHitDigi]" ) { algo.AlgorithmInit(logger); algo.AlgorithmChangeRun(); - auto mhit = edm4hep::MutableSimCalorimeterHit { + edm4hep::SimCalorimeterHitCollection simhits; + auto mhit = simhits.create( 0xABABABAB, // std::uint64_t cellID 1.0 /* GeV */, // float energy - {0. /* mm */, 0. /* mm */, 0. /* mm */}, // edm4hep::Vector3f position - }; + edm4hep::Vector3f({0. /* mm */, 0. /* mm */, 0. /* mm */}) // edm4hep::Vector3f position + ); mhit.addToContributions({ 0, // std::int32_t PDG 0.5 /* GeV */, // float energy @@ -47,15 +48,12 @@ TEST_CASE( "the clustering algorithm runs", "[CalorimeterHitDigi]" ) { 9.0 /* ns */, // float time {0. /* mm */, 0. /* mm */, 0. /* mm */}, // edm4hep::Vector3f stepPosition }); - algo.simhits = { - new edm4hep::SimCalorimeterHit(mhit), - }; - algo.AlgorithmProcess(); + std::unique_ptr rawhits = algo.AlgorithmProcess(simhits); - REQUIRE( algo.rawhits.size() == 1 ); - REQUIRE( algo.rawhits[0]->getCellID() == 0xABABABAB); - REQUIRE( algo.rawhits[0]->getAmplitude() == 123 + 111 ); - REQUIRE( algo.rawhits[0]->getTimeStamp() == 7 ); // currently, earliest contribution is returned + REQUIRE( (*rawhits).size() == 1 ); + REQUIRE( (*rawhits)[0].getCellID() == 0xABABABAB); + REQUIRE( (*rawhits)[0].getAmplitude() == 123 + 111 ); + REQUIRE( (*rawhits)[0].getTimeStamp() == 7 ); // currently, earliest contribution is returned } }