7 #ifndef Pythia8_LHAPowheg_H 8 #define Pythia8_LHAPowheg_H 10 #include "Pythia8/Plugins.h" 11 #include "Pythia8Plugins/LHAFortran.h" 25 int rnd_numseeds, rnd_initialseed, rnd_iwhichseed;
26 char rnd_cwhichseed[4];
41 void resetcnt_(
const char *
string,
int length);
79 bool readString(
string line);
82 bool readFile(
string name);
97 map<string, string> settings;
100 char cwd[FILENAME_MAX];
109 Logger* loggerPtrIn) : loggerPtr(loggerPtrIn), dir(
"powhegrun"), pdf(
"") {
112 if (settingsPtr !=
nullptr) {
113 dir = settingsPtr->word(
"POWHEG:dir");
114 pdf = settingsPtr->word(
"POWHEG:pdf");
117 for (
string cmndFile : settingsPtr->wvec(
"POWHEG:cmndFiles"))
119 for (
string cmnd : settingsPtr->wvec(
"POWHEG:cmnds"))
124 if (pythiaPtr !=
nullptr) {
125 if (settingsPtr->
isFlag(
"POWHEG:pythiaRandom")) rndmPtr = &pythiaPtr->
rndm;
127 mkdir(dir.c_str(), 0777);
139 getcwd(cwd,
sizeof(cwd));
141 strcpy(
pwhg_rnd_.rnd_cwhichseed,
"none");
147 resetcnt_(
"upper bound failure in inclusive cross section", 46);
148 resetcnt_(
"vetoed calls in inclusive cross section", 39);
149 resetcnt_(
"upper bound failures in generation of radiation", 47);
163 getcwd(cwd,
sizeof(cwd));
167 if (rndmPtr !=
nullptr) {
171 for (
int i = 0; i < 97; ++i)
r48st1_.u[i] = rndmPtr->
flat();
186 bool LHAupPowheg::readString(
string line) {
189 if (line.find_first_not_of(
" \n\t\v\b\r\f\a") == string::npos)
return true;
190 int firstChar = line.find_first_not_of(
" \n\t\v\b\r\f\a");
191 int lastChar = line.find_last_not_of(
" \n\t\v\b\r\f\a");
192 line = line.substr(firstChar, lastChar + 1 - firstChar);
195 firstChar = line.find_first_of(
" \t\f\v\n\r");
196 string key =
toLower( line.substr(0, firstChar),
false);
200 && key.find_first_of(
"abcdedfghijklmnopqrtsuvwxyz") == 0) {
201 map<string, string>::iterator setting = settings.find(key);
202 if (setting != settings.end()) {
203 if (loggerPtr) loggerPtr->WARNING_MSG(
204 "replacing previous POWHEG setting for " + key);
205 setting->second = line;
206 }
else settings[key] = line;
216 bool LHAupPowheg::readFile(
string name) {
218 fstream config(name.c_str(), ios::in);
string line;
219 while (getline(config, line,
'\n')) readString(line);
229 bool LHAupPowheg::init() {
233 fstream pdfin(pdf.c_str(), ios::in | ios::binary);
234 fstream pdfout((dir +
"/" + pdf.substr(0, pdf.find_last_of(
"/"))).c_str(),
235 ios::out | ios::binary);
236 pdfout << pdfin.rdbuf();
242 fstream config((dir +
"/" +
"powheg.input").c_str(), ios::out);
243 for (map<string, string>::iterator setting = settings.begin();
244 setting != settings.end(); ++setting) config << setting->second <<
"\n";
255 settingsPtr->addWord(
"POWHEG:dir",
"powhegrun");
256 settingsPtr->addWord(
"POWHEG:pdf",
"");
257 settingsPtr->addWVec(
"POWHEG:cmnds", {});
258 settingsPtr->addWVec(
"POWHEG:cmndFiles", {});
259 settingsPtr->
addFlag(
"POWHEG:pythiaRandom",
true);
268 PYTHIA8_PLUGIN_VERSIONS(PYTHIA_VERSION_INTEGER)
Rndm rndm
Random number generator.
Definition: Pythia.h:338
bool fillHepEup()
Call pwhgevent and fill the HEEUP commonblock.
Definition: LHAPowheg.h:160
Definition: LHAFortran.h:51
void powhegSettings(Settings *settingsPtr)
Register POWHEG settings.
Definition: LHAPowheg.h:254
struct Pythia8::@2 pwhg_rnd_
Give access to the POWHEG commonblocks and subroutines.
string toLower(const string &name, bool trim=true)
Definition: PythiaStdlib.cc:17
bool isFlag(string keyIn)
Query existence of an entry.
Definition: Settings.h:249
void resetcnt_(const char *string, int length)
Reset the counters.
double powheginput_(const char *string, int length)
Access Powheg input data.
void pwhgevent_()
Generate an event.
Definition: LesHouches.h:78
Definition: LHAPowheg.h:63
void pwhginit_()
Initialize Powheg.
LHAupPowheg(Pythia *pythiaPtr, Settings *settingsPtr, Logger *loggerPtr)
Constructor.
Definition: LHAPowheg.h:108
struct Pythia8::@3 r48st1_
The RANMAR (R48 modification) common block.
Header for classes to set beam momentum and interaction vertex spread.
Definition: Analysis.h:20
The Pythia class contains the top-level routines to generate an event.
Definition: Pythia.h:71
double flat()
Generate next random number uniformly between 0 and 1.
Definition: Basics.cc:189
bool fillHepRup()
Call pwhginit and fill the HEPRUP commonblock.
Definition: LHAPowheg.h:136
Definition: Settings.h:195
void addFlag(string keyIn, bool defaultIn)
Add new entry.
Definition: Settings.h:267