Jpp
Classes | Functions
pulse_classification_IO.hh File Reference
#include <iostream>
#include "Jeep/JParser.hh"
#include "Jeep/JMessage.hh"

Go to the source code of this file.

Classes

struct  IO
 Structure to store the different command line arguments for JInterDomCal. More...
 

Functions

int read_user_options (IO &options, int argc, char **argv)
 Parses the command line options and fills an IO structure with them. More...
 

Function Documentation

◆ read_user_options()

int read_user_options ( IO options,
int  argc,
char **  argv 
)
inline

Parses the command line options and fills an IO structure with them.

Parameters
optionsan option structure
argcthe number of command line arguments
argvthe command line arguments
Returns
1 if works 2 if it doesn't work

Definition at line 54 of file pulse_classification_IO.hh.

54  {
55 
56  int a = 0;
57 
58  try {
59 
60  JParser<string> zap;
61 
62  zap["o"] = make_field(options.ofname) = "out.root" ;
63 
64  zap["f"] = make_field(options.ifname) ;
65 
66  zap["a"] = make_field(options.detector_file) ;
67 
68  zap["s"] = make_field(options.string_number) ;
69 
70  zap["l"] = make_field(options.analysis_level) = 0 ;
71 
72  zap["u"] = make_field(options.up_pmts) = 1 ;
73 
74  zap["d"] = make_field(options.down_pmts) = 4 ;
75 
76  zap["n"] = make_field(options.number_neighbors) = 2 ;
77 
78  if (zap.read(argc, argv) != 0)
79 
80  a = 1;
81 
82  }
83 
84  catch(const exception &error) {
85 
86  ERROR(error.what() << endl);
87 
88  a = 2;
89 
90  }
91 
92  return a;
93 
94 }
IO::analysis_level
int analysis_level
Definition: JInterDomCal_IO.hh:63
IO::down_pmts
int down_pmts
Definition: JInterDomCal_IO.hh:59
JPARSER::JParser
Utility class to parse command line options.
Definition: JParser.hh:1493
ERROR
#define ERROR(A)
Definition: JMessage.hh:66
IO::ofname
string ofname
Definition: JPulseFinder_IO.hh:42
IO::ifname
string ifname
Definition: JInterDomCal_IO.hh:53
IO::up_pmts
int up_pmts
Definition: JInterDomCal_IO.hh:57
IO::string_number
int string_number
Definition: JInterDomCal_IO.hh:55
make_field
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition: JParser.hh:1954
IO::detector_file
string detector_file
Definition: JInterDomCal_IO.hh:45
IO::number_neighbors
int number_neighbors
Definition: JInterDomCal_IO.hh:61
JPARSER::JParser::read
int read(const int argc, const char *const argv[])
Parse the program's command line options.
Definition: JParser.hh:1791