From 3d398a730e5835eaead18d054ce692ed343268ae Mon Sep 17 00:00:00 2001 From: vslokenb <108902248+vslokenb@users.noreply.github.com> Date: Tue, 19 Sep 2023 21:48:17 -0400 Subject: [PATCH] Restore extra backport changes PowhegHooksVincia removed because of potential error with PR #42020, however this commit exactly copies the file from the 13_1 backport. Hopefully this remedies the issue --- .../plugins/Pythia8Hadronizer.cc | 27 ++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) diff --git a/GeneratorInterface/Pythia8Interface/plugins/Pythia8Hadronizer.cc b/GeneratorInterface/Pythia8Interface/plugins/Pythia8Hadronizer.cc index a810aa7b36170..18181e47303e7 100644 --- a/GeneratorInterface/Pythia8Interface/plugins/Pythia8Hadronizer.cc +++ b/GeneratorInterface/Pythia8Interface/plugins/Pythia8Hadronizer.cc @@ -30,6 +30,7 @@ using namespace Pythia8; // Emission Veto Hooks // #include "Pythia8Plugins/PowhegHooks.h" +#include "Pythia8Plugins/PowhegHooksVincia.h" #include "GeneratorInterface/Pythia8Interface/plugins/EmissionVetoHook1.h" // Resonance scale hook @@ -133,6 +134,7 @@ class Pythia8Hadronizer : public Py8InterfaceBase { // Emission Veto Hooks // std::shared_ptr fEmissionVetoHook; + std::shared_ptr fEmissionVetoHookVincia; std::shared_ptr fEmissionVetoHook1; // Resonance scale hook @@ -388,7 +390,10 @@ bool Pythia8Hadronizer::initializeForInternalPartons() { (fUserHooksVector->hooks).push_back(fEmissionVetoHook1); } - if (fMasterGen->settings.mode("POWHEG:veto") > 0 || fMasterGen->settings.mode("POWHEG:MPIveto") > 0) { + bool VinciaShower = fMasterGen->settings.mode("PartonShowers:Model") == 2; + + if ((fMasterGen->settings.mode("POWHEG:veto") > 0 || fMasterGen->settings.mode("POWHEG:MPIveto") > 0) && + !VinciaShower) { if (fJetMatchingHook.get() || fEmissionVetoHook1.get()) throw edm::Exception(edm::errors::Configuration, "Pythia8Interface") << " Attempt to turn on PowhegHooks by pythia8 settings but there are incompatible hooks on \n Incompatible " @@ -401,6 +406,13 @@ bool Pythia8Hadronizer::initializeForInternalPartons() { (fUserHooksVector->hooks).push_back(fEmissionVetoHook); } + if (fMasterGen->settings.mode("POWHEG:veto") > 0 && VinciaShower) { + edm::LogInfo("Pythia8Interface") << "Turning on Vincia Emission Veto Hook from pythia8 code"; + if (!fEmissionVetoHookVincia.get()) + fEmissionVetoHookVincia.reset(new PowhegHooksVincia()); + (fUserHooksVector->hooks).push_back(fEmissionVetoHookVincia); + } + bool PowhegRes = fMasterGen->settings.flag("POWHEGres:calcScales"); if (PowhegRes) { edm::LogInfo("Pythia8Interface") << "Turning on resonance scale setting from CMSSW Pythia8Interface"; @@ -555,7 +567,10 @@ bool Pythia8Hadronizer::initializeForExternalPartons() { } } - if (fMasterGen->settings.mode("POWHEG:veto") > 0 || fMasterGen->settings.mode("POWHEG:MPIveto") > 0) { + bool VinciaShower = fMasterGen->settings.mode("PartonShowers:Model") == 2; + + if ((fMasterGen->settings.mode("POWHEG:veto") > 0 || fMasterGen->settings.mode("POWHEG:MPIveto") > 0) && + !VinciaShower) { if (fJetMatchingHook.get() || fEmissionVetoHook1.get()) throw edm::Exception(edm::errors::Configuration, "Pythia8Interface") << " Attempt to turn on PowhegHooks by pythia8 settings but there are incompatible hooks on \n Incompatible " @@ -568,6 +583,13 @@ bool Pythia8Hadronizer::initializeForExternalPartons() { (fUserHooksVector->hooks).push_back(fEmissionVetoHook); } + if (fMasterGen->settings.mode("POWHEG:veto") > 0 && VinciaShower) { + edm::LogInfo("Pythia8Interface") << "Turning on Vincia Emission Veto Hook from pythia8 code"; + if (!fEmissionVetoHookVincia.get()) + fEmissionVetoHookVincia.reset(new PowhegHooksVincia()); + (fUserHooksVector->hooks).push_back(fEmissionVetoHookVincia); + } + bool PowhegRes = fMasterGen->settings.flag("POWHEGres:calcScales"); if (PowhegRes) { edm::LogInfo("Pythia8Interface") << "Turning on resonance scale setting from CMSSW Pythia8Interface"; @@ -591,7 +613,6 @@ bool Pythia8Hadronizer::initializeForExternalPartons() { fTopRecoilHook.reset(new TopRecoilHook()); (fUserHooksVector->hooks).push_back(fTopRecoilHook); } - //adapted from main89.cc in pythia8 examples bool internalMatching = fMasterGen->settings.flag("JetMatching:merge"); bool internalMerging = !(fMasterGen->settings.word("Merging:Process") == "void");