17 #include "HepMCInterface.h"
19 #include "HepMC/GenEvent.h"
20 #include "HepMC/IO_GenEvent.h"
27 #ifdef HEPMC_HAS_UNITS
28 #include "HepMC/Units.h"
31 using namespace Pythia8;
33 int main(
int argc,
char* argv[]) {
37 cerr <<
" Unexpected number of command-line arguments. \n You are"
38 <<
" expected to provide one input and one output file name. \n"
39 <<
" Program stopped! " << endl;
46 cerr <<
" Command-line file " << argv[1] <<
" was not found. \n"
47 <<
" Program stopped! " << endl;
52 cout <<
"\n >>> PYTHIA settings will be read from file " << argv[1]
53 <<
" <<< \n >>> HepMC events will be written to file "
54 << argv[2] <<
" <<< \n" << endl;
71 pythia.readFile(argv[1]);
74 int nEvent = pythia.mode(
"Main:numberOfEvents");
75 int nAbort = pythia.mode(
"Main:timesAllowErrors");
82 for (
int iEvent = 0; iEvent < nEvent; ++iEvent) {
88 if (pythia.info.atEndOfFile()) {
89 cout <<
" Aborted since reached end of Les Houches Event File\n";
94 if (++iAbort < nAbort)
continue;
95 cout <<
" Event generation aborted prematurely, owing to error!\n";
100 #ifdef HEPMC_HAS_UNITS
104 HepMC::Units::GEV, HepMC::Units::MM);
112 ToHepMC.fill_next_event( pythia, hepmcevt );
117 ascii_io << hepmcevt;
The GenEvent class is the core of HepMC.
IO_GenEvent also deals with HeavyIon and PdfInfo.