00001
00002
00003
00004
00006
00007
00008
00009
00010 #include <iostream>
00011 #include <fstream>
00012 #include "HepMC/IO_GenEvent.h"
00013 #include "HepMC/GenEvent.h"
00014
00015 int main() {
00016
00017
00018 {
00019
00020 std::ifstream istr( "example_MyPythia.dat" );
00021 if( !istr ) {
00022 std::cerr << "example_ReadMyPythia: cannot open example_MyPythia.dat" << std::endl;
00023 exit(-1);
00024 }
00025 HepMC::IO_GenEvent ascii_in(istr);
00026
00027 HepMC::IO_GenEvent ascii_out("example_MyPythia2.dat",std::ios::out);
00028
00029 int icount=0;
00030 HepMC::GenEvent* evt = ascii_in.read_next_event();
00031 while ( evt ) {
00032 icount++;
00033 if ( icount%50==1 ) std::cout << "Processing Event Number " << icount
00034 << " its # " << evt->event_number()
00035 << std::endl;
00036
00037 ascii_out << evt;
00038 delete evt;
00039 ascii_in >> evt;
00040 }
00041
00042 std::cout << icount << " events found. Finished." << std::endl;
00043 }
00044
00045 return 0;
00046 }
00047
00048
00049