From 1952c290234940523ee9cce5c07960e9da1772f1 Mon Sep 17 00:00:00 2001 From: Sam Harper Date: Tue, 26 Apr 2022 09:09:47 +0200 Subject: [PATCH 1/2] making copy of temporary returned std::vector --- EventFilter/Utilities/plugins/FRDStreamSource.cc | 6 ++++-- EventFilter/Utilities/plugins/FRDStreamSource.h | 1 + 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/EventFilter/Utilities/plugins/FRDStreamSource.cc b/EventFilter/Utilities/plugins/FRDStreamSource.cc index 2fe77bc35f367..d9d51a7f1b9b9 100644 --- a/EventFilter/Utilities/plugins/FRDStreamSource.cc +++ b/EventFilter/Utilities/plugins/FRDStreamSource.cc @@ -22,8 +22,9 @@ FRDStreamSource::FRDStreamSource(edm::ParameterSet const& pset, edm::InputSource verifyAdler32_(pset.getUntrackedParameter("verifyAdler32", true)), verifyChecksum_(pset.getUntrackedParameter("verifyChecksum", true)), useL1EventID_(pset.getUntrackedParameter("useL1EventID", false)) { - itFileName_ = fileNames(0).begin(); - endFileName_ = fileNames(0).end(); + fileNames_ = fileNames(0), + itFileName_ = fileNames_.begin(); + endFileName_ = fileNames_.end(); openFile(*itFileName_); produces(); } @@ -31,6 +32,7 @@ FRDStreamSource::FRDStreamSource(edm::ParameterSet const& pset, edm::InputSource bool FRDStreamSource::setRunAndEventInfo(edm::EventID& id, edm::TimeValue_t& theTime, edm::EventAuxiliary::ExperimentType& eType) { + if (fin_.peek() == EOF) { if (++itFileName_ == endFileName_) { fin_.close(); diff --git a/EventFilter/Utilities/plugins/FRDStreamSource.h b/EventFilter/Utilities/plugins/FRDStreamSource.h index 2250ad63885d4..7a52810acea2d 100644 --- a/EventFilter/Utilities/plugins/FRDStreamSource.h +++ b/EventFilter/Utilities/plugins/FRDStreamSource.h @@ -34,6 +34,7 @@ class FRDStreamSource : public edm::ProducerSourceFromFiles { private: // member data + std::vector fileNames_; std::vector::const_iterator itFileName_; std::vector::const_iterator endFileName_; std::ifstream fin_; From 67781c4edbecc870d48e91258fa93e2622e0ba5b Mon Sep 17 00:00:00 2001 From: Sam Harper Date: Tue, 26 Apr 2022 09:11:41 +0200 Subject: [PATCH 2/2] code checks/format --- EventFilter/Utilities/plugins/FRDStreamSource.cc | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/EventFilter/Utilities/plugins/FRDStreamSource.cc b/EventFilter/Utilities/plugins/FRDStreamSource.cc index d9d51a7f1b9b9..1a0c9129ff9fd 100644 --- a/EventFilter/Utilities/plugins/FRDStreamSource.cc +++ b/EventFilter/Utilities/plugins/FRDStreamSource.cc @@ -22,8 +22,7 @@ FRDStreamSource::FRDStreamSource(edm::ParameterSet const& pset, edm::InputSource verifyAdler32_(pset.getUntrackedParameter("verifyAdler32", true)), verifyChecksum_(pset.getUntrackedParameter("verifyChecksum", true)), useL1EventID_(pset.getUntrackedParameter("useL1EventID", false)) { - fileNames_ = fileNames(0), - itFileName_ = fileNames_.begin(); + fileNames_ = fileNames(0), itFileName_ = fileNames_.begin(); endFileName_ = fileNames_.end(); openFile(*itFileName_); produces(); @@ -32,7 +31,6 @@ FRDStreamSource::FRDStreamSource(edm::ParameterSet const& pset, edm::InputSource bool FRDStreamSource::setRunAndEventInfo(edm::EventID& id, edm::TimeValue_t& theTime, edm::EventAuxiliary::ExperimentType& eType) { - if (fin_.peek() == EOF) { if (++itFileName_ == endFileName_) { fin_.close();