11 #include <boost/shared_ptr.hpp> 12 #include <boost/algorithm/string/classification.hpp> 13 #include <boost/algorithm/string/split.hpp> 15 #include <HepMC/GenEvent.h> 16 #include <HepMC/GenParticle.h> 17 #include <HepMC/GenVertex.h> 18 #include <HepMC/PdfInfo.h> 19 #include <HepMC/HerwigWrapper.h> 20 #include <HepMC/HEPEVT_Wrapper.h> 21 #include <HepMC/IO_HERWIG.h> 22 #include "HepPID/ParticleIDTranslations.hh" 45 void hwuidt_(
int *iopt,
int *ipdg,
int *iwig,
char nwig[8]);
50 inline bool call_hwmsct()
57 int pdgToHerwig(
int ipdg,
char *nwig)
61 hwuidt_(&iopt, &ipdg, &iwig, nwig);
62 return ipdg ? iwig : 0;
65 bool markStable(
int pdgId)
68 if (!pdgToHerwig(pdgId, nwig))
75 #define qcd_1994 qcd_1994_ 77 void qcd_1994(
double&,
double&,
double*,
int&);
80 #define qcd_2006 qcd_2006_ 82 void qcd_2006(
double&,
double&,
int&,
double*,
double*,
double*,
double*,
double*);
98 herwigVerbosity(params.getUntrackedParameter<
int>(
"herwigVerbosity", 0)),
99 hepmcVerbosity(params.getUntrackedParameter<
int>(
"hepmcVerbosity", 0)),
101 printCards(params.getUntrackedParameter<
bool>(
"printCards",
false)),
102 comEnergy(params.getParameter<double>(
"comEnergy")),
103 survivalProbability(params.getParameter<double>(
"survivalProbability")),
104 diffTopology(params.getParameter<
int>(
"diffTopology")),
105 h1fit(params.getParameter<
int>(
"h1fit")),
106 useJimmy(params.getParameter<
bool>(
"useJimmy")),
107 doMPInteraction(params.getParameter<
bool>(
"doMPInteraction")),
108 numTrials(params.getUntrackedParameter<
int>(
"numTrialsMPI", 100)),
111 if ( params.
exists(
"doPDGConvert" ) )
149 <<
"Initializing PomwigHadronizer\n" 150 <<
"----------------------------------------------\n";
161 hwbmch.PART1[0] =
'E';
162 hwbmch.PART1[1] =
'-';
163 hwbmch.PART2[0] =
'E';
164 hwbmch.PART2[1] =
'-';
167 hwbmch.PART1[0] =
'E';
168 hwbmch.PART1[1] =
'-';
169 hwbmch.PART2[0] =
'P';
170 hwbmch.PART2[1] =
' ';
173 hwbmch.PART1[0] =
'P';
174 hwbmch.PART1[1] =
' ';
175 hwbmch.PART2[0] =
'E';
176 hwbmch.PART2[1] =
'-';
179 hwbmch.PART1[0] =
'P';
180 hwbmch.PART1[1] =
' ';
181 hwbmch.PART2[0] =
'P';
182 hwbmch.PART2[1] =
' ';
186 <<
" Invalid Diff. Topology. Must be DPE(diffTopology = 0), SD particle 1 (diffTopology = 1), SD particle 2 (diffTopology = 2) and Non diffractive (diffTopology = 3)";
189 for(
int i=2;
i<8;++
i){
190 hwbmch.PART1[
i] =
' ';
191 hwbmch.PART2[
i] =
' ';}
196 hwevnt.MAXER = 100000000;
202 for(
unsigned int i = 0;
i < 2;
i++) {
203 hwpram.MODPDF[
i] = -111;
204 std::memcpy(
hwprch.AUTPDF[
i],
"HWLHAPDF", 8);
211 <<
"Reading HERWIG parameters\n" 212 <<
"------------------------------------\n";
219 <<
"Herwig 6 did not accept the following: \"" 220 << *
line <<
"\"." << std::endl;
251 int nstru = hwpram.NSTRU;
253 if((nstru == 9)||(nstru == 10)){
254 if((ifit <= 0)||(ifit >= 7)){
256 <<
" Attempted to set non existant H1 1997 fit index. Has to be 1...6";
260 <<
" IFIT = " << ifit;
265 }
else if((nstru >= 12)&&(nstru <= 15)){
266 bool isPom = (nstru == 12)||(nstru == 14);
267 bool isFitA = (nstru == 12)||(nstru == 13);
272 <<
" IFIT = "<< ifit;
280 qcd_2006(xp,Q2,ifit,xpq,f2,fl,c2,cl);
283 <<
" Only running Pomeron H1 1997 (NSTRU=9), H1 2006 fit A (NSTRU=12) and H1 2006 fit B (NSTRU=14) or Reggeon H1 1997 (NSTRU=10), H1 2006 fit A (NSTRU=13) and H1 2006 fit B (NSTRU=15)";
291 for(std::vector<int>::const_iterator iter = pdgIds.begin();
292 iter != pdgIds.end(); ++iter)
293 if (!markStable(*iter))
300 double RNWGT = 1. / hwevnt.NWGTS;
301 double AVWGT = hwevnt.WGTSUM * RNWGT;
303 double xsec = 1.0e3 * AVWGT;
343 if (!hwevnt.IERROR)
return true;
353 event()->set_signal_process_id(hwproc.IPROC);
355 event()->weights().push_back(hwevnt.EVWGT);
373 event().reset(
new HepMC::GenEvent);
374 if (!
conv.fill_next_event(
event().
get()))
376 <<
"HepMC Conversion problems in event." << std::endl;
380 for ( HepMC::GenEvent::particle_iterator
part =
event()->particles_begin();
part !=
event()->particles_end(); ++
part) {
381 if ((*part)->pdg_id() != HepPID::translateHerwigtoPDT((*part)->pdg_id()))
382 (*part)->set_pdg_id(HepPID::translateHerwigtoPDT((*part)->pdg_id()));
bool declareStableParticles(const std::vector< int > &pdgIds)
T getParameter(std::string const &) const
void mysetpdfpath_(const char *path)
bool exists(std::string const ¶meterName) const
checks if a parameter exists
static void fixHepMCEventTimeOrdering(HepMC::GenEvent *event)
void setInternalXSec(const XSec &xsec)
GenRunInfoProduct & runInfo()
static const std::vector< std::string > theSharedResources
bool callWithTimeout(unsigned int secs, void(*fn)())
void hwwarn_(const char *method, int *id)
bool initializeForInternalPartons()
std::unique_ptr< HepMC::GenEvent > & event()
bool give(const std::string &line)
static const std::string kFortranInstance
bool generatePartonsAndHadronize()
void hwuidt_(int *iopt, int *ipdg, int *iwig, char nwig[8])
~PomwigHadronizer() override
void doSetRandomEngine(CLHEP::HepRandomEngine *v) override
void setHerwigRandomEngine(CLHEP::HepRandomEngine *v)
double survivalProbability
PomwigHadronizer(const edm::ParameterSet ¶ms)
static const std::string kHerwig6
bool initializeForExternalPartons()
static HepMC::HEPEVT_Wrapper wrapper