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"; }
67 std::shared_ptr<lhef::LHEProxy>
proxy_;
79 eventsToPrint(pset.getUntrackedParameter<unsigned int>(
"eventsToPrint", 0)),
80 handlerDirectory_(pset.getParameter<std::
string>(
"eventHandlers")),
81 runFileName(pset.getParameter<std::
string>(
"run")) {
96 edm::LogInfo(
"Generator|Herwig7Hadronizer") <<
"No run step for Herwig chosen. Program will be aborted.";
105 <<
"Read in of LHE files is not supported in this way. You can read them manually if necessary.";
119 edm::LogInfo(
"Generator|Herwig7Hadronizer") <<
"Start production";
125 <<
"EGPtr::shoot() thrown an exception, event skipped: " << exc.what();
130 edm::LogWarning(
"Generator|Herwig7Hadronizer") <<
"thepegEvent not initialized";
135 if (!
event().
get()) {
136 edm::LogWarning(
"Generator|Herwig7Hadronizer") <<
"genEvent not initialized";
145 <<
"Read in of LHE files is not supported in this way. You can read them manually if necessary.";
150 eventInfo() = std::make_unique<GenEventInfoProduct>(
event().get());
161 edm::LogInfo(
"Generator|Herwig7Hadronizer") <<
"Event produced";
169 auto genLumiInfoHeader = BaseHadronizer::getGenLumiInfoHeader();
172 int weights_number =
thepegEvent->optionalWeights().size();
174 if (weights_number > 1) {
175 genLumiInfoHeader->weightNames().reserve(weights_number + 1);
176 genLumiInfoHeader->weightNames().push_back(
"nominal");
177 std::map<std::string, double> weights_map =
thepegEvent->optionalWeights();
178 for (std::map<std::string, double>::iterator it = weights_map.begin(); it != weights_map.end(); it++) {
179 genLumiInfoHeader->weightNames().push_back(it->first);
184 return genLumiInfoHeader;
188 BaseHadronizer::randomizeIndex(lumi, rengine);
LuminosityBlockID id() const
~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 >)
bool initializeForExternalPartons()
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()
LuminosityBlockNumber_t luminosityBlock() const
unsigned int currentLumiBlock
Herwig7Hadronizer(const edm::ParameterSet ¶ms)
ThePEG::EventPtr thepegEvent
void beginLuminosityBlock(edm::LuminosityBlock const &, edm::EventSetup const &)
const char * classname() 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)