#include "merge/extractEvt.C"
#include <cstdlib>
#include <stdexcept>
Go to the source code of this file.
|
int | main (int argc, char **argv) |
|
int main |
( |
int |
argc, |
|
|
char ** |
argv |
|
) |
| |
Definition at line 16 of file extractEvt.cpp.
20 for (
int i = 1; i <
argc; ++i ) {
21 if ( *
argv[i] ==
'-' ) {
24 if ( 1 != ::
sscanf(
argv[i + 1],
"%d", &evt_num ) ) {
25 ::printf(
"\nERROR: No valid event identifier given.\n\n" );
31 if ( i + 1 < argc ) output =
argv[i + 1];
35 if ( i + 1 < argc ) input =
argv[i + 1];
43 if ( input.empty() ) {
44 ::printf(
"\nERROR: No input file(s) supplied\n\n" );
46 }
else if ( output.empty() ) {
47 ::printf(
"\nERROR: No output file supplied.\n\n" );
49 }
else if ( evt_num < 0 ) {
50 ::printf(
"\nERROR: No valid event identifier given.\n\n" );
53 gROOT->SetBatch( kTRUE );
55 if ( extract_event( input.c_str(), output.c_str(), evt_num ) != EXTRACT_SUCCESS ) {
56 ::printf(
"\nERROR: Event extraction from file %s failed.\n", input.c_str() );
61 ::printf(
"\nERROR: Event extraction from file %s failed [%s]\n", input.c_str(), e.
what() );
62 }
catch ( ... ) { ::printf(
"\nERROR: Event extraction from file %s failed [unknown reason]\n", input.c_str() ); }
void usage(std::string argv0)
void toupper(std::string &s)