Skip to content

Commit

Permalink
Merge pull request #38471 from mseidel42/PowhegHooksVincia_12_5
Browse files Browse the repository at this point in the history
Powheg+Vincia matching
  • Loading branch information
cmsbuild committed Jun 28, 2022
2 parents 8e76e62 + 9f3c759 commit a0b5b83
Showing 1 changed file with 24 additions and 2 deletions.
26 changes: 24 additions & 2 deletions GeneratorInterface/Pythia8Interface/plugins/Pythia8Hadronizer.cc
Expand Up @@ -29,6 +29,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 @@ -132,6 +133,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 @@ -383,7 +385,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 @@ -396,6 +401,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 @@ -542,7 +554,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 @@ -555,6 +570,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 Down

0 comments on commit a0b5b83

Please sign in to comment.