17 #include <system_error>
19 using namespace boost::program_options;
21 boost::program_options::options_description
24 <<
"\n\n======================= DEPRECATION NOTICE "
25 "========================\n"
26 "The examples executables is deprecated. They will be removed in a\n"
28 "Consider using the python bindings for the example algorithms: \n"
29 "https://acts.readthedocs.io/en/latest/examples/python_bindings.html\n"
30 "==================================================================="
34 options_description opt(caption);
36 opt.add_options()(
"help,h",
"Produce help message");
38 "loglevel,l", value<size_t>()->default_value(2),
39 "The output log level. Please set the wished number (0 = VERBOSE, 1 = "
40 "DEBUG, 2 = INFO, 3 = WARNING, 4 = ERROR, 5 = FATAL).");
42 "response-file", value<std::string>()->default_value(
""),
43 "Configuration file (response file) replacing command line options.");
49 boost::program_options::options_description& opt) {
51 opt.add_options()(
"events,n", value<size_t>(),
52 "The number of events to process. If not given, all "
53 "available events will be processed.")(
54 "skip", value<size_t>()->default_value(0),
55 "The number of events to skip")(
"jobs,j", value<int>()->default_value(-1),
56 "Number of parallel jobs, negative for "
61 boost::program_options::options_description& opt) {
62 opt.add_options()(
"rnd-seed", value<uint64_t>()->default_value(1234567890
u),
63 "Random numbers seed.");
67 boost::program_options::options_description& opt) {
68 opt.add_options()(
"geo-surface-loglevel", value<size_t>()->default_value(3),
69 "The outoput log level for the surface building.")(
70 "geo-layer-loglevel", value<size_t>()->default_value(3),
71 "The output log level for the layer building.")(
72 "geo-volume-loglevel", value<size_t>()->default_value(3),
73 "The output log level "
79 boost::program_options::options_description& opt) {
81 "mat-input-type", value<std::string>()->default_value(
"build"),
82 "The way material is loaded: 'none', 'build', 'proto', 'file'.")(
83 "mat-input-file", value<std::string>()->default_value(
""),
84 "Name of the material map input file, supported: '.json', '.cbor' or "
85 "'.root'.")(
"mat-output-file", value<std::string>()->default_value(
""),
86 "Name of the material map output file (without extension).")(
87 "mat-output-sensitives", value<bool>()->default_value(
true),
88 "Write material information of sensitive surfaces.")(
89 "mat-output-approaches", value<bool>()->default_value(
true),
90 "Write material information of approach surfaces.")(
91 "mat-output-representing", value<bool>()->default_value(
true),
92 "Write material information of representing surfaces.")(
93 "mat-output-boundaries", value<bool>()->default_value(
true),
94 "Write material information of boundary surfaces.")(
95 "mat-output-volumes", value<bool>()->default_value(
true),
96 "Write material information of volumes.")(
97 "mat-output-dense-volumes", value<bool>()->default_value(
false),
98 "Write material information of dense volumes.")(
99 "mat-output-allmaterial", value<bool>()->default_value(
false),
100 "Add protoMaterial to all surfaces and volume for the mapping.");
104 boost::program_options::options_description& opt,
107 opt.add_options()(
"output-dir", value<std::string>()->default_value(
""),
108 "Output directory location.");
111 opt.add_options()(
"output-root", bool_switch(),
112 "Switch on to write '.root' output file(s).");
116 opt.add_options()(
"output-csv", bool_switch(),
117 "Switch on to write '.csv' output file(s).");
121 opt.add_options()(
"output-obj", bool_switch(),
122 "Switch on to write '.obj' output file(s).");
126 opt.add_options()(
"output-json", bool_switch(),
127 "Switch on to write '.json' output file(s).");
131 opt.add_options()(
"output-cbor", bool_switch(),
132 "Switch on to write '.cbor' output file(s).");
136 opt.add_options()(
"output-txt", bool_switch(),
137 "Switch on to write '.txt' output file(s).");
142 boost::program_options::options_description& opt) {
144 opt.add_options()(
"input-dir", value<std::string>()->default_value(
""),
145 "Input directory location.")(
146 "input-files",
value<std::vector<std::string>>(),
147 "Input files, can occur multiple times.")(
148 "input-root", value<bool>()->default_value(
false),
149 "Switch on to read '.root' file(s).")(
150 "input-csv", value<bool>()->default_value(
false),
151 "Switch on to read '.csv' file(s).")(
"input-obj",
152 value<bool>()->default_value(
false),
153 "Switch on to read '.obj' file(s).")(
154 "input-json", value<bool>()->default_value(
false),
155 "Switch on to read '.json' file(s).")(
156 "input-cbor", value<bool>()->default_value(
false),
157 "Switch on to read '.cbor' file(s).");
161 const boost::program_options::options_description& opt,
int argc,
162 char* argv[]) noexcept(
false) {
167 if (vm.count(
"response-file") != 0
u and
168 not vm[
"response-file"].template as<std::string>().empty()) {
170 std::ifstream ifs(vm[
"response-file"].as<std::string>().c_str());
172 throw(std::system_error(std::error_code(),
173 "Could not open response file."));
176 std::stringstream ss;
179 std::vector<std::string>
args;
180 const std::regex rgx(
"[ \t\r\n\f]");
181 std::sregex_token_iterator iter(rString.begin(), rString.end(), rgx, -1);
182 std::sregex_token_iterator
end;
183 for (; iter !=
end; ++iter) {
187 args.push_back(*iter);
194 if (vm.count(
"help") != 0
u) {
195 std::cout << opt << std::endl;
202 const boost::program_options::variables_map& vm) {
207 const boost::program_options::variables_map& vm) {
209 cfg.
skip = vm[
"skip"].as<
size_t>();
210 if (not vm[
"events"].empty()) {
211 cfg.
events = vm[
"events"].as<
size_t>();
215 if (not vm[
"output-dir"].empty()) {
224 const boost::program_options::variables_map& vm) {
226 cfg.
seed = vm[
"rnd-seed"].as<uint64_t>();