| The Gaudi Framework v29r0 (ff2e7097)

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

Functions
extractEvt.cpp File Reference
`#include "merge/extractEvt.C"`
`#include <cstdlib>`
`#include <stdexcept>`
Include dependency graph for extractEvt.cpp:

Go to the source code of this file.

## Functions
int | main (int argc, char **argv)

## Function Documentation

int main | ( | int | argc,
|  | char ** | argv
| ) |  |

Definition at line 17 of file extractEvt.cpp.

18 {
19 string input;
20 string output;
21 int evt_num = -1;
22 for ( int i = 1; i < argc; ++i ) {
23 if ( *argv[i] == '-' ) {
24 switch (::toupper( *( argv[i] + 1 ) ) ) {
25 case 'E':
26 if ( 1 != ::sscanf( argv[i + 1], "%d", &evt_num ) ) {
27 ::printf( "\nERROR: No valid event identifier given.\n\n" );
28 return usage();
29 }
30 ++i;
31 break;
32 case 'O':
33 if ( i + 1 < argc ) output = argv[i + 1];
34 ++i;
35 break;
36 case 'I':
37 if ( i + 1 < argc ) input = argv[i + 1];
38 ++i;
39 break;
40 default:
41 return usage();
42 }
43 }
44 }
45 if ( input.empty() ) {
46 ::printf( "\nERROR: No input file(s) supplied\n\n" );
47 return usage();
48 } else if ( output.empty() ) {
49 ::printf( "\nERROR: No output file supplied.\n\n" );
50 return usage();
51 } else if ( evt_num < 0 ) {
52 ::printf( "\nERROR: No valid event identifier given.\n\n" );
53 return usage();
54 }
55 gROOT->SetBatch( kTRUE );
56 try {
57 if ( extract_event( input.c_str(), output.c_str(), evt_num ) != EXTRACT_SUCCESS ) {
58 ::printf( "\nERROR: Event extraction from file %s failed.\n", input.c_str() );
59 return 1;
60 }
61 return 0;
62 } catch ( const std::exception& e ) {
63 ::printf( "\nERROR: Event extraction from file %s failed [%s]\n", input.c_str(), e.what() );
64 } catch ( ... ) {
65 ::printf( "\nERROR: Event extraction from file %s failed [unknown reason]\n", input.c_str() );
66 }
67 return 1;
68 }
std::sscanf
T sscanf(T...args)
gaudirun.output
output
Definition: gaudirun.py:404
gaudirun.argv
list argv
Definition: gaudirun.py:235
usage
void usage(std::string argv0)
Definition: listcomponents.cpp:39
std::exception::what
T what(T...args)
std::exception
STL class.
plotBacklogPyRoot.argc
argc
Definition: plotBacklogPyRoot.py:138
toupper
void toupper(std::string &s)
Definition: StatusCodeSvc.cpp:10