From a1ac0f7d981987f849387a24efe85912de1d5d0a Mon Sep 17 00:00:00 2001 From: Juraj Smiesko Date: Wed, 4 Oct 2023 12:48:50 +0200 Subject: [PATCH] SimG4SaveTrackerHits: Eliminate m_readoutNames from saveOutput method --- SimG4Components/src/SimG4SaveTrackerHits.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/SimG4Components/src/SimG4SaveTrackerHits.cpp b/SimG4Components/src/SimG4SaveTrackerHits.cpp index 7b8cc09..9a82a26 100644 --- a/SimG4Components/src/SimG4SaveTrackerHits.cpp +++ b/SimG4Components/src/SimG4SaveTrackerHits.cpp @@ -51,10 +51,11 @@ StatusCode SimG4SaveTrackerHits::initialize() { if (!m_readoutNames.empty()) { warning() << "Providing multiple readout names deprecated." << endmsg; - warning() << "Please use \"readoutName\" parameter instead." << endmsg; + warning() << "Please, use \"readoutName\" property instead." << endmsg; if (m_readoutNames.size() > 1) { error() << "More than one readout name provided. Exiting..." << endmsg; + return StatusCode::FAILURE; } m_readoutName = m_readoutNames[0]; @@ -97,7 +98,7 @@ StatusCode SimG4SaveTrackerHits::saveOutput(const G4Event& aEvent) { edm4hep::SimTrackerHitCollection* edmHits = m_trackHits.createAndPut(); for (int iter_coll = 0; iter_coll < collections->GetNumberOfCollections(); iter_coll++) { collect = collections->GetHC(iter_coll); - if (std::find(m_readoutNames.begin(), m_readoutNames.end(), collect->GetName()) != m_readoutNames.end()) { + if (m_readoutName == collect->GetName()) { size_t n_hit = collect->GetSize(); verbose() << "\t" << n_hit << " hits are stored in a tracker collection #" << iter_coll << ": " << collect->GetName() << endmsg;