13 #include "HepMC/GenEvent.h" 15 #include "HepMC/ReaderAsciiHepMC2.h" 16 #include "HepMC/WriterAscii.h" 17 #include "HepMC/Print.h" 21 using namespace HepMC;
26 int main(
int argc,
char **argv) {
29 cout<<
"Usage: " << argv[0] <<
" <input_hepmc2_file> <output_hepmc3_file> [<optional_events_limit>]" << endl;
36 int events_parsed = 0;
39 if( argc >= 4 ) events_limit = atoi(argv[3]);
41 while( !adapter.failed() ) {
45 adapter.read_event(evt);
48 if( adapter.failed() )
break;
51 output_file.write_event(evt);
53 if(events_parsed==0) {
54 cout <<
" First event: " << endl;
59 if( events_parsed%100 == 0 ) cout<<
"Events parsed: "<<events_parsed<<endl;
60 if( events_limit && events_parsed >= events_limit )
break;
static void listing(const GenEvent &event, unsigned short precision=2)
Print event in listing (HepMC2) format.
Stores event-related information.
GenEvent I/O serialization for structured text files.
int main(int argc, char **argv)
Definition of template class SmartPointer.
Parser for HepMC2 I/O files.