File indexing completed on 2026-07-26 08:22:14
0001
0002
0003
0004
0005
0006
0007
0008 #include "traccc/options/truth_finding.hpp"
0009
0010 #include <format>
0011
0012 #include "traccc/definitions/common.hpp"
0013 #include "traccc/examples/utils/printable.hpp"
0014
0015 namespace traccc::opts {
0016
0017 truth_finding::truth_finding() : interface("Truth Track Finding Options") {
0018 m_desc.add_options()(
0019 "truth-finding-min-pt",
0020 boost::program_options::value(&m_pT_min)->default_value(m_pT_min),
0021 "Candidate particle pT cut [GeV]");
0022 m_desc.add_options()(
0023 "truth-finding-min-z",
0024 boost::program_options::value(&m_z_min)->default_value(m_z_min),
0025 "Candidate particle min z cut [mm]");
0026 m_desc.add_options()(
0027 "truth-finding-max-z",
0028 boost::program_options::value(&m_z_max)->default_value(m_z_max),
0029 "Candidate particle max z cut [mm]");
0030 m_desc.add_options()(
0031 "truth-finding-max-r",
0032 boost::program_options::value(&m_r_max)->default_value(m_r_max),
0033 "Candidate particle max r cut [mm]");
0034 m_desc.add_options()(
0035 "truth-finding-max-eta",
0036 boost::program_options::value(&m_eta_max)->default_value(m_eta_max),
0037 "Candidate particle max eta cut");
0038 m_desc.add_options()(
0039 "truth-finding-process-id",
0040 boost::program_options::value(&m_process_id)->default_value(m_process_id),
0041 "Candidate particle is from a selected process");
0042 m_desc.add_options()("truth-finding-min-track-candidates",
0043 boost::program_options::value(&m_min_track_candidates)
0044 ->default_value(m_min_track_candidates),
0045 "Minimum track candidates on track");
0046 }
0047
0048 void truth_finding::read(const boost::program_options::variables_map &) {
0049 m_pT_min *= unit<float>::GeV;
0050 m_z_min *= unit<float>::mm;
0051 m_z_max *= unit<float>::mm;
0052 m_r_max *= unit<float>::mm;
0053 }
0054
0055 truth_finding::operator truth_matching_config() const {
0056 return truth_matching_config{.pT_min = m_pT_min,
0057 .z_min = m_z_min,
0058 .z_max = m_z_max,
0059 .r_max = m_r_max,
0060 .eta_max = m_eta_max,
0061 .process_id = m_process_id,
0062 .min_track_candidates = m_min_track_candidates};
0063 }
0064
0065 std::unique_ptr<configuration_printable> truth_finding::as_printable() const {
0066 auto cat = std::make_unique<configuration_category>(m_description);
0067
0068 cat->add_child(std::make_unique<configuration_kv_pair>(
0069 "Minimum pT", std::format("{} GeV", m_pT_min / unit<float>::GeV)));
0070 cat->add_child(std::make_unique<configuration_kv_pair>(
0071 "Minimum z", std::format("{} mm", m_z_min / unit<float>::mm)));
0072 cat->add_child(std::make_unique<configuration_kv_pair>(
0073 "Maximum z", std::format("{} mm", m_z_max / unit<float>::mm)));
0074 cat->add_child(std::make_unique<configuration_kv_pair>(
0075 "Maximum r", std::format("{} mm", m_r_max / unit<float>::mm)));
0076 cat->add_child(std::make_unique<configuration_kv_pair>(
0077 "Maximum eta", std::format("{}", m_eta_max)));
0078 cat->add_child(std::make_unique<configuration_kv_pair>(
0079 "Process ID", std::format("{}", m_process_id)));
0080 cat->add_child(std::make_unique<configuration_kv_pair>(
0081 "Minimum track candidates", std::format("{}", m_min_track_candidates)));
0082
0083 return cat;
0084 }
0085 }