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 ) {
std::cout << "Usage: " << argv[0] << " <HepMC3_input_file> <output_file>" << std::endl;
exit(-1);
}
int events_parsed = 0;
if( input_file.
failed() )
break;
if(events_parsed==0) {
std::cout << " First event: " << std::endl;
std::cout << " Testing attribute reading for the first event: " << std::endl;
if(cs) {
std::cout << " Has GenCrossSection: ";
}
else std::cout << " No GenCrossSection " << std::endl;
if(pi) {
std::cout << " Has GenPdfInfo: ";
}
else std::cout << " No GenPdfInfo " << std::endl;
if(hi) {
std::cout << " Has GenHeavyIon: ";
}
else std::cout << " No GenHeavyIon " << std::endl;
}
++events_parsed;
if( events_parsed%100 == 0 ) std::cout<<"Events parsed: "<<events_parsed<<std::endl;
}
return 0;
}