8 #include <HepMC/GenEvent.h>
9 #include <HepMC/GenParticle.h>
12 #include <HepMCInterface.h>
43 #include "HepPID/ParticleIDTranslations.hh"
48 class HepRandomEngine;
52 using namespace Pythia8;
61 bool initializeForInternalPartons()
override;
62 bool initializeForExternalPartons();
64 bool generatePartonsAndHadronize()
override;
66 void finalizeEvent()
override;
70 const char *
classname()
const override {
return "Pythia8Hadronizer"; }
75 virtual std::vector<std::string>
const&
doSharedResources()
const override {
return p8SharedResources; }
81 std::auto_ptr<LHAupLesHouches>
lhaUP;
83 enum { PP,
PPbar, ElectronPositron };
118 comEnergy(params.getParameter<double>(
"comEnergy")),
119 LHEInputFileName(params.getUntrackedParameter<
string>(
"LHEInputFileName",
"")),
121 fReweightUserHook(0),
123 fEmissionVetoHook(0),fEmissionVetoHook1(0)
128 if ( params.
exists(
"PPbarInitialState" ) )
134 <<
"Pythia6 will be initialized for PROTON-ANTIPROTON INITIAL STATE. "
135 <<
"This is a user-request change from the DEFAULT PROTON-PROTON initial state." << std::endl;
136 std::cout <<
"Pythia6 will be initialized for PROTON-ANTIPROTON INITIAL STATE." << std::endl;
137 std::cout <<
"This is a user-request change from the DEFAULT PROTON-PROTON initial state." << std::endl;
144 else if ( params.
exists(
"ElectronPositronInitialState" ) )
150 <<
"Pythia6 will be initialized for ELECTRON-POSITRON INITIAL STATE. "
151 <<
"This is a user-request change from the DEFAULT PROTON-PROTON initial state." << std::endl;
152 std::cout <<
"Pythia6 will be initialized for ELECTRON-POSITRON INITIAL STATE." << std::endl;
153 std::cout <<
"This is a user-request change from the DEFAULT PROTON-PROTON initial state." << std::endl;
160 else if ( params.
exists(
"ElectronProtonInitialState" ) || params.
exists(
"PositronProtonInitialState" ) )
164 <<
" UNKNOWN INITIAL STATE. \n The allowed initial states are: PP, PPbar, ElectronPositron \n";
167 if( params.
exists(
"SLHAFileForPythia8" ) ) {
175 if (
line->find(
"SLHA:file") != std::string::npos)
176 throw cms::Exception(
"PythiaError") <<
"Attempted to set SLHA file name twice, "
177 <<
"using Pythia8 card SLHA:file and Pythia8Interface card SLHAFileForPythia8"
184 if( params.
exists(
"reweightGen" ) )
187 if( params.
exists(
"useUserHook" ) )
189 <<
" Obsolete parameter: useUserHook \n Please use the actual one instead \n";
193 if ( params.
exists(
"jetMatching") )
198 if ( scheme ==
"Madgraph" || scheme ==
"MadgraphFastJet" )
206 if ( params.
exists(
"emissionVeto") )
211 if ( params.
exists(
"emissionVeto1") )
225 <<
" Wrong value for EV1_pTempMode code\n";
244 <<
" Too many User Hooks. \n Please choose one from: reweightGen, jetMatching, emissionVeto \n";
249 cout <<
"Turning on Emission Veto Hook";
252 int nversion = (int)(1000.*(
fMasterGen->settings.parm(
"Pythia:versionNumber") - 8.));
254 cout <<
"obsolete pythia8 version for this Emission Veto code" << endl;
255 cout <<
"Please update pythia8 version using the instructions here:" << endl;
256 cout <<
"https://twiki.cern.ch/twiki/bin/view/CMS/Pythia8Interface" << endl;
257 cout <<
"or try to use tag V00-01-28 of this interface" << endl;
259 <<
" Obsolete pythia8 version for this Emission Veto code\n";
296 <<
" UNKNOWN INITIAL STATE. \n The allowed initial states are: PP, PPbar, ElectronPositron \n";
316 std::cout <<
"Initializing for external partons" << std::endl;
359 else if (status > -30 && status < 0)
382 event().reset(
new HepMC::GenEvent);
411 event().reset(
new HepMC::GenEvent);
445 <<
"----------------------" << std::endl;
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
ParameterCollector fParameters
double comEnergy
Center-of-Mass energy.
std::auto_ptr< Pythia8::Pythia > fMasterGen
EmissionVetoHook1 * fEmissionVetoHook1
edm::GeneratorFilter< Pythia8Hadronizer, ExternalDecayDriver > Pythia8GeneratorFilter
bool initializeForInternalPartons() override
UserHooks * fReweightUserHook
EmissionVetoHook * fEmissionVetoHook
bool initializeForExternalPartons()
#define DEFINE_FWK_MODULE(type)
void statistics() override
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)
void setInternalXSec(const XSec &xsec)
virtual void beforeHadronization(lhef::LHEEvent *lhee)
std::auto_ptr< HepMC::GenEvent > & event()
virtual std::vector< std::string > const & doSharedResources() const override
GenRunInfoProduct & runInfo()
std::auto_ptr< LHAupLesHouches > lhaUP
lhef::LHEEvent * lheEvent()
static const std::vector< std::string > p8SharedResources
unsigned int pythiaPylistVerbosity
const char * classname() const override
std::auto_ptr< GenEventInfoProduct > & eventInfo()
lhef::LHERunInfo * lheRunInfo()
bool generatePartonsAndHadronize() override
virtual void init(lhef::LHERunInfo *runInfo)
JetMatchingHook * fJetMatchingHook
unsigned int maxEventsToPrint
Pythia8Hadronizer(const edm::ParameterSet ¶ms)
void resetMatchingStatus()
bool pythiaHepMCVerbosity
const_iterator end() const
const_iterator begin() const
static const std::string kPythia8
void finalizeEvent() override
virtual void doSetRandomEngine(CLHEP::HepRandomEngine *v) override
edm::HadronizerFilter< Pythia8Hadronizer, ExternalDecayDriver > Pythia8HadronizerFilter