From 4872c3f658b9e891a345d0825a2af0e4503f84cc Mon Sep 17 00:00:00 2001 From: Josh Bendavid Date: Mon, 17 Nov 2014 20:54:33 +0100 Subject: [PATCH] Update printout and make pythia8 interface explicitly fail when pythia initialization fails (instead of just silently filtering out the empty events) --- .../Core/interface/HadronizerFilter.h | 2 +- .../plugins/Pythia8Hadronizer.cc | 23 +++++++++++-------- 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/GeneratorInterface/Core/interface/HadronizerFilter.h b/GeneratorInterface/Core/interface/HadronizerFilter.h index 0af02bc0856a8..504c5050a940a 100644 --- a/GeneratorInterface/Core/interface/HadronizerFilter.h +++ b/GeneratorInterface/Core/interface/HadronizerFilter.h @@ -369,7 +369,7 @@ namespace edm throw edm::Exception(errors::Configuration) << "Failed to initialize hadronizer " << hadronizer_.classname() - << " for internal parton generation\n"; + << " for external parton generation\n"; } template diff --git a/GeneratorInterface/Pythia8Interface/plugins/Pythia8Hadronizer.cc b/GeneratorInterface/Pythia8Interface/plugins/Pythia8Hadronizer.cc index 144027ec0ed6c..6fc8d76b33088 100644 --- a/GeneratorInterface/Pythia8Interface/plugins/Pythia8Hadronizer.cc +++ b/GeneratorInterface/Pythia8Interface/plugins/Pythia8Hadronizer.cc @@ -304,13 +304,16 @@ Pythia8Hadronizer::~Pythia8Hadronizer() bool Pythia8Hadronizer::initializeForInternalPartons() { + + bool status = true; + if ( fInitialState == PP ) // default { //fMasterGen->init(2212, 2212, comEnergy); fMasterGen->settings.mode("Beams:idA", 2212); fMasterGen->settings.mode("Beams:idB", 2212); fMasterGen->settings.parm("Beams:eCM", comEnergy); - fMasterGen->init(); + status &= fMasterGen->init(); } else if ( fInitialState == PPbar ) { @@ -318,7 +321,7 @@ bool Pythia8Hadronizer::initializeForInternalPartons() fMasterGen->settings.mode("Beams:idA", 2212); fMasterGen->settings.mode("Beams:idB", -2212); fMasterGen->settings.parm("Beams:eCM", comEnergy); - fMasterGen->init(); + status &= fMasterGen->init(); } else if ( fInitialState == ElectronPositron ) { @@ -326,7 +329,7 @@ bool Pythia8Hadronizer::initializeForInternalPartons() fMasterGen->settings.mode("Beams:idA", 11); fMasterGen->settings.mode("Beams:idB", -11); fMasterGen->settings.parm("Beams:eCM", comEnergy); - fMasterGen->init(); + status &= fMasterGen->init(); } else { @@ -350,9 +353,9 @@ bool Pythia8Hadronizer::initializeForInternalPartons() //fDecayer->readString("ProcessLevel::resonanceDecays=on"); fDecayer->settings.flag("ProcessLevel:all", false ); // trick fDecayer->settings.flag("ProcessLevel:resonanceDecays", true ); - fDecayer->init(); + status &= fDecayer->init(); - return true; + return status; } @@ -361,6 +364,8 @@ bool Pythia8Hadronizer::initializeForExternalPartons() edm::LogInfo("Pythia8Interface") << "Initializing for external partons"; + bool status = true; + if((fMasterGen->settings.mode("POWHEG:veto") > 0 || fMasterGen->settings.mode("POWHEG:MPIveto") > 0) && !fEmissionVetoHook) { if(fJetMatchingHook || fEmissionVetoHook1) @@ -411,7 +416,7 @@ bool Pythia8Hadronizer::initializeForExternalPartons() //fMasterGen->init(LHEInputFileName); fMasterGen->settings.mode("Beams:frameType", 4); fMasterGen->settings.word("Beams:LHEF", LHEInputFileName); - fMasterGen->init(); + status &= fMasterGen->init(); } else { @@ -426,7 +431,7 @@ bool Pythia8Hadronizer::initializeForExternalPartons() //fMasterGen->init(lhaUP.get()); fMasterGen->settings.mode("Beams:frameType", 5); fMasterGen->setLHAupPtr(lhaUP.get()); - fMasterGen->init(); + status &= fMasterGen->init(); } if ( pythiaPylistVerbosity > 10 ) @@ -442,9 +447,9 @@ bool Pythia8Hadronizer::initializeForExternalPartons() //fDecayer->readString("ProcessLevel::resonanceDecays=on"); fDecayer->settings.flag("ProcessLevel:all", false ); // trick fDecayer->settings.flag("ProcessLevel:resonanceDecays", true ); - fDecayer->init(); + status &= fDecayer->init(); - return true; + return status; }