11 #include <boost/algorithm/string/classification.hpp>
12 #include <boost/algorithm/string/split.hpp>
14 #include <HepMC/GenEvent.h>
15 #include <HepMC/GenParticle.h>
16 #include <HepMC/GenVertex.h>
17 #include <HepMC/PdfInfo.h>
18 #include <HepMC/HerwigWrapper.h>
19 #include <HepMC/HEPEVT_Wrapper.h>
20 #include <HepMC/IO_HERWIG.h>
21 #include "HepPID/ParticleIDTranslations.hh"
43 void hwuidt_(
int *iopt,
int *ipdg,
int *iwig,
char nwig[8]);
48 inline bool call_hwmsct() {
54 int pdgToHerwig(
int ipdg,
char *nwig) {
57 hwuidt_(&iopt, &ipdg, &iwig, nwig);
58 return ipdg ? iwig : 0;
61 bool markStable(
int pdgId) {
63 if (!pdgToHerwig(
pdgId, nwig))
70 #define qcd_1994 qcd_1994_
72 void qcd_1994(
double &,
double &,
double *,
int &);
75 #define qcd_2006 qcd_2006_
77 void qcd_2006(
double &,
double &,
int &,
double *,
double *,
double *,
double *,
double *);
94 hepmcVerbosity(
params.getUntrackedParameter<
int>(
"hepmcVerbosity", 0)),
103 numTrials(
params.getUntrackedParameter<
int>(
"numTrialsMPI", 100)),
105 if (
params.exists(
"doPDGConvert"))
131 <<
"Initializing PomwigHadronizer\n"
132 <<
"----------------------------------------------\n";
143 hwbmch.PART1[0] =
'E';
144 hwbmch.PART1[1] =
'-';
145 hwbmch.PART2[0] =
'E';
146 hwbmch.PART2[1] =
'-';
149 hwbmch.PART1[0] =
'E';
150 hwbmch.PART1[1] =
'-';
151 hwbmch.PART2[0] =
'P';
152 hwbmch.PART2[1] =
' ';
155 hwbmch.PART1[0] =
'P';
156 hwbmch.PART1[1] =
' ';
157 hwbmch.PART2[0] =
'E';
158 hwbmch.PART2[1] =
'-';
161 hwbmch.PART1[0] =
'P';
162 hwbmch.PART1[1] =
' ';
163 hwbmch.PART2[0] =
'P';
164 hwbmch.PART2[1] =
' ';
168 <<
" Invalid Diff. Topology. Must be DPE(diffTopology = 0), SD particle 1 (diffTopology = 1), SD particle "
169 "2 (diffTopology = 2) and Non diffractive (diffTopology = 3)";
172 for (
int i = 2;
i < 8; ++
i) {
173 hwbmch.PART1[
i] =
' ';
174 hwbmch.PART2[
i] =
' ';
180 hwevnt.MAXER = 100000000;
186 for (
unsigned int i = 0;
i < 2;
i++) {
187 hwpram.MODPDF[
i] = -111;
188 std::memcpy(
hwprch.AUTPDF[
i],
"HWLHAPDF", 8);
195 <<
"Reading HERWIG parameters\n"
196 <<
"------------------------------------\n";
202 <<
"Herwig 6 did not accept the following: \"" << *
line <<
"\"." << std::endl;
232 int nstru = hwpram.NSTRU;
234 if ((nstru == 9) || (nstru == 10)) {
235 if ((ifit <= 0) || (ifit >= 7)) {
237 <<
" Attempted to set non existant H1 1997 fit index. Has to be 1...6";
241 <<
" IFIT = " << ifit;
246 }
else if ((nstru >= 12) && (nstru <= 15)) {
247 bool isPom = (nstru == 12) || (nstru == 14);
248 bool isFitA = (nstru == 12) || (nstru == 13);
249 ifit = (isFitA) ? 1 : 2;
251 std::string aux_1((isPom) ?
"Pomeron" :
"Reggeon");
253 <<
" IFIT = " << ifit;
264 <<
" Only running Pomeron H1 1997 (NSTRU=9), H1 2006 fit A (NSTRU=12) and H1 2006 fit B (NSTRU=14) or "
265 "Reggeon H1 1997 (NSTRU=10), H1 2006 fit A (NSTRU=13) and H1 2006 fit B (NSTRU=15)";
272 for (std::vector<int>::const_iterator iter =
pdgIds.begin(); iter !=
pdgIds.end(); ++iter)
273 if (!markStable(*iter))
279 double RNWGT = 1. / hwevnt.NWGTS;
280 double AVWGT = hwevnt.WGTSUM * RNWGT;
282 double xsec = 1.0e3 * AVWGT;
328 event()->set_signal_process_id(hwproc.IPROC);
330 event()->weights().push_back(hwevnt.EVWGT);
349 throw cms::Exception(
"PomwigError") <<
"HepMC Conversion problems in event." << std::endl;
353 for (HepMC::GenEvent::particle_iterator
part =
event()->particles_begin();
part !=
event()->particles_end();
355 if ((*part)->pdg_id() != HepPID::translateHerwigtoPDT((*part)->pdg_id()))
356 (*part)->set_pdg_id(HepPID::translateHerwigtoPDT((*part)->pdg_id()));