34 #include "LHAFortran.h"
36 using namespace Pythia8;
44 #define pygive_ PYGIVE
45 #define pyinit_ PYINIT
46 #define pyupin_ PYUPIN
47 #define pyupev_ PYUPEV
48 #define pylist_ PYLIST
49 #define pystat_ PYSTAT
54 extern void pyinit_(
const char*,
int,
const char*,
int,
const char*,
57 extern void pyinit_(
const char*,
const char*,
const char*,
double&,
63 extern void pygive_(
const char*,
int);
64 extern void pyupin_();
65 extern void pyupev_();
66 extern void pylist_(
int&);
67 extern void pystat_(
int&);
80 static void pygive(
const string cmnd) {
81 const char* cstring = cmnd.c_str();
int len = cmnd.length();
82 pygive_(cstring, len);
86 static void pyinit(
const string frame,
const string beam,
87 const string target,
double wIn) {
88 const char* cframe = frame.c_str();
int lenframe = frame.length();
89 const char* cbeam = beam.c_str();
int lenbeam = beam.length();
90 const char* ctarget = target.c_str();
int lentarget = target.length();
92 pyinit_(cframe, lenframe, cbeam, lenbeam, ctarget, lentarget, wIn);
94 pyinit_(cframe, cbeam, ctarget, wIn, lenframe, lenbeam, lentarget);
99 static void pyupin() {pyupin_();}
103 static void pyupev() {pyupev_();}
106 static void pylist(
int mode) {pylist_(mode);}
109 static void pystat(
int mode) {pystat_(mode);}
122 bool LHAupFortran::fillHepRup() {
131 Pythia6Interface::pygive(
"msel = 11");
132 Pythia6Interface::pygive(
"ckin(1) = 50.");
135 Pythia6Interface::pygive(
"mstp(81)=0");
138 Pythia6Interface::pyinit(
"cms",
"p",
"p",14000.);
141 Pythia6Interface::pyupin();
153 bool LHAupFortran::fillHepEup() {
156 Pythia6Interface::pyupev();
172 Event&
event = pythia.event;
173 Settings& settings = pythia.settings;
176 pythia.readString(
"BeamRemnants:primordialKThard = 2.");
177 pythia.readString(
"MultipartonInteractions:bProfile = 3");
178 pythia.readString(
"Next:numberShowInfo = 0");
179 pythia.readString(
"Next:numberShowProcess = 0");
180 pythia.readString(
"Next:numberShowEvent = 0");
183 pythia.readString(
"Beams:frameType = 5");
185 pythia.setLHAupPtr( &pythia6);
194 settings.listChanged();
198 double epTol = 1e-7 * eCM;
199 Hist epCons(
"deviation from energy-momentum conservation",100,0.,epTol);
200 Hist nFinal(
"final particle multiplicity",100,-0.5,1599.5);
201 Hist nChg(
"final charged multiplicity",100,-0.5,799.5);
205 for (
int iEvent = 0; iEvent < nEvent; ++iEvent) {
208 if (!pythia.next()) {
209 if (++iAbort < nAbort)
continue;
210 cout <<
" Event generation aborted prematurely, owing to error!\n";
215 if (iEvent < nList) {
218 Pythia6Interface::pylist(1);
219 pythia.process.list();
226 Vec4 pSum = - (
event[1].p() +
event[2].p());
229 for (
int i = 0; i <
event.size(); ++i)
230 if (event[i].isFinal()) {
232 if (event[i].isCharged()) ++nch;
233 pSum +=
event[i].p();
237 double epDev = abs(pSum.e()) + abs(pSum.px()) + abs(pSum.py())
248 Pythia6Interface::pystat(1);
251 cout << epCons << nFinal<< nChg;