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> 28 #include <Herwig/API/HerwigAPI.h> 29 #include "CLHEP/Random/RandomEngine.h" 32 class HepRandomEngine;
41 bool initializeForInternalPartons();
42 bool initializeForExternalPartons();
43 bool declareStableParticles(
const std::vector<int> &pdgIds);
48 bool generatePartonsAndHadronize();
54 const char *
classname()
const {
return "Herwig7Hadronizer"; }
67 std::shared_ptr<lhef::LHEProxy>
proxy_;
71 unsigned int firstLumiBlock=0;
72 unsigned int currentLumiBlock=0;
78 eventsToPrint(pset.getUntrackedParameter<unsigned
int>(
"eventsToPrint", 0)),
79 handlerDirectory_(pset.getParameter<
std::
string>(
"eventHandlers")),
80 runFileName(pset.getParameter<
std::
string>(
"run"))
101 edm::LogInfo(
"Generator|Herwig7Hadronizer") <<
"No run step for Herwig chosen. Program will be aborted.";
110 edm::LogError(
"Herwig7 interface") <<
"Read in of LHE files is not supported in this way. You can read them manually if necessary.";
123 eg_->integratedXSec() / ThePEG::picobarn,
124 eg_->integratedXSecErr() / ThePEG::picobarn));
130 edm::LogInfo(
"Generator|Herwig7Hadronizer") <<
"Start production";
134 edm::LogWarning(
"Generator|Herwig7Hadronizer") <<
"EGPtr::shoot() thrown an exception, event skipped: " << exc.what();
139 edm::LogWarning(
"Generator|Herwig7Hadronizer") <<
"thepegEvent not initialized";
144 if (!
event().
get()) {
145 edm::LogWarning(
"Generator|Herwig7Hadronizer") <<
"genEvent not initialized";
155 edm::LogError(
"Herwig7 interface") <<
"Read in of LHE files is not supported in this way. You can read them manually if necessary.";
173 edm::LogInfo(
"Generator|Herwig7Hadronizer") <<
"Event produced";
191 int weights_number =
thepegEvent->optionalWeights().size();
193 if(weights_number > 1){
194 genLumiInfoHeader->
weightNames().reserve(weights_number + 1);
195 genLumiInfoHeader->
weightNames().push_back(
"nominal");
196 std::map<std::string,double> weights_map =
thepegEvent->optionalWeights();
197 for (std::map<std::string,double>::iterator it = weights_map.begin(); it != weights_map.end(); it++)
199 genLumiInfoHeader->
weightNames().push_back(it->first);
209 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)