19 #include "HepMCInterface.h"
21 #include "HepMC/GenEvent.h"
22 #include "HepMC/IO_GenEvent.h"
29 #ifdef HEPMC_HAS_UNITS
30 #include "HepMC/Units.h"
33 using namespace Pythia8;
35 int main(
int argc,
char* argv[]) {
39 cerr <<
" Unexpected number of command-line arguments. \n You are"
40 <<
" expected to provide one input and one output file name. \n"
41 <<
" Program stopped! " << endl;
48 cerr <<
" Command-line file " << argv[1] <<
" was not found. \n"
49 <<
" Program stopped! " << endl;
54 cout <<
"\n >>> PYTHIA settings will be read from file " << argv[1]
55 <<
" <<< \n >>> HepMC events will be written to file "
56 << argv[2] <<
" <<< \n" << endl;
73 pythia.readFile( argv[1]);
76 int nSubrun = pythia.mode(
"Main:numberOfSubruns");
77 int nAbort = pythia.mode(
"Main:timesAllowErrors");
81 for (
int iSubrun = 1; iSubrun <= nSubrun; ++iSubrun) {
84 pythia.readFile( argv[1], iSubrun);
90 string lheFile = pythia.settings.word(
"Beams:LHEF");
91 cout <<
"\n >>> Now begin subrun " << iSubrun
92 <<
" with events from file " << lheFile <<
" <<< \n"
96 for (
int iEvent = 0; ; ++iEvent) {
102 if (pythia.info.atEndOfFile())
break;
105 if (++iAbort < nAbort)
continue;
106 cout <<
" Event generation aborted prematurely, owing to error!\n";
111 #ifdef HEPMC_HAS_UNITS
115 HepMC::Units::GEV, HepMC::Units::MM);
123 ToHepMC.fill_next_event( pythia, hepmcevt );
128 ascii_io << hepmcevt;
The GenEvent class is the core of HepMC.
IO_GenEvent also deals with HeavyIon and PdfInfo.