19 |
using namespace std; |
using namespace std; |
20 |
// |
// |
21 |
void usage(){ |
void usage(){ |
22 |
printf("\nUsage:\n\n FCaloQLOOK [-v] file from_event to_event output_dir figure_format \n"); |
printf("\nUsage:\n\n FCaloQLOOK [-name] file [OPTIONS] \n"); |
23 |
printf("\n -v be verbose \n"); |
printf("\n file must be in the form: /path/to/filesfromyoda/ZZZ_XXX_YYYYY_cln2.root \n"); |
24 |
printf( " file must be in the form: /path/to/filesfromyoda/dw_000000_00000/ \n"); |
printf( " if in the first position \"-name\" can be omitted. \n"); |
25 |
printf( " from_event is an integer (progressive number) \n"); |
printf("\n OPTIONS: \n"); |
26 |
printf( " to_event is an integer (progressive number) \n"); |
printf("\n -v be verbose \n"); |
27 |
printf( " output_dir directory where to store figures \n"); |
printf( " -fromev from_event first event to analyze [default = 0] \n"); |
28 |
printf( " figure format any format recognized by ROOT (ps,eps,gif,...)\n"); |
printf( " -toev to_event last event to analyze [default = 0] \n"); |
29 |
printf("\nExample: \n\nFCaloQLOOK /home/pamela/filesfromyoda/dw_050301_00100/ 0 0 /tmp/ ps \n\n"); |
printf( " -oudDir output_dir path of the output directory [default = ./] (with or without final '/') \n"); |
30 |
|
printf( " -format format format for output file (without . )[default = png] \n"); |
31 |
|
printf("\nExamples: "); |
32 |
|
printf("\n\nFCaloQLOOK /home/pamela/filesfromyoda/dw_050301_00100.root \n"); |
33 |
|
printf("\nFCaloQLOOK -v -name /home/pamela/filesfromyoda/dw_050301_00100.root \n"); |
34 |
|
printf("\nFCaloQLOOK /home/pamela/filesfromyoda/DW_050523_01600.root -v -fromev 0 -toev 0 -outDir /tmp/ -format gif \n\n"); |
35 |
} |
} |
36 |
|
|
37 |
int main(int numinp, char *inps[]){ |
int main(int numinp, char *inps[]){ |
38 |
TString name; |
TString name; |
39 |
TString outdir = ""; |
TString outdir = ""; |
40 |
TString format = "ps"; |
TString format = "png"; |
41 |
int fromev = 0; |
int fromev = 0; |
42 |
int toev = 0; |
int toev = 0; |
43 |
int nul = 0; |
int nul = 0; |
44 |
bool beverbose = false; |
bool beverbose = false; |
45 |
if ( numinp == 1 ){ |
// |
|
usage(); |
|
|
return(0); |
|
|
}; |
|
46 |
if ( numinp > 1 ){ |
if ( numinp > 1 ){ |
47 |
if ( !strcmp(inps[1],"--version") ){ |
name = (TString)inps[1]; |
48 |
info(); |
for ( int i = 0; i < numinp; i++ ){ |
49 |
return(0); |
|
50 |
}; |
if ( !strcmp(inps[i],"--version") ){ |
51 |
if ( !strcmp(inps[1],"-h") || !strcmp(inps[1],"--help") || numinp>7 ){ |
info(); |
52 |
usage(); |
return(0); |
53 |
return(0); |
}; |
54 |
} else { |
if ( !strcmp(inps[i],"-h") || !strcmp(inps[i],"--help") ){ |
55 |
if ( !strcmp(inps[1],"-v") || !strcmp(inps[1],"--verbose") ){ |
usage(); |
56 |
beverbose = true; |
return(0); |
57 |
if ( numinp == 2 ) { |
}; |
58 |
info(); |
if ( !strcmp(inps[i],"-name") ) { |
59 |
return(0); |
if ( numinp-1 < i+1 ){ |
60 |
|
usage(); |
61 |
|
exit(-3); |
62 |
}; |
}; |
63 |
if ( numinp >= 3 ) name = (TString)inps[2]; |
name = (TString)inps[i+1]; |
|
if ( numinp >= 4 ) fromev = atoi(inps[3]); |
|
|
if ( numinp >= 5 ) toev = atoi(inps[4]); |
|
|
if ( numinp >= 6 ) outdir = (TString)inps[5]; |
|
|
if ( numinp == 7 ) format = (TString)inps[6]; |
|
|
} else { |
|
|
if ( numinp >= 2 ) name = (TString)inps[1]; |
|
|
if ( numinp >= 3 ) fromev = atoi(inps[2]); |
|
|
if ( numinp >= 4 ) toev = atoi(inps[3]); |
|
|
if ( numinp >= 5 ) outdir = (TString)inps[4]; |
|
|
if ( numinp == 6 ) format = (TString)inps[5]; |
|
64 |
}; |
}; |
65 |
|
if ( !strcmp(inps[i],"-outDir") ) { |
66 |
|
if ( numinp-1 < i+1 ){ |
67 |
|
usage(); |
68 |
|
exit(-3); |
69 |
|
}; |
70 |
|
outdir = (TString)inps[i+1]; |
71 |
|
}; |
72 |
|
if ( !strcmp(inps[i],"-format") ) { |
73 |
|
if ( numinp-1 < i+1 ){ |
74 |
|
usage(); |
75 |
|
exit(-3); |
76 |
|
}; |
77 |
|
format = (TString)inps[i+1]; |
78 |
|
}; |
79 |
|
|
80 |
|
if ( !strcmp(inps[i],"-fromev") ) { |
81 |
|
if ( numinp-1 < i+1 ){ |
82 |
|
usage(); |
83 |
|
exit(-3); |
84 |
|
}; |
85 |
|
fromev = atoi(inps[i+1]); |
86 |
|
}; |
87 |
|
if ( !strcmp(inps[i],"-toev") ) { |
88 |
|
if ( numinp-1 < i+1 ){ |
89 |
|
usage(); |
90 |
|
exit(-3); |
91 |
|
}; |
92 |
|
toev = atoi(inps[i+1]); |
93 |
|
}; |
94 |
|
if ( !strcmp(inps[i],"-v") || !strcmp(inps[i],"--verbose") ) beverbose = true; |
95 |
}; |
}; |
96 |
|
} else { |
97 |
|
// |
98 |
|
// no input parameters exit with error, we need at least the run id. |
99 |
|
// |
100 |
|
usage(); |
101 |
|
return(0); |
102 |
}; |
}; |
103 |
// |
// |
104 |
if ( !beverbose ){ |
if ( !beverbose ){ |