diff --git a/GeneratorInterface/CepGenInterface/src/CepGenEventGenerator.cc b/GeneratorInterface/CepGenInterface/src/CepGenEventGenerator.cc index 4507f5d7ec415..a1cd0e42a19da 100644 --- a/GeneratorInterface/CepGenInterface/src/CepGenEventGenerator.cc +++ b/GeneratorInterface/CepGenInterface/src/CepGenEventGenerator.cc @@ -20,6 +20,8 @@ #include #include +#include + using namespace gen; CepGenEventGenerator::CepGenEventGenerator(const edm::ParameterSet& iConfig, edm::ConsumesCollector&& iC) @@ -85,7 +87,7 @@ bool CepGenEventGenerator::initializeForInternalPartons() { } bool CepGenEventGenerator::generatePartonsAndHadronize() { - event().reset(new HepMC::CepGenEvent(gen_->next())); + event() = std::make_unique(gen_->next()); event()->set_cross_section(xsec_); event()->weights().push_back(1.); return true; diff --git a/GeneratorInterface/Herwig7Interface/src/Herwig7Interface.cc b/GeneratorInterface/Herwig7Interface/src/Herwig7Interface.cc index 063676b55bce3..8ff321089d189 100644 --- a/GeneratorInterface/Herwig7Interface/src/Herwig7Interface.cc +++ b/GeneratorInterface/Herwig7Interface/src/Herwig7Interface.cc @@ -99,7 +99,7 @@ void Herwig7Interface::initRepository(const edm::ParameterSet &pset) { else runModeTemp.erase(0, pos + 1); - HwUI_.reset(new Herwig::HerwigUIProvider(pset, dumpConfig_, Herwig::RunMode::READ)); + HwUI_ = std::make_shared(pset, dumpConfig_, Herwig::RunMode::READ); edm::LogInfo("Herwig7Interface") << "HerwigUIProvider object with run mode " << HwUI_->runMode() << " created.\n"; // Chose run mode diff --git a/GeneratorInterface/LHEInterface/src/LH5Reader.cc b/GeneratorInterface/LHEInterface/src/LH5Reader.cc index dc64a6968ef14..a718b8827a7b1 100644 --- a/GeneratorInterface/LHEInterface/src/LH5Reader.cc +++ b/GeneratorInterface/LHEInterface/src/LH5Reader.cc @@ -233,7 +233,7 @@ namespace lhef { // Use temporary process info block to define const HEPRUP const HEPRUP heprup(tmprup); - curRunInfo.reset(new LHERunInfo(heprup)); + curRunInfo = std::make_shared(heprup); // Run info has now been set when a new file is encountered } // Handler should be modified to have these capabilities @@ -277,7 +277,7 @@ namespace lhef { // Use temporary event to construct const HEPEUP; const HEPEUP hepeup(tmp); - lheevent.reset(new LHEEvent(curRunInfo, hepeup)); + lheevent = std::make_shared(curRunInfo, hepeup); // Might have to add this capability later /* const XMLHandler::wgt_info &info = handler->weightsinevent; for (size_t i = 0; i < info.size(); ++i) { diff --git a/GeneratorInterface/LHEInterface/src/LHEReader.cc b/GeneratorInterface/LHEInterface/src/LHEReader.cc index 76a05926a3301..06f804b0febc8 100644 --- a/GeneratorInterface/LHEInterface/src/LHEReader.cc +++ b/GeneratorInterface/LHEInterface/src/LHEReader.cc @@ -489,7 +489,7 @@ namespace lhef { data.str(handler->buffer); handler->buffer.clear(); - curRunInfo.reset(new LHERunInfo(data)); + curRunInfo = std::make_shared(data); std::for_each(handler->headers.begin(), handler->headers.end(), @@ -521,7 +521,7 @@ namespace lhef { handler->buffer.clear(); std::shared_ptr lheevent; - lheevent.reset(new LHEEvent(curRunInfo, data)); + lheevent = std::make_shared(curRunInfo, data); const XMLHandler::wgt_info &info = handler->weightsinevent; for (size_t i = 0; i < info.size(); ++i) { double num = -1.0; diff --git a/GeneratorInterface/Pythia6Interface/src/PtYDistributor.cc b/GeneratorInterface/Pythia6Interface/src/PtYDistributor.cc index 2f8c9d9bdfbf5..26a872aa83e04 100644 --- a/GeneratorInterface/Pythia6Interface/src/PtYDistributor.cc +++ b/GeneratorInterface/Pythia6Interface/src/PtYDistributor.cc @@ -22,7 +22,7 @@ PtYDistributor::PtYDistributor(const edm::FileInPath& fip, int ybins = 50) : ptmax_(ptmax), ptmin_(ptmin), ymax_(ymax), ymin_(ymin), ptbins_(ptbins), ybins_(ybins) { // edm::FileInPath f1(input); - std::string fDataFile = fip.fullPath(); + const std::string& fDataFile = fip.fullPath(); std::cout << " File from " << fDataFile << std::endl; TFile f(fDataFile.c_str(), "READ"); diff --git a/GeneratorInterface/Pythia6Interface/src/Pythia6Service.cc b/GeneratorInterface/Pythia6Interface/src/Pythia6Service.cc index ba0be2ad86112..10a9360457a66 100644 --- a/GeneratorInterface/Pythia6Interface/src/Pythia6Service.cc +++ b/GeneratorInterface/Pythia6Interface/src/Pythia6Service.cc @@ -175,7 +175,7 @@ void Pythia6Service::setCSAParams() { for (size_t i = 0; i < SETCSAPARBUFSIZE; ++i) buf[i] = ' '; // Skip empty parameters. - if (iter->length() <= 0) + if (iter->empty()) continue; // Limit the size of the string to something which fits the buffer. size_t maxSize = iter->length() > (SETCSAPARBUFSIZE - 2) ? (SETCSAPARBUFSIZE - 2) : iter->length(); @@ -251,7 +251,7 @@ void Pythia6Service::setSLHAParams() { //std::cout << " start, end = " << start << " " << end << std::endl; std::string shortfile = iter->substr(start, end - start + 1); FileInPath f1(shortfile); - std::string file = f1.fullPath(); + const std::string& file = f1.fullPath(); /* // diff --git a/GeneratorInterface/Pythia8Interface/plugins/Pythia8HepMC3Hadronizer.cc b/GeneratorInterface/Pythia8Interface/plugins/Pythia8HepMC3Hadronizer.cc index 8d29061c09e8c..29b7f2be78be5 100644 --- a/GeneratorInterface/Pythia8Interface/plugins/Pythia8HepMC3Hadronizer.cc +++ b/GeneratorInterface/Pythia8Interface/plugins/Pythia8HepMC3Hadronizer.cc @@ -218,8 +218,8 @@ Pythia8HepMC3Hadronizer::Pythia8HepMC3Hadronizer(const edm::ParameterSet ¶ms if (params.exists("reweightGen")) { edm::LogInfo("Pythia8Interface") << "Start setup for reweightGen"; edm::ParameterSet rgParams = params.getParameter("reweightGen"); - fReweightUserHook.reset( - new PtHatReweightUserHook(rgParams.getParameter("pTRef"), rgParams.getParameter("power"))); + fReweightUserHook = std::make_shared(rgParams.getParameter("pTRef"), + rgParams.getParameter("power")); edm::LogInfo("Pythia8Interface") << "End setup for reweightGen"; } if (params.exists("reweightGenEmp")) { @@ -229,29 +229,30 @@ Pythia8HepMC3Hadronizer::Pythia8HepMC3Hadronizer(const edm::ParameterSet ¶ms std::string tuneName = ""; if (rgeParams.exists("tune")) tuneName = rgeParams.getParameter("tune"); - fReweightEmpUserHook.reset(new PtHatEmpReweightUserHook(tuneName)); + fReweightEmpUserHook = std::make_shared(tuneName); edm::LogInfo("Pythia8Interface") << "End setup for reweightGenEmp"; } if (params.exists("reweightGenRap")) { edm::LogInfo("Pythia8Interface") << "Start setup for reweightGenRap"; edm::ParameterSet rgrParams = params.getParameter("reweightGenRap"); - fReweightRapUserHook.reset(new RapReweightUserHook(rgrParams.getParameter("yLabSigmaFunc"), - rgrParams.getParameter("yLabPower"), - rgrParams.getParameter("yCMSigmaFunc"), - rgrParams.getParameter("yCMPower"), - rgrParams.getParameter("pTHatMin"), - rgrParams.getParameter("pTHatMax"))); + fReweightRapUserHook = std::make_shared(rgrParams.getParameter("yLabSigmaFunc"), + rgrParams.getParameter("yLabPower"), + rgrParams.getParameter("yCMSigmaFunc"), + rgrParams.getParameter("yCMPower"), + rgrParams.getParameter("pTHatMin"), + rgrParams.getParameter("pTHatMax")); edm::LogInfo("Pythia8Interface") << "End setup for reweightGenRap"; } if (params.exists("reweightGenPtHatRap")) { edm::LogInfo("Pythia8Interface") << "Start setup for reweightGenPtHatRap"; edm::ParameterSet rgrParams = params.getParameter("reweightGenPtHatRap"); - fReweightPtHatRapUserHook.reset(new PtHatRapReweightUserHook(rgrParams.getParameter("yLabSigmaFunc"), - rgrParams.getParameter("yLabPower"), - rgrParams.getParameter("yCMSigmaFunc"), - rgrParams.getParameter("yCMPower"), - rgrParams.getParameter("pTHatMin"), - rgrParams.getParameter("pTHatMax"))); + fReweightPtHatRapUserHook = + std::make_shared(rgrParams.getParameter("yLabSigmaFunc"), + rgrParams.getParameter("yLabPower"), + rgrParams.getParameter("yCMSigmaFunc"), + rgrParams.getParameter("yCMPower"), + rgrParams.getParameter("pTHatMin"), + rgrParams.getParameter("pTHatMax")); edm::LogInfo("Pythia8Interface") << "End setup for reweightGenPtHatRap"; } @@ -265,7 +266,7 @@ Pythia8HepMC3Hadronizer::Pythia8HepMC3Hadronizer(const edm::ParameterSet ¶ms edm::ParameterSet jmParams = params.getUntrackedParameter("jetMatching"); std::string scheme = jmParams.getParameter("scheme"); if (scheme == "Madgraph" || scheme == "MadgraphFastJet") { - fJetMatchingHook.reset(new JetMatchingHook(jmParams, &fMasterGen->info)); + fJetMatchingHook = std::make_shared(jmParams, &fMasterGen->info); } } @@ -304,17 +305,17 @@ Pythia8HepMC3Hadronizer::Pythia8HepMC3Hadronizer(const edm::ParameterSet ¶ms EV1_nFinalMode = 0; if (params.exists("EV1_nFinalMode")) EV1_nFinalMode = params.getParameter("EV1_nFinalMode"); - fEmissionVetoHook1.reset(new EmissionVetoHook1(EV1_nFinal, - EV1_vetoOn, - EV1_maxVetoCount, - EV1_pThardMode, - EV1_pTempMode, - EV1_emittedMode, - EV1_pTdefMode, - EV1_MPIvetoOn, - EV1_QEDvetoMode, - EV1_nFinalMode, - 0)); + fEmissionVetoHook1 = std::make_shared(EV1_nFinal, + EV1_vetoOn, + EV1_maxVetoCount, + EV1_pThardMode, + EV1_pTempMode, + EV1_emittedMode, + EV1_pTdefMode, + EV1_MPIvetoOn, + EV1_QEDvetoMode, + EV1_nFinalMode, + 0); } if (params.exists("UserCustomization")) { @@ -364,7 +365,7 @@ bool Pythia8HepMC3Hadronizer::initializeForInternalPartons() { } if (!fUserHooksVector.get()) - fUserHooksVector.reset(new UserHooksVector); + fUserHooksVector = std::make_shared(); (fUserHooksVector->hooks).clear(); if (fReweightUserHook.get()) @@ -389,7 +390,7 @@ bool Pythia8HepMC3Hadronizer::initializeForInternalPartons() { "are : jetMatching, emissionVeto1 \n"; if (!fEmissionVetoHook.get()) - fEmissionVetoHook.reset(new PowhegHooks()); + fEmissionVetoHook = std::make_shared(); edm::LogInfo("Pythia8Interface") << "Turning on Emission Veto Hook from pythia8 code"; (fUserHooksVector->hooks).push_back(fEmissionVetoHook); @@ -399,7 +400,7 @@ bool Pythia8HepMC3Hadronizer::initializeForInternalPartons() { if (PowhegRes) { edm::LogInfo("Pythia8Interface") << "Turning on resonance scale setting from CMSSW Pythia8Interface"; if (!fPowhegResHook.get()) - fPowhegResHook.reset(new PowhegResHook()); + fPowhegResHook = std::make_shared(); (fUserHooksVector->hooks).push_back(fPowhegResHook); } @@ -407,7 +408,7 @@ bool Pythia8HepMC3Hadronizer::initializeForInternalPartons() { if (PowhegBB4L) { edm::LogInfo("Pythia8Interface") << "Turning on BB4l hook from CMSSW Pythia8Interface"; if (!fPowhegHooksBB4L.get()) - fPowhegHooksBB4L.reset(new PowhegHooksBB4L()); + fPowhegHooksBB4L = std::make_shared(); (fUserHooksVector->hooks).push_back(fPowhegHooksBB4L); } @@ -422,7 +423,7 @@ bool Pythia8HepMC3Hadronizer::initializeForInternalPartons() { if (internalMatching) { if (!fJetMatchingPy8InternalHook.get()) - fJetMatchingPy8InternalHook.reset(new Pythia8::JetMatchingMadgraph); + fJetMatchingPy8InternalHook = std::make_shared(); (fUserHooksVector->hooks).push_back(fJetMatchingPy8InternalHook); } @@ -436,7 +437,7 @@ bool Pythia8HepMC3Hadronizer::initializeForInternalPartons() { ? 2 : 0); if (!fMergingHook.get()) - fMergingHook.reset(new Pythia8::amcnlo_unitarised_interface(scheme)); + fMergingHook = std::make_shared(scheme); (fUserHooksVector->hooks).push_back(fMergingHook); } @@ -444,7 +445,7 @@ bool Pythia8HepMC3Hadronizer::initializeForInternalPartons() { if (biasedTauDecayer) { if (!fBiasedTauDecayer.get()) { Pythia8::Info localInfo = fMasterGen->info; - fBiasedTauDecayer.reset(new BiasedTauDecayer(&localInfo, &(fMasterGen->settings))); + fBiasedTauDecayer = std::make_shared(&localInfo, &(fMasterGen->settings)); } std::vector handledParticles; handledParticles.push_back(15); @@ -453,13 +454,13 @@ bool Pythia8HepMC3Hadronizer::initializeForInternalPartons() { bool resonanceDecayFilter = fMasterGen->settings.flag("ResonanceDecayFilter:filter"); if (resonanceDecayFilter) { - fResonanceDecayFilterHook.reset(new ResonanceDecayFilterHook); + fResonanceDecayFilterHook = std::make_shared(); (fUserHooksVector->hooks).push_back(fResonanceDecayFilterHook); } bool PTFilter = fMasterGen->settings.flag("PTFilter:filter"); if (PTFilter) { - fPTFilterHook.reset(new PTFilterHook); + fPTFilterHook = std::make_shared(); (fUserHooksVector->hooks).push_back(fPTFilterHook); } @@ -501,7 +502,7 @@ bool Pythia8HepMC3Hadronizer::initializeForInternalPartons() { if (useEvtGen) { edm::LogInfo("Pythia8Hadronizer") << "Creating and initializing pythia8 EvtGen plugin"; if (!evtgenDecays.get()) { - evtgenDecays.reset(new EvtGenDecays(fMasterGen.get(), evtgenDecFile, evtgenPdlFile)); + evtgenDecays = std::make_shared(fMasterGen.get(), evtgenDecFile, evtgenPdlFile); for (unsigned int i = 0; i < evtgenUserFiles.size(); i++) evtgenDecays->readDecayFile(evtgenUserFiles.at(i)); } @@ -516,7 +517,7 @@ bool Pythia8HepMC3Hadronizer::initializeForExternalPartons() { bool status = false, status1 = false; if (!fUserHooksVector.get()) - fUserHooksVector.reset(new UserHooksVector); + fUserHooksVector = std::make_shared(); (fUserHooksVector->hooks).clear(); if (fReweightUserHook.get()) @@ -548,7 +549,7 @@ bool Pythia8HepMC3Hadronizer::initializeForExternalPartons() { "are : jetMatching, emissionVeto1 \n"; if (!fEmissionVetoHook.get()) - fEmissionVetoHook.reset(new PowhegHooks()); + fEmissionVetoHook = std::make_shared(); edm::LogInfo("Pythia8Interface") << "Turning on Emission Veto Hook from pythia8 code"; (fUserHooksVector->hooks).push_back(fEmissionVetoHook); @@ -558,7 +559,7 @@ bool Pythia8HepMC3Hadronizer::initializeForExternalPartons() { if (PowhegRes) { edm::LogInfo("Pythia8Interface") << "Turning on resonance scale setting from CMSSW Pythia8Interface"; if (!fPowhegResHook.get()) - fPowhegResHook.reset(new PowhegResHook()); + fPowhegResHook = std::make_shared(); (fUserHooksVector->hooks).push_back(fPowhegResHook); } @@ -566,7 +567,7 @@ bool Pythia8HepMC3Hadronizer::initializeForExternalPartons() { if (PowhegBB4L) { edm::LogInfo("Pythia8Interface") << "Turning on BB4l hook from CMSSW Pythia8Interface"; if (!fPowhegHooksBB4L.get()) - fPowhegHooksBB4L.reset(new PowhegHooksBB4L()); + fPowhegHooksBB4L = std::make_shared(); (fUserHooksVector->hooks).push_back(fPowhegHooksBB4L); } @@ -581,7 +582,7 @@ bool Pythia8HepMC3Hadronizer::initializeForExternalPartons() { if (internalMatching) { if (!fJetMatchingPy8InternalHook.get()) - fJetMatchingPy8InternalHook.reset(new Pythia8::JetMatchingMadgraph); + fJetMatchingPy8InternalHook = std::make_shared(); (fUserHooksVector->hooks).push_back(fJetMatchingPy8InternalHook); } @@ -595,7 +596,7 @@ bool Pythia8HepMC3Hadronizer::initializeForExternalPartons() { ? 2 : 0); if (!fMergingHook.get()) - fMergingHook.reset(new Pythia8::amcnlo_unitarised_interface(scheme)); + fMergingHook = std::make_shared(scheme); (fUserHooksVector->hooks).push_back(fMergingHook); } @@ -603,7 +604,7 @@ bool Pythia8HepMC3Hadronizer::initializeForExternalPartons() { if (biasedTauDecayer) { if (!fBiasedTauDecayer.get()) { Pythia8::Info localInfo = fMasterGen->info; - fBiasedTauDecayer.reset(new BiasedTauDecayer(&localInfo, &(fMasterGen->settings))); + fBiasedTauDecayer = std::make_shared(&localInfo, &(fMasterGen->settings)); } std::vector handledParticles; handledParticles.push_back(15); @@ -612,13 +613,13 @@ bool Pythia8HepMC3Hadronizer::initializeForExternalPartons() { bool resonanceDecayFilter = fMasterGen->settings.flag("ResonanceDecayFilter:filter"); if (resonanceDecayFilter) { - fResonanceDecayFilterHook.reset(new ResonanceDecayFilterHook); + fResonanceDecayFilterHook = std::make_shared(); (fUserHooksVector->hooks).push_back(fResonanceDecayFilterHook); } bool PTFilter = fMasterGen->settings.flag("PTFilter:filter"); if (PTFilter) { - fPTFilterHook.reset(new PTFilterHook); + fPTFilterHook = std::make_shared(); (fUserHooksVector->hooks).push_back(fPTFilterHook); } @@ -637,7 +638,7 @@ bool Pythia8HepMC3Hadronizer::initializeForExternalPartons() { status = fMasterGen->init(); } else { - lhaUP.reset(new LHAupLesHouches()); + lhaUP = std::make_shared(); lhaUP->setScalesFromLHEF(fMasterGen->settings.flag("Beams:setProductionScalesFromLHEF")); lhaUP->loadRunInfo(lheRunInfo()); @@ -672,7 +673,7 @@ bool Pythia8HepMC3Hadronizer::initializeForExternalPartons() { if (useEvtGen) { edm::LogInfo("Pythia8Hadronizer") << "Creating and initializing pythia8 EvtGen plugin"; if (!evtgenDecays.get()) { - evtgenDecays.reset(new EvtGenDecays(fMasterGen.get(), evtgenDecFile, evtgenPdlFile)); + evtgenDecays = std::make_shared(fMasterGen.get(), evtgenDecFile, evtgenPdlFile); for (unsigned int i = 0; i < evtgenUserFiles.size(); i++) evtgenDecays->readDecayFile(evtgenUserFiles.at(i)); } diff --git a/GeneratorInterface/Pythia8Interface/src/Py8GunBase.cc b/GeneratorInterface/Pythia8Interface/src/Py8GunBase.cc index 77af17e0b5114..b560d45205be8 100644 --- a/GeneratorInterface/Pythia8Interface/src/Py8GunBase.cc +++ b/GeneratorInterface/Pythia8Interface/src/Py8GunBase.cc @@ -1,3 +1,5 @@ +#include + #include "GeneratorInterface/Pythia8Interface/interface/Py8GunBase.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" #include "FWCore/Concurrency/interface/SharedResourceNames.h" @@ -45,7 +47,7 @@ namespace gen { if (useEvtGen) { edm::LogInfo("Pythia8Interface") << "Creating and initializing pythia8 EvtGen plugin"; - evtgenDecays.reset(new EvtGenDecays(fMasterGen.get(), evtgenDecFile, evtgenPdlFile)); + evtgenDecays = std::make_shared(fMasterGen.get(), evtgenDecFile, evtgenPdlFile); for (unsigned int i = 0; i < evtgenUserFiles.size(); i++) evtgenDecays->readDecayFile(evtgenUserFiles.at(i)); } diff --git a/GeneratorInterface/RivetInterface/plugins/GenParticles2HepMCConverter.cc b/GeneratorInterface/RivetInterface/plugins/GenParticles2HepMCConverter.cc index d6973b72be907..90c87cb2d59f2 100644 --- a/GeneratorInterface/RivetInterface/plugins/GenParticles2HepMCConverter.cc +++ b/GeneratorInterface/RivetInterface/plugins/GenParticles2HepMCConverter.cc @@ -99,7 +99,7 @@ void GenParticles2HepMCConverter::produce(edm::Event& event, const edm::EventSet hepmc_event.weights() = genEventInfoHandle->weights(); // add dummy weight if necessary - if (hepmc_event.weights().size() == 0) { + if (hepmc_event.weights().empty()) { hepmc_event.weights().push_back(1.); } diff --git a/GeneratorInterface/RivetInterface/plugins/HTXSRivetProducer.cc b/GeneratorInterface/RivetInterface/plugins/HTXSRivetProducer.cc index 4ea9b9c594b23..75a327ad52171 100644 --- a/GeneratorInterface/RivetInterface/plugins/HTXSRivetProducer.cc +++ b/GeneratorInterface/RivetInterface/plugins/HTXSRivetProducer.cc @@ -84,7 +84,7 @@ void HTXSRivetProducer::produce(edm::Event& iEvent, const edm::EventSetup&) { ConstGenVertexPtr HSvtx = myGenEvent->vertices()[0]; if (HSvtx) { - for (auto ptcl : HepMCUtils::particles(HSvtx, Relatives::CHILDREN)) { + for (const auto& ptcl : HepMCUtils::particles(HSvtx, Relatives::CHILDREN)) { if (std::abs(ptcl->pdg_id()) == 24) ++nWs; if (ptcl->pdg_id() == 23) diff --git a/GeneratorInterface/RivetInterface/src/HiggsTemplateCrossSections.cc b/GeneratorInterface/RivetInterface/src/HiggsTemplateCrossSections.cc index 601cce14c70fa..6b3eb735271d2 100644 --- a/GeneratorInterface/RivetInterface/src/HiggsTemplateCrossSections.cc +++ b/GeneratorInterface/RivetInterface/src/HiggsTemplateCrossSections.cc @@ -73,7 +73,7 @@ namespace Rivet { /// @brief Checks whether the input particle has a parent with a given PDGID bool hasParent(const ConstGenParticlePtr &ptcl, int pdgID) { - for (auto parent : HepMCUtils::particles(ptcl->production_vertex(), Relatives::PARENTS)) + for (const auto &parent : HepMCUtils::particles(ptcl->production_vertex(), Relatives::PARENTS)) if (parent->pdg_id() == pdgID) return true; return false; @@ -191,7 +191,7 @@ namespace Rivet { FourVector uncatV_v4(0, 0, 0, 0); int nWs = 0, nZs = 0; if (isVH(prodMode)) { - for (auto ptcl : HepMCUtils::particles(HSvtx, Relatives::CHILDREN)) { + for (const auto &ptcl : HepMCUtils::particles(HSvtx, Relatives::CHILDREN)) { if (PID::isW(ptcl->pdg_id())) { ++nWs; cat.V = Particle(ptcl); @@ -204,7 +204,7 @@ namespace Rivet { if (nWs + nZs > 0) cat.V = getLastInstance(cat.V); else { - for (auto ptcl : HepMCUtils::particles(HSvtx, Relatives::CHILDREN)) { + for (const auto &ptcl : HepMCUtils::particles(HSvtx, Relatives::CHILDREN)) { if (!PID::isHiggs(ptcl->pdg_id())) { uncatV_decays += Particle(ptcl); uncatV_p4 += Particle(ptcl).momentum(); @@ -236,7 +236,7 @@ namespace Rivet { Particles Ws; if (prodMode == HTXS::TTH || prodMode == HTXS::TH) { // loop over particles produced in hard-scatter vertex - for (auto ptcl : HepMCUtils::particles(HSvtx, Relatives::CHILDREN)) { + for (const auto &ptcl : HepMCUtils::particles(HSvtx, Relatives::CHILDREN)) { if (!PID::isTop(ptcl->pdg_id())) continue; Particle top = getLastInstance(Particle(ptcl)); diff --git a/IOMC/ParticleGuns/src/BeamMomentumGunProducer.cc b/IOMC/ParticleGuns/src/BeamMomentumGunProducer.cc index 5c8e05ba146e6..4193fec6e73b6 100644 --- a/IOMC/ParticleGuns/src/BeamMomentumGunProducer.cc +++ b/IOMC/ParticleGuns/src/BeamMomentumGunProducer.cc @@ -47,7 +47,7 @@ namespace edm { << "Beam vertex offset (cm) " << xoff_ << ":" << yoff_ << " and z position " << zpos_; edm::FileInPath fp = pgun_params.getParameter("FileName"); - std::string infileName = fp.fullPath(); + const std::string& infileName = fp.fullPath(); fFile_ = new TFile(infileName.c_str()); fFile_->GetObject("EventTree", fTree_); diff --git a/IOMC/ParticleGuns/src/FileRandomKEThetaGunProducer.cc b/IOMC/ParticleGuns/src/FileRandomKEThetaGunProducer.cc index f262c37a5128f..d6c7ab9c0362d 100644 --- a/IOMC/ParticleGuns/src/FileRandomKEThetaGunProducer.cc +++ b/IOMC/ParticleGuns/src/FileRandomKEThetaGunProducer.cc @@ -23,7 +23,7 @@ FileRandomKEThetaGunProducer::FileRandomKEThetaGunProducer(const edm::ParameterS edm::ParameterSet pgun_params = pset.getParameter("PGunParameters"); edm::FileInPath fp = pgun_params.getParameter("File"); - std::string file = fp.fullPath(); + const std::string& file = fp.fullPath(); particleN = pgun_params.getParameter("Particles"); if (particleN <= 0) particleN = 1; diff --git a/IOMC/ParticleGuns/src/FileRandomMultiParticlePGunProducer.cc b/IOMC/ParticleGuns/src/FileRandomMultiParticlePGunProducer.cc index 0b254951ab2f5..6557424d10dbe 100644 --- a/IOMC/ParticleGuns/src/FileRandomMultiParticlePGunProducer.cc +++ b/IOMC/ParticleGuns/src/FileRandomMultiParticlePGunProducer.cc @@ -24,7 +24,7 @@ FileRandomMultiParticlePGunProducer::FileRandomMultiParticlePGunProducer(const P fMinP_ = pgunParams.getParameter("MinP"); fMaxP_ = pgunParams.getParameter("MaxP"); edm::FileInPath fp = pgunParams.getParameter("FileName"); - std::string file = fp.fullPath(); + const std::string& file = fp.fullPath(); produces("unsmeared"); produces();