ATLAS Offline Software
cmdline.cxx
Go to the documentation of this file.
1 /*
2  File autogenerated by gengetopt version 2.22.4
3  generated with the following command:
4  gengetopt
5 
6  The developers of gengetopt consider the fixed text that goes in all
7  gengetopt output files to be in the public domain:
8  we make no copyright claims on it.
9 */
10 
13 
14 /* If we use autoconf. */
15 #ifdef HAVE_CONFIG_H
16 #include "config.h"
17 #endif
18 
19 #include <stdio.h>
20 #include <stdlib.h>
21 #include <string.h>
22 
23 #include <getopt.h>
24 
25 #include "cmdline.h"
26 
27 const char *gengetopt_args_info_purpose = "";
28 
29 const char *gengetopt_args_info_usage = "Usage: iLumiCalc.exe [OPTIONS]...";
30 
32 
33 const char *gengetopt_args_info_help[] = {
34  " -h, --help Print help and exit",
35  " --version Print version and exit",
36  "\nFlags to specify data sample:",
37  " -r, --runnumber=STRING Run number, range, or comma separated list, e.g. \n 177986-178109,179710",
38  " --lbstart=INT LumiBlock number begin",
39  " --lbend=INT LumiBlock number end",
40  " -x, --xml=STRING Input XML file name",
41  " --xml_blacklist=STRING Input XML file of blacklist",
42  " -T, --tag=STRING Input TAG file name",
43  " --root=STRING Input ROOT file name",
44  " --tree=STRING Name of TTree in input ROOT file to which Lumi \n string is attached",
45  " --d3pd_dir=STRING Name of TDirectory in input ROOT file where Lumi \n string is stored",
46  "\nFlags to control luminosity calculation:",
47  " --lumitag=STRING Offline luminosity database tag \n (default=`OflLumi-8TeV-002')",
48  " --online Use online luminosity estimates instead of \n offline database (default=off)",
49  " --lumichannel=INT Luminosity estimate method by value \n (default=`0')",
50  " --lumimethod=STRING Luminosity estimate method by string \n (default=`ATLAS_PREFERRED')",
51  " -t, --trigger=STRING Trigger chain name used for prescale calculation",
52  " --livetrigger=STRING L1 Trigger used for livetime calculation \n (default=`L1_EM30')",
53  " --lar Calculate LAr defect fraction (default=off)",
54  " --lartag=STRING LAr noise burst database tag \n (default=`LARBadChannelsOflEventVeto-UPD4-01')",
55  " --beamspot Require online beamspot valid in trigger \n livefraction (default=off)",
56  " --beamspottag=STRING Online beamspot database tag \n (default=`IndetBeamposOnl-HLT-UPD1-001-00')",
57  " --scale_lumi=DOUBLE Scale luminosity with a constant value \n (default=`1.0')",
58  "\nFlags to control output:",
59  " --xml_out=STRING Output XML file name",
60  " --xml_collisionlist Output XML file of lists of collision candidates \n (default=off)",
61  " --plots Create some plots on demand (default=off)",
62  " -V, --verbose Verbose output level (default=off)",
63  " --quiet Quiet output level (default=off)",
64  0
65 };
66 
67 typedef enum {ARG_NO
73 
74 static
75 void clear_given (struct gengetopt_args_info *args_info);
76 static
77 void clear_args (struct gengetopt_args_info *args_info);
78 
79 static int
80 cmdline_parser_internal (int argc, char **argv, struct gengetopt_args_info *args_info,
81  struct cmdline_parser_params *params, const char *additional_error);
82 
83 static int
84 cmdline_parser_required2 (struct gengetopt_args_info *args_info, const char *prog_name, const char *additional_error);
85 
86 static char *
87 gengetopt_strdup (const char *s);
88 
89 static
90 void clear_given (struct gengetopt_args_info *args_info)
91 {
92  args_info->help_given = 0 ;
93  args_info->version_given = 0 ;
94  args_info->runnumber_given = 0 ;
95  args_info->lbstart_given = 0 ;
96  args_info->lbend_given = 0 ;
97  args_info->xml_given = 0 ;
98  args_info->xml_blacklist_given = 0 ;
99  args_info->tag_given = 0 ;
100  args_info->root_given = 0 ;
101  args_info->tree_given = 0 ;
102  args_info->d3pd_dir_given = 0 ;
103  args_info->lumitag_given = 0 ;
104  args_info->online_given = 0 ;
105  args_info->lumichannel_given = 0 ;
106  args_info->lumimethod_given = 0 ;
107  args_info->trigger_given = 0 ;
108  args_info->livetrigger_given = 0 ;
109  args_info->lar_given = 0 ;
110  args_info->lartag_given = 0 ;
111  args_info->beamspot_given = 0 ;
112  args_info->beamspottag_given = 0 ;
113  args_info->scale_lumi_given = 0 ;
114  args_info->xml_out_given = 0 ;
115  args_info->xml_collisionlist_given = 0 ;
116  args_info->plots_given = 0 ;
117  args_info->verbose_given = 0 ;
118  args_info->quiet_given = 0 ;
119 }
120 
121 static
122 void clear_args (struct gengetopt_args_info *args_info)
123 {
124  args_info->runnumber_arg = NULL;
125  args_info->runnumber_orig = NULL;
126  args_info->lbstart_arg = NULL;
127  args_info->lbstart_orig = NULL;
128  args_info->lbend_arg = NULL;
129  args_info->lbend_orig = NULL;
130  args_info->xml_arg = NULL;
131  args_info->xml_orig = NULL;
132  args_info->xml_blacklist_arg = NULL;
133  args_info->xml_blacklist_orig = NULL;
134  args_info->tag_arg = NULL;
135  args_info->tag_orig = NULL;
136  args_info->root_arg = NULL;
137  args_info->root_orig = NULL;
138  args_info->tree_arg = NULL;
139  args_info->tree_orig = NULL;
140  args_info->d3pd_dir_arg = NULL;
141  args_info->d3pd_dir_orig = NULL;
142  args_info->lumitag_arg = gengetopt_strdup ("OflLumi-8TeV-002");
143  args_info->lumitag_orig = NULL;
144  args_info->online_flag = 0;
145  args_info->lumichannel_arg = 0;
146  args_info->lumichannel_orig = NULL;
147  args_info->lumimethod_arg = gengetopt_strdup ("");
148  args_info->lumimethod_orig = NULL;
149  args_info->trigger_arg = NULL;
150  args_info->trigger_orig = NULL;
151  args_info->livetrigger_arg = gengetopt_strdup ("L1_EM30");
152  args_info->livetrigger_orig = NULL;
153  args_info->lar_flag = 0;
154  args_info->lartag_arg = gengetopt_strdup ("LARBadChannelsOflEventVeto-UPD4-01");
155  args_info->lartag_orig = NULL;
156  args_info->beamspot_flag = 0;
157  args_info->beamspottag_arg = gengetopt_strdup ("IndetBeamposOnl-HLT-UPD1-001-00");
158  args_info->beamspottag_orig = NULL;
159  args_info->scale_lumi_arg = 1.0;
160  args_info->scale_lumi_orig = NULL;
161  args_info->xml_out_arg = NULL;
162  args_info->xml_out_orig = NULL;
163  args_info->xml_collisionlist_flag = 0;
164  args_info->plots_flag = 0;
165  args_info->verbose_flag = 0;
166  args_info->quiet_flag = 0;
167 
168 }
169 
170 static
171 void init_args_info(struct gengetopt_args_info *args_info)
172 {
173 
174 
175  args_info->help_help = gengetopt_args_info_help[0] ;
176  args_info->version_help = gengetopt_args_info_help[1] ;
177  args_info->runnumber_help = gengetopt_args_info_help[3] ;
178  args_info->runnumber_min = 0;
179  args_info->runnumber_max = 0;
180  args_info->lbstart_help = gengetopt_args_info_help[4] ;
181  args_info->lbstart_min = 0;
182  args_info->lbstart_max = 0;
183  args_info->lbend_help = gengetopt_args_info_help[5] ;
184  args_info->lbend_min = 0;
185  args_info->lbend_max = 0;
186  args_info->xml_help = gengetopt_args_info_help[6] ;
187  args_info->xml_min = 0;
188  args_info->xml_max = 0;
190  args_info->tag_help = gengetopt_args_info_help[8] ;
191  args_info->tag_min = 0;
192  args_info->tag_max = 0;
193  args_info->root_help = gengetopt_args_info_help[9] ;
194  args_info->root_min = 0;
195  args_info->root_max = 0;
196  args_info->tree_help = gengetopt_args_info_help[10] ;
197  args_info->d3pd_dir_help = gengetopt_args_info_help[11] ;
198  args_info->lumitag_help = gengetopt_args_info_help[13] ;
199  args_info->online_help = gengetopt_args_info_help[14] ;
200  args_info->lumichannel_help = gengetopt_args_info_help[15] ;
201  args_info->lumimethod_help = gengetopt_args_info_help[16] ;
202  args_info->trigger_help = gengetopt_args_info_help[17] ;
203  args_info->trigger_min = 0;
204  args_info->trigger_max = 0;
205  args_info->livetrigger_help = gengetopt_args_info_help[18] ;
206  args_info->lar_help = gengetopt_args_info_help[19] ;
207  args_info->lartag_help = gengetopt_args_info_help[20] ;
208  args_info->beamspot_help = gengetopt_args_info_help[21] ;
209  args_info->beamspottag_help = gengetopt_args_info_help[22] ;
210  args_info->scale_lumi_help = gengetopt_args_info_help[23] ;
211  args_info->xml_out_help = gengetopt_args_info_help[25] ;
213  args_info->plots_help = gengetopt_args_info_help[27] ;
214  args_info->verbose_help = gengetopt_args_info_help[28] ;
215  args_info->quiet_help = gengetopt_args_info_help[29] ;
216 
217 }
218 
219 void
221 {
222  printf ("%s %s\n",
225 }
226 
227 static void print_help_common(void) {
229 
230  if (strlen(gengetopt_args_info_purpose) > 0)
231  printf("\n%s\n", gengetopt_args_info_purpose);
232 
233  if (strlen(gengetopt_args_info_usage) > 0)
234  printf("\n%s\n", gengetopt_args_info_usage);
235 
236  printf("\n");
237 
238  if (strlen(gengetopt_args_info_description) > 0)
239  printf("%s\n\n", gengetopt_args_info_description);
240 }
241 
242 void
244 {
245  int i = 0;
246  print_help_common();
247  while (gengetopt_args_info_help[i])
248  printf("%s\n", gengetopt_args_info_help[i++]);
249 }
250 
251 void
253 {
254  clear_given (args_info);
255  clear_args (args_info);
256  init_args_info (args_info);
257 }
258 
259 void
261 {
262  if (params)
263  {
264  params->override = 0;
265  params->initialize = 1;
266  params->check_required = 1;
267  params->check_ambiguity = 0;
268  params->print_errors = 1;
269  }
270 }
271 
272 struct cmdline_parser_params *
274 {
275  struct cmdline_parser_params *params =
276  (struct cmdline_parser_params *)malloc(sizeof(struct cmdline_parser_params));
278  return params;
279 }
280 
281 static void
282 free_string_field (char **s)
283 {
284  if (*s)
285  {
286  free (*s);
287  *s = 0;
288  }
289 }
290 
293  int int_arg;
294  double double_arg;
295  char *string_arg;
296  const char *default_string_arg;
297 };
298 
301 {
302  union generic_value arg;
303  char *orig;
305 };
306 
310 static void add_node(struct generic_list **list) {
311  struct generic_list *new_node = (struct generic_list *) malloc (sizeof (struct generic_list));
312  new_node->next = *list;
313  *list = new_node;
314  new_node->arg.string_arg = 0;
315  new_node->orig = 0;
316 }
317 
321 static void
322 free_multiple_field(unsigned int len, void *arg, char ***orig)
323 {
324  unsigned int i;
325  if (arg) {
326  for (i = 0; i < len; ++i)
327  {
328  free_string_field(&((*orig)[i]));
329  }
330 
331  free (arg);
332  free (*orig);
333  *orig = 0;
334  }
335 }
336 
337 static void
338 free_multiple_string_field(unsigned int len, char ***arg, char ***orig)
339 {
340  unsigned int i;
341  if (*arg) {
342  for (i = 0; i < len; ++i)
343  {
344  free_string_field(&((*arg)[i]));
345  free_string_field(&((*orig)[i]));
346  }
347  free_string_field(&((*arg)[0])); /* free default string */
348 
349  free (*arg);
350  *arg = 0;
351  free (*orig);
352  *orig = 0;
353  }
354 }
355 
356 static void
357 cmdline_parser_release (struct gengetopt_args_info *args_info)
358 {
359 
360  free_multiple_string_field (args_info->runnumber_given, &(args_info->runnumber_arg), &(args_info->runnumber_orig));
361  free_multiple_field (args_info->lbstart_given, (void *)(args_info->lbstart_arg), &(args_info->lbstart_orig));
362  args_info->lbstart_arg = 0;
363  free_multiple_field (args_info->lbend_given, (void *)(args_info->lbend_arg), &(args_info->lbend_orig));
364  args_info->lbend_arg = 0;
365  free_multiple_string_field (args_info->xml_given, &(args_info->xml_arg), &(args_info->xml_orig));
366  free_string_field (&(args_info->xml_blacklist_arg));
367  free_string_field (&(args_info->xml_blacklist_orig));
368  free_multiple_string_field (args_info->tag_given, &(args_info->tag_arg), &(args_info->tag_orig));
369  free_multiple_string_field (args_info->root_given, &(args_info->root_arg), &(args_info->root_orig));
370  free_string_field (&(args_info->tree_arg));
371  free_string_field (&(args_info->tree_orig));
372  free_string_field (&(args_info->d3pd_dir_arg));
373  free_string_field (&(args_info->d3pd_dir_orig));
374  free_string_field (&(args_info->lumitag_arg));
375  free_string_field (&(args_info->lumitag_orig));
376  free_string_field (&(args_info->lumichannel_orig));
377  free_string_field (&(args_info->lumimethod_arg));
378  free_string_field (&(args_info->lumimethod_orig));
379  free_multiple_string_field (args_info->trigger_given, &(args_info->trigger_arg), &(args_info->trigger_orig));
380  free_string_field (&(args_info->livetrigger_arg));
381  free_string_field (&(args_info->livetrigger_orig));
382  free_string_field (&(args_info->lartag_arg));
383  free_string_field (&(args_info->lartag_orig));
384  free_string_field (&(args_info->beamspottag_arg));
385  free_string_field (&(args_info->beamspottag_orig));
386  free_string_field (&(args_info->scale_lumi_orig));
387  free_string_field (&(args_info->xml_out_arg));
388  free_string_field (&(args_info->xml_out_orig));
389 
390 
391 
392  clear_given (args_info);
393 }
394 
395 
396 static void
397 write_into_file(FILE *outfile, const char *opt, const char *arg, const char */*values*/[])
398 {
399  if (arg) {
400  fprintf(outfile, "%s=\"%s\"\n", opt, arg);
401  } else {
402  fprintf(outfile, "%s\n", opt);
403  }
404 }
405 
406 static void
407 write_multiple_into_file(FILE *outfile, int len, const char *opt, char **arg, const char *values[])
408 {
409  int i;
410 
411  for (i = 0; i < len; ++i)
412  write_into_file(outfile, opt, (arg ? arg[i] : 0), values);
413 }
414 
415 int
417 {
418  int i = 0;
419 
420  if (!outfile)
421  {
422  fprintf (stderr, "%s: cannot dump options to stream\n", CMDLINE_PARSER_PACKAGE);
423  return EXIT_FAILURE;
424  }
425 
426  if (args_info->help_given)
427  write_into_file(outfile, "help", 0, 0 );
428  if (args_info->version_given)
429  write_into_file(outfile, "version", 0, 0 );
430  write_multiple_into_file(outfile, args_info->runnumber_given, "runnumber", args_info->runnumber_orig, 0);
431  write_multiple_into_file(outfile, args_info->lbstart_given, "lbstart", args_info->lbstart_orig, 0);
432  write_multiple_into_file(outfile, args_info->lbend_given, "lbend", args_info->lbend_orig, 0);
433  write_multiple_into_file(outfile, args_info->xml_given, "xml", args_info->xml_orig, 0);
434  if (args_info->xml_blacklist_given)
435  write_into_file(outfile, "xml_blacklist", args_info->xml_blacklist_orig, 0);
436  write_multiple_into_file(outfile, args_info->tag_given, "tag", args_info->tag_orig, 0);
437  write_multiple_into_file(outfile, args_info->root_given, "root", args_info->root_orig, 0);
438  if (args_info->tree_given)
439  write_into_file(outfile, "tree", args_info->tree_orig, 0);
440  if (args_info->d3pd_dir_given)
441  write_into_file(outfile, "d3pd_dir", args_info->d3pd_dir_orig, 0);
442  if (args_info->lumitag_given)
443  write_into_file(outfile, "lumitag", args_info->lumitag_orig, 0);
444  if (args_info->online_given)
445  write_into_file(outfile, "online", 0, 0 );
446  if (args_info->lumichannel_given)
447  write_into_file(outfile, "lumichannel", args_info->lumichannel_orig, 0);
448  if (args_info->lumimethod_given)
449  write_into_file(outfile, "lumimethod", args_info->lumimethod_orig, 0);
450  write_multiple_into_file(outfile, args_info->trigger_given, "trigger", args_info->trigger_orig, 0);
451  if (args_info->livetrigger_given)
452  write_into_file(outfile, "livetrigger", args_info->livetrigger_orig, 0);
453  if (args_info->lar_given)
454  write_into_file(outfile, "lar", 0, 0 );
455  if (args_info->lartag_given)
456  write_into_file(outfile, "lartag", args_info->lartag_orig, 0);
457  if (args_info->beamspot_given)
458  write_into_file(outfile, "beamspot", 0, 0 );
459  if (args_info->beamspottag_given)
460  write_into_file(outfile, "beamspottag", args_info->beamspottag_orig, 0);
461  if (args_info->scale_lumi_given)
462  write_into_file(outfile, "scale_lumi", args_info->scale_lumi_orig, 0);
463  if (args_info->xml_out_given)
464  write_into_file(outfile, "xml_out", args_info->xml_out_orig, 0);
465  if (args_info->xml_collisionlist_given)
466  write_into_file(outfile, "xml_collisionlist", 0, 0 );
467  if (args_info->plots_given)
468  write_into_file(outfile, "plots", 0, 0 );
469  if (args_info->verbose_given)
470  write_into_file(outfile, "verbose", 0, 0 );
471  if (args_info->quiet_given)
472  write_into_file(outfile, "quiet", 0, 0 );
473 
474 
475  i = EXIT_SUCCESS;
476  return i;
477 }
478 
479 int
481 {
482  FILE *outfile;
483  int i = 0;
484 
485  outfile = fopen(filename, "w");
486 
487  if (!outfile)
488  {
489  fprintf (stderr, "%s: cannot open file for writing: %s\n", CMDLINE_PARSER_PACKAGE, filename);
490  return EXIT_FAILURE;
491  }
492 
493  i = cmdline_parser_dump(outfile, args_info);
494  fclose (outfile);
495 
496  return i;
497 }
498 
499 void
501 {
502  cmdline_parser_release (args_info);
503 }
504 
506 char *
507 gengetopt_strdup (const char *s)
508 {
509  char *result = 0;
510  if (!s)
511  return result;
512 
513  result = (char*)malloc(strlen(s) + 1);
514  if (result == (char*)0)
515  return (char*)0;
516  strcpy(result, s);
517  return result;
518 }
519 
520 static char *
521 get_multiple_arg_token(const char *arg)
522 {
523  const char *tok;
524  char *ret;
525  size_t len, num_of_escape, i, j;
526 
527  if (!arg)
528  return 0;
529 
530  tok = strchr (arg, ',');
531  num_of_escape = 0;
532 
533  /* make sure it is not escaped */
534  while (tok)
535  {
536  if (*(tok-1) == '\\')
537  {
538  /* find the next one */
539  tok = strchr (tok+1, ',');
540  ++num_of_escape;
541  }
542  else
543  break;
544  }
545 
546  if (tok)
547  len = (size_t)(tok - arg + 1);
548  else
549  len = strlen (arg) + 1;
550 
551  len -= num_of_escape;
552 
553  ret = (char *) malloc (len);
554 
555  i = 0;
556  j = 0;
557  while (arg[i] && (j < len-1))
558  {
559  if (arg[i] == '\\' &&
560  arg[ i + 1 ] &&
561  arg[ i + 1 ] == ',')
562  ++i;
563 
564  ret[j++] = arg[i++];
565  }
566 
567  ret[len-1] = '\0';
568 
569  return ret;
570 }
571 
572 static const char *
573 get_multiple_arg_token_next(const char *arg)
574 {
575  const char *tok;
576 
577  if (!arg)
578  return 0;
579 
580  tok = strchr (arg, ',');
581 
582  /* make sure it is not escaped */
583  while (tok)
584  {
585  if (*(tok-1) == '\\')
586  {
587  /* find the next one */
588  tok = strchr (tok+1, ',');
589  }
590  else
591  break;
592  }
593 
594  if (! tok || strlen(tok) == 1)
595  return 0;
596 
597  return tok+1;
598 }
599 
600 static int
601 check_multiple_option_occurrences(const char *prog_name, unsigned int option_given, unsigned int min, unsigned int max, const char *option_desc);
602 
603 int
604 check_multiple_option_occurrences(const char *prog_name, unsigned int option_given, unsigned int min, unsigned int max, const char *option_desc)
605 {
606  int error = 0;
607 
608  if (option_given && (min > 0 || max > 0))
609  {
610  if (min > 0 && max > 0)
611  {
612  if (min == max)
613  {
614  /* specific occurrences */
615  if (option_given != (unsigned int) min)
616  {
617  fprintf (stderr, "%s: %s option occurrences must be %u\n",
618  prog_name, option_desc, min);
619  error = 1;
620  }
621  }
622  else if (option_given < (unsigned int) min
623  || option_given > (unsigned int) max)
624  {
625  /* range occurrences */
626  fprintf (stderr, "%s: %s option occurrences must be between %u and %u\n",
627  prog_name, option_desc, min, max);
628  error = 1;
629  }
630  }
631  else if (min > 0)
632  {
633  /* at least check */
634  if (option_given < min)
635  {
636  fprintf (stderr, "%s: %s option occurrences must be at least %u\n",
637  prog_name, option_desc, min);
638  error = 1;
639  }
640  }
641  else if (max > 0)
642  {
643  /* at most check */
644  if (option_given > max)
645  {
646  fprintf (stderr, "%s: %s option occurrences must be at most %u\n",
647  prog_name, option_desc, max);
648  error = 1;
649  }
650  }
651  }
652 
653  return error;
654 }
655 int
656 cmdline_parser (int argc, char **argv, struct gengetopt_args_info *args_info)
657 {
658  return cmdline_parser2 (argc, argv, args_info, 0, 1, 1);
659 }
660 
661 int
662 cmdline_parser_ext (int argc, char **argv, struct gengetopt_args_info *args_info,
664 {
665  int result;
666  result = cmdline_parser_internal (argc, argv, args_info, params, 0);
667 
668  if (result == EXIT_FAILURE)
669  {
670  cmdline_parser_free (args_info);
671  exit (EXIT_FAILURE);
672  }
673 
674  return result;
675 }
676 
677 int
678 cmdline_parser2 (int argc, char **argv, struct gengetopt_args_info *args_info, int override, int initialize, int check_required)
679 {
680  int result;
682 
683  params.override = override;
684  params.initialize = initialize;
685  params.check_required = check_required;
686  params.check_ambiguity = 0;
687  params.print_errors = 1;
688 
689  result = cmdline_parser_internal (argc, argv, args_info, &params, 0);
690 
691  if (result == EXIT_FAILURE)
692  {
693  cmdline_parser_free (args_info);
694  exit (EXIT_FAILURE);
695  }
696 
697  return result;
698 }
699 
700 int
701 cmdline_parser_required (struct gengetopt_args_info *args_info, const char *prog_name)
702 {
703  int result = EXIT_SUCCESS;
704 
705  if (cmdline_parser_required2(args_info, prog_name, 0) > 0)
706  result = EXIT_FAILURE;
707 
708  if (result == EXIT_FAILURE)
709  {
710  cmdline_parser_free (args_info);
711  exit (EXIT_FAILURE);
712  }
713 
714  return result;
715 }
716 
717 int
718 cmdline_parser_required2 (struct gengetopt_args_info *args_info, const char *prog_name, const char */*additional_error*/)
719 {
720  int error = 0;
721 
722  /* checks for required options */
723  if (check_multiple_option_occurrences(prog_name, args_info->runnumber_given, args_info->runnumber_min, args_info->runnumber_max, "'--runnumber' ('-r')"))
724  error = 1;
725 
726  if (check_multiple_option_occurrences(prog_name, args_info->lbstart_given, args_info->lbstart_min, args_info->lbstart_max, "'--lbstart'"))
727  error = 1;
728 
729  if (check_multiple_option_occurrences(prog_name, args_info->lbend_given, args_info->lbend_min, args_info->lbend_max, "'--lbend'"))
730  error = 1;
731 
732  if (check_multiple_option_occurrences(prog_name, args_info->xml_given, args_info->xml_min, args_info->xml_max, "'--xml' ('-x')"))
733  error = 1;
734 
735  if (check_multiple_option_occurrences(prog_name, args_info->tag_given, args_info->tag_min, args_info->tag_max, "'--tag' ('-T')"))
736  error = 1;
737 
738  if (check_multiple_option_occurrences(prog_name, args_info->root_given, args_info->root_min, args_info->root_max, "'--root'"))
739  error = 1;
740 
741  if (check_multiple_option_occurrences(prog_name, args_info->trigger_given, args_info->trigger_min, args_info->trigger_max, "'--trigger' ('-t')"))
742  error = 1;
743 
744 
745  /* checks for dependences among options */
746 
747  return error;
748 }
749 
750 
751 static char *package_name = 0;
752 
771 static
772 int update_arg(void *field, char **orig_field,
773  unsigned int *field_given, unsigned int *prev_given,
774  char *value, const char *possible_values[],
775  const char */*default_value*/,
776  cmdline_parser_arg_type arg_type,
777  int check_ambiguity, int override,
778  int no_free, int multiple_option,
779  const char *long_opt, char short_opt,
780  const char *additional_error)
781 {
782  char *stop_char = 0;
783  const char *val = value;
784  int found;
785  char **string_field;
786 
787  stop_char = 0;
788  found = 0;
789 
790  if (!multiple_option && field_given && prev_given && (*prev_given || (check_ambiguity && *field_given)))
791  {
792  if (short_opt != '-')
793  fprintf (stderr, "%s: `--%s' (`-%c') option given more than once%s\n",
794  package_name, long_opt, short_opt,
795  (additional_error ? additional_error : ""));
796  else
797  fprintf (stderr, "%s: `--%s' option given more than once%s\n",
798  package_name, long_opt,
799  (additional_error ? additional_error : ""));
800  return 1; /* failure */
801  }
802 
803  if (field_given && *field_given && ! override)
804  return 0;
805  if (prev_given)
806  (*prev_given)++;
807  if (field_given)
808  (*field_given)++;
809  if (possible_values)
810  val = possible_values[found];
811 
812  switch(arg_type) {
813  case ARG_FLAG:
814  *((int *)field) = !*((int *)field);
815  break;
816  case ARG_INT:
817  if (val) *((int *)field) = strtol (val, &stop_char, 0);
818  break;
819  case ARG_DOUBLE:
820  if (val) *((double *)field) = strtod (val, &stop_char);
821  break;
822  case ARG_STRING:
823  if (val) {
824  string_field = (char **)field;
825  if (!no_free && *string_field)
826  free (*string_field); /* free previous string */
827  *string_field = gengetopt_strdup (val);
828  }
829  break;
830  default:
831  break;
832  };
833 
834  /* check numeric conversion */
835  switch(arg_type) {
836  case ARG_INT:
837  case ARG_DOUBLE:
838  if (val && !(stop_char && *stop_char == '\0')) {
839  fprintf(stderr, "%s: invalid numeric value: %s\n", package_name, val);
840  return 1; /* failure */
841  }
842  break;
843  default:
844  ;
845  };
846 
847  /* store the original value */
848  switch(arg_type) {
849  case ARG_NO:
850  case ARG_FLAG:
851  break;
852  default:
853  if (value && orig_field) {
854  if (no_free) {
855  *orig_field = value;
856  } else {
857  if (*orig_field)
858  free (*orig_field); /* free previous string */
859  *orig_field = gengetopt_strdup (value);
860  }
861  }
862  };
863 
864  return 0; /* OK */
865 }
866 
871 static
872 int update_multiple_arg_temp(struct generic_list **list,
873  unsigned int *prev_given, const char *val,
874  const char *possible_values[], const char *default_value,
875  cmdline_parser_arg_type arg_type,
876  const char *long_opt, char short_opt,
877  const char *additional_error)
878 {
879  /* store single arguments */
880  char *multi_token;
881  const char *multi_next;
882 
883  if (arg_type == ARG_NO) {
884  (*prev_given)++;
885  return 0; /* OK */
886  }
887 
888  multi_token = get_multiple_arg_token(val);
889  multi_next = get_multiple_arg_token_next (val);
890 
891  while (1)
892  {
893  add_node (list);
894  if (update_arg((void *)&((*list)->arg), &((*list)->orig), 0,
895  prev_given, multi_token, possible_values, default_value,
896  arg_type, 0, 1, 1, 1, long_opt, short_opt, additional_error)) {
897  if (multi_token) free(multi_token);
898  return 1; /* failure */
899  }
900 
901  if (multi_next)
902  {
903  multi_token = get_multiple_arg_token(multi_next);
904  multi_next = get_multiple_arg_token_next (multi_next);
905  }
906  else
907  break;
908  }
909 
910  return 0; /* OK */
911 }
912 
916 static
917 void free_list(struct generic_list *list, short string_arg)
918 {
919  if (list) {
920  struct generic_list *tmp;
921  while (list)
922  {
923  tmp = list;
924  if (string_arg && list->arg.string_arg)
925  free (list->arg.string_arg);
926  if (list->orig)
927  free (list->orig);
928  list = list->next;
929  free (tmp);
930  }
931  }
932 }
933 
937 static
938 void update_multiple_arg(void *field, char ***orig_field,
939  unsigned int field_given, unsigned int prev_given, union generic_value *default_value,
940  cmdline_parser_arg_type arg_type,
941  struct generic_list *list)
942 {
943  int i;
944  struct generic_list *tmp;
945 
946  if (prev_given && list) {
947  *orig_field = (char **) realloc (*orig_field, (field_given + prev_given) * sizeof (char *));
948 
949  switch(arg_type) {
950  case ARG_INT:
951  *((int **)field) = (int *)realloc (*((int **)field), (field_given + prev_given) * sizeof (int)); break;
952  case ARG_DOUBLE:
953  *((double **)field) = (double *)realloc (*((double **)field), (field_given + prev_given) * sizeof (double)); break;
954  case ARG_STRING:
955  *((char ***)field) = (char **)realloc (*((char ***)field), (field_given + prev_given) * sizeof (char *)); break;
956  default:
957  break;
958  };
959 
960  for (i = (prev_given - 1); i >= 0; --i)
961  {
962  tmp = list;
963 
964  switch(arg_type) {
965  case ARG_INT:
966  (*((int **)field))[i + field_given] = tmp->arg.int_arg; break;
967  case ARG_DOUBLE:
968  (*((double **)field))[i + field_given] = tmp->arg.double_arg; break;
969  case ARG_STRING:
970  (*((char ***)field))[i + field_given] = tmp->arg.string_arg; break;
971  default:
972  break;
973  }
974  (*orig_field) [i + field_given] = list->orig;
975  list = list->next;
976  free (tmp);
977  }
978  } else { /* set the default value */
979  if (default_value && ! field_given) {
980  switch(arg_type) {
981  case ARG_INT:
982  if (! *((int **)field)) {
983  *((int **)field) = (int *)malloc (sizeof (int));
984  (*((int **)field))[0] = default_value->int_arg;
985  }
986  break;
987  case ARG_DOUBLE:
988  if (! *((double **)field)) {
989  *((double **)field) = (double *)malloc (sizeof (double));
990  (*((double **)field))[0] = default_value->double_arg;
991  }
992  break;
993  case ARG_STRING:
994  if (! *((char ***)field)) {
995  *((char ***)field) = (char **)malloc (sizeof (char *));
996  (*((char ***)field))[0] = gengetopt_strdup(default_value->string_arg);
997  }
998  break;
999  default: break;
1000  }
1001  if (!(*orig_field)) {
1002  *orig_field = (char **) malloc (sizeof (char *));
1003  (*orig_field)[0] = 0;
1004  }
1005  }
1006  }
1007 }
1008 
1009 int
1010 cmdline_parser_internal (
1011  int argc, char **argv, struct gengetopt_args_info *args_info,
1012  struct cmdline_parser_params *params, const char *additional_error)
1013 {
1014  int c; /* Character of the parsed option. */
1015 
1016  struct generic_list * runnumber_list = NULL;
1017  struct generic_list * lbstart_list = NULL;
1018  struct generic_list * lbend_list = NULL;
1019  struct generic_list * xml_list = NULL;
1020  struct generic_list * tag_list = NULL;
1021  struct generic_list * root_list = NULL;
1022  struct generic_list * trigger_list = NULL;
1023  int error = 0;
1024  struct gengetopt_args_info local_args_info;
1025 
1026  int override;
1027  int initialize;
1028  int check_required;
1029  int check_ambiguity;
1030 
1031  package_name = argv[0];
1032 
1033  override = params->override;
1034  initialize = params->initialize;
1035  check_required = params->check_required;
1036  check_ambiguity = params->check_ambiguity;
1037 
1038  if (initialize)
1039  cmdline_parser_init (args_info);
1040 
1041  cmdline_parser_init (&local_args_info);
1042 
1043  optarg = 0;
1044  optind = 0;
1045  opterr = params->print_errors;
1046  optopt = '?';
1047 
1048  while (1)
1049  {
1050  int option_index = 0;
1051 
1052  static struct option long_options[] = {
1053  { "help", 0, NULL, 'h' },
1054  { "version", 0, NULL, 0 },
1055  { "runnumber", 1, NULL, 'r' },
1056  { "lbstart", 1, NULL, 0 },
1057  { "lbend", 1, NULL, 0 },
1058  { "xml", 1, NULL, 'x' },
1059  { "xml_blacklist", 1, NULL, 0 },
1060  { "tag", 1, NULL, 'T' },
1061  { "root", 1, NULL, 0 },
1062  { "tree", 1, NULL, 0 },
1063  { "d3pd_dir", 1, NULL, 0 },
1064  { "lumitag", 1, NULL, 0 },
1065  { "online", 0, NULL, 0 },
1066  { "lumichannel", 1, NULL, 0 },
1067  { "lumimethod", 1, NULL, 0 },
1068  { "trigger", 1, NULL, 't' },
1069  { "livetrigger", 1, NULL, 0 },
1070  { "lar", 0, NULL, 0 },
1071  { "lartag", 1, NULL, 0 },
1072  { "beamspot", 0, NULL, 0 },
1073  { "beamspottag", 1, NULL, 0 },
1074  { "scale_lumi", 1, NULL, 0 },
1075  { "xml_out", 1, NULL, 0 },
1076  { "xml_collisionlist", 0, NULL, 0 },
1077  { "plots", 0, NULL, 0 },
1078  { "verbose", 0, NULL, 'V' },
1079  { "quiet", 0, NULL, 0 },
1080  { 0, 0, 0, 0 }
1081  };
1082 
1083  c = getopt_long (argc, argv, "hr:x:T:t:V", long_options, &option_index);
1084 
1085  if (c == -1) break; /* Exit from `while (1)' loop. */
1086 
1087  switch (c)
1088  {
1089  case 'h': /* Print help and exit. */
1091  cmdline_parser_free (&local_args_info);
1092  exit (EXIT_SUCCESS);
1093 
1094  case 'r': /* Run number, range, or comma separated list, e.g. 177986-178109,179710. */
1095 
1096  if (update_multiple_arg_temp(&runnumber_list,
1097  &(local_args_info.runnumber_given), optarg, 0, 0, ARG_STRING,
1098  "runnumber", 'r',
1099  additional_error))
1100  goto failure;
1101 
1102  break;
1103  case 'x': /* Input XML file name. */
1104 
1105  if (update_multiple_arg_temp(&xml_list,
1106  &(local_args_info.xml_given), optarg, 0, 0, ARG_STRING,
1107  "xml", 'x',
1108  additional_error))
1109  goto failure;
1110 
1111  break;
1112  case 'T': /* Input TAG file name. */
1113 
1114  if (update_multiple_arg_temp(&tag_list,
1115  &(local_args_info.tag_given), optarg, 0, 0, ARG_STRING,
1116  "tag", 'T',
1117  additional_error))
1118  goto failure;
1119 
1120  break;
1121  case 't': /* Trigger chain name used for prescale calculation. */
1122 
1123  if (update_multiple_arg_temp(&trigger_list,
1124  &(local_args_info.trigger_given), optarg, 0, 0, ARG_STRING,
1125  "trigger", 't',
1126  additional_error))
1127  goto failure;
1128 
1129  break;
1130  case 'V': /* Verbose output level. */
1131 
1132 
1133  if (update_arg((void *)&(args_info->verbose_flag), 0, &(args_info->verbose_given),
1134  &(local_args_info.verbose_given), optarg, 0, 0, ARG_FLAG,
1135  check_ambiguity, override, 1, 0, "verbose", 'V',
1136  additional_error))
1137  goto failure;
1138 
1139  break;
1140 
1141  case 0: /* Long option with no short option */
1142  if (strcmp (long_options[option_index].name, "version") == 0) {
1144  cmdline_parser_free (&local_args_info);
1145  exit (EXIT_SUCCESS);
1146  }
1147 
1148  /* LumiBlock number begin. */
1149  if (strcmp (long_options[option_index].name, "lbstart") == 0)
1150  {
1151 
1152  if (update_multiple_arg_temp(&lbstart_list,
1153  &(local_args_info.lbstart_given), optarg, 0, 0, ARG_INT,
1154  "lbstart", '-',
1155  additional_error))
1156  goto failure;
1157 
1158  }
1159  /* LumiBlock number end. */
1160  else if (strcmp (long_options[option_index].name, "lbend") == 0)
1161  {
1162 
1163  if (update_multiple_arg_temp(&lbend_list,
1164  &(local_args_info.lbend_given), optarg, 0, 0, ARG_INT,
1165  "lbend", '-',
1166  additional_error))
1167  goto failure;
1168 
1169  }
1170  /* Input XML file of blacklist. */
1171  else if (strcmp (long_options[option_index].name, "xml_blacklist") == 0)
1172  {
1173 
1174 
1175  if (update_arg( (void *)&(args_info->xml_blacklist_arg),
1176  &(args_info->xml_blacklist_orig), &(args_info->xml_blacklist_given),
1177  &(local_args_info.xml_blacklist_given), optarg, 0, 0, ARG_STRING,
1178  check_ambiguity, override, 0, 0,
1179  "xml_blacklist", '-',
1180  additional_error))
1181  goto failure;
1182 
1183  }
1184  /* Input ROOT file name. */
1185  else if (strcmp (long_options[option_index].name, "root") == 0)
1186  {
1187 
1188  if (update_multiple_arg_temp(&root_list,
1189  &(local_args_info.root_given), optarg, 0, 0, ARG_STRING,
1190  "root", '-',
1191  additional_error))
1192  goto failure;
1193 
1194  }
1195  /* Name of TTree in input ROOT file to which Lumi string is attached. */
1196  else if (strcmp (long_options[option_index].name, "tree") == 0)
1197  {
1198 
1199 
1200  if (update_arg( (void *)&(args_info->tree_arg),
1201  &(args_info->tree_orig), &(args_info->tree_given),
1202  &(local_args_info.tree_given), optarg, 0, 0, ARG_STRING,
1203  check_ambiguity, override, 0, 0,
1204  "tree", '-',
1205  additional_error))
1206  goto failure;
1207 
1208  }
1209  /* Name of TDirectory in input ROOT file where Lumi string is stored. */
1210  else if (strcmp (long_options[option_index].name, "d3pd_dir") == 0)
1211  {
1212 
1213 
1214  if (update_arg( (void *)&(args_info->d3pd_dir_arg),
1215  &(args_info->d3pd_dir_orig), &(args_info->d3pd_dir_given),
1216  &(local_args_info.d3pd_dir_given), optarg, 0, 0, ARG_STRING,
1217  check_ambiguity, override, 0, 0,
1218  "d3pd_dir", '-',
1219  additional_error))
1220  goto failure;
1221 
1222  }
1223  /* Offline luminosity database tag. */
1224  else if (strcmp (long_options[option_index].name, "lumitag") == 0)
1225  {
1226 
1227 
1228  if (update_arg( (void *)&(args_info->lumitag_arg),
1229  &(args_info->lumitag_orig), &(args_info->lumitag_given),
1230  &(local_args_info.lumitag_given), optarg, 0, "OflLumi-8TeV-002", ARG_STRING,
1231  check_ambiguity, override, 0, 0,
1232  "lumitag", '-',
1233  additional_error))
1234  goto failure;
1235 
1236  }
1237  /* Use online luminosity estimates instead of offline database. */
1238  else if (strcmp (long_options[option_index].name, "online") == 0)
1239  {
1240 
1241 
1242  if (update_arg((void *)&(args_info->online_flag), 0, &(args_info->online_given),
1243  &(local_args_info.online_given), optarg, 0, 0, ARG_FLAG,
1244  check_ambiguity, override, 1, 0, "online", '-',
1245  additional_error))
1246  goto failure;
1247 
1248  }
1249  /* Luminosity estimate method by value. */
1250  else if (strcmp (long_options[option_index].name, "lumichannel") == 0)
1251  {
1252 
1253 
1254  if (update_arg( (void *)&(args_info->lumichannel_arg),
1255  &(args_info->lumichannel_orig), &(args_info->lumichannel_given),
1256  &(local_args_info.lumichannel_given), optarg, 0, "0", ARG_INT,
1257  check_ambiguity, override, 0, 0,
1258  "lumichannel", '-',
1259  additional_error))
1260  goto failure;
1261 
1262  }
1263  /* Luminosity estimate method by string. */
1264  else if (strcmp (long_options[option_index].name, "lumimethod") == 0)
1265  {
1266 
1267 
1268  if (update_arg( (void *)&(args_info->lumimethod_arg),
1269  &(args_info->lumimethod_orig), &(args_info->lumimethod_given),
1270  &(local_args_info.lumimethod_given), optarg, 0, "ATLAS_PREFERRED", ARG_STRING,
1271  check_ambiguity, override, 0, 0,
1272  "lumimethod", '-',
1273  additional_error))
1274  goto failure;
1275 
1276  }
1277  /* L1 Trigger used for livetime calculation. */
1278  else if (strcmp (long_options[option_index].name, "livetrigger") == 0)
1279  {
1280 
1281 
1282  if (update_arg( (void *)&(args_info->livetrigger_arg),
1283  &(args_info->livetrigger_orig), &(args_info->livetrigger_given),
1284  &(local_args_info.livetrigger_given), optarg, 0, "L1_EM30", ARG_STRING,
1285  check_ambiguity, override, 0, 0,
1286  "livetrigger", '-',
1287  additional_error))
1288  goto failure;
1289 
1290  }
1291  /* Calculate LAr defect fraction. */
1292  else if (strcmp (long_options[option_index].name, "lar") == 0)
1293  {
1294 
1295 
1296  if (update_arg((void *)&(args_info->lar_flag), 0, &(args_info->lar_given),
1297  &(local_args_info.lar_given), optarg, 0, 0, ARG_FLAG,
1298  check_ambiguity, override, 1, 0, "lar", '-',
1299  additional_error))
1300  goto failure;
1301 
1302  }
1303  /* LAr noise burst database tag. */
1304  else if (strcmp (long_options[option_index].name, "lartag") == 0)
1305  {
1306 
1307 
1308  if (update_arg( (void *)&(args_info->lartag_arg),
1309  &(args_info->lartag_orig), &(args_info->lartag_given),
1310  &(local_args_info.lartag_given), optarg, 0, "LARBadChannelsOflEventVeto-UPD4-01", ARG_STRING,
1311  check_ambiguity, override, 0, 0,
1312  "lartag", '-',
1313  additional_error))
1314  goto failure;
1315 
1316  }
1317  /* Require online beamspot valid in trigger livefraction. */
1318  else if (strcmp (long_options[option_index].name, "beamspot") == 0)
1319  {
1320 
1321 
1322  if (update_arg((void *)&(args_info->beamspot_flag), 0, &(args_info->beamspot_given),
1323  &(local_args_info.beamspot_given), optarg, 0, 0, ARG_FLAG,
1324  check_ambiguity, override, 1, 0, "beamspot", '-',
1325  additional_error))
1326  goto failure;
1327 
1328  }
1329  /* Online beamspot database tag. */
1330  else if (strcmp (long_options[option_index].name, "beamspottag") == 0)
1331  {
1332 
1333 
1334  if (update_arg( (void *)&(args_info->beamspottag_arg),
1335  &(args_info->beamspottag_orig), &(args_info->beamspottag_given),
1336  &(local_args_info.beamspottag_given), optarg, 0, "IndetBeamposOnl-HLT-UPD1-001-00", ARG_STRING,
1337  check_ambiguity, override, 0, 0,
1338  "beamspottag", '-',
1339  additional_error))
1340  goto failure;
1341 
1342  }
1343  /* Scale luminosity with a constant value. */
1344  else if (strcmp (long_options[option_index].name, "scale_lumi") == 0)
1345  {
1346 
1347 
1348  if (update_arg( (void *)&(args_info->scale_lumi_arg),
1349  &(args_info->scale_lumi_orig), &(args_info->scale_lumi_given),
1350  &(local_args_info.scale_lumi_given), optarg, 0, "1.0", ARG_DOUBLE,
1351  check_ambiguity, override, 0, 0,
1352  "scale_lumi", '-',
1353  additional_error))
1354  goto failure;
1355 
1356  }
1357  /* Output XML file name. */
1358  else if (strcmp (long_options[option_index].name, "xml_out") == 0)
1359  {
1360 
1361 
1362  if (update_arg( (void *)&(args_info->xml_out_arg),
1363  &(args_info->xml_out_orig), &(args_info->xml_out_given),
1364  &(local_args_info.xml_out_given), optarg, 0, 0, ARG_STRING,
1365  check_ambiguity, override, 0, 0,
1366  "xml_out", '-',
1367  additional_error))
1368  goto failure;
1369 
1370  }
1371  /* Output XML file of lists of collision candidates. */
1372  else if (strcmp (long_options[option_index].name, "xml_collisionlist") == 0)
1373  {
1374 
1375 
1376  if (update_arg((void *)&(args_info->xml_collisionlist_flag), 0, &(args_info->xml_collisionlist_given),
1377  &(local_args_info.xml_collisionlist_given), optarg, 0, 0, ARG_FLAG,
1378  check_ambiguity, override, 1, 0, "xml_collisionlist", '-',
1379  additional_error))
1380  goto failure;
1381 
1382  }
1383  /* Create some plots on demand. */
1384  else if (strcmp (long_options[option_index].name, "plots") == 0)
1385  {
1386 
1387 
1388  if (update_arg((void *)&(args_info->plots_flag), 0, &(args_info->plots_given),
1389  &(local_args_info.plots_given), optarg, 0, 0, ARG_FLAG,
1390  check_ambiguity, override, 1, 0, "plots", '-',
1391  additional_error))
1392  goto failure;
1393 
1394  }
1395  /* Quiet output level. */
1396  else if (strcmp (long_options[option_index].name, "quiet") == 0)
1397  {
1398 
1399 
1400  if (update_arg((void *)&(args_info->quiet_flag), 0, &(args_info->quiet_given),
1401  &(local_args_info.quiet_given), optarg, 0, 0, ARG_FLAG,
1402  check_ambiguity, override, 1, 0, "quiet", '-',
1403  additional_error))
1404  goto failure;
1405 
1406  }
1407 
1408  break;
1409  case '?': /* Invalid option. */
1410  /* `getopt_long' already printed an error message. */
1411  goto failure;
1412 
1413  default: /* bug: option not considered. */
1414  fprintf (stderr, "%s: option unknown: %c%s\n", CMDLINE_PARSER_PACKAGE, c, (additional_error ? additional_error : ""));
1415  abort ();
1416  } /* switch */
1417  } /* while */
1418 
1419 
1420  update_multiple_arg((void *)&(args_info->runnumber_arg),
1421  &(args_info->runnumber_orig), args_info->runnumber_given,
1422  local_args_info.runnumber_given, 0,
1423  ARG_STRING, runnumber_list);
1424  update_multiple_arg((void *)&(args_info->lbstart_arg),
1425  &(args_info->lbstart_orig), args_info->lbstart_given,
1426  local_args_info.lbstart_given, 0,
1427  ARG_INT, lbstart_list);
1428  update_multiple_arg((void *)&(args_info->lbend_arg),
1429  &(args_info->lbend_orig), args_info->lbend_given,
1430  local_args_info.lbend_given, 0,
1431  ARG_INT, lbend_list);
1432  update_multiple_arg((void *)&(args_info->xml_arg),
1433  &(args_info->xml_orig), args_info->xml_given,
1434  local_args_info.xml_given, 0,
1435  ARG_STRING, xml_list);
1436  update_multiple_arg((void *)&(args_info->tag_arg),
1437  &(args_info->tag_orig), args_info->tag_given,
1438  local_args_info.tag_given, 0,
1439  ARG_STRING, tag_list);
1440  update_multiple_arg((void *)&(args_info->root_arg),
1441  &(args_info->root_orig), args_info->root_given,
1442  local_args_info.root_given, 0,
1443  ARG_STRING, root_list);
1444  update_multiple_arg((void *)&(args_info->trigger_arg),
1445  &(args_info->trigger_orig), args_info->trigger_given,
1446  local_args_info.trigger_given, 0,
1447  ARG_STRING, trigger_list);
1448 
1449  args_info->runnumber_given += local_args_info.runnumber_given;
1450  local_args_info.runnumber_given = 0;
1451  args_info->lbstart_given += local_args_info.lbstart_given;
1452  local_args_info.lbstart_given = 0;
1453  args_info->lbend_given += local_args_info.lbend_given;
1454  local_args_info.lbend_given = 0;
1455  args_info->xml_given += local_args_info.xml_given;
1456  local_args_info.xml_given = 0;
1457  args_info->tag_given += local_args_info.tag_given;
1458  local_args_info.tag_given = 0;
1459  args_info->root_given += local_args_info.root_given;
1460  local_args_info.root_given = 0;
1461  args_info->trigger_given += local_args_info.trigger_given;
1462  local_args_info.trigger_given = 0;
1463 
1464  if (check_required)
1465  {
1466  error += cmdline_parser_required2 (args_info, argv[0], additional_error);
1467  }
1468 
1469  cmdline_parser_release (&local_args_info);
1470 
1471  if ( error )
1472  return (EXIT_FAILURE);
1473 
1474  return 0;
1475 
1476 failure:
1477  free_list (runnumber_list, 1 );
1478  free_list (lbstart_list, 0 );
1479  free_list (lbend_list, 0 );
1480  free_list (xml_list, 1 );
1481  free_list (tag_list, 1 );
1482  free_list (root_list, 1 );
1483  free_list (trigger_list, 1 );
1484 
1485  cmdline_parser_release (&local_args_info);
1486  return (EXIT_FAILURE);
1487 }
gengetopt_args_info::lartag_arg
char * lartag_arg
LAr noise burst database tag (default='LARBadChannelsOflEventVeto-UPD4-01').
Definition: cmdline.h:106
cmdline_parser_dump
int cmdline_parser_dump(FILE *outfile, struct gengetopt_args_info *args_info)
Save the contents of the option struct into an already open FILE stream.
Definition: cmdline.cxx:416
gengetopt_args_info::help_given
unsigned int help_given
Whether help was given.
Definition: cmdline.h:129
gengetopt_args_info::d3pd_dir_orig
char * d3pd_dir_orig
Name of TDirectory in input ROOT file where Lumi string is stored original value given at command lin...
Definition: cmdline.h:83
gengetopt_args_info::xml_out_orig
char * xml_out_orig
Output XML file name original value given at command line.
Definition: cmdline.h:118
gengetopt_args_info::tag_arg
char ** tag_arg
Input TAG file name.
Definition: cmdline.h:69
ATLAS_NO_CHECK_FILE_THREAD_SAFETY
ATLAS_NO_CHECK_FILE_THREAD_SAFETY
Definition: cmdline.cxx:12
CMDLINE_PARSER_PACKAGE_NAME
#define CMDLINE_PARSER_PACKAGE_NAME
the complete program name (used for help and version)
Definition: cmdline.h:33
gengetopt_args_info::tag_given
unsigned int tag_given
Whether tag was given.
Definition: cmdline.h:136
gengetopt_args_info::online_flag
int online_flag
Use online luminosity estimates instead of offline database (default=off).
Definition: cmdline.h:88
python.SystemOfUnits.s
int s
Definition: SystemOfUnits.py:131
ARG_NO
@ ARG_NO
Definition: cmdline.cxx:67
gengetopt_args_info::lumimethod_help
const char * lumimethod_help
Luminosity estimate method by string help description.
Definition: cmdline.h:95
gengetopt_args_info::beamspot_given
unsigned int beamspot_given
Whether beamspot was given.
Definition: cmdline.h:148
get_generator_info.result
result
Definition: get_generator_info.py:21
gengetopt_args_info::lbend_arg
int * lbend_arg
LumiBlock number end.
Definition: cmdline.h:56
max
#define max(a, b)
Definition: cfImp.cxx:41
gengetopt_args_info::beamspottag_help
const char * beamspottag_help
Online beamspot database tag help description.
Definition: cmdline.h:113
cmdline_parser
int cmdline_parser(int argc, char **argv, struct gengetopt_args_info *args_info)
The command line parser.
Definition: cmdline.cxx:656
cmdline_parser_file_save
int cmdline_parser_file_save(const char *filename, struct gengetopt_args_info *args_info)
Save the contents of the option struct into a (text) file.
Definition: cmdline.cxx:480
gengetopt_args_info::lumitag_given
unsigned int lumitag_given
Whether lumitag was given.
Definition: cmdline.h:140
gengetopt_args_info::verbose_help
const char * verbose_help
Verbose output level help description.
Definition: cmdline.h:125
CaloCellPos2Ntuple.int
int
Definition: CaloCellPos2Ntuple.py:24
make_coralServer_rep.opt
opt
Definition: make_coralServer_rep.py:19
gengetopt_args_info::runnumber_min
unsigned int runnumber_min
Run number, range, or comma separated list, e.g.
Definition: cmdline.h:48
gengetopt_args_info::xml_blacklist_orig
char * xml_blacklist_orig
Input XML file of blacklist original value given at command line.
Definition: cmdline.h:67
gengetopt_args_info::verbose_flag
int verbose_flag
Verbose output level (default=off).
Definition: cmdline.h:124
gengetopt_args_info::quiet_flag
int quiet_flag
Quiet output level (default=off).
Definition: cmdline.h:126
gengetopt_args_info_description
const char * gengetopt_args_info_description
Definition: cmdline.cxx:31
gengetopt_args_info::trigger_given
unsigned int trigger_given
Whether trigger was given.
Definition: cmdline.h:144
gengetopt_args_info::scale_lumi_help
const char * scale_lumi_help
Scale luminosity with a constant value help description.
Definition: cmdline.h:116
gengetopt_args_info::tree_given
unsigned int tree_given
Whether tree was given.
Definition: cmdline.h:138
gengetopt_args_info::xml_blacklist_help
const char * xml_blacklist_help
Input XML file of blacklist help description.
Definition: cmdline.h:68
gengetopt_args_info::d3pd_dir_arg
char * d3pd_dir_arg
Name of TDirectory in input ROOT file where Lumi string is stored.
Definition: cmdline.h:82
gengetopt_args_info::xml_collisionlist_flag
int xml_collisionlist_flag
Output XML file of lists of collision candidates (default=off).
Definition: cmdline.h:120
initialize
void initialize()
Definition: run_EoverP.cxx:894
gengetopt_args_info::tree_help
const char * tree_help
Name of TTree in input ROOT file to which Lumi string is attached help description.
Definition: cmdline.h:81
cmdline_parser_free
void cmdline_parser_free(struct gengetopt_args_info *args_info)
Deallocates the string fields of the gengetopt_args_info structure (but does not deallocate the struc...
Definition: cmdline.cxx:500
cmdline_parser_print_help
void cmdline_parser_print_help(void)
Print the help.
Definition: cmdline.cxx:243
generic_list::arg
union generic_value arg
Definition: cmdline.cxx:302
gengetopt_args_info::lbstart_max
unsigned int lbstart_max
LumiBlock number begin's maximum occurreces.
Definition: cmdline.h:54
gengetopt_args_info::root_max
unsigned int root_max
Input ROOT file name's maximum occurreces.
Definition: cmdline.h:77
get_generator_info.stderr
stderr
Definition: get_generator_info.py:40
athena.value
value
Definition: athena.py:124
gengetopt_args_info::lbstart_orig
char ** lbstart_orig
LumiBlock number begin original value given at command line.
Definition: cmdline.h:52
WriteCaloSwCorrections.tag_list
tag_list
Definition: WriteCaloSwCorrections.py:28
gengetopt_args_info::lumichannel_arg
int lumichannel_arg
Luminosity estimate method by value (default='0').
Definition: cmdline.h:90
gengetopt_args_info::beamspottag_orig
char * beamspottag_orig
Online beamspot database tag original value given at command line.
Definition: cmdline.h:112
gengetopt_args_info::lartag_given
unsigned int lartag_given
Whether lartag was given.
Definition: cmdline.h:147
gengetopt_args_info::lbstart_arg
int * lbstart_arg
LumiBlock number begin.
Definition: cmdline.h:51
gengetopt_args_info::tag_max
unsigned int tag_max
Input TAG file name's maximum occurreces.
Definition: cmdline.h:72
ReadOfcFromCool.field
field
Definition: ReadOfcFromCool.py:48
generic_value::double_arg
double double_arg
Definition: cmdline.cxx:294
ARG_FLAG
@ ARG_FLAG
Definition: cmdline.cxx:68
gengetopt_args_info::lumitag_orig
char * lumitag_orig
Offline luminosity database tag original value given at command line.
Definition: cmdline.h:86
generic_list::next
struct generic_list * next
Definition: cmdline.cxx:304
cmdline_parser_required
int cmdline_parser_required(struct gengetopt_args_info *args_info, const char *prog_name)
Checks that all the required options were specified.
Definition: cmdline.cxx:701
gengetopt_args_info::lumimethod_arg
char * lumimethod_arg
Luminosity estimate method by string (default='ATLAS_PREFERRED').
Definition: cmdline.h:93
gengetopt_args_info::runnumber_orig
char ** runnumber_orig
Run number, range, or comma separated list, e.g.
Definition: cmdline.h:47
gengetopt_args_info::lbstart_help
const char * lbstart_help
LumiBlock number begin help description.
Definition: cmdline.h:55
generic_value
generic value variable
Definition: cmdline.cxx:292
gengetopt_args_info::xml_collisionlist_help
const char * xml_collisionlist_help
Output XML file of lists of collision candidates help description.
Definition: cmdline.h:121
gengetopt_args_info::trigger_arg
char ** trigger_arg
Trigger chain name used for prescale calculation.
Definition: cmdline.h:96
cmdline_parser_params_create
struct cmdline_parser_params * cmdline_parser_params_create(void)
Allocates dynamically a cmdline_parser_params structure and initializes all its fields to their defau...
Definition: cmdline.cxx:273
handi.long_options
list long_options
Definition: handi.py:43
gengetopt_args_info::scale_lumi_orig
char * scale_lumi_orig
Scale luminosity with a constant value original value given at command line.
Definition: cmdline.h:115
gengetopt_args_info::verbose_given
unsigned int verbose_given
Whether verbose was given.
Definition: cmdline.h:154
gengetopt_args_info::version_given
unsigned int version_given
Whether version was given.
Definition: cmdline.h:130
python.Bindings.values
values
Definition: Control/AthenaPython/python/Bindings.py:805
gengetopt_args_info::xml_arg
char ** xml_arg
Input XML file name.
Definition: cmdline.h:61
gengetopt_args_info::root_given
unsigned int root_given
Whether root was given.
Definition: cmdline.h:137
gengetopt_args_info::lumichannel_orig
char * lumichannel_orig
Luminosity estimate method by value original value given at command line.
Definition: cmdline.h:91
generic_value::int_arg
int int_arg
Definition: cmdline.cxx:293
gengetopt_args_info::lumitag_help
const char * lumitag_help
Offline luminosity database tag help description.
Definition: cmdline.h:87
gengetopt_args_info::tree_orig
char * tree_orig
Name of TTree in input ROOT file to which Lumi string is attached original value given at command lin...
Definition: cmdline.h:80
gengetopt_args_info::lbend_min
unsigned int lbend_min
LumiBlock number end's minimum occurreces.
Definition: cmdline.h:58
gengetopt_args_info::lartag_help
const char * lartag_help
LAr noise burst database tag help description.
Definition: cmdline.h:108
generic_value::default_string_arg
const char * default_string_arg
Definition: cmdline.cxx:296
gengetopt_args_info::scale_lumi_arg
double scale_lumi_arg
Scale luminosity with a constant value (default='1.0').
Definition: cmdline.h:114
gengetopt_args_info::lbend_max
unsigned int lbend_max
LumiBlock number end's maximum occurreces.
Definition: cmdline.h:59
gengetopt_args_info::runnumber_given
unsigned int runnumber_given
Whether runnumber was given.
Definition: cmdline.h:131
gengetopt_args_info::beamspot_flag
int beamspot_flag
Require online beamspot valid in trigger livefraction (default=off).
Definition: cmdline.h:109
gengetopt_args_info::xml_blacklist_arg
char * xml_blacklist_arg
Input XML file of blacklist.
Definition: cmdline.h:66
lumiFormat.i
int i
Definition: lumiFormat.py:85
LArCellNtuple.argv
argv
Definition: LArCellNtuple.py:152
gengetopt_args_info::lartag_orig
char * lartag_orig
LAr noise burst database tag original value given at command line.
Definition: cmdline.h:107
generic_list
holds temporary values for multiple options
Definition: cmdline.cxx:301
gengetopt_args_info::lar_flag
int lar_flag
Calculate LAr defect fraction (default=off).
Definition: cmdline.h:104
ARG_STRING
@ ARG_STRING
Definition: cmdline.cxx:69
gengetopt_args_info_purpose
const char * gengetopt_args_info_purpose
the purpose string of the program
Definition: cmdline.cxx:27
TrigInDetValidation_Base.malloc
malloc
Definition: TrigInDetValidation_Base.py:132
histSizes.list
def list(name, path='/')
Definition: histSizes.py:38
gengetopt_args_info::lbstart_given
unsigned int lbstart_given
Whether lbstart was given.
Definition: cmdline.h:132
DQHistogramMergeRegExp.argc
argc
Definition: DQHistogramMergeRegExp.py:20
gengetopt_args_info::xml_orig
char ** xml_orig
Input XML file name original value given at command line.
Definition: cmdline.h:62
xAOD::double
double
Definition: CompositeParticle_v1.cxx:159
gengetopt_args_info::lar_help
const char * lar_help
Calculate LAr defect fraction help description.
Definition: cmdline.h:105
DeMoUpdate.tmp
string tmp
Definition: DeMoUpdate.py:1167
gengetopt_args_info::lumimethod_given
unsigned int lumimethod_given
Whether lumimethod was given.
Definition: cmdline.h:143
gengetopt_args_info::lbstart_min
unsigned int lbstart_min
LumiBlock number begin's minimum occurreces.
Definition: cmdline.h:53
calibdata.exit
exit
Definition: calibdata.py:236
cmdline_parser_params::check_ambiguity
int check_ambiguity
whether to check for options already specified in the option structure gengetopt_args_info (default 0...
Definition: cmdline.h:165
gengetopt_args_info::lumitag_arg
char * lumitag_arg
Offline luminosity database tag (default='OflLumi-8TeV-002').
Definition: cmdline.h:85
gengetopt_args_info::xml_min
unsigned int xml_min
Input XML file name's minimum occurreces.
Definition: cmdline.h:63
min
#define min(a, b)
Definition: cfImp.cxx:40
create_dcsc_inputs_sqlite.arg
list arg
Definition: create_dcsc_inputs_sqlite.py:48
gengetopt_args_info::xml_blacklist_given
unsigned int xml_blacklist_given
Whether xml_blacklist was given.
Definition: cmdline.h:135
gengetopt_args_info::trigger_min
unsigned int trigger_min
Trigger chain name used for prescale calculation's minimum occurreces.
Definition: cmdline.h:98
cmdline_parser_ext
int cmdline_parser_ext(int argc, char **argv, struct gengetopt_args_info *args_info, struct cmdline_parser_params *params)
The command line parser (version with additional parameters)
Definition: cmdline.cxx:662
gengetopt_args_info::plots_given
unsigned int plots_given
Whether plots was given.
Definition: cmdline.h:153
gengetopt_args_info::xml_collisionlist_given
unsigned int xml_collisionlist_given
Whether xml_collisionlist was given.
Definition: cmdline.h:152
gengetopt_args_info::runnumber_max
unsigned int runnumber_max
Run number, range, or comma separated list, e.g.
Definition: cmdline.h:49
gengetopt_args_info::xml_out_given
unsigned int xml_out_given
Whether xml_out was given.
Definition: cmdline.h:151
gengetopt_args_info::xml_out_arg
char * xml_out_arg
Output XML file name.
Definition: cmdline.h:117
gengetopt_args_info::tag_min
unsigned int tag_min
Input TAG file name's minimum occurreces.
Definition: cmdline.h:71
gengetopt_args_info_help
const char * gengetopt_args_info_help[]
all the lines making the help output
Definition: cmdline.cxx:33
gengetopt_args_info::livetrigger_given
unsigned int livetrigger_given
Whether livetrigger was given.
Definition: cmdline.h:145
gengetopt_args_info::tag_help
const char * tag_help
Input TAG file name help description.
Definition: cmdline.h:73
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:221
gengetopt_args_info::lbend_orig
char ** lbend_orig
LumiBlock number end original value given at command line.
Definition: cmdline.h:57
gengetopt_args_info::tag_orig
char ** tag_orig
Input TAG file name original value given at command line.
Definition: cmdline.h:70
gengetopt_args_info::quiet_given
unsigned int quiet_given
Whether quiet was given.
Definition: cmdline.h:155
gengetopt_args_info::version_help
const char * version_help
Print version and exit help description.
Definition: cmdline.h:45
gengetopt_args_info::scale_lumi_given
unsigned int scale_lumi_given
Whether scale_lumi was given.
Definition: cmdline.h:150
gengetopt_args_info::beamspot_help
const char * beamspot_help
Require online beamspot valid in trigger livefraction help description.
Definition: cmdline.h:110
cmdline_parser_params_init
void cmdline_parser_params_init(struct cmdline_parser_params *params)
Initializes all the fields a cmdline_parser_params structure to their default values.
Definition: cmdline.cxx:260
gengetopt_args_info::lumimethod_orig
char * lumimethod_orig
Luminosity estimate method by string original value given at command line.
Definition: cmdline.h:94
cmdline_parser_arg_type
cmdline_parser_arg_type
Definition: cmdline.cxx:67
gengetopt_args_info::xml_help
const char * xml_help
Input XML file name help description.
Definition: cmdline.h:65
gengetopt_args_info::livetrigger_orig
char * livetrigger_orig
L1 Trigger used for livetime calculation original value given at command line.
Definition: cmdline.h:102
cmdline.h
The header file for the command line option parser generated by GNU Gengetopt version 2....
gengetopt_args_info::d3pd_dir_given
unsigned int d3pd_dir_given
Whether d3pd_dir was given.
Definition: cmdline.h:139
gengetopt_args_info::root_help
const char * root_help
Input ROOT file name help description.
Definition: cmdline.h:78
gengetopt_args_info::lbend_given
unsigned int lbend_given
Whether lbend was given.
Definition: cmdline.h:133
CondAlgsOpts.found
int found
Definition: CondAlgsOpts.py:101
ARG_DOUBLE
@ ARG_DOUBLE
Definition: cmdline.cxx:71
cmdline_parser_print_version
void cmdline_parser_print_version(void)
Print the version.
Definition: cmdline.cxx:220
gengetopt_args_info::beamspottag_arg
char * beamspottag_arg
Online beamspot database tag (default='IndetBeamposOnl-HLT-UPD1-001-00').
Definition: cmdline.h:111
gengetopt_args_info::online_given
unsigned int online_given
Whether online was given.
Definition: cmdline.h:141
gengetopt_args_info::root_min
unsigned int root_min
Input ROOT file name's minimum occurreces.
Definition: cmdline.h:76
Pythia8_RapidityOrderMPI.val
val
Definition: Pythia8_RapidityOrderMPI.py:14
cmdline_parser_init
void cmdline_parser_init(struct gengetopt_args_info *args_info)
Initializes the passed gengetopt_args_info structure's fields (also set default values for options th...
Definition: cmdline.cxx:252
gengetopt_args_info
Where the command line options are stored.
Definition: cmdline.h:43
CaloCellTimeCorrFiller.filename
filename
Definition: CaloCellTimeCorrFiller.py:24
gengetopt_args_info::xml_given
unsigned int xml_given
Whether xml was given.
Definition: cmdline.h:134
generic_value::string_arg
char * string_arg
Definition: cmdline.cxx:295
gengetopt_args_info::runnumber_arg
char ** runnumber_arg
Run number, range, or comma separated list, e.g.
Definition: cmdline.h:46
cmdline_parser_params
The additional parameters to pass to parser functions.
Definition: cmdline.h:161
gengetopt_args_info::livetrigger_help
const char * livetrigger_help
L1 Trigger used for livetime calculation help description.
Definition: cmdline.h:103
gengetopt_args_info::lar_given
unsigned int lar_given
Whether lar was given.
Definition: cmdline.h:146
gengetopt_args_info::help_help
const char * help_help
Print help and exit help description.
Definition: cmdline.h:44
gengetopt_args_info::root_orig
char ** root_orig
Input ROOT file name original value given at command line.
Definition: cmdline.h:75
gengetopt_args_info::plots_help
const char * plots_help
Create some plots on demand help description.
Definition: cmdline.h:123
gengetopt_args_info::livetrigger_arg
char * livetrigger_arg
L1 Trigger used for livetime calculation (default='L1_EM30').
Definition: cmdline.h:101
gengetopt_args_info::lumichannel_given
unsigned int lumichannel_given
Whether lumichannel was given.
Definition: cmdline.h:142
gengetopt_args_info::quiet_help
const char * quiet_help
Quiet output level help description.
Definition: cmdline.h:127
cmdline_parser2
int cmdline_parser2(int argc, char **argv, struct gengetopt_args_info *args_info, int override, int initialize, int check_required)
The command line parser (version with additional parameters - deprecated)
Definition: cmdline.cxx:678
gengetopt_args_info::xml_out_help
const char * xml_out_help
Output XML file name help description.
Definition: cmdline.h:119
gengetopt_args_info::runnumber_help
const char * runnumber_help
Run number, range, or comma separated list, e.g.
Definition: cmdline.h:50
PowhegControl_ttFCNC_NLO.params
params
Definition: PowhegControl_ttFCNC_NLO.py:226
ARG_INT
@ ARG_INT
Definition: cmdline.cxx:70
gengetopt_args_info::online_help
const char * online_help
Use online luminosity estimates instead of offline database help description.
Definition: cmdline.h:89
get_generator_info.error
error
Definition: get_generator_info.py:40
CMDLINE_PARSER_PACKAGE
#define CMDLINE_PARSER_PACKAGE
the program name (used for printing errors)
Definition: cmdline.h:28
gengetopt_args_info::tree_arg
char * tree_arg
Name of TTree in input ROOT file to which Lumi string is attached.
Definition: cmdline.h:79
cmdline_parser_params::check_required
int check_required
whether to check that all required options were provided (default 1)
Definition: cmdline.h:164
checker_macros.h
Define macros for attributes used to control the static checker.
PrepareReferenceFile.outfile
outfile
Definition: PrepareReferenceFile.py:42
gengetopt_args_info::root_arg
char ** root_arg
Input ROOT file name.
Definition: cmdline.h:74
error
Definition: IImpactPoint3dEstimator.h:70
gengetopt_args_info::lbend_help
const char * lbend_help
LumiBlock number end help description.
Definition: cmdline.h:60
gengetopt_args_info::plots_flag
int plots_flag
Create some plots on demand (default=off).
Definition: cmdline.h:122
python.compressB64.c
def c
Definition: compressB64.py:93
gengetopt_args_info::trigger_orig
char ** trigger_orig
Trigger chain name used for prescale calculation original value given at command line.
Definition: cmdline.h:97
gengetopt_args_info::lumichannel_help
const char * lumichannel_help
Luminosity estimate method by value help description.
Definition: cmdline.h:92
gengetopt_args_info::trigger_help
const char * trigger_help
Trigger chain name used for prescale calculation help description.
Definition: cmdline.h:100
gengetopt_args_info_usage
const char * gengetopt_args_info_usage
the usage string of the program
Definition: cmdline.cxx:29
generic_list::orig
char * orig
Definition: cmdline.cxx:303
gengetopt_args_info::xml_max
unsigned int xml_max
Input XML file name's maximum occurreces.
Definition: cmdline.h:64
CMDLINE_PARSER_VERSION
#define CMDLINE_PARSER_VERSION
the program version
Definition: cmdline.h:38
gengetopt_args_info::trigger_max
unsigned int trigger_max
Trigger chain name used for prescale calculation's maximum occurreces.
Definition: cmdline.h:99
gengetopt_args_info::d3pd_dir_help
const char * d3pd_dir_help
Name of TDirectory in input ROOT file where Lumi string is stored help description.
Definition: cmdline.h:84
gengetopt_args_info::beamspottag_given
unsigned int beamspottag_given
Whether beamspottag was given.
Definition: cmdline.h:149