101 char str[256], path[256], key_name[256], line[256];
117 if (
strchr(key_name,
'[')) {
119 *
strchr(key_name,
'[') = 0;
133 s =
fgets(line,
sizeof(line), f);
140 s =
fgets(line,
sizeof(line), f);
166 s =
fgets(line,
sizeof(line), f);
170 if (line[0] ==
'[' &&
atoi(line + 1) ==
index) {
184 }
while (line[0] !=
'[' || line[1] !=
'/');
195 while (
str[a] !=
'\0')
198 while ((
str[
k] !=
'.') && (
k >= 0))
200 for (
i = 0;
i < (10 - (a -
k));
i++)
241 while (result != 0) {
248 if (line[0] ==
'[') {
283 if ((
fgets(line,
sizeof(line),
f1) !=
NULL) && (line[0] !=
'['))
291 while (
fgets(line,
sizeof(line),
f1) !=
NULL && line[0] !=
'[') {
306 if ((
fgets(line,
sizeof(line),
f1) !=
NULL) && (line[0] !=
'['))
312 if ((
fgets(line,
sizeof(line),
f1) !=
NULL) && (line[0] !=
'['))
329 printf(
"\n ERROR:\nCan't open file %s\n", filename);
348#define EVENTID_BOR ((short int) 0x8000)
349#define EVENTID_EOR ((short int) 0x8001)
350#define EVENTID_MESSAGE ((short int) 0x8002)
395 n =
read(
fhm, &header,
sizeof(header));
396 if (
n !=
sizeof(header)) {
434 strcpy(
var_name,
"/Runinfo/Run number");
450 if (
argv[
i][0] ==
'-')
451 if (
argv[
i][1] ==
'c') {
465 if (
argv[
i][0] ==
'-') {
466 if (
argv[
i][1] ==
'q')
468 else if (
argv[
i][1] ==
'a')
473 if (
argv[
i][1] ==
'r') {
476 }
else if (
argv[
i][1] ==
'v') {
479 if (
argv[
i + 1][0] !=
'-') {
482 if (
argv[
i][0] !=
'-')
485 }
else if (
argv[
i][1] ==
'f')
487 else if (
argv[
i][1] ==
'e')
495 printf(
"\nusage: odbhist -r <run1> <run2> -v <varname>[index]\n");
496 printf(
" [-f <filename>] [-q] [-a] [-c <file>] [-e <file>]\n");
497 printf(
" <run1> <run2> Range of run numbers (inclusive)\n");
499 (
" <varname> ODB variable name like \"/Runinfo/Run number\"\n");
500 printf(
" [index] Index if <varname> is an array\n");
501 printf(
" <filename> run%%05d.odb by default\n");
502 printf(
" -e <file> Extract ODB file from MID file\n");
503 printf(
" -q Don't display run number\n");
504 printf(
" -a Add numbers for all runs\n");
505 printf(
" -c load configuration from file\n");
506 printf(
" (parameters loaded from cfg file will be\n");
507 printf(
" overwriten by parameters from command line)\n");
519 printf(
"Second run is %d and must be larger or equal than first run %d\n",
529 for (
k = 0;
k <=
j;
k++) {
556 for (
k = 0;
k <=
j;
k++)
562 printf(
"No files found in selected range\n");
#define write(n, a, f, d)
BOOL equal_ustring(char *str1, char *str2)
int load_pars_from_file(char filename[256])
int extract(char *mid_file, char *odb_file)
int odb_hist(char *file_name, int run_number, char *var_name, int quiet, double *value, int eoln, int boln, int print)
TH1X EXPRT * h1_book(const char *name, const char *title, int bins, double min, double max)