Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
TruthSeedSelectorOptions.cpp
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file TruthSeedSelectorOptions.cpp
1 // This file is part of the Acts project.
2 //
3 // Copyright (C) 2022 CERN for the benefit of the Acts project
4 //
5 // This Source Code Form is subject to the terms of the Mozilla Public
6 // License, v. 2.0. If a copy of the MPL was not distributed with this
7 // file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 
10 
13 
14 #include <boost/program_options.hpp>
15 
16 namespace ActsExamples {
17 namespace Options {
18 
21  using Options::Interval;
22 
23  auto opt = desc.add_options();
24  opt("select-rho-mm", value<Interval>()->value_name("MIN:MAX"),
25  "Select particle transverse distance to the origin in mm");
26  opt("select-z-mm", value<Interval>()->value_name("MIN:MAX"),
27  "Select particle longitudinal distance range to the origin in mm");
28  opt("select-phi-degree", value<Interval>()->value_name("MIN:MAX"),
29  "Select particle direction angle in the transverse plane in degree");
30  opt("select-eta", value<Interval>()->value_name("MIN:MAX"),
31  "Select particle pseudo-rapidity");
32  opt("select-abseta", value<Interval>()->value_name("MIN:MAX"),
33  "Select particle absolute pseudo-rapidity");
34  opt("select-pt-gev", value<Interval>()->value_name("MIN:MAX"),
35  "Select particle transverse momentum in GeV");
36  opt("select-min-hits", value<size_t>()->default_value(3),
37  "Select particle minimum hits");
38 }
39 
41  const Options::Variables& vars) {
42  using namespace Acts::UnitLiterals;
43 
44  // Set boundary values if the given config exists
45  auto extractInterval = [&](const char* name, auto unit, auto& lower,
46  auto& upper) {
47  if (vars[name].empty()) {
48  return;
49  }
50  auto interval = vars[name].as<Options::Interval>();
51  lower = interval.lower.value_or(lower) * unit;
52  upper = interval.upper.value_or(upper) * unit;
53  };
54 
56  extractInterval("select-rho-mm", 1_mm, cfg.rhoMin, cfg.rhoMax);
57  extractInterval("select-z-mm", 1_mm, cfg.zMin, cfg.zMax);
58  extractInterval("select-phi-degree", 1_degree, cfg.phiMin, cfg.phiMax);
59  extractInterval("select-eta", 1.0, cfg.etaMin, cfg.etaMax);
60  extractInterval("select-abseta", 1.0, cfg.absEtaMin, cfg.absEtaMax);
61  extractInterval("select-pt-gev", 1_GeV, cfg.ptMin, cfg.ptMax);
62  cfg.nHitsMin = vars["select-min-hits"].as<size_t>();
63  return cfg;
64 }
65 
66 } // namespace Options
67 } // namespace ActsExamples