18 #include "HepMCInterface.h"
20 #include "HepMC/GenEvent.h"
21 #include "HepMC/IO_GenEvent.h"
28 #ifdef HEPMC_HAS_UNITS
29 #include "HepMC/Units.h"
32 using namespace Pythia8;
34 int main(
int argc,
char* argv[]) {
38 cerr <<
" Unexpected number of command-line arguments. \n You are"
39 <<
" expected to provide one input and one output file name. \n"
40 <<
" Program stopped! " << endl;
47 cerr <<
" Command-line file " << argv[1] <<
" was not found. \n"
48 <<
" Program stopped! " << endl;
53 cout <<
"\n >>> PYTHIA settings will be read from file " << argv[1]
54 <<
" <<< \n >>> HepMC events will be written to file "
55 << argv[2] <<
" <<< \n" << endl;
72 pythia.readFile(argv[1]);
75 int nEvent = pythia.mode(
"Main:numberOfEvents");
76 int nAbort = pythia.mode(
"Main:timesAllowErrors");
83 for (
int iEvent = 0; iEvent < nEvent; ++iEvent) {
89 if (pythia.info.atEndOfFile()) {
90 cout <<
" Aborted since reached end of Les Houches Event File\n";
95 if (++iAbort < nAbort)
continue;
96 cout <<
" Event generation aborted prematurely, owing to error!\n";
101 #ifdef HEPMC_HAS_UNITS
105 HepMC::Units::GEV, HepMC::Units::MM);
113 ToHepMC.fill_next_event( pythia, hepmcevt );
118 ascii_io << hepmcevt;
The GenEvent class is the core of HepMC.
IO_GenEvent also deals with HeavyIon and PdfInfo.