Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[GENERATORS] Apply code checks/format #46992

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
#include <CepGen/Process/Process.h>
#include <CepGenAddOns/HepMC2Wrapper/HepMC2EventInterface.h>

#include <memory>

using namespace gen;

CepGenEventGenerator::CepGenEventGenerator(const edm::ParameterSet& iConfig, edm::ConsumesCollector&& iC)
Expand Down Expand Up @@ -85,7 +87,7 @@ bool CepGenEventGenerator::initializeForInternalPartons() {
}

bool CepGenEventGenerator::generatePartonsAndHadronize() {
event().reset(new HepMC::CepGenEvent(gen_->next()));
event() = std::make_unique<HepMC::CepGenEvent>(gen_->next());
event()->set_cross_section(xsec_);
event()->weights().push_back(1.);
return true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<Herwig::HerwigUIProvider>(pset, dumpConfig_, Herwig::RunMode::READ);
edm::LogInfo("Herwig7Interface") << "HerwigUIProvider object with run mode " << HwUI_->runMode() << " created.\n";

// Chose run mode
Expand Down
4 changes: 2 additions & 2 deletions GeneratorInterface/LHEInterface/src/LH5Reader.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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<LHERunInfo>(heprup);
// Run info has now been set when a new file is encountered
}
// Handler should be modified to have these capabilities
Expand Down Expand Up @@ -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<LHEEvent>(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) {
Expand Down
4 changes: 2 additions & 2 deletions GeneratorInterface/LHEInterface/src/LHEReader.cc
Original file line number Diff line number Diff line change
Expand Up @@ -489,7 +489,7 @@ namespace lhef {
data.str(handler->buffer);
handler->buffer.clear();

curRunInfo.reset(new LHERunInfo(data));
curRunInfo = std::make_shared<LHERunInfo>(data);

std::for_each(handler->headers.begin(),
handler->headers.end(),
Expand Down Expand Up @@ -521,7 +521,7 @@ namespace lhef {
handler->buffer.clear();

std::shared_ptr<LHEEvent> lheevent;
lheevent.reset(new LHEEvent(curRunInfo, data));
lheevent = std::make_shared<LHEEvent>(curRunInfo, data);
const XMLHandler::wgt_info &info = handler->weightsinevent;
for (size_t i = 0; i < info.size(); ++i) {
double num = -1.0;
Expand Down
2 changes: 1 addition & 1 deletion GeneratorInterface/Pythia6Interface/src/PtYDistributor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down
4 changes: 2 additions & 2 deletions GeneratorInterface/Pythia6Interface/src/Pythia6Service.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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();

/*
//
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -218,8 +218,8 @@ Pythia8HepMC3Hadronizer::Pythia8HepMC3Hadronizer(const edm::ParameterSet &params
if (params.exists("reweightGen")) {
edm::LogInfo("Pythia8Interface") << "Start setup for reweightGen";
edm::ParameterSet rgParams = params.getParameter<edm::ParameterSet>("reweightGen");
fReweightUserHook.reset(
new PtHatReweightUserHook(rgParams.getParameter<double>("pTRef"), rgParams.getParameter<double>("power")));
fReweightUserHook = std::make_shared<PtHatReweightUserHook>(rgParams.getParameter<double>("pTRef"),
rgParams.getParameter<double>("power"));
edm::LogInfo("Pythia8Interface") << "End setup for reweightGen";
}
if (params.exists("reweightGenEmp")) {
Expand All @@ -229,29 +229,30 @@ Pythia8HepMC3Hadronizer::Pythia8HepMC3Hadronizer(const edm::ParameterSet &params
std::string tuneName = "";
if (rgeParams.exists("tune"))
tuneName = rgeParams.getParameter<std::string>("tune");
fReweightEmpUserHook.reset(new PtHatEmpReweightUserHook(tuneName));
fReweightEmpUserHook = std::make_shared<PtHatEmpReweightUserHook>(tuneName);
edm::LogInfo("Pythia8Interface") << "End setup for reweightGenEmp";
}
if (params.exists("reweightGenRap")) {
edm::LogInfo("Pythia8Interface") << "Start setup for reweightGenRap";
edm::ParameterSet rgrParams = params.getParameter<edm::ParameterSet>("reweightGenRap");
fReweightRapUserHook.reset(new RapReweightUserHook(rgrParams.getParameter<std::string>("yLabSigmaFunc"),
rgrParams.getParameter<double>("yLabPower"),
rgrParams.getParameter<std::string>("yCMSigmaFunc"),
rgrParams.getParameter<double>("yCMPower"),
rgrParams.getParameter<double>("pTHatMin"),
rgrParams.getParameter<double>("pTHatMax")));
fReweightRapUserHook = std::make_shared<RapReweightUserHook>(rgrParams.getParameter<std::string>("yLabSigmaFunc"),
rgrParams.getParameter<double>("yLabPower"),
rgrParams.getParameter<std::string>("yCMSigmaFunc"),
rgrParams.getParameter<double>("yCMPower"),
rgrParams.getParameter<double>("pTHatMin"),
rgrParams.getParameter<double>("pTHatMax"));
edm::LogInfo("Pythia8Interface") << "End setup for reweightGenRap";
}
if (params.exists("reweightGenPtHatRap")) {
edm::LogInfo("Pythia8Interface") << "Start setup for reweightGenPtHatRap";
edm::ParameterSet rgrParams = params.getParameter<edm::ParameterSet>("reweightGenPtHatRap");
fReweightPtHatRapUserHook.reset(new PtHatRapReweightUserHook(rgrParams.getParameter<std::string>("yLabSigmaFunc"),
rgrParams.getParameter<double>("yLabPower"),
rgrParams.getParameter<std::string>("yCMSigmaFunc"),
rgrParams.getParameter<double>("yCMPower"),
rgrParams.getParameter<double>("pTHatMin"),
rgrParams.getParameter<double>("pTHatMax")));
fReweightPtHatRapUserHook =
std::make_shared<PtHatRapReweightUserHook>(rgrParams.getParameter<std::string>("yLabSigmaFunc"),
rgrParams.getParameter<double>("yLabPower"),
rgrParams.getParameter<std::string>("yCMSigmaFunc"),
rgrParams.getParameter<double>("yCMPower"),
rgrParams.getParameter<double>("pTHatMin"),
rgrParams.getParameter<double>("pTHatMax"));
edm::LogInfo("Pythia8Interface") << "End setup for reweightGenPtHatRap";
}

Expand All @@ -265,7 +266,7 @@ Pythia8HepMC3Hadronizer::Pythia8HepMC3Hadronizer(const edm::ParameterSet &params
edm::ParameterSet jmParams = params.getUntrackedParameter<edm::ParameterSet>("jetMatching");
std::string scheme = jmParams.getParameter<std::string>("scheme");
if (scheme == "Madgraph" || scheme == "MadgraphFastJet") {
fJetMatchingHook.reset(new JetMatchingHook(jmParams, &fMasterGen->info));
fJetMatchingHook = std::make_shared<JetMatchingHook>(jmParams, &fMasterGen->info);
}
}

Expand Down Expand Up @@ -304,17 +305,17 @@ Pythia8HepMC3Hadronizer::Pythia8HepMC3Hadronizer(const edm::ParameterSet &params
EV1_nFinalMode = 0;
if (params.exists("EV1_nFinalMode"))
EV1_nFinalMode = params.getParameter<int>("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<EmissionVetoHook1>(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")) {
Expand Down Expand Up @@ -364,7 +365,7 @@ bool Pythia8HepMC3Hadronizer::initializeForInternalPartons() {
}

if (!fUserHooksVector.get())
fUserHooksVector.reset(new UserHooksVector);
fUserHooksVector = std::make_shared<UserHooksVector>();
(fUserHooksVector->hooks).clear();

if (fReweightUserHook.get())
Expand All @@ -389,7 +390,7 @@ bool Pythia8HepMC3Hadronizer::initializeForInternalPartons() {
"are : jetMatching, emissionVeto1 \n";

if (!fEmissionVetoHook.get())
fEmissionVetoHook.reset(new PowhegHooks());
fEmissionVetoHook = std::make_shared<PowhegHooks>();

edm::LogInfo("Pythia8Interface") << "Turning on Emission Veto Hook from pythia8 code";
(fUserHooksVector->hooks).push_back(fEmissionVetoHook);
Expand All @@ -399,15 +400,15 @@ 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<PowhegResHook>();
(fUserHooksVector->hooks).push_back(fPowhegResHook);
}

bool PowhegBB4L = fMasterGen->settings.flag("POWHEG:bb4l");
if (PowhegBB4L) {
edm::LogInfo("Pythia8Interface") << "Turning on BB4l hook from CMSSW Pythia8Interface";
if (!fPowhegHooksBB4L.get())
fPowhegHooksBB4L.reset(new PowhegHooksBB4L());
fPowhegHooksBB4L = std::make_shared<PowhegHooksBB4L>();
(fUserHooksVector->hooks).push_back(fPowhegHooksBB4L);
}

Expand All @@ -422,7 +423,7 @@ bool Pythia8HepMC3Hadronizer::initializeForInternalPartons() {

if (internalMatching) {
if (!fJetMatchingPy8InternalHook.get())
fJetMatchingPy8InternalHook.reset(new Pythia8::JetMatchingMadgraph);
fJetMatchingPy8InternalHook = std::make_shared<Pythia8::JetMatchingMadgraph>();
(fUserHooksVector->hooks).push_back(fJetMatchingPy8InternalHook);
}

Expand All @@ -436,15 +437,15 @@ bool Pythia8HepMC3Hadronizer::initializeForInternalPartons() {
? 2
: 0);
if (!fMergingHook.get())
fMergingHook.reset(new Pythia8::amcnlo_unitarised_interface(scheme));
fMergingHook = std::make_shared<Pythia8::amcnlo_unitarised_interface>(scheme);
(fUserHooksVector->hooks).push_back(fMergingHook);
}

bool biasedTauDecayer = fMasterGen->settings.flag("BiasedTauDecayer:filter");
if (biasedTauDecayer) {
if (!fBiasedTauDecayer.get()) {
Pythia8::Info localInfo = fMasterGen->info;
fBiasedTauDecayer.reset(new BiasedTauDecayer(&localInfo, &(fMasterGen->settings)));
fBiasedTauDecayer = std::make_shared<BiasedTauDecayer>(&localInfo, &(fMasterGen->settings));
}
std::vector<int> handledParticles;
handledParticles.push_back(15);
Expand All @@ -453,13 +454,13 @@ bool Pythia8HepMC3Hadronizer::initializeForInternalPartons() {

bool resonanceDecayFilter = fMasterGen->settings.flag("ResonanceDecayFilter:filter");
if (resonanceDecayFilter) {
fResonanceDecayFilterHook.reset(new ResonanceDecayFilterHook);
fResonanceDecayFilterHook = std::make_shared<ResonanceDecayFilterHook>();
(fUserHooksVector->hooks).push_back(fResonanceDecayFilterHook);
}

bool PTFilter = fMasterGen->settings.flag("PTFilter:filter");
if (PTFilter) {
fPTFilterHook.reset(new PTFilterHook);
fPTFilterHook = std::make_shared<PTFilterHook>();
(fUserHooksVector->hooks).push_back(fPTFilterHook);
}

Expand Down Expand Up @@ -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<EvtGenDecays>(fMasterGen.get(), evtgenDecFile, evtgenPdlFile);
for (unsigned int i = 0; i < evtgenUserFiles.size(); i++)
evtgenDecays->readDecayFile(evtgenUserFiles.at(i));
}
Expand All @@ -516,7 +517,7 @@ bool Pythia8HepMC3Hadronizer::initializeForExternalPartons() {
bool status = false, status1 = false;

if (!fUserHooksVector.get())
fUserHooksVector.reset(new UserHooksVector);
fUserHooksVector = std::make_shared<UserHooksVector>();
(fUserHooksVector->hooks).clear();

if (fReweightUserHook.get())
Expand Down Expand Up @@ -548,7 +549,7 @@ bool Pythia8HepMC3Hadronizer::initializeForExternalPartons() {
"are : jetMatching, emissionVeto1 \n";

if (!fEmissionVetoHook.get())
fEmissionVetoHook.reset(new PowhegHooks());
fEmissionVetoHook = std::make_shared<PowhegHooks>();

edm::LogInfo("Pythia8Interface") << "Turning on Emission Veto Hook from pythia8 code";
(fUserHooksVector->hooks).push_back(fEmissionVetoHook);
Expand All @@ -558,15 +559,15 @@ 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<PowhegResHook>();
(fUserHooksVector->hooks).push_back(fPowhegResHook);
}

bool PowhegBB4L = fMasterGen->settings.flag("POWHEG:bb4l");
if (PowhegBB4L) {
edm::LogInfo("Pythia8Interface") << "Turning on BB4l hook from CMSSW Pythia8Interface";
if (!fPowhegHooksBB4L.get())
fPowhegHooksBB4L.reset(new PowhegHooksBB4L());
fPowhegHooksBB4L = std::make_shared<PowhegHooksBB4L>();
(fUserHooksVector->hooks).push_back(fPowhegHooksBB4L);
}

Expand All @@ -581,7 +582,7 @@ bool Pythia8HepMC3Hadronizer::initializeForExternalPartons() {

if (internalMatching) {
if (!fJetMatchingPy8InternalHook.get())
fJetMatchingPy8InternalHook.reset(new Pythia8::JetMatchingMadgraph);
fJetMatchingPy8InternalHook = std::make_shared<Pythia8::JetMatchingMadgraph>();
(fUserHooksVector->hooks).push_back(fJetMatchingPy8InternalHook);
}

Expand All @@ -595,15 +596,15 @@ bool Pythia8HepMC3Hadronizer::initializeForExternalPartons() {
? 2
: 0);
if (!fMergingHook.get())
fMergingHook.reset(new Pythia8::amcnlo_unitarised_interface(scheme));
fMergingHook = std::make_shared<Pythia8::amcnlo_unitarised_interface>(scheme);
(fUserHooksVector->hooks).push_back(fMergingHook);
}

bool biasedTauDecayer = fMasterGen->settings.flag("BiasedTauDecayer:filter");
if (biasedTauDecayer) {
if (!fBiasedTauDecayer.get()) {
Pythia8::Info localInfo = fMasterGen->info;
fBiasedTauDecayer.reset(new BiasedTauDecayer(&localInfo, &(fMasterGen->settings)));
fBiasedTauDecayer = std::make_shared<BiasedTauDecayer>(&localInfo, &(fMasterGen->settings));
}
std::vector<int> handledParticles;
handledParticles.push_back(15);
Expand All @@ -612,13 +613,13 @@ bool Pythia8HepMC3Hadronizer::initializeForExternalPartons() {

bool resonanceDecayFilter = fMasterGen->settings.flag("ResonanceDecayFilter:filter");
if (resonanceDecayFilter) {
fResonanceDecayFilterHook.reset(new ResonanceDecayFilterHook);
fResonanceDecayFilterHook = std::make_shared<ResonanceDecayFilterHook>();
(fUserHooksVector->hooks).push_back(fResonanceDecayFilterHook);
}

bool PTFilter = fMasterGen->settings.flag("PTFilter:filter");
if (PTFilter) {
fPTFilterHook.reset(new PTFilterHook);
fPTFilterHook = std::make_shared<PTFilterHook>();
(fUserHooksVector->hooks).push_back(fPTFilterHook);
}

Expand All @@ -637,7 +638,7 @@ bool Pythia8HepMC3Hadronizer::initializeForExternalPartons() {
status = fMasterGen->init();

} else {
lhaUP.reset(new LHAupLesHouches());
lhaUP = std::make_shared<LHAupLesHouches>();
lhaUP->setScalesFromLHEF(fMasterGen->settings.flag("Beams:setProductionScalesFromLHEF"));
lhaUP->loadRunInfo(lheRunInfo());

Expand Down Expand Up @@ -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<EvtGenDecays>(fMasterGen.get(), evtgenDecFile, evtgenPdlFile);
for (unsigned int i = 0; i < evtgenUserFiles.size(); i++)
evtgenDecays->readDecayFile(evtgenUserFiles.at(i));
}
Expand Down
4 changes: 3 additions & 1 deletion GeneratorInterface/Pythia8Interface/src/Py8GunBase.cc
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#include <memory>

#include "GeneratorInterface/Pythia8Interface/interface/Py8GunBase.h"
#include "FWCore/MessageLogger/interface/MessageLogger.h"
#include "FWCore/Concurrency/interface/SharedResourceNames.h"
Expand Down Expand Up @@ -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<EvtGenDecays>(fMasterGen.get(), evtgenDecFile, evtgenPdlFile);
for (unsigned int i = 0; i < evtgenUserFiles.size(); i++)
evtgenDecays->readDecayFile(evtgenUserFiles.at(i));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.);
}

Expand Down
Loading