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