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;
42 bool initializeForInternalPartons();
43 bool initializeForExternalPartons();
44 bool declareStableParticles(
const std::vector<int> &pdgIds);
49 bool generatePartonsAndHadronize();
55 const char *
classname()
const {
return "Herwig7Hadronizer"; }
69 std::shared_ptr<lhef::LHEProxy>
proxy_;
74 unsigned int firstLumiBlock=0;
75 unsigned int currentLumiBlock=0;
81 eventsToPrint(pset.getUntrackedParameter<unsigned
int>(
"eventsToPrint", 0)),
82 handlerDirectory_(pset.getParameter<
std::
string>(
"eventHandlers")),
83 runFileName(pset.getParameter<
std::
string>(
"run"))
105 edm::LogInfo(
"Generator|Herwig7Hadronizer") <<
"No run step for Herwig chosen. Program will be aborted.";
114 edm::LogError(
"Herwig7 interface") <<
"Read in of LHE files is not supported in this way. You can read them manually if necessary.";
127 eg_->integratedXSec() / ThePEG::picobarn,
128 eg_->integratedXSecErr() / ThePEG::picobarn));
134 edm::LogInfo(
"Generator|Herwig7Hadronizer") <<
"Start production";
140 edm::LogWarning(
"Generator|Herwig7Hadronizer") <<
"EGPtr::shoot() thrown an exception, event skipped: " << exc.what();
145 edm::LogWarning(
"Generator|Herwig7Hadronizer") <<
"thepegEvent not initialized";
150 if (!
event().
get()) {
151 edm::LogWarning(
"Generator|Herwig7Hadronizer") <<
"genEvent not initialized";
161 edm::LogError(
"Herwig7 interface") <<
"Read in of LHE files is not supported in this way. You can read them manually if necessary.";
179 edm::LogInfo(
"Generator|Herwig7Hadronizer") <<
"Event produced";
197 int weights_number =
thepegEvent->optionalWeights().size();
199 if(weights_number > 1){
200 genLumiInfoHeader->
weightNames().reserve(weights_number + 1);
201 genLumiInfoHeader->
weightNames().push_back(
"nominal");
202 std::map<std::string,double> weights_map =
thepegEvent->optionalWeights();
203 for (std::map<std::string,double>::iterator it = weights_map.begin(); it != weights_map.end(); it++)
205 genLumiInfoHeader->
weightNames().push_back(it->first);
210 return genLumiInfoHeader;
215 BaseHadronizer::randomizeIndex(lumi, rengine);
LuminosityBlockID id() const
~Herwig7Hadronizer() override
bool generatePartonsAndHadronize()
static double pthat(const ThePEG::EventPtr &event)
void initRepository(const edm::ParameterSet ¶ms)
GenLumiInfoHeader * getGenLumiInfoHeader() const override
unsigned int firstLumiBlock
std::auto_ptr< HepMC::IO_BaseClass > iobc_
#define DEFINE_FWK_MODULE(type)
void setInternalXSec(const XSec &xsec)
std::auto_ptr< HepMC::GenEvent > & event()
GenRunInfoProduct & runInfo()
bool declareSpecialSettings(const std::vector< std::string >)
bool initializeForExternalPartons()
edm::GeneratorFilter< Herwig7Hadronizer, gen::ExternalDecayDriver > Herwig7GeneratorFilter
unsigned int eventsToPrint
edm::ParameterSet paramSettings
edm::HadronizerFilter< Herwig7Hadronizer, gen::ExternalDecayDriver > Herwig7HadronizerFilter
static std::auto_ptr< HepMC::GenEvent > convert(const ThePEG::EventPtr &event)
bool initializeForInternalPartons()
std::auto_ptr< GenEventInfoProduct > & eventInfo()
void doSetRandomEngine(CLHEP::HepRandomEngine *v) override
std::shared_ptr< lhef::LHEProxy > proxy_
LuminosityBlockNumber_t luminosityBlock() const
unsigned int currentLumiBlock
Herwig7Hadronizer(const edm::ParameterSet ¶ms)
ThePEG::EventPtr thepegEvent
const char * classname() const
const std::string handlerDirectory_
const std::string runFileName
bool declareStableParticles(const std::vector< int > &pdgIds)
void randomizeIndex(edm::LuminosityBlock const &lumi, CLHEP::HepRandomEngine *rengine)