18 #include "Pythia8/Pythia.h"
19 #include "Pythia8/Pythia8ToHepMC.h"
20 #include "HepMC/GenEvent.h"
21 #include "HepMC/IO_GenEvent.h"
23 using namespace Pythia8;
25 int main(
int argc,
char* argv[]) {
29 cerr <<
" Unexpected number of command-line arguments. \n You are"
30 <<
" expected to provide one input and one output file name. \n"
31 <<
" Program stopped! " << endl;
38 cerr <<
" Command-line file " << argv[1] <<
" was not found. \n"
39 <<
" Program stopped! " << endl;
44 cout <<
"\n >>> PYTHIA settings will be read from file " << argv[1]
45 <<
" <<< \n >>> HepMC events will be written to file "
46 << argv[2] <<
" <<< \n" << endl;
58 pythia.readFile(argv[1]);
61 int nEvent = pythia.mode(
"Main:numberOfEvents");
62 int nAbort = pythia.mode(
"Main:timesAllowErrors");
69 for (
int iEvent = 0; iEvent < nEvent; ++iEvent) {
75 if (pythia.info.atEndOfFile()) {
76 cout <<
" Aborted since reached end of Les Houches Event File\n";
81 if (++iAbort < nAbort)
continue;
82 cout <<
" Event generation aborted prematurely, owing to error!\n";
90 ToHepMC.fill_next_event( pythia, hepmcevt );
The GenEvent class is the core of HepMC.
IO_GenEvent also deals with HeavyIon and PdfInfo.