ATTPCROOT  0.3.0-alpha
A ROOT-based framework for analyzing data from active target detectors
option.h
Go to the documentation of this file.
1 //
2 // option.h
3 // Class and functions for parsing and storing command line options.
4 //
5 // Author: Jens Wilberg, Lukas Aymans, Christoph Dalitz
6 // Date: 2018-08-30
7 // License: see ../LICENSE
8 //
9 
10 #ifndef OPTION_H
11 #define OPTION_H
12 #include "util.h"
13 
14 #include <cstddef>
15 #include <utility>
16 
17 // class for handling all command line option
18 class Opt {
19 private:
20  char *infile_name, *outfile_prefix;
21  // output as gnuplot
22  bool gnuplot;
23  // csv file delimiter
24  char delimiter;
25  // csv file with header
26  size_t skip;
27  // verbosity level
28  int verbose;
29 
30  // neighbour distance for smoothing
31  double r;
32  bool rdnn; // compute r with dnn
33 
34  // tested neighbours of triplet mid point
35  size_t k;
36  // max number of triplets to one mid point
37  size_t n;
38  // 1 - cos alpha, where alpha is the angle between the two triplet branches
39  double a;
40 
41  // distance scale factor in metric
42  double s;
43  bool sdnn; // compute s with dnn
44  // threshold for cdist in clustering
45  double t;
46  bool tauto; // auto generate t
47  // maximum gap width
48  double dmax;
49  bool isdmax; // dmax != none
50  bool dmax_dnn; // use dnn for dmax
51  // linkage method for clustering
52  Linkage link;
53 
54  // min number of triplets per cluster
55  size_t m;
56 
57  std::pair<double, bool> parse_argument(const char *str);
58 
59 public:
60  Opt();
61  int parse_args(int argc, char **argv);
62  // compute attributes which depend on dnn.
63  void set_dnn(double dnn);
64 
65  void set_parameters(double _s, double _k, double _n, double _m, double _r, double _a, double _t);
66 
67  // read access functions
68  const char *get_ifname();
69  // get outfile name
70  const char *get_ofprefix();
71  bool needs_dnn();
72  bool is_gnuplot();
73  char get_delimiter();
74  size_t get_skip();
75  int get_verbosity();
76  double get_r();
77  size_t get_k();
78  size_t get_n();
79  double get_a();
80  double get_s();
81  bool is_tauto();
82  double get_t();
83  bool is_dmax();
84  double get_dmax();
86  size_t get_m();
87 };
88 
89 #endif
Opt::get_skip
size_t get_skip()
Definition: option.cxx:284
Linkage
Linkage
Definition: util.h:13
Opt::is_dmax
bool is_dmax()
Definition: option.cxx:324
Opt::get_t
double get_t()
Definition: option.cxx:320
Opt::needs_dnn
bool needs_dnn()
Definition: option.cxx:276
Opt::set_parameters
void set_parameters(double _s, double _k, double _n, double _m, double _r, double _a, double _t)
Definition: option.cxx:53
Opt::set_dnn
void set_dnn(double dnn)
Definition: option.cxx:245
Opt::get_k
size_t get_k()
Definition: option.cxx:300
Opt::is_gnuplot
bool is_gnuplot()
Definition: option.cxx:280
Opt::get_ifname
const char * get_ifname()
Definition: option.cxx:268
Opt::get_ofprefix
const char * get_ofprefix()
Definition: option.cxx:272
Opt::get_m
size_t get_m()
Definition: option.cxx:336
Opt::Opt
Opt()
Definition: option.cxx:19
Opt::parse_args
int parse_args(int argc, char **argv)
Definition: option.cxx:74
Opt::get_n
size_t get_n()
Definition: option.cxx:304
Opt::is_tauto
bool is_tauto()
Definition: option.cxx:316
Opt::get_verbosity
int get_verbosity()
Definition: option.cxx:292
Opt::get_delimiter
char get_delimiter()
Definition: option.cxx:288
Opt::get_dmax
double get_dmax()
Definition: option.cxx:328
Opt::get_r
double get_r()
Definition: option.cxx:296
Opt::get_linkage
Linkage get_linkage()
Definition: option.cxx:332
util.h
Opt::get_a
double get_a()
Definition: option.cxx:308
Opt
Definition: option.h:18
Opt::get_s
double get_s()
Definition: option.cxx:312