From e7846d53fb5e57ef69c434b87e2989544d7f74b7 Mon Sep 17 00:00:00 2001 From: Cms Build Date: Wed, 8 Apr 2020 16:07:25 +0200 Subject: [PATCH 1/2] Clang-tidy --- .../plugins/TemplatedSecondaryVertexProducer.cc | 2 +- RecoHI/HiJetAlgos/src/MultipleAlgoIterator.cc | 6 +++++- RecoJets/JetProducers/plugins/CATopJetProducer.cc | 6 +++++- RecoJets/JetProducers/plugins/CSJetProducer.cc | 6 +++++- RecoJets/JetProducers/plugins/ECFAdder.cc | 2 +- RecoJets/JetProducers/plugins/FastjetJetProducer.cc | 4 ++-- RecoJets/JetProducers/plugins/HTTTopJetProducer.cc | 6 +++++- RecoJets/JetProducers/plugins/NjettinessAdder.cc | 2 +- RecoJets/JetProducers/plugins/SubEventGenJetProducer.cc | 6 +++++- RecoJets/JetProducers/plugins/VirtualJetProducer.cc | 2 +- RecoJets/JetProducers/src/PileUpSubtractor.cc | 6 ++++-- .../LumiProducer/plugins/LumiProducerFromBrilcalc.cc | 6 +++--- RecoTauTag/RecoTau/src/RecoTauConstructor.cc | 6 +++++- 13 files changed, 43 insertions(+), 17 deletions(-) diff --git a/RecoBTag/SecondaryVertex/plugins/TemplatedSecondaryVertexProducer.cc b/RecoBTag/SecondaryVertex/plugins/TemplatedSecondaryVertexProducer.cc index 73547526a3355..faac3f6c490d7 100644 --- a/RecoBTag/SecondaryVertex/plugins/TemplatedSecondaryVertexProducer.cc +++ b/RecoBTag/SecondaryVertex/plugins/TemplatedSecondaryVertexProducer.cc @@ -295,7 +295,7 @@ TemplatedSecondaryVertexProducer::TemplatedSecondaryVertexProducer(co token_fatJets = consumes >(params.getParameter("fatJets")); } edm::InputTag srcWeights = params.getParameter("weights"); - if (srcWeights.label() != "") + if (!srcWeights.label().empty()) token_weights = consumes >(srcWeights); if (useGroomedFatJets) { token_groomedFatJets = consumes >(params.getParameter("groomedFatJets")); diff --git a/RecoHI/HiJetAlgos/src/MultipleAlgoIterator.cc b/RecoHI/HiJetAlgos/src/MultipleAlgoIterator.cc index a85ba07fe2968..d893664638cf9 100644 --- a/RecoHI/HiJetAlgos/src/MultipleAlgoIterator.cc +++ b/RecoHI/HiJetAlgos/src/MultipleAlgoIterator.cc @@ -1,3 +1,7 @@ +#include + + + #include "RecoHI/HiJetAlgos/interface/MultipleAlgoIterator.h" #include "DataFormats/Candidate/interface/CandidateFwd.h" #include "DataFormats/Candidate/interface/Candidate.h" @@ -22,7 +26,7 @@ void MultipleAlgoIterator::offsetCorrectJets() { subtractPedestal(*fjInputs_); const fastjet::JetDefinition& def = *fjJetDefinition_; if (!doAreaFastjet_ && !doRhoFastjet_) { - fjClusterSeq_ = ClusterSequencePtr(new fastjet::ClusterSequence(*fjInputs_, def)); + fjClusterSeq_ = std::make_shared(*fjInputs_, def); } else { fjClusterSeq_ = ClusterSequencePtr(new fastjet::ClusterSequenceArea(*fjInputs_, def, *fjActiveArea_)); } diff --git a/RecoJets/JetProducers/plugins/CATopJetProducer.cc b/RecoJets/JetProducers/plugins/CATopJetProducer.cc index 071c46000869c..e516e72394f42 100644 --- a/RecoJets/JetProducers/plugins/CATopJetProducer.cc +++ b/RecoJets/JetProducers/plugins/CATopJetProducer.cc @@ -1,5 +1,9 @@ #include "FWCore/Framework/interface/MakerMacros.h" #include "RecoJets/JetProducers/plugins/CATopJetProducer.h" + + +#include + #include "RecoJets/JetProducers/plugins/FastjetJetProducer.h" using namespace edm; @@ -64,7 +68,7 @@ void CATopJetProducer::produce(edm::Event& e, const edm::EventSetup& c) { Fastje void CATopJetProducer::runAlgorithm(edm::Event& iEvent, const edm::EventSetup& iSetup) { if (!doAreaFastjet_ && !doRhoFastjet_) { - fjClusterSeq_ = ClusterSequencePtr(new fastjet::ClusterSequence(fjInputs_, *fjJetDefinition_)); + fjClusterSeq_ = std::make_shared(fjInputs_, *fjJetDefinition_); } else if (voronoiRfact_ <= 0) { fjClusterSeq_ = ClusterSequencePtr(new fastjet::ClusterSequenceArea(fjInputs_, *fjJetDefinition_, *fjAreaDefinition_)); diff --git a/RecoJets/JetProducers/plugins/CSJetProducer.cc b/RecoJets/JetProducers/plugins/CSJetProducer.cc index 3b2071b2bdb84..1b5092dcc38db 100644 --- a/RecoJets/JetProducers/plugins/CSJetProducer.cc +++ b/RecoJets/JetProducers/plugins/CSJetProducer.cc @@ -1,5 +1,9 @@ #include "FWCore/Framework/interface/MakerMacros.h" #include "RecoJets/JetProducers/plugins/CSJetProducer.h" + + +#include + #include "FWCore/Utilities/interface/Exception.h" #include "RecoJets/JetProducers/interface/JetSpecific.h" @@ -32,7 +36,7 @@ void CSJetProducer::produce(edm::Event& iEvent, const edm::EventSetup& iSetup) { void CSJetProducer::runAlgorithm(edm::Event& iEvent, edm::EventSetup const& iSetup) { // run algorithm if (!doAreaFastjet_ && !doRhoFastjet_) { - fjClusterSeq_ = ClusterSequencePtr(new fastjet::ClusterSequence(fjInputs_, *fjJetDefinition_)); + fjClusterSeq_ = std::make_shared(fjInputs_, *fjJetDefinition_); } else if (voronoiRfact_ <= 0) { fjClusterSeq_ = ClusterSequencePtr(new fastjet::ClusterSequenceArea(fjInputs_, *fjJetDefinition_, *fjAreaDefinition_)); diff --git a/RecoJets/JetProducers/plugins/ECFAdder.cc b/RecoJets/JetProducers/plugins/ECFAdder.cc index aa808d0ef42ee..b51e825a8a853 100644 --- a/RecoJets/JetProducers/plugins/ECFAdder.cc +++ b/RecoJets/JetProducers/plugins/ECFAdder.cc @@ -19,7 +19,7 @@ ECFAdder::ECFAdder(const edm::ParameterSet& iConfig) } edm::InputTag srcWeights = iConfig.getParameter("srcWeights"); - if (srcWeights.label() != "") + if (!srcWeights.label().empty()) input_weights_token_ = consumes>(srcWeights); for (std::vector::const_iterator n = Njets_.begin(); n != Njets_.end(); ++n) { diff --git a/RecoJets/JetProducers/plugins/FastjetJetProducer.cc b/RecoJets/JetProducers/plugins/FastjetJetProducer.cc index 2f00bd7d80ef9..c6d54e0aa723a 100644 --- a/RecoJets/JetProducers/plugins/FastjetJetProducer.cc +++ b/RecoJets/JetProducers/plugins/FastjetJetProducer.cc @@ -74,7 +74,7 @@ FastjetJetProducer::FastjetJetProducer(const edm::ParameterSet& iConfig) : Virtu nFilt_ = iConfig.getParameter("nFilt"); useDynamicFiltering_ = iConfig.getParameter("useDynamicFiltering"); if (useDynamicFiltering_) - rFiltDynamic_ = DynamicRfiltPtr(new DynamicRfilt(rFilt_, rFiltFactor_)); + rFiltDynamic_ = std::make_shared(rFilt_, rFiltFactor_); rFiltFactor_ = iConfig.getParameter("rFiltFactor"); useTrimming_ = iConfig.getParameter("useTrimming"); @@ -355,7 +355,7 @@ void FastjetJetProducer::runAlgorithm(edm::Event& iEvent, edm::EventSetup const& */ if (!doAreaFastjet_ && !doRhoFastjet_) { - fjClusterSeq_ = ClusterSequencePtr(new fastjet::ClusterSequence(fjInputs_, *fjJetDefinition_)); + fjClusterSeq_ = std::make_shared(fjInputs_, *fjJetDefinition_); } else if (voronoiRfact_ <= 0) { fjClusterSeq_ = ClusterSequencePtr(new fastjet::ClusterSequenceArea(fjInputs_, *fjJetDefinition_, *fjAreaDefinition_)); diff --git a/RecoJets/JetProducers/plugins/HTTTopJetProducer.cc b/RecoJets/JetProducers/plugins/HTTTopJetProducer.cc index 61cf21ea3fa9a..cd59cb7e5eca4 100644 --- a/RecoJets/JetProducers/plugins/HTTTopJetProducer.cc +++ b/RecoJets/JetProducers/plugins/HTTTopJetProducer.cc @@ -3,6 +3,10 @@ #include "DataFormats/JetReco/interface/BasicJetCollection.h" #include "HTTTopJetProducer.h" + +#include + + using namespace edm; using namespace cms; using namespace reco; @@ -90,7 +94,7 @@ void HTTTopJetProducer::produce(edm::Event& e, const edm::EventSetup& c) { void HTTTopJetProducer::runAlgorithm(edm::Event& iEvent, const edm::EventSetup& iSetup) { if (!doAreaFastjet_ && !doRhoFastjet_) { - fjClusterSeq_ = ClusterSequencePtr(new fastjet::ClusterSequence(fjInputs_, *fjJetDefinition_)); + fjClusterSeq_ = std::make_shared(fjInputs_, *fjJetDefinition_); } else if (voronoiRfact_ <= 0) { fjClusterSeq_ = ClusterSequencePtr(new fastjet::ClusterSequenceArea(fjInputs_, *fjJetDefinition_, *fjAreaDefinition_)); diff --git a/RecoJets/JetProducers/plugins/NjettinessAdder.cc b/RecoJets/JetProducers/plugins/NjettinessAdder.cc index db8e6b23587a5..e09a7dd575a3d 100644 --- a/RecoJets/JetProducers/plugins/NjettinessAdder.cc +++ b/RecoJets/JetProducers/plugins/NjettinessAdder.cc @@ -14,7 +14,7 @@ NjettinessAdder::NjettinessAdder(const edm::ParameterSet& iConfig) nPass_(iConfig.getParameter("nPass")), akAxesR0_(iConfig.getParameter("akAxesR0")) { edm::InputTag srcWeights = iConfig.getParameter("srcWeights"); - if (srcWeights.label() != "") + if (!srcWeights.label().empty()) input_weights_token_ = consumes>(srcWeights); for (std::vector::const_iterator n = Njets_.begin(); n != Njets_.end(); ++n) { diff --git a/RecoJets/JetProducers/plugins/SubEventGenJetProducer.cc b/RecoJets/JetProducers/plugins/SubEventGenJetProducer.cc index 1424fa863d3be..e7474281a614d 100644 --- a/RecoJets/JetProducers/plugins/SubEventGenJetProducer.cc +++ b/RecoJets/JetProducers/plugins/SubEventGenJetProducer.cc @@ -1,6 +1,10 @@ #include "FWCore/Framework/interface/MakerMacros.h" #include "RecoJets/JetProducers/plugins/SubEventGenJetProducer.h" + + +#include + #include "FWCore/Utilities/interface/Exception.h" #include "FWCore/Utilities/interface/isFinite.h" #include "RecoJets/JetProducers/interface/JetSpecific.h" @@ -128,7 +132,7 @@ void SubEventGenJetProducer::runAlgorithm(edm::Event& iEvent, edm::EventSetup co // run algorithm fjJets_.clear(); - fjClusterSeq_ = ClusterSequencePtr(new fastjet::ClusterSequence(fjInputs_, *fjJetDefinition_)); + fjClusterSeq_ = std::make_shared(fjInputs_, *fjJetDefinition_); fjJets_ = fastjet::sorted_by_pt(fjClusterSeq_->inclusive_jets(jetPtMin_)); using namespace reco; diff --git a/RecoJets/JetProducers/plugins/VirtualJetProducer.cc b/RecoJets/JetProducers/plugins/VirtualJetProducer.cc index 6fb7a81916f0c..966c90a9b003c 100644 --- a/RecoJets/JetProducers/plugins/VirtualJetProducer.cc +++ b/RecoJets/JetProducers/plugins/VirtualJetProducer.cc @@ -154,7 +154,7 @@ VirtualJetProducer::VirtualJetProducer(const edm::ParameterSet& iConfig) { if (srcWeights.label() == src_.label()) LogWarning("VirtualJetProducer") << "Particle and weights collection have the same label. You may be applying the same weights twice.\n"; - if (srcWeights.label() != "") + if (!srcWeights.label().empty()) input_weights_token_ = consumes>(srcWeights); } diff --git a/RecoJets/JetProducers/src/PileUpSubtractor.cc b/RecoJets/JetProducers/src/PileUpSubtractor.cc index 13b1a75fd236d..30ccf6cd06793 100644 --- a/RecoJets/JetProducers/src/PileUpSubtractor.cc +++ b/RecoJets/JetProducers/src/PileUpSubtractor.cc @@ -13,6 +13,8 @@ #include "Geometry/Records/interface/CaloGeometryRecord.h" #include +#include + using namespace std; PileUpSubtractor::PileUpSubtractor(const edm::ParameterSet& iConfig, edm::ConsumesCollector&& iC) { @@ -28,7 +30,7 @@ PileUpSubtractor::PileUpSubtractor(const edm::ParameterSet& iConfig, edm::Consum ghostArea = iConfig.getParameter("GhostArea"); if (doAreaFastjet_ || doRhoFastjet_) { - fjActiveArea_ = ActiveAreaSpecPtr(new fastjet::ActiveAreaSpec(ghostEtaMax, activeAreaRepeats, ghostArea)); + fjActiveArea_ = std::make_shared(ghostEtaMax, activeAreaRepeats, ghostArea); if ((ghostEtaMax < 0) || (activeAreaRepeats < 0) || (ghostArea < 0)) throw cms::Exception("doAreaFastjet or doRhoFastjet") << "Parameters ghostEtaMax, activeAreaRepeats or ghostArea for doAreaFastjet/doRhoFastjet are not defined." @@ -49,7 +51,7 @@ void PileUpSubtractor::reset(std::vector >& input, } void PileUpSubtractor::setDefinition(JetDefPtr const& jetDef) { - fjJetDefinition_ = JetDefPtr(new fastjet::JetDefinition(*jetDef)); + fjJetDefinition_ = std::make_shared(*jetDef); } void PileUpSubtractor::setupGeometryMap(edm::Event& iEvent, const edm::EventSetup& iSetup) { diff --git a/RecoLuminosity/LumiProducer/plugins/LumiProducerFromBrilcalc.cc b/RecoLuminosity/LumiProducer/plugins/LumiProducerFromBrilcalc.cc index e405550435a83..38f38e40354c0 100644 --- a/RecoLuminosity/LumiProducer/plugins/LumiProducerFromBrilcalc.cc +++ b/RecoLuminosity/LumiProducer/plugins/LumiProducerFromBrilcalc.cc @@ -42,12 +42,12 @@ class LumiProducerFromBrilcalc : public edm::global::EDProducer<> { public: explicit LumiProducerFromBrilcalc(const edm::ParameterSet&); - ~LumiProducerFromBrilcalc() = default; + ~LumiProducerFromBrilcalc() override = default; static void fillDescriptions(edm::ConfigurationDescriptions& descriptions); private: - virtual void produce(edm::StreamID, edm::Event&, const edm::EventSetup&) const override; + void produce(edm::StreamID, edm::Event&, const edm::EventSetup&) const override; // ----------member data --------------------------- const std::string lumiFile_; @@ -82,7 +82,7 @@ LumiProducerFromBrilcalc::LumiProducerFromBrilcalc(const edm::ParameterSet& iCon int nLS = 0; std::string line; - while (1) { + while (true) { std::getline(lumiFile, line); if (lumiFile.eof() || lumiFile.fail()) break; diff --git a/RecoTauTag/RecoTau/src/RecoTauConstructor.cc b/RecoTauTag/RecoTau/src/RecoTauConstructor.cc index f2cae4d5d6f58..d897707557c48 100644 --- a/RecoTauTag/RecoTau/src/RecoTauConstructor.cc +++ b/RecoTauTag/RecoTau/src/RecoTauConstructor.cc @@ -1,3 +1,7 @@ +#include + + + #include "RecoTauTag/RecoTau/interface/RecoTauConstructor.h" #include "RecoTauTag/RecoTau/interface/RecoTauCommonUtilities.h" @@ -42,7 +46,7 @@ namespace reco::tau { // RefVectors for (auto const& colkey : collections_) { // Build an empty list for each collection - sortedCollections_[colkey.first] = SortedListPtr(new SortedListPtr::element_type); + sortedCollections_[colkey.first] = std::make_shared(); } tau_->setjetRef(jet); From 9144d9e08a9d058695724e22241092228d27acd6 Mon Sep 17 00:00:00 2001 From: Cms Build Date: Wed, 8 Apr 2020 16:07:34 +0200 Subject: [PATCH 2/2] Clang-Format --- RecoHI/HiJetAlgos/src/MultipleAlgoIterator.cc | 2 -- RecoJets/JetProducers/plugins/CATopJetProducer.cc | 1 - RecoJets/JetProducers/plugins/CSJetProducer.cc | 1 - RecoJets/JetProducers/plugins/HTTTopJetProducer.cc | 2 -- RecoJets/JetProducers/plugins/SubEventGenJetProducer.cc | 1 - RecoTauTag/RecoTau/src/RecoTauConstructor.cc | 2 -- 6 files changed, 9 deletions(-) diff --git a/RecoHI/HiJetAlgos/src/MultipleAlgoIterator.cc b/RecoHI/HiJetAlgos/src/MultipleAlgoIterator.cc index d893664638cf9..7acb4c1065028 100644 --- a/RecoHI/HiJetAlgos/src/MultipleAlgoIterator.cc +++ b/RecoHI/HiJetAlgos/src/MultipleAlgoIterator.cc @@ -1,7 +1,5 @@ #include - - #include "RecoHI/HiJetAlgos/interface/MultipleAlgoIterator.h" #include "DataFormats/Candidate/interface/CandidateFwd.h" #include "DataFormats/Candidate/interface/Candidate.h" diff --git a/RecoJets/JetProducers/plugins/CATopJetProducer.cc b/RecoJets/JetProducers/plugins/CATopJetProducer.cc index e516e72394f42..58bc31f1bc127 100644 --- a/RecoJets/JetProducers/plugins/CATopJetProducer.cc +++ b/RecoJets/JetProducers/plugins/CATopJetProducer.cc @@ -1,7 +1,6 @@ #include "FWCore/Framework/interface/MakerMacros.h" #include "RecoJets/JetProducers/plugins/CATopJetProducer.h" - #include #include "RecoJets/JetProducers/plugins/FastjetJetProducer.h" diff --git a/RecoJets/JetProducers/plugins/CSJetProducer.cc b/RecoJets/JetProducers/plugins/CSJetProducer.cc index 1b5092dcc38db..4c8f69505e9c4 100644 --- a/RecoJets/JetProducers/plugins/CSJetProducer.cc +++ b/RecoJets/JetProducers/plugins/CSJetProducer.cc @@ -1,7 +1,6 @@ #include "FWCore/Framework/interface/MakerMacros.h" #include "RecoJets/JetProducers/plugins/CSJetProducer.h" - #include #include "FWCore/Utilities/interface/Exception.h" diff --git a/RecoJets/JetProducers/plugins/HTTTopJetProducer.cc b/RecoJets/JetProducers/plugins/HTTTopJetProducer.cc index cd59cb7e5eca4..6d0c467f4b0d9 100644 --- a/RecoJets/JetProducers/plugins/HTTTopJetProducer.cc +++ b/RecoJets/JetProducers/plugins/HTTTopJetProducer.cc @@ -3,10 +3,8 @@ #include "DataFormats/JetReco/interface/BasicJetCollection.h" #include "HTTTopJetProducer.h" - #include - using namespace edm; using namespace cms; using namespace reco; diff --git a/RecoJets/JetProducers/plugins/SubEventGenJetProducer.cc b/RecoJets/JetProducers/plugins/SubEventGenJetProducer.cc index e7474281a614d..0e8a7b75a8418 100644 --- a/RecoJets/JetProducers/plugins/SubEventGenJetProducer.cc +++ b/RecoJets/JetProducers/plugins/SubEventGenJetProducer.cc @@ -2,7 +2,6 @@ #include "FWCore/Framework/interface/MakerMacros.h" #include "RecoJets/JetProducers/plugins/SubEventGenJetProducer.h" - #include #include "FWCore/Utilities/interface/Exception.h" diff --git a/RecoTauTag/RecoTau/src/RecoTauConstructor.cc b/RecoTauTag/RecoTau/src/RecoTauConstructor.cc index d897707557c48..f0fcb0f53f11b 100644 --- a/RecoTauTag/RecoTau/src/RecoTauConstructor.cc +++ b/RecoTauTag/RecoTau/src/RecoTauConstructor.cc @@ -1,7 +1,5 @@ #include - - #include "RecoTauTag/RecoTau/interface/RecoTauConstructor.h" #include "RecoTauTag/RecoTau/interface/RecoTauCommonUtilities.h"