Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
FatrasOptions.cpp
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file FatrasOptions.cpp
1 // This file is part of the Acts project.
2 //
3 // Copyright (C) 2019-2021 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 
14 
15 #include <stdexcept>
16 
17 #include <boost/program_options.hpp>
18 
19 namespace ActsExamples {
20 namespace Options {
21 
23  using boost::program_options::bool_switch;
25 
26  auto opt = desc.add_options();
27  opt("fatras-pmin-gev", value<double>()->default_value(0.5),
28  "Minimum momentum for simulated particles in GeV");
29  opt("fatras-em-scattering", value<bool>()->default_value(true),
30  "Simulate multiple scattering of charged particles");
31  opt("fatras-em-ionisation", value<bool>()->default_value(true),
32  "Simulate ionisiation/excitation energy loss of charged particles");
33  opt("fatras-em-radiation", value<bool>()->default_value(true),
34  "Simulate radiative energy loss of charged particles");
35  opt("fatras-em-photonconversion", value<bool>()->default_value(true),
36  "Simulate electron-positron pair production by photon conversion");
37  opt("fatras-hits",
38  value<std::string>()
39  ->value_name("none|sensitive|material|all")
40  ->default_value("sensitive"),
41  "Which surfaces should record charged particle hits");
42 }
43 
45  const Options::Variables& vars) {
46  using namespace Acts::UnitLiterals;
47 
49 
50  cfg.pMin = vars["fatras-pmin-gev"].as<double>() * 1_GeV;
51 
52  cfg.emScattering = vars["fatras-em-scattering"].as<bool>();
53  cfg.emEnergyLossIonisation = vars["fatras-em-ionisation"].as<bool>();
54  cfg.emEnergyLossRadiation = vars["fatras-em-radiation"].as<bool>();
55  cfg.emPhotonConversion = vars["fatras-em-photonconversion"].as<bool>();
56 
57  // select hit surfaces for charged particles
58  const std::string hits = vars["fatras-hits"].as<std::string>();
59  if (hits == "sensitive") {
60  cfg.generateHitsOnSensitive = true;
61  cfg.generateHitsOnMaterial = false;
62  cfg.generateHitsOnPassive = false;
63  } else if (hits == "material") {
64  cfg.generateHitsOnSensitive = false;
65  cfg.generateHitsOnMaterial = true;
66  cfg.generateHitsOnPassive = false;
67  } else if (hits == "all") {
68  cfg.generateHitsOnSensitive = true;
69  cfg.generateHitsOnMaterial = true;
70  cfg.generateHitsOnPassive = true;
71  } else {
72  throw std::runtime_error("Invalid Fatras hits selection '" + hits + "'");
73  }
74 
75  return cfg;
76 }
77 
78 } // namespace Options
79 } // namespace ActsExamples