Jpp
examples
JNanobeacon
pulse_classification_IO.hh
Go to the documentation of this file.
1
#ifndef __READOPTIONS__
2
#define __READOPTIONS__
3
4
//c++ standard library
5
#include <iostream>
6
7
// Jpp
8
#include "
Jeep/JParser.hh
"
9
#include "
Jeep/JMessage.hh
"
10
11
//root
12
13
// namespaces
14
using namespace
std
;
15
16
/**
17
* \author rgruiz
18
*/
19
20
21
22
/**
23
* Structure to store the different command line arguments for pulse_classification.cc .
24
*/
25
struct
IO
{
26
27
string
ifname ;
28
29
string
ofname ;
30
31
string
detector_file ;
32
33
int
string_number ;
34
35
int
analysis_level ;
36
37
int
up_pmts ;
38
39
int
down_pmts ;
40
41
int
number_neighbors ;
42
43
};
44
45
/**
46
* Parses the command line options and fills an IO structure with them.
47
*
48
* \param options an option structure
49
* \param argc the number of command line arguments
50
* \param argv the command line arguments
51
*
52
* \return 1 if works 2 if it doesn't work
53
*/
54
inline
int
read_user_options
(
IO
&options,
int
argc,
char
**argv){
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
}
95
96
97
#endif
IO::analysis_level
int analysis_level
Definition:
JInterDomCal_IO.hh:63
read_user_options
int read_user_options(IO &options, int argc, char **argv)
Parses the command line options and fills an IO structure with them.
Definition:
pulse_classification_IO.hh:54
JMessage.hh
IO::down_pmts
int down_pmts
Definition:
JInterDomCal_IO.hh:59
JPARSER::JParser
Utility class to parse command line options.
Definition:
JParser.hh:1493
IO
Structure to store the different command line arguments for JRunAnalyzer.
Definition:
JRunAnalyzer.cc:40
ERROR
#define ERROR(A)
Definition:
JMessage.hh:66
IO::ofname
string ofname
Definition:
JRunAnalyzer.cc:44
IO::ifname
string ifname
Definition:
JRunAnalyzer.cc:42
IO::up_pmts
int up_pmts
Definition:
JInterDomCal_IO.hh:57
JParser.hh
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:
JRunAnalyzer.cc:46
std
Definition:
jaanetDictionary.h:36
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
Generated by
1.8.16