7 #include <HepMC/GenEvent.h>
8 #include <HepMC/GenParticle.h>
11 #include <HepMCInterface.h>
32 #include "HepPID/ParticleIDTranslations.hh"
37 using namespace Pythia8;
44 bool initializeForInternalPartons();
45 bool initializeForExternalPartons();
47 bool declareStableParticles(
const std::vector<int> &pdgIds);
48 bool declareSpecialSettings(
const std::vector<std::string> );
52 bool generatePartonsAndHadronize();
58 const char *
classname()
const {
return "Pythia8Hadronizer"; }
77 std::auto_ptr<LHAupLesHouches>
lhaUP;
89 comEnergy(params.getParameter<double>(
"comEnergy")),
93 LHEInputFileName(params.getUntrackedParameter<string>(
"LHEInputFileName",
"")),
96 if( params.
exists(
"useUserHook" ) )
116 pythia->setRndmEnginePtr(RP8);
123 if (
line->find(
"Random:") != std::string::npos)
125 <<
"Attempted to set random number "
126 "using Pythia commands. Please use "
127 "the RandomNumberGeneratorService."
132 <<
"Pythia 8 did not accept \""
133 << *
line <<
"\"." << std::endl;
138 pythia->settings.listAll();
140 pythia->particleData.listAll();
145 pythia->settings.listChanged();
154 std::cout <<
"Initializing for external partons" << std::endl;
160 pythia->setRndmEnginePtr(RP8);
166 if (
line->find(
"Random:") != std::string::npos)
168 <<
"Attempted to set random number "
169 "using Pythia commands. Please use "
170 "the RandomNumberGeneratorService."
175 <<
"Pythia 8 did not accept \""
176 << *
line <<
"\"." << std::endl;
181 pythia->settings.listAll();
183 pythia->particleData.listAll();
212 else if (status > -30 && status < 0)
222 for (
size_t i=0;
i<pdgIds.size();
i++ )
227 int PyID = HepPID::translatePDTtoPythia( pdgIds[
i] );
228 std::ostringstream pyCard ;
229 pyCard << PyID <<
":mayDecay=false";
230 pythia->readString( pyCard.str() );
250 double xsec =
pythia->info.sigmaGen();
260 event().reset(
new HepMC::GenEvent);
281 event().reset(
new HepMC::GenEvent);
301 event()->set_signal_process_id(
pythia->info.code());
304 int id1 =
pythia->info.id1();
305 int id2 =
pythia->info.id2();
306 if (id1 == 21) id1 = 0;
307 if (id2 == 21) id2 = 0;
308 double x1 =
pythia->info.x1();
309 double x2 =
pythia->info.x2();
310 double Q =
pythia->info.QRen();
313 event()->set_pdf_info(HepMC::PdfInfo(id1,id2,x1,x2,Q,pdf1,pdf2));
315 event()->weights().push_back(
pythia->info.weight());
325 eventInfo()->setBinningValues(std::vector<double>(1,
pythia->info.pTHat()));
340 <<
pythia->info.code() <<
"\n"
341 <<
"----------------------" << std::endl;
bool pythiaHepMCVerbosity
HepMC verbosity flag.
T getParameter(std::string const &) const
bool initializeForInternalPartons()
double comEnergy
Center-of-Mass energy.
edm::GeneratorFilter< Pythia8Hadronizer, ExternalDecayDriver > Pythia8GeneratorFilter
bool declareStableParticles(const std::vector< int > &pdgIds)
bool initializeForExternalPartons()
std::auto_ptr< Pythia > pythia
#define DEFINE_FWK_MODULE(type)
bool exists(std::string const ¶meterName) const
checks if a parameter exists
void count(LHERunInfo::CountMode count, double weight=1.0, double matchWeight=1.0)
bool declareSpecialSettings(const std::vector< std::string >)
static int getStatus(const HepMC::GenParticle *p)
void setInternalXSec(const XSec &xsec)
bool useUserHook
Switch User Hook flag.
std::auto_ptr< HepMC::GenEvent > & event()
CLHEP::HepRandomEngine & getEngineReference()
GenRunInfoProduct & runInfo()
std::auto_ptr< LHAupLesHouches > lhaUP
lhef::LHEEvent * lheEvent()
tuple pythiaPylistVerbosity
CLHEP::HepRandomEngine * randomEngine
const char * classname() const
unsigned int pythiaPylistVerbosity
Pythia PYLIST Verbosity flag.
std::auto_ptr< GenEventInfoProduct > & eventInfo()
lhef::LHERunInfo * lheRunInfo()
ParameterCollector parameters
unsigned int maxEventsToPrint
Events to print if verbosity.
bool generatePartonsAndHadronize()
Pythia8Hadronizer(const edm::ParameterSet ¶ms)
const_iterator end() const
const_iterator begin() const
tuple pythiaHepMCVerbosity
edm::HadronizerFilter< Pythia8Hadronizer, ExternalDecayDriver > Pythia8HadronizerFilter