Basic example of use of root I/O: reading events from file
- Author
- Witold Pokorski
- Date
- 16/10/14
#include <iostream>
using namespace HepMC3;
int main(
int argc,
char **argv) {
if( argc<3 ) {
std::cout << "Usage: " << argv[0] << " <input_root_file> <output_hepmc3_file>" << std::endl;
exit(-1);
}
int events_parsed = 0;
while( !root_input.
failed() ) {
if( root_input.
failed() )
break;
if( events_parsed == 0 ) {
std::cout << "First event: " << std::endl;
}
++events_parsed;
if( events_parsed%100 == 0 ) {
std::cout << "Event: " << events_parsed << std::endl;
}
}
std::cout << "Events parsed and written: " << events_parsed << std::endl;
return 0;
}