19 #include "Pythia8/Pythia.h"
20 #include "Pythia8/Pythia8ToHepMC.h"
21 #include "HepMC/GenEvent.h"
22 #include "HepMC/IO_GenEvent.h"
24 using namespace Pythia8;
26 int main(
int argc,
char* argv[]) {
30 cerr <<
" Unexpected number of command-line arguments. \n You are"
31 <<
" expected to provide one input and one output file name. \n"
32 <<
" Program stopped! " << endl;
39 cerr <<
" Command-line file " << argv[1] <<
" was not found. \n"
40 <<
" Program stopped! " << endl;
45 cout <<
"\n >>> PYTHIA settings will be read from file " << argv[1]
46 <<
" <<< \n >>> HepMC events will be written to file "
47 << argv[2] <<
" <<< \n" << endl;
59 pythia.readFile( argv[1]);
62 int nSubrun = pythia.mode(
"Main:numberOfSubruns");
63 int nAbort = pythia.mode(
"Main:timesAllowErrors");
67 for (
int iSubrun = 1; iSubrun <= nSubrun; ++iSubrun) {
70 pythia.readFile( argv[1], iSubrun);
76 string lheFile = pythia.settings.word(
"Beams:LHEF");
77 cout <<
"\n >>> Now begin subrun " << iSubrun
78 <<
" with events from file " << lheFile <<
" <<< \n"
82 for (
int iEvent = 0; ; ++iEvent) {
88 if (pythia.info.atEndOfFile())
break;
91 if (++iAbort < nAbort)
continue;
92 cout <<
" Event generation aborted prematurely, owing to error!\n";
100 ToHepMC.fill_next_event( pythia, hepmcevt );
103 ascii_io << hepmcevt;
The GenEvent class is the core of HepMC.
IO_GenEvent also deals with HeavyIon and PdfInfo.