HepMC3 event record library
testIO6.cc
1 // -*- C++ -*-
2 #include "HepMC3/GenEvent.h"
3 #include "HepMC3/ReaderAscii.h"
4 #include "HepMC3/WriterAscii.h"
7 #include "HepMC3TestUtils.h"
8 using namespace HepMC3;
9 int main()
10 {
11  ReaderAsciiHepMC2 inputA("inputIO6.hepmc");
12  if(inputA.failed()) return 1;
13  WriterAscii outputA("frominputIO6.hepmc");
14  if(outputA.failed()) return 2;
15  while( !inputA.failed() )
16  {
17  GenEvent evt(Units::GEV,Units::MM);
18  inputA.read_event(evt);
19  if( inputA.failed() ) {
20  printf("End of file reached. Exit.\n");
21  break;
22  }
23  outputA.write_event(evt);
24  evt.clear();
25  }
26  inputA.close();
27  outputA.close();
28 
29 
30  ReaderAscii inputB("frominputIO6.hepmc");
31  if(inputB.failed()) return 3;
32  WriterAscii outputB("fromfrominputIO6.hepmc");
33  if(outputB.failed()) return 4;
34  while( !inputB.failed() )
35  {
36  GenEvent evt(Units::GEV,Units::MM);
37  inputB.read_event(evt);
38  if( inputB.failed() ) {
39  printf("End of file reached. Exit.\n");
40  break;
41  }
42  outputB.write_event(evt);
43  evt.clear();
44  }
45  inputB.close();
46  outputB.close();
47  return COMPARE_ASCII_FILES("fromfrominputIO6.hepmc","frominputIO6.hepmc");
48 }
GenEvent I/O parsing for structured text files.
Definition: ReaderAscii.h:27
Definition of class WriterAscii.
Parser for HepMC2 I/O files.
Definition of class ReaderAsciiHepMC2.
Stores event-related information.
Definition: GenEvent.h:42
Definition of class ReaderAscii.
Definition of class WriterAsciiHepMC2.
int main(int argc, char **argv)
Definition of class GenEvent.
GenEvent I/O serialization for structured text files.
Definition: WriterAscii.h:25