16 ::printf(
"Gaudi event extraction facility for ROOT tree based files.\n"
18 "extract_event -o <output-file> -i <input-file> ...]\n\n"
19 "input- and output files may specify any legal (ROOT) file name.\n"
20 " -output Specify output file name.\n"
21 " -input Specify input file name.\n"
22 " -event Specify the event entry number.\n" );
30 for (
int i = 1; i <
argc; ++i ) {
31 if ( *
argv[i] ==
'-' ) {
34 if ( 1 != ::sscanf(
argv[i + 1],
"%d", &evt_num ) ) {
35 ::printf(
"\nERROR: No valid event identifier given.\n\n" );
45 if ( i + 1 <
argc ) input =
argv[i + 1];
53 if ( input.empty() ) {
54 ::printf(
"\nERROR: No input file(s) supplied\n\n" );
56 }
else if (
output.empty() ) {
57 ::printf(
"\nERROR: No output file supplied.\n\n" );
59 }
else if ( evt_num < 0 ) {
60 ::printf(
"\nERROR: No valid event identifier given.\n\n" );
63 gROOT->SetBatch( kTRUE );
66 ::printf(
"\nERROR: Event extraction from file %s failed.\n", input.c_str() );
70 }
catch (
const std::exception& e ) {
71 ::printf(
"\nERROR: Event extraction from file %s failed [%s]\n", input.c_str(), e.what() );
72 }
catch ( ... ) { ::printf(
"\nERROR: Event extraction from file %s failed [unknown reason]\n", input.c_str() ); }