HepMC3 event record library
testIO2.cc
1 // -*- C++ -*-
2 #include "HepMC3/GenEvent.h"
7 #include "HepMC3TestUtils.h"
8 using namespace HepMC3;
9 int main()
10 {
11  ReaderAsciiHepMC2 inputA("inputIO2.hepmc");
12  if(inputA.failed()) return 1;
13  WriterRootTree outputA("frominputIO2.root");
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  ReaderRootTree inputB("frominputIO2.root");
30  if(inputB.failed()) return 3;
31  WriterAsciiHepMC2 outputB("fromfrominputIO2.hepmc");
32  if(outputB.failed()) return 4;
33  while( !inputB.failed() )
34  {
35  GenEvent evt(Units::GEV,Units::MM);
36  inputB.read_event(evt);
37  if( inputB.failed() ) {
38  printf("End of file reached. Exit.\n");
39  break;
40  }
41  outputB.write_event(evt);
42  evt.clear();
43  }
44  inputB.close();
45  outputB.close();
46  return COMPARE_ASCII_FILES("fromfrominputIO2.hepmc","inputIO2.hepmc");
47 }
GenEvent I/O serialization for structured text files.
HepMC3 main namespace.
Definition: WriterDOT.h:19
Definition of class WriterRootTree.
Definition of class ReaderRootTree.
Parser for HepMC2 I/O files.
Definition of class ReaderAsciiHepMC2.
Stores event-related information.
Definition: GenEvent.h:42
GenEvent I/O serialization for root files based on root TTree.
Definition of class WriterAsciiHepMC2.
GenEvent I/O parsing and serialization for root files based on root TTree.
int main(int argc, char **argv)
Definition of class GenEvent.