19 |
using namespace std; |
using namespace std; |
20 |
// |
// |
21 |
void usage(){ |
void usage(){ |
22 |
printf("\nUsage:\n\n FCaloCHKCALIB [-v] file calib_number output_directory matra figure_format \n"); |
printf("\nUsage:\n\n FCaloCHKCALIB [-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( " calib_number is an integer (progressive calibration number), 0 = all \n"); |
printf("\n OPTIONS: \n"); |
26 |
printf( " output_dir directory where to store figures \n"); |
printf("\n -v be verbose \n"); |
27 |
printf( " matra integer, 1 to print the strip rms in a box plot 0 to skip it\n"); |
printf( " -entry entry calibration entry to analyze [default = 0, all] \n"); |
28 |
printf( " figure format any format recognized by ROOT (eps,gif,...)\n"); |
printf( " -matra draw the strip rms in a box plot [default: do not draw] \n"); |
29 |
printf("\nExample: \n\nFCaloCHKCALIB /home/pamela/filesfromyoda/dw_050301_00100/ 0 /tmp/ 0 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 = ps] \n"); |
31 |
|
printf("\nExamples: "); |
32 |
|
printf("\n\nFCaloCHKCALIB /home/pamela/filesfromyoda/dw_050301_00100.root \n"); |
33 |
|
printf("\nFCaloCHKCALIB -v -name /home/pamela/filesfromyoda/dw_050301_00100.root \n"); |
34 |
|
printf("\nFCaloCHKCALIB /home/pamela/filesfromyoda/DW_050523_01600.root -v -entry 2 -matra -outDir /tmp/ -format gif \n\n"); |
35 |
} |
} |
36 |
// |
// |
37 |
int main(int numinp, char *inps[]){ |
int main(int numinp, char *inps[]){ |
43 |
char *pEnd; |
char *pEnd; |
44 |
int nul = 0; |
int nul = 0; |
45 |
bool beverbose = false; |
bool beverbose = false; |
46 |
if ( numinp == 1 ){ |
|
47 |
usage(); |
|
|
return(0); |
|
|
}; |
|
48 |
if ( numinp > 1 ){ |
if ( numinp > 1 ){ |
49 |
if ( !strcmp(inps[1],"--version") ){ |
name = (TString)inps[1]; |
50 |
info(); |
for ( int i = 0; i < numinp; i++ ){ |
51 |
return(0); |
|
52 |
}; |
if ( !strcmp(inps[i],"--version") ){ |
53 |
if ( !strcmp(inps[1],"-h") || !strcmp(inps[1],"--help") || numinp>7 ){ |
info(); |
54 |
usage(); |
return(0); |
55 |
return(0); |
}; |
56 |
} else { |
if ( !strcmp(inps[i],"-h") || !strcmp(inps[i],"--help") ){ |
57 |
if ( !strcmp(inps[1],"-v") || !strcmp(inps[1],"--verbose") ){ |
usage(); |
58 |
beverbose = true; |
return(0); |
59 |
if ( numinp == 2 ) { |
}; |
60 |
info(); |
if ( !strcmp(inps[i],"-name") ) { |
61 |
return(0); |
if ( numinp-1 < i+1 ){ |
62 |
|
usage(); |
63 |
|
exit(-3); |
64 |
|
}; |
65 |
|
name = (TString)inps[i+1]; |
66 |
|
}; |
67 |
|
if ( !strcmp(inps[i],"-outDir") ) { |
68 |
|
if ( numinp-1 < i+1 ){ |
69 |
|
usage(); |
70 |
|
exit(-3); |
71 |
}; |
}; |
72 |
if ( numinp >= 3 ) name = (TString)inps[2]; |
outdir = (TString)inps[i+1]; |
|
if ( numinp >= 4 ) calibno = strtoull(inps[3],&pEnd,0); |
|
|
if ( numinp >= 5 ) outdir = (TString)inps[4]; |
|
|
if ( numinp >= 6 ) matra = atoi(inps[5]); |
|
|
if ( numinp == 7 ) format = (TString)inps[6]; |
|
|
} else { |
|
|
if ( numinp >= 2 ) name = (TString)inps[1]; |
|
|
if ( numinp >= 3 ) calibno = strtoull(inps[2],&pEnd,0); |
|
|
if ( numinp >= 4 ) outdir = (TString)inps[3]; |
|
|
if ( numinp >= 5 ) matra = atoi(inps[4]); |
|
|
if ( numinp == 6 ) format = (TString)inps[5]; |
|
73 |
}; |
}; |
74 |
|
if ( !strcmp(inps[i],"-format") ) { |
75 |
|
if ( numinp-1 < i+1 ){ |
76 |
|
usage(); |
77 |
|
exit(-3); |
78 |
|
}; |
79 |
|
format = (TString)inps[i+1]; |
80 |
|
}; |
81 |
|
|
82 |
|
if ( !strcmp(inps[i],"-entry") ) { |
83 |
|
if ( numinp-1 < i+1 ){ |
84 |
|
usage(); |
85 |
|
exit(-3); |
86 |
|
}; |
87 |
|
calibno = strtoull(inps[i+1],&pEnd,0); |
88 |
|
}; |
89 |
|
if ( !strcmp(inps[i],"-matra") ) { |
90 |
|
matra = 1; |
91 |
|
}; |
92 |
|
if ( !strcmp(inps[i],"-v") || !strcmp(inps[i],"--verbose") ) beverbose = true; |
93 |
}; |
}; |
94 |
|
} else { |
95 |
|
// |
96 |
|
// no input parameters exit with error, we need at least the run id. |
97 |
|
// |
98 |
|
usage(); |
99 |
|
return(0); |
100 |
}; |
}; |
101 |
// |
// |
102 |
if ( !beverbose ){ |
if ( !beverbose ){ |