Test of file I/OParses HepMC3 file and saves it as a new HepMC3 file. The resulting file should be an exact copy of the input file
#include <iostream>
using namespace HepMC3;
int main(
int argc,
char **argv) {
if( argc<3 ) {
cout << "Usage: " << argv[0] << " <HepMC3_input_file> <output_file>" << endl;
exit(-1);
}
int events_parsed = 0;
if( input_file.
failed() )
break;
if(events_parsed==0) {
cout << " First event: " << endl;
cout << " Testing attribute reading for the first event: " << endl;
if(cs) {
cout << " Has GenCrossSection: ";
}
else cout << " No GenCrossSection " << endl;
if(pi) {
cout << " Has GenPdfInfo: ";
}
else cout << " No GenPdfInfo " << endl;
if(hi) {
cout << " Has GenHeavyIon: ";
}
else cout << " No GenHeavyIon " << endl;
}
++events_parsed;
if( events_parsed%100 == 0 ) cout<<"Events parsed: "<<events_parsed<<endl;
}
return 0;
}