HepMC3 event record library
testIO2.cc
1// -*- C++ -*-
2//
3// This file is part of HepMC
4// Copyright (C) 2014-2019 The HepMC collaboration (see AUTHORS for details)
5//
6#include "HepMC3/GenEvent.h"
11#include "HepMC3TestUtils.h"
12using namespace HepMC3;
13int main()
14{
15 ReaderAsciiHepMC2 inputA("inputIO2.hepmc");
16 if(inputA.failed()) return 1;
17 WriterRootTree outputA("frominputIO2.root");
18 if(outputA.failed()) return 2;
19 while( !inputA.failed() )
20 {
21 GenEvent evt(Units::GEV,Units::MM);
22 inputA.read_event(evt);
23 if( inputA.failed() ) {
24 printf("End of file reached. Exit.\n");
25 break;
26 }
27 outputA.write_event(evt);
28 evt.clear();
29 }
30 inputA.close();
31 outputA.close();
32
33 ReaderRootTree inputB("frominputIO2.root");
34 if(inputB.failed()) return 3;
35 WriterAsciiHepMC2 outputB("fromfrominputIO2.hepmc");
36 if(outputB.failed()) return 4;
37 while( !inputB.failed() )
38 {
39 GenEvent evt(Units::GEV,Units::MM);
40 inputB.read_event(evt);
41 if( inputB.failed() ) {
42 printf("End of file reached. Exit.\n");
43 break;
44 }
45 outputB.write_event(evt);
46 evt.clear();
47 }
48 inputB.close();
49 outputB.close();
50 return COMPARE_ASCII_FILES("fromfrominputIO2.hepmc","inputIO2.hepmc");
51}
Definition of class GenEvent.
Definition of class ReaderAsciiHepMC2.
Definition of class ReaderRootTree.
Definition of class WriterAsciiHepMC2.
Definition of class WriterRootTree.
Stores event-related information.
Definition: GenEvent.h:41
Parser for HepMC2 I/O files.
GenEvent I/O parsing and serialization for root files based on root TTree.
GenEvent I/O serialization for structured text files.
GenEvent I/O serialization for root files based on root TTree.
HepMC3 main namespace.