diff --git a/DQM/HLTEvF/plugins/TrigObjTnPHistColl.cc b/DQM/HLTEvF/plugins/TrigObjTnPHistColl.cc index 1fedb25a1476e..d52bd247487f6 100644 --- a/DQM/HLTEvF/plugins/TrigObjTnPHistColl.cc +++ b/DQM/HLTEvF/plugins/TrigObjTnPHistColl.cc @@ -122,7 +122,8 @@ void TrigObjTnPHistColl::FilterSelector::mergeTrigKeys(trigger::Keys& keys, void TrigObjTnPHistColl::FilterSelector::cleanTrigKeys(trigger::Keys& keys) { std::sort(keys.begin(), keys.end()); - std::unique(keys.begin(), keys.end()); + auto last = std::unique(keys.begin(), keys.end()); + keys.erase(last, keys.end()); while (!keys.empty() && keys.back() == std::numeric_limits::max()) { keys.pop_back(); } diff --git a/DQMOffline/RecoB/src/BTagDifferentialPlot.cc b/DQMOffline/RecoB/src/BTagDifferentialPlot.cc index 0197429433f71..cb55fcbe43d50 100644 --- a/DQMOffline/RecoB/src/BTagDifferentialPlot.cc +++ b/DQMOffline/RecoB/src/BTagDifferentialPlot.cc @@ -222,7 +222,8 @@ void BTagDifferentialPlot::bookHisto(DQMStore::IBooker& ibook) { stream << constVariableValue.second << "_" << "_Vs_" << diffVariableName; commonName += stream.str(); - std::remove(commonName.begin(), commonName.end(), ' '); + auto last = std::remove(commonName.begin(), commonName.end(), ' '); + commonName.erase(last, commonName.end()); std::replace(commonName.begin(), commonName.end(), '.', 'v'); std::string label(commonName); diff --git a/DQMOffline/RecoB/src/EtaPtBin.cc b/DQMOffline/RecoB/src/EtaPtBin.cc index cb7bd304499d1..61fac48f156a4 100644 --- a/DQMOffline/RecoB/src/EtaPtBin.cc +++ b/DQMOffline/RecoB/src/EtaPtBin.cc @@ -34,7 +34,8 @@ std::string EtaPtBin::buildDescriptionString(const bool& etaActive_, std::string descr(stream.str()); // remove blanks which are introduced when adding doubles - std::remove(descr.begin(), descr.end(), ' '); + auto last = std::remove(descr.begin(), descr.end(), ' '); + descr.erase(last, descr.end()); std::replace(descr.begin(), descr.end(), '.', 'v'); return descr; diff --git a/PhysicsTools/PatAlgos/plugins/PATElectronProducer.cc b/PhysicsTools/PatAlgos/plugins/PATElectronProducer.cc index 045630c611f15..2398bc0603751 100644 --- a/PhysicsTools/PatAlgos/plugins/PATElectronProducer.cc +++ b/PhysicsTools/PatAlgos/plugins/PATElectronProducer.cc @@ -724,7 +724,8 @@ void PATElectronProducer::produce(edm::Event& iEvent, const edm::EventSetup& iSe //remove duplicates std::sort(selectedCells.begin(), selectedCells.end()); - std::unique(selectedCells.begin(), selectedCells.end()); + auto last = std::unique(selectedCells.begin(), selectedCells.end()); + selectedCells.erase(last, selectedCells.end()); // Retrieve the corresponding RecHits @@ -968,7 +969,8 @@ void PATElectronProducer::produce(edm::Event& iEvent, const edm::EventSetup& iSe //remove duplicates std::sort(selectedCells.begin(), selectedCells.end()); - std::unique(selectedCells.begin(), selectedCells.end()); + auto last = std::unique(selectedCells.begin(), selectedCells.end()); + selectedCells.erase(last, selectedCells.end()); // Retrieve the corresponding RecHits diff --git a/PhysicsTools/PatAlgos/plugins/PATPhotonProducer.cc b/PhysicsTools/PatAlgos/plugins/PATPhotonProducer.cc index f634776701a19..f4a768866056b 100644 --- a/PhysicsTools/PatAlgos/plugins/PATPhotonProducer.cc +++ b/PhysicsTools/PatAlgos/plugins/PATPhotonProducer.cc @@ -417,7 +417,8 @@ void PATPhotonProducer::produce(edm::Event& iEvent, const edm::EventSetup& iSetu //remove duplicates std::sort(selectedCells.begin(), selectedCells.end()); - std::unique(selectedCells.begin(), selectedCells.end()); + auto last = std::unique(selectedCells.begin(), selectedCells.end()); + selectedCells.erase(last, selectedCells.end()); // Retrieve the corresponding RecHits diff --git a/RecoEcal/EgammaClusterProducers/src/InterestingDetIdCollectionProducer.cc b/RecoEcal/EgammaClusterProducers/src/InterestingDetIdCollectionProducer.cc index 1e7cf14b6a960..495bf3a2e6c8b 100644 --- a/RecoEcal/EgammaClusterProducers/src/InterestingDetIdCollectionProducer.cc +++ b/RecoEcal/EgammaClusterProducers/src/InterestingDetIdCollectionProducer.cc @@ -194,7 +194,8 @@ void InterestingDetIdCollectionProducer::produce(edm::StreamID, //unify the vector std::sort(indexToStore.begin(), indexToStore.end()); - std::unique(indexToStore.begin(), indexToStore.end()); + auto last = std::unique(indexToStore.begin(), indexToStore.end()); + indexToStore.erase(last, indexToStore.end()); iEvent.put(std::make_unique(indexToStore), interestingDetIdCollection_); } diff --git a/RecoEcal/EgammaClusterProducers/src/InterestingDetIdFromSuperClusterProducer.cc b/RecoEcal/EgammaClusterProducers/src/InterestingDetIdFromSuperClusterProducer.cc index 223a7cd9434d9..4abfe0972e3e9 100644 --- a/RecoEcal/EgammaClusterProducers/src/InterestingDetIdFromSuperClusterProducer.cc +++ b/RecoEcal/EgammaClusterProducers/src/InterestingDetIdFromSuperClusterProducer.cc @@ -193,7 +193,8 @@ void InterestingDetIdFromSuperClusterProducer::produce(edm::StreamID, //unify the vector std::sort(indexToStore.begin(), indexToStore.end()); - std::unique(indexToStore.begin(), indexToStore.end()); + auto last = std::unique(indexToStore.begin(), indexToStore.end()); + indexToStore.erase(last, indexToStore.end()); auto detIdCollection = std::make_unique(indexToStore); diff --git a/RecoEcal/EgammaClusterProducers/src/ReducedRecHitCollectionProducer.cc b/RecoEcal/EgammaClusterProducers/src/ReducedRecHitCollectionProducer.cc index de1e473296ae0..2ab276a807284 100644 --- a/RecoEcal/EgammaClusterProducers/src/ReducedRecHitCollectionProducer.cc +++ b/RecoEcal/EgammaClusterProducers/src/ReducedRecHitCollectionProducer.cc @@ -117,7 +117,8 @@ void ReducedRecHitCollectionProducer::produce(edm::Event& iEvent, const edm::Eve } std::sort(xtalsToStore.begin(), xtalsToStore.end()); - std::unique(xtalsToStore.begin(), xtalsToStore.end()); + auto last = std::unique(xtalsToStore.begin(), xtalsToStore.end()); + xtalsToStore.erase(last, xtalsToStore.end()); // std::cout << "New Collection " << reducedHitsCollection_ << " size is " << miniRecHitCollection->size() << " original is " << recHitsHandle->size() << std::endl; iEvent.put(std::move(miniRecHitCollection), reducedHitsCollection_); diff --git a/RecoEgamma/EgammaIsolationAlgos/plugins/EgammaIsoESDetIdCollectionProducer.cc b/RecoEgamma/EgammaIsolationAlgos/plugins/EgammaIsoESDetIdCollectionProducer.cc index 984eb75aa4e94..1e6ef55ac2e51 100644 --- a/RecoEgamma/EgammaIsolationAlgos/plugins/EgammaIsoESDetIdCollectionProducer.cc +++ b/RecoEgamma/EgammaIsolationAlgos/plugins/EgammaIsoESDetIdCollectionProducer.cc @@ -114,7 +114,8 @@ void EgammaIsoESDetIdCollectionProducer::produce(edm::StreamID, edm::Event& iEve //unify the vector std::sort(indexToStore.begin(), indexToStore.end()); - std::unique(indexToStore.begin(), indexToStore.end()); + auto last = std::unique(indexToStore.begin(), indexToStore.end()); + indexToStore.erase(last, indexToStore.end()); auto detIdCollection = std::make_unique(indexToStore); diff --git a/RecoEgamma/EgammaIsolationAlgos/plugins/EgammaIsoHcalDetIdCollectionProducer.cc b/RecoEgamma/EgammaIsolationAlgos/plugins/EgammaIsoHcalDetIdCollectionProducer.cc index 88af1bb46b23a..c89f6d9752cc3 100644 --- a/RecoEgamma/EgammaIsolationAlgos/plugins/EgammaIsoHcalDetIdCollectionProducer.cc +++ b/RecoEgamma/EgammaIsolationAlgos/plugins/EgammaIsoHcalDetIdCollectionProducer.cc @@ -125,7 +125,8 @@ void EgammaIsoHcalDetIdCollectionProducer::produce(edm::Event& iEvent, const edm //unify the vector std::sort(indexToStore.begin(), indexToStore.end()); - std::unique(indexToStore.begin(), indexToStore.end()); + auto last = std::unique(indexToStore.begin(), indexToStore.end()); + indexToStore.erase(last, indexToStore.end()); auto detIdCollection = std::make_unique(indexToStore); diff --git a/RecoLocalTracker/SiPixelClusterizer/plugins/PixelThresholdClusterizer.cc b/RecoLocalTracker/SiPixelClusterizer/plugins/PixelThresholdClusterizer.cc index 30273146b16e9..04539850371c1 100644 --- a/RecoLocalTracker/SiPixelClusterizer/plugins/PixelThresholdClusterizer.cc +++ b/RecoLocalTracker/SiPixelClusterizer/plugins/PixelThresholdClusterizer.cc @@ -246,7 +246,8 @@ void PixelThresholdClusterizer::copy_to_buffer(DigiIterator begin, DigiIterator // the 2nd occurrence (duplicate pixel: reset the buffer to 0 and remove from the list of seed pixels) case 2: theBuffer.set_adc(row, col, 0); - std::remove(theSeeds.begin(), theSeeds.end(), SiPixelCluster::PixelPos(row, col)); + auto last = std::remove(theSeeds.begin(), theSeeds.end(), SiPixelCluster::PixelPos(row, col)); + theSeeds.erase(last, theSeeds.end()); break; // in case a pixel appears more than twice, nothing needs to be done because it was already removed at the 2nd occurrence