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() ) {printf("End of file reached. Exit.\n"); break;}
20  outputA.write_event(evt);
21  evt.clear();
22  }
23  inputA.close();
24  outputA.close();
25 
26  ReaderRootTree inputB("frominputIO2.root");
27  if(inputB.failed()) return 3;
28  WriterAsciiHepMC2 outputB("fromfrominputIO2.hepmc");
29  if(outputB.failed()) return 4;
30  while( !inputB.failed() )
31  {
32  GenEvent evt(Units::GEV,Units::MM);
33  inputB.read_event(evt);
34  if( inputB.failed() ) {printf("End of file reached. Exit.\n"); break;}
35  outputB.write_event(evt);
36  evt.clear();
37  }
38  inputB.close();
39  outputB.close();
40  return COMPARE_ASCII_FILES("fromfrominputIO2.hepmc","inputIO2.hepmc");
41 }
GenEvent I/O serialization for structured text files.
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.