5 #include <HepMC/GenEvent.h> 6 #include <HepMC/IO_BaseClass.h> 8 #include <ThePEG/Repository/Repository.h> 9 #include <ThePEG/EventRecord/Event.h> 10 #include <ThePEG/Config/ThePEG.h> 11 #include <ThePEG/LesHouches/LesHouchesReader.h> 29 #include <Herwig/API/HerwigAPI.h> 30 #include "CLHEP/Random/RandomEngine.h" 33 class HepRandomEngine;
55 const char*
classname()
const {
return "Herwig7Hadronizer"; }
68 std::shared_ptr<lhef::LHEProxy>
proxy_;
80 eventsToPrint(
pset.getUntrackedParameter<unsigned
int>(
"eventsToPrint", 0)),
81 handlerDirectory_(
pset.getParameter<
std::
string>(
"eventHandlers")),
97 edm::LogInfo(
"Generator|Herwig7Hadronizer") <<
"No run step for Herwig chosen. Program will be aborted.";
112 edm::LogInfo(
"Generator|Herwig7Hadronizer") <<
"No run step for Herwig chosen. Program will be aborted.";
129 edm::LogInfo(
"Generator|Herwig7Hadronizer") <<
"Start production";
135 <<
"EGPtr::shoot() thrown an exception, event skipped: " << exc.what();
140 edm::LogWarning(
"Generator|Herwig7Hadronizer") <<
"thepegEvent not initialized";
145 if (!
event().
get()) {
146 edm::LogWarning(
"Generator|Herwig7Hadronizer") <<
"genEvent not initialized";
160 <<
"EGPtr::shoot() thrown an exception, event skipped: " << exc.what();
167 <<
"Event number not set in lhe file, needed for correctly aligning Herwig and LHE events!";
171 edm::LogError(
"Herwig7 interface") <<
"Herwig does not seem to be generating events in order, did you set " 172 "/Herwig/EventHandlers/FxFxLHReader:AllowedToReOpen Yes?";
177 edm::LogWarning(
"Generator|Herwig7Hadronizer") <<
"thepegEvent not initialized";
182 if (!
event().
get()) {
183 edm::LogWarning(
"Generator|Herwig7Hadronizer") <<
"genEvent not initialized";
188 edm::LogWarning(
"Generator|Herwig7Hadronizer") <<
"Event " << evtnum <<
" not generated (likely skipped in merging)";
193 eventInfo() = std::make_unique<GenEventInfoProduct>(
event().get());
204 edm::LogInfo(
"Generator|Herwig7Hadronizer") <<
"Event produced";
215 int weights_number =
thepegEvent->optionalWeights().size();
217 if (weights_number > 1) {
220 std::map<std::string, double> weights_map =
thepegEvent->optionalWeights();
221 for (std::map<std::string, double>::iterator it = weights_map.begin(); it != weights_map.end(); it++) {
231 BaseHadronizer::randomizeIndex(
lumi, rengine);
~Herwig7Hadronizer() override
bool generatePartonsAndHadronize()
static double pthat(const ThePEG::EventPtr &event)
void initRepository(const edm::ParameterSet ¶ms)
unsigned int firstLumiBlock
void setPEGRandomEngine(CLHEP::HepRandomEngine *)
std::auto_ptr< HepMC::IO_BaseClass > iobc_
#define DEFINE_FWK_MODULE(type)
Log< level::Error, false > LogError
void setInternalXSec(const XSec &xsec)
GenRunInfoProduct & runInfo()
bool declareSpecialSettings(const std::vector< std::string >)
const char * classname() const
bool initializeForExternalPartons()
lhef::LHEEvent * lheEvent()
edm::GeneratorFilter< Herwig7Hadronizer, gen::ExternalDecayDriver > Herwig7GeneratorFilter
unsigned int eventsToPrint
std::unique_ptr< GenLumiInfoHeader > getGenLumiInfoHeader() const override
edm::ParameterSet paramSettings
edm::HadronizerFilter< Herwig7Hadronizer, gen::ExternalDecayDriver > Herwig7HadronizerFilter
static std::auto_ptr< HepMC::GenEvent > convert(const ThePEG::EventPtr &event)
bool initializeForInternalPartons()
std::unique_ptr< HepMC::GenEvent > & event()
Log< level::Info, false > LogInfo
void doSetRandomEngine(CLHEP::HepRandomEngine *v) override
std::shared_ptr< lhef::LHEProxy > proxy_
std::unique_ptr< GenEventInfoProduct > & eventInfo()
unsigned int currentLumiBlock
Herwig7Hadronizer(const edm::ParameterSet ¶ms)
ThePEG::EventPtr thepegEvent
void beginLuminosityBlock(edm::LuminosityBlock const &, edm::EventSetup const &)
const std::string handlerDirectory_
const std::string runFileName
bool declareStableParticles(const std::vector< int > &pdgIds)
Log< level::Warning, false > LogWarning
void randomizeIndex(edm::LuminosityBlock const &lumi, CLHEP::HepRandomEngine *rengine)