28#include "MyRunClass.h"
31int main(
int argc,
char **argv) {
34 cout <<
"Usage: " << argv[0] <<
" <input_hepmc3_file> <output_root_file>" << endl;
40 TFile* fFile =
new TFile(argv[2],
"RECREATE");
42 int events_parsed = 0;
44 bool is_gen_run_info_written =
false;
46 while( !text_input.failed() ) {
50 text_input.read_event(evt);
52 if( text_input.failed() )
break;
54 if( events_parsed == 0 ) {
55 cout <<
"First event: " << endl;
59 if(!is_gen_run_info_written) {
67 fFile->WriteObject(my_run,
"MyRunClass");
69 is_gen_run_info_written =
true;
77 std::ostringstream os;
79 std::string stevt =
"Event_" + os.str();
80 const char* chevt = stevt.c_str();
82 cout <<
"writing " << stevt << endl;
84 fFile->WriteObject(myclass, chevt);
88 if( events_parsed%100 == 0 ) {
89 cout <<
"Event: " << events_parsed << endl;
95 std::cout <<
"Events parsed and written: " << events_parsed << std::endl;
Definition of class GenEvent.
Definition of class GenRunInfo.
Definition of static class Print.
Definition of class ReaderAscii.
Stores event-related information.
Stores run-related information.
GenEvent I/O parsing for structured text files.
Sample class for root I/O test.
void SetEvent(GenEvent *)
Set HepMC event.
Sample class for root I/O test.
void SetRunInfo(GenRunInfo *)
Set HepMC event.
int main(int argc, char **argv)