StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
LHAMadgraph.h
1 // LHAMadgraph.h is a part of the PYTHIA event generator.
2 // Copyright (C) 2018 Torbjorn Sjostrand.
3 // PYTHIA is licenced under the GNU GPL v2 or later, see COPYING for details.
4 // Please respect the MCnet Guidelines, see GUIDELINES for details.
5 
6 // Author: Philip Ilten, December 2015.
7 
8 #ifndef Pythia8_LHAMadgraph_H
9 #define Pythia8_LHAMadgraph_H
10 
11 #include "Pythia8/Pythia.h"
12 #include "Pythia8Plugins/JetMatching.h"
13 #include "Pythia8Plugins/GeneratorInput.h"
14 #include <unistd.h>
15 #include <sys/stat.h>
16 
17 using namespace std;
18 
19 namespace Pythia8 {
20 
21 //==========================================================================
22 
23 // A derived class from LHAup which generates events with MadGraph 5.
24 
25 // This class automatically generates hard processes with MadGraph 5
26 // and aMC@NLO, reads in the LHEF file output, and performs matching
27 // (if requested). For tree-level generation MLM matching is performed
28 // while FxFx is used for aMC@NLO generation.
29 
30 // The user can send commands to MadGraph via the readString
31 // method. Any string begining with "configure " is used for the initial
32 // MadGraph configuration with "configure " stripped from the
33 // begining. In general, only the process and run settings need to be
34 // provided. Run settings must begin with " set" (note the leading
35 // space). The output and launch commands, random seed, and shower
36 // choice are automatically handled. For example, the following will
37 // produce di-muon events from 13 TeV proton proton collisions at NLO
38 // in QCD:
39 
40 // readString("generate p p > mu+ mu- [QCD]")
41 
42 // The number of events generated per MadGraph run is controlled by
43 // setEvents, while the random seed is controlled by setSeed. The
44 // maximum number of jets produced by MadGraph (needed for matching)
45 // is automatically determined but can be manually specified with
46 // setJets. In general these methods should not be needed; for further
47 // details see the method documentation.
48 
49 // Events are generated with MadGraph utilizing the "gridpack" method
50 // for MadGraph 5:
51 //
52 // https://cp3.irmp.ucl.ac.be/projects/madgraph/wiki/GridDevelopment
53 //
54 // and an eqivalent method for aMC@NLO:
55 //
56 // https://answers.launchpad.net/mg5amcnlo/+question/243268
57 //
58 // Consequently the run directory ("madgraphrun" by default) does not
59 // need to be deleted between independent runs with the same
60 // configuration (excluding random seeds). Indeed, keeping the
61 // directory significantly speeds the generation process, particularly
62 // for NLO generation with aMC@NLO as the grid initialization
63 // can be skipped after the initial run.
64 
65 class LHAupMadgraph : public LHAup {
66 
67 public:
68 
69  // Types of MadGraph stages.
70  enum Stage{Auto, Configure, Generate, Launch};
71 
72  // Constructor.
73  LHAupMadgraph(Pythia* pythiaIn, bool matchIn = true,
74  string dirIn = "madgraphrun", string exeIn = "mg5_aMC");
75 
76  // Destructor.
77  ~LHAupMadgraph();
78 
79  // Read a MadGraph command string.
80  bool readString(string line, Stage stage = Auto);
81 
82  // Add a MadGraph configuration card to be used.
83  void addCard(string src, string dst);
84 
85  // Set the number of events to generate per run.
86  void setEvents(int eventsIn);
87 
88  // Set the random seed and maximum runs.
89  bool setSeed(int seedIn, int runsIn = 30081);
90 
91  // Set the maximum number of jets produced by MadGraph.
92  void setJets(int jetsIn);
93 
94  // Set the initialization information.
95  bool setInit();
96 
97  // Set the event information.
98  bool setEvent(int = 0);
99 
100 protected:
101 
102  // Execute a system command.
103  bool execute(string line);
104 
105  // Write the MadGraph configuration.
106  bool configure();
107 
108  // Run the generate stage of MadGraph.
109  bool generate();
110 
111  // Run the launch stage of MadGraph.
112  bool launch();
113 
114  // Run MadGraph.
115  bool run(int eventsIn, int seedIn = -1);
116 
117  // Create the LHEF reader.
118  bool reader(bool init);
119 
120  // The PYTHIA object and LHEF file reader and matching hook.
121  Pythia *pythia;
122  LHAupLHEF *lhef;
123  JetMatchingMadgraph *hook;
124 
125  // Stored members.
126  int events, seed, runs, nRuns, jets;
127  bool match, amcatnlo;
128  string dir, exe, lhegz;
129  double sigWgt, wgt;
130  vector< pair<string, string> > cards;
131 
132  // The MadGraph commands for the config, generate, and launch stages.
133  vector<string> configureLines, generateLines, launchLines;
134 
135  // Vector of whether a command stage has been overridden by the user.
136  vector<bool> override;
137 
138 };
139 
140 //--------------------------------------------------------------------------
141 
142 // Constructor.
143 
144 LHAupMadgraph::LHAupMadgraph(Pythia *pythiaIn, bool matchIn, string dirIn,
145  string exeIn) :
146  pythia(pythiaIn), lhef(0), hook(0), events(10000), seed(-1), runs(30081),
147  nRuns(0), jets(-1), match(matchIn), dir(dirIn), exe(exeIn),
148  lhegz(dirIn + "/events.lhe.gz"), override(vector<bool>(3, false)) {
149  mkdir(dir.c_str(), 0777);
150  if (pythia) pythia->readString("Beams:frameType = 5");
151 }
152 
153 //--------------------------------------------------------------------------
154 
155 // Destructor.
156 
157 LHAupMadgraph::~LHAupMadgraph() {if (lhef) delete lhef; if (hook) delete hook;}
158 
159 //--------------------------------------------------------------------------
160 
161 // Read a MadGraph command string.
162 
163 // If the stage is set to Auto, commands beginning with " set" are
164 // used in the launch stage (these must begin with a single space to
165 // differentiate from generate stage set commands), commands begining
166 // with "configure" are used in the configuration stage, and all
167 // remaining commands (excluding output and launch) are used in the
168 // generate stage. Output, launch, seed, and shower commands are
169 // automatically handled. If the user wishes to override commands,
170 // then the stage can be specified. This will prevent any
171 // automatically generated commands from being used for that
172 // stage. This should only be done if the user understands what
173 // additional commands are needed.
174 
175 // The system MadGraph configuration will be used if the configuration
176 // stage is overridden by the user and only blank commands have been
177 // passed. This is accomplished via
178 // readString("", LHAupMadgraph::Configure).
179 
180 bool LHAupMadgraph::readString(string line, Stage stage) {
181  if (stage == Auto) {
182  if (line.substr(0, 4) == " set") launchLines.push_back(line);
183  else if (line.substr(0, 10) == "configure ")
184  configureLines.push_back(line.substr(10));
185  else if (line.substr(0, 6) != "output" && line.substr(0, 6) != "launch")
186  generateLines.push_back(line);
187  else return false;
188  } else if (stage == Configure) {
189  override[Configure] = true; if (line != "") configureLines.push_back(line);
190  } else if (stage == Generate) {
191  override[Generate] = true; generateLines.push_back(line);
192  } else if (stage == Launch) {
193  override[Launch] = true; launchLines.push_back(line);
194  } else return false;
195  return true;
196 }
197 
198 //--------------------------------------------------------------------------
199 
200 // Add a MadGraph configuration card to be used.
201 
202 // In general, MadGraph should be configured via the readString
203 // method. However, there are some cases where the user might wish to
204 // provide an entire configuration card, e.g. setting BSM model
205 // space. This method allows the user to provide a source card, src,
206 // which is then copied to <MadGraph run directory>/Cards/dst. These
207 // cards are copied before any MadGraph processes are launched.
208 
209 void LHAupMadgraph::addCard(string src, string dst) {
210  cards.push_back(make_pair(src, dst));
211 }
212 
213 //--------------------------------------------------------------------------
214 
215 // Set the random seed and maximum allowed runs.
216 
217 // If the random seed is negative (default of -1), then the MadGraph
218 // seed is taken as the Pythia parameter "Random:seed", which must be
219 // greater than 0. If the maximum number of allowed runs is exceeded
220 // (default of 30081) an error is thrown. The seed for a MadGraph run
221 // is set as:
222 
223 // (random seed - 1) * (maximum runs) + (number of runs) + 1
224 
225 // MadGraph can only handle random seeds up to 30081 * 30081. So, with
226 // this strategy, one can generate Pythia jobs with seeds from 1 to
227 // 30081, with each job running MadGraph less than 30081 times, and
228 // ensure a fully statistically independent sample. If more than 30081
229 // jobs are needed, then the maximum allowed runs can be lowered
230 // accordingly, and if need be, setEvents can be used to increase the
231 // number of events generated per run.
232 
233 bool LHAupMadgraph::setSeed(int seedIn, int runsIn) {
234 
235  if (!pythia) return false;
236  seed = seedIn;
237  if (seed < 0) {
238  seed = pythia->settings.mode("Random:seed");
239  if (seed < 1) {
240  pythia->info.errorMsg("Error from LHAupMadgraph::setSeed: the given "
241  "Pythia seed is less than 1."); return false;}
242  }
243  runs = runsIn;
244  if (seed * runs > 30081 * 30081) {
245  pythia->info.errorMsg("Error from LHAupMadgraph::setSeed: the given seed "
246  "exceeds the MadGraph limit."); return false;}
247  nRuns = 0;
248  return true;
249 
250 }
251 
252 //--------------------------------------------------------------------------
253 
254 // Set the number of events to generate per MadGraph run, the default is 10000.
255 
256 void LHAupMadgraph::setEvents(int eventsIn) {events = eventsIn;}
257 
258 //--------------------------------------------------------------------------
259 
260 // Set the number maximum number of jets generated by MadGraph.
261 
262 // If negative (default of -1) then the number of jets is determined
263 // automatically. This is the maximum number of jets produced at
264 // leading order.
265 
266 void LHAupMadgraph::setJets(int jetsIn) {jets = jetsIn;}
267 
268 //--------------------------------------------------------------------------
269 
270 // Execute a system command.
271 
272 bool LHAupMadgraph::execute(string line) {return system(line.c_str()) != -1;}
273 
274 //--------------------------------------------------------------------------
275 
276 // Write the MadGraph configuration.
277 
278 // If not overridden, the MadGraph configuration is set to prevent the
279 // output from being opened in a web-browser and stop MadGraph
280 // updates.
281 
282 bool LHAupMadgraph::configure() {
283 
284  if (override[Configure] && configureLines.size() == 0) return true;
285  mkdir((dir + "/.mg5").c_str(), 0777);
286  fstream config((dir + "/.mg5/mg5_configuration.txt").c_str(), ios::out);
287  for (int iLine = 0; iLine < (int)configureLines.size(); ++iLine)
288  config << configureLines[iLine] << "\n";
289  if (!override[Configure])
290  config << "automatic_html_opening = False\n"
291  << "auto_update = 0\n";
292  config.close();
293  return true;
294 
295 }
296 
297 //--------------------------------------------------------------------------
298 
299 // Run the generate stage of MadGraph.
300 
301 // The final command of "output <dir> -f -nojpeg\n" is automatically
302 // set, if not overridden. MadGraph is then run and the output is
303 // checked. Finally, the configuration is updated and the type of run,
304 // MadGraph or aMC@NLO, is determined.
305 
306 bool LHAupMadgraph::generate() {
307 
308  // Write the user settings to the generate configuration file.
309  if (!pythia) return false;
310  fstream config((dir + "/generate.py").c_str(), ios::out);
311  for (int iLine = 0; iLine < (int)generateLines.size(); ++iLine)
312  config << generateLines[iLine] << "\n";
313  if (!override[Generate]) config << "output " << dir << "/tmp -f -nojpeg\n";
314  config.close();
315 
316  // Run MadGraph and check output.
317  fstream orig((dir + "/.mg5/mg5_configuration.txt").c_str(), ios::in);
318  char *home = getenv("HOME");
319  setenv("HOME", dir.c_str(), 1);
320  bool success = execute(exe + " " + dir + "/generate.py");
321  setenv("HOME", home, 1);
322  if (!success) {orig.close(); return false;}
323  else if (access((dir + "/tmp/Cards/run_card.dat").c_str(), F_OK) == -1) {
324  pythia->info.errorMsg("Error from LHAupMadgraph::generate: MadGraph "
325  "failed to produce run_card.dat");
326  orig.close(); return false;
327  } else execute("mv " + dir + "/tmp/* " + dir + "; rmdir " + dir + "/tmp");
328 
329  // Update configuration.
330  amcatnlo =
331  access((dir + "/Cards/amcatnlo_configuration.txt").c_str(), F_OK) != -1;
332  if (orig.good()) {
333  fstream copy((dir + "/Cards/" + (amcatnlo ? "amcatnlo" : "me5") +
334  "_configuration.txt").c_str(), ios::out);
335  copy << orig.rdbuf(); copy.close();
336  }
337  orig.close();
338 
339  // Copy over any user provided configuration cards.
340  for (int iCard = 0; iCard < (int)cards.size(); ++iCard) {
341  ifstream src((cards[iCard].first).c_str(), ios::binary);
342  ofstream dst((dir + "/Cards/" + cards[iCard].second).c_str(), ios::binary);
343  dst << src.rdbuf();
344  }
345  return true;
346 
347 }
348 
349 //--------------------------------------------------------------------------
350 
351 // Run the launch stage of MadGraph.
352 
353 // The first command "launch ..." is automatically set, and depends on
354 // whether aMC@NLO is being used.
355 
356 bool LHAupMadgraph::launch() {
357 
358  // Open the launch configuration file and write the settings.
359  if (!pythia) return false;
360  fstream config((dir + "/launch.py").c_str(), ios::out);
361  if (!override[Launch]) {
362  config << "launch " << dir << " -n run";
363  if (amcatnlo) config << " -p\n" << "set parton_shower PYTHIA8\n"
364  << "set ickkw 3\n" << "set nevents 0\n"
365  << "set req_acc 0.001\n";
366  else config << " -s parton\n" << "set ickkw 1\n" << "set gridpack True\n";
367  }
368 
369  // Write the user settings.
370  for (int iLine = 0; iLine < (int)launchLines.size(); ++iLine)
371  config << launchLines[iLine] << "\n";
372  if (!override[Launch]) config << "done\n";
373  config.close();
374 
375  // Fix aMC@NLO linking.
376  if (amcatnlo) {
377  string line = "cd " + dir + "/MCatNLO/lib; LINKS=`ls`; for LINK in $LINKS;"
378  " do TARG=`readlink $LINK`; if [[ $TARG = ../* ]]; then "
379  "rm $LINK; ln -s ${TARG:3} $LINK; fi; done";
380  if (!execute(line)) {
381  pythia->info.errorMsg("Error from LHAupMadgraph::launch: failed to "
382  "link aMC@NLO libraries"); return false;}
383  }
384 
385  // Run MadGraph and create run scripts.
386  if (!execute(exe + " " + dir + "/launch.py")) return false;
387  if (amcatnlo) {
388  if (access((dir + "/SubProcesses/results.dat").c_str(), F_OK) == -1) {
389  pythia->info.errorMsg("Error from LHAupMadgraph::launch: aMC@NLO failed "
390  "to produce results.dat"); return false;}
391  fstream script((dir + "/run.sh").c_str(), ios::out);
392  script << "#!/usr/bin/env bash\n"
393  << "sed -i \"s/.*= *nevents/$1 = nevents/g\" ./Cards/run_card.dat\n"
394  << "sed -i \"s/.*= *iseed/$2 = iseed/g\" ./Cards/run_card.dat\n"
395  << "./bin/generate_events --parton --nocompile --only_generation "
396  "--force --name run\n" << "mv Events/run/events.lhe.gz ./\n";
397  script.close(); execute("chmod 755 " + dir + "/run.sh");
398  } else {
399  string gpk = "run_gridpack.tar.gz";
400  if (access((dir + "/" + gpk).c_str(), F_OK) == -1) {
401  pythia->info.errorMsg("Error from LHAupMadgraph::launch: MadEvent failed"
402  " to produce " + gpk); return false;}
403  string line = "cd " + dir + "; tar -xzf " + gpk + "; cd madevent/lib; "
404  "LINK=`readlink libLHAPDF.a`; if [[ $LINK = ../* ]]; then "
405  "rm libLHAPDF.a; ln -s ../$LINK libLHAPDF.a; fi; cd ../; "
406  "./bin/compile dynamic; ./bin/clean4grid";
407  if (!execute(line)) {
408  pythia->info.errorMsg("Error from LHAupMadgraph::launch: failed to "
409  "compile MadEvent code"); return false;}
410  }
411  return true;
412 
413 }
414 
415 //--------------------------------------------------------------------------
416 
417 // Run MadGraph.
418 
419 bool LHAupMadgraph::run(int eventsIn, int seedIn) {
420 
421  if (!pythia) return false;
422  if (nRuns >= runs) {
423  pythia->info.errorMsg("Error from LHAupMadgraph::run: maximum number "
424  "of allowed runs exceeded."); return false;}
425  if (access((dir + "/run.sh").c_str(), F_OK) == -1) return false;
426  if (seed < 0 && !setSeed(seed, runs)) return false;
427  if (seedIn < 0) seedIn = (seed - 1) * runs + nRuns + 1;
428  stringstream line;
429  line << "cd " + dir + "; ./run.sh " << eventsIn << " " << seedIn;
430  if (!amcatnlo) line << "; rm -rf ./madevent/Events/*";
431  if (!execute(line.str())) return false;
432  if (access(lhegz.c_str(), F_OK) == -1) return false;
433  ++nRuns;
434  return true;
435 
436 }
437 
438 //--------------------------------------------------------------------------
439 
440 // Create the LHEF reader.
441 
442 bool LHAupMadgraph::reader(bool init) {
443 
444  // Check valid LHE file.
445  if (!pythia) return false;
446  if (lhef) delete lhef;
447  bool setScales(pythia->settings.flag("Beams:setProductionScalesFromLHEF"));
448  lhef = new LHAupLHEF(&pythia->info, lhegz.c_str(), NULL, false, setScales);
449  if (!lhef->setInit()) {
450  pythia->info.errorMsg("Error from LHAupMadgraph::reader: failed to "
451  "initialize the LHEF reader"); return false;}
452  if (lhef->sizeProc() != 1) {
453  pythia->info.errorMsg("Error from LHAupMadgraph::reader: number of "
454  "processes is not 1"); return false;}
455 
456  if (init) {
457 
458  // Determine the cross-section (if needed).
459  double sig(lhef->xSec(0)), err(lhef->xErr(0));
460  if (!amcatnlo) {
461  fstream results((dir + "/madevent/SubProcesses/"
462  "run_results.dat").c_str(), ios::in);
463  string v; vector<double> vs;
464  while (std::getline(results, v, ' ')) vs.push_back(atof(v.c_str()));
465  if (vs.size() < 2) {
466  pythia->info.errorMsg("Error from LHAupMadgraph::reader: could not "
467  "extract cross-section"); return false;}
468  sig = vs[0]; err = vs[1];
469  }
470 
471  // Set the info.
472  setBeamA(lhef->idBeamA(), lhef->eBeamA(), lhef->pdfGroupBeamA(),
473  lhef->pdfSetBeamA());
474  setBeamB(lhef->idBeamB(), lhef->eBeamB(), lhef->pdfGroupBeamB(),
475  lhef->pdfSetBeamB());
476  setStrategy(lhef->strategy());
477  addProcess(lhef->idProcess(0), sig, err, lhef->xMax(0));
478  xSecSumSave = sig; xErrSumSave = err;
479  }
480  return true;
481 
482 }
483 
484 //--------------------------------------------------------------------------
485 
486 // Set the initialization information.
487 
488 // If shower matching has been requested, then the matching is also
489 // set up depending on the type of MadGraph output.
490 
491 bool LHAupMadgraph::setInit() {
492 
493  // Initialize MadGraph.
494  if (!pythia) return false;
495  if (access((dir + "/run.sh").c_str(), F_OK) == -1) {
496  if (!configure()) {
497  pythia->info.errorMsg("Error from LHAupMadgraph::setInit: failed to "
498  "create the MadGraph configuration"); return false;}
499  if (!generate()) {
500  pythia->info.errorMsg("Error from LHAupMadgraph::setInit: failed to "
501  "generate the MadGraph process"); return false;}
502  if (!launch()) {
503  pythia->info.errorMsg("Error from LHAupMadgraph::setInit: failed to "
504  "launch the MadGraph process"); return false;}
505  } else
506  amcatnlo =
507  access((dir + "/Cards/amcatnlo_configuration.txt").c_str(), F_OK) != -1;
508 
509  // Set up matching if requested.
510  if (match) {
511 
512  // Load the MadGraph parameters.
513  ifstream card((dir + "/Cards/run_card.dat").c_str());
514  string str((istreambuf_iterator<char>(card)), istreambuf_iterator<char>());
515  MadgraphPar mad;
516  mad.parse(str);
517  mad.printParams();
518 
519  // Extract maximum number of jets.
520  int iLine = jets < 0 ? 0 : generateLines.size();
521  for (; iLine < (int)generateLines.size(); ++iLine) {
522  string line = generateLines[iLine];
523  size_t found = line.find(">");
524  if (found == string::npos) continue;
525  else line = line.substr(found);
526  stringstream sline(line); string p; int n(0);
527  while (std::getline(sline, p, ' ') && p != ",")
528  if (p == "j" || p == "g" || p == "u" || p == "d" || p == "c" ||
529  p == "s" || p == "b" || p == "u~" || p == "d~" || p == "c~" ||
530  p == "s~" || p == "b~") ++n;
531  if (n > jets) jets = n;
532  }
533 
534  // Common settings.
535  double etaj = mad.getParam("etaj");
536  Settings &set = pythia->settings;
537  set.flag("JetMatching:merge", true);
538  set.mode("JetMatching:scheme", 1);
539  set.flag("JetMatching:setMad", false);
540  set.mode("JetMatching:nQmatch", mad.getParamAsInt("maxjetflavor"));
541  set.parm("JetMatching:qCut", mad.getParam("ptj"));
542  set.parm("JetMatching:etaJetMax", etaj > 0 ? etaj : 100);
543  set.mode("JetMatching:nJetMax", jets);
544  set.parm("Check:epTolErr", 1e-2);
545 
546  // aMC@NLO settings.
547  if (amcatnlo) {
548  set.parm("JetMatching:coneRadius", mad.getParam("jetradius"));
549  set.mode("JetMatching:slowJetPower", mad.getParam("jetalgo"));
550  set.parm("JetMatching:qCutME", mad.getParam("ptj"));
551  set.mode("JetMatching:jetAlgorithm", 2);
552  set.flag("JetMatching:doFxFx", true);
553  set.flag("SpaceShower:MEcorrections", false);
554  set.parm("TimeShower:pTmaxMatch", 1);
555  set.parm("TimeShower:pTmaxFudge", 1);
556  set.flag("TimeShower:MEcorrections", false);
557  set.flag("TimeShower:globalRecoil", true);
558  set.flag("TimeShower:limitPTmaxGlobal", true);
559  set.mode("TimeShower:nMaxGlobalRecoil", 1);
560  set.mode("TimeShower:globalRecoilMode", 2);
561 
562  // MLM tree-level MadGraph settings.
563  } else set.parm("JetMatching:clFact", mad.getParam("alpsfact"));
564 
565  // Set the matching hook.
566  hook = new JetMatchingMadgraph();
567  pythia->setUserHooksPtr(hook);
568  }
569 
570  // Create the LHEF LHAup object and run setInit.
571  if (!run(events)) return false;
572  if (!reader(true)) return false;
573  listInit();
574  return true;
575 
576 }
577 
578 //--------------------------------------------------------------------------
579 
580 // Set the event information.
581 
582 bool LHAupMadgraph::setEvent(int) {
583 
584  // Run setEvent from the LHEF object and launch MadGraph if failed.
585  if (!pythia) return false;
586  if (!lhef) {
587  pythia->info.errorMsg("Error from LHAupMadgraph::setEvent: LHAupLHEF "
588  "object not correctly initialized"); return false;}
589  if (!lhef->fileFound()) {
590  pythia->info.errorMsg("Error from LHAupMadgraph::setEvent: LHEF "
591  "event file was not found"); return false;}
592  if (!lhef->setEvent()) {
593  if (!run(events)) return false;
594  if (!reader(false)) return false;
595  lhef->setEvent();
596  }
597 
598  // Read the event from the LHEF object.
599  setProcess(lhef->idProcess(), lhef->weight(), lhef->scale(),
600  lhef->alphaQED(), lhef->alphaQCD());
601  for (int ip = 1; ip < lhef->sizePart(); ++ip)
602  addParticle(lhef->id(ip), lhef->status(ip), lhef->mother1(ip),
603  lhef->mother2(ip), lhef->col1(ip), lhef->col2(ip),
604  lhef->px(ip), lhef->py(ip), lhef->pz(ip), lhef->e(ip),
605  lhef->m(ip), lhef->tau(ip), lhef->spin(ip), lhef->scale(ip));
606  setIdX(lhef->id1(), lhef->id2(), lhef->x1(), lhef->x2());
607  setPdf(lhef->id1pdf(), lhef->id2pdf(), lhef->x1pdf(), lhef->x2pdf(),
608  lhef->scalePDF(), lhef->pdf1(), lhef->pdf2(), lhef->pdfIsSet());
609  return true;
610 
611 }
612 
613 //==========================================================================
614 
615 } // end namespace Pythia8
616 
617 #endif // Pythia8_LHAMadgraph_H