Gaudi Framework, version v24r2
Home
Generated: Wed Dec 4 2013
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Groups
Pages
RootCnv
merge
extractEvt.cpp
Go to the documentation of this file.
1
#include "merge/extractEvt.C"
2
#include <
cstdlib
>
3
4
static
int
usage
() {
5
::printf(
"Gaudi event extraction facility for ROOT tree based files.\n"
6
" Usage: \n"
7
"extract_event -o <output-file> -i <input-file> ...]\n\n"
8
"input- and output files may specify any legal (ROOT) file name.\n"
9
" -output Specify output file name.\n"
10
" -input Specify input file name.\n"
11
" -event Specify the event entry number.\n"
12
);
13
return
1;
14
}
15
16
int
main
(
int
argc
,
char
**
argv
) {
17
string
input;
18
string
output;
19
int
evt_num = -1;
20
for
(
int
i
=1;
i
<
argc
; ++
i
) {
21
if
( *argv[
i
] ==
'-'
) {
22
switch
(::
toupper
(*(argv[
i
]+1))) {
23
case
'E'
:
24
if
( 1 != ::sscanf(argv[
i
+1],
"%d"
,&evt_num) ) {
25
::printf(
"\nERROR: No valid event identifier given.\n\n"
);
26
return
usage
();
27
}
28
++
i
;
29
break
;
30
case
'O'
:
31
if
(
i
+1 < argc ) output = argv[
i
+1];
32
++
i
;
33
break
;
34
case
'I'
:
35
if
(
i
+1 < argc ) input = argv[
i
+1];
36
++
i
;
37
break
;
38
default
:
39
return
usage
();
40
}
41
}
42
}
43
if
( input.empty() ) {
44
::printf(
"\nERROR: No input file(s) supplied\n\n"
);
45
return
usage
();
46
}
47
else
if
( output.empty() ) {
48
::printf(
"\nERROR: No output file supplied.\n\n"
);
49
return
usage
();
50
}
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
if
( extract_event(input.c_str(),output.c_str(),evt_num) != EXTRACT_SUCCESS ) {
57
printf(
"\nERROR: Event extraction from file %s failed.\n"
,input.c_str());
58
return
1;
59
}
60
return
0;
61
}
Generated at Wed Dec 4 2013 14:33:12 for Gaudi Framework, version v24r2 by
Doxygen
version 1.8.2 written by
Dimitri van Heesch
, © 1997-2004