Skip to content

Commit

Permalink
Restore extra backport changes
Browse files Browse the repository at this point in the history
PowhegHooksVincia removed because of potential error with PR cms-sw#42020, however this commit exactly copies the file from the 13_1 backport. Hopefully this remedies the issue
  • Loading branch information
vslokenb authored Sep 20, 2023
1 parent 81dde92 commit 3d398a7
Showing 1 changed file with 24 additions and 3 deletions.
27 changes: 24 additions & 3 deletions GeneratorInterface/Pythia8Interface/plugins/Pythia8Hadronizer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -133,6 +134,7 @@ class Pythia8Hadronizer : public Py8InterfaceBase {
// Emission Veto Hooks
//
std::shared_ptr<PowhegHooks> fEmissionVetoHook;
std::shared_ptr<PowhegHooksVincia> fEmissionVetoHookVincia;
std::shared_ptr<EmissionVetoHook1> fEmissionVetoHook1;

// Resonance scale hook
Expand Down Expand Up @@ -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 "
Expand All @@ -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";
Expand Down Expand Up @@ -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 "
Expand All @@ -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";
Expand All @@ -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");
Expand Down

0 comments on commit 3d398a7

Please sign in to comment.