Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-05-27 07:24:15

0001 // This file is part of the ACTS project.
0002 //
0003 // Copyright (C) 2016 CERN for the benefit of the ACTS project
0004 //
0005 // This Source Code Form is subject to the terms of the Mozilla Public
0006 // License, v. 2.0. If a copy of the MPL was not distributed with this
0007 // file, You can obtain one at https://mozilla.org/MPL/2.0/.
0008 
0009 #pragma once
0010 
0011 // Project include(s)
0012 #include "detray/definitions/pdg_particle.hpp"
0013 
0014 // detray plugin include(s)
0015 #include "detray/plugins/svgtools/styling/styling.hpp"
0016 
0017 // Detray test include(s)
0018 #include "detray/test/framework/test_configuration.hpp"
0019 
0020 // System include(s)
0021 #include <limits>
0022 #include <memory>
0023 #include <string>
0024 
0025 namespace detray::test {
0026 
0027 /// @brief Configuration for a detector scan test.
0028 template <concepts::algebra algebra_t>
0029 struct navigation_validation_config
0030     : public detray::test::configuration<dscalar<algebra_t>> {
0031   using scalar_type = dscalar<algebra_t>;
0032   using vector3_type = dvector3D<algebra_t>;
0033   using base_type = detray::test::configuration<scalar_type>;
0034 
0035   /// Name of the test
0036   std::string m_name{"navigation_validation"};
0037   /// Name of the input file, containing the complete ray scan traces
0038   std::string m_intersection_file{"truth_intersections.csv"};
0039   std::string m_track_param_file{"truth_trk_parameters.csv"};
0040   /// The maximum number of test tracks to run
0041   std::size_t m_n_tracks{detray::detail::invalid_value<std::size_t>()};
0042   /// Particle hypothesis (truth particle from simulation)
0043   pdg_particle<scalar_type> m_ptc_hypo{muon<scalar_type>()};
0044   /// Navigation direction
0045   navigation::direction m_nav_dir{navigation::direction::e_forward};
0046   /// Collect only the sensitive intersections for comparison
0047   bool m_collect_sensitives_only{false};
0048   /// Drop an SVG only if navigation missed a surface
0049   bool m_display_only_missed{false};
0050   /// Whether to stop execution at the first error
0051   bool m_fail_on_diff{true};
0052   /// Verbosity of the console output
0053   bool m_verbose{true};
0054   /// Configured momentum range of the test sample (only needed to generate
0055   /// correct file names). If none was passed, it will be determined from
0056   /// the track data (imprecise!)
0057   darray<scalar_type, 2> m_p_range{
0058       detray::detail::invalid_value<scalar_type>(),
0059       detray::detail::invalid_value<scalar_type>()};
0060   /// B-field vector for helix
0061   vector3_type m_B{0.f * unit<scalar_type>::T, 0.f * unit<scalar_type>::T,
0062                    2.f * unit<scalar_type>::T};
0063   /// Visualization style to be applied to the SVGs
0064   detray::svgtools::styling::style m_style =
0065       detray::svgtools::styling::tableau_colorblind::style;
0066 
0067   /// Getters
0068   /// @{
0069   const std::string &name() const { return m_name; }
0070   const std::string &intersection_file() const { return m_intersection_file; }
0071   const std::string &track_param_file() const { return m_track_param_file; }
0072   std::size_t n_tracks() const { return m_n_tracks; }
0073   pdg_particle<scalar_type> ptc_hypothesis() const { return m_ptc_hypo; }
0074   navigation::direction navigation_direction() const { return m_nav_dir; }
0075   bool collect_sensitives_only() const { return m_collect_sensitives_only; }
0076   bool display_only_missed() const { return m_display_only_missed; }
0077   bool fail_on_diff() const { return m_fail_on_diff; }
0078   bool verbose() const { return m_verbose; }
0079   darray<scalar_type, 2> p_range() const { return m_p_range; }
0080   const vector3_type &B_vector() const { return m_B; }
0081   const auto &svg_style() const { return m_style; }
0082   /// @}
0083 
0084   /// Setters
0085   /// @{
0086   navigation_validation_config &name(const std::string &n) {
0087     m_name = n;
0088     return *this;
0089   }
0090   navigation_validation_config &intersection_file(const std::string &f) {
0091     m_intersection_file = f;
0092     return *this;
0093   }
0094   navigation_validation_config &track_param_file(const std::string &f) {
0095     m_track_param_file = f;
0096     return *this;
0097   }
0098   navigation_validation_config &ptc_hypothesis(
0099       pdg_particle<scalar_type> pdg_ptc) {
0100     m_ptc_hypo = pdg_ptc;
0101     return *this;
0102   }
0103   navigation_validation_config &navigation_direction(
0104       const navigation::direction dir) {
0105     m_nav_dir = dir;
0106     return *this;
0107   }
0108   navigation_validation_config &collect_sensitives_only(
0109       const bool only_sensitives) {
0110     m_collect_sensitives_only = only_sensitives;
0111     return *this;
0112   }
0113   navigation_validation_config &display_only_missed(const bool only_missed) {
0114     m_display_only_missed = only_missed;
0115     return *this;
0116   }
0117   navigation_validation_config &fail_on_diff(const bool fail_on_diff) {
0118     m_fail_on_diff = fail_on_diff;
0119     return *this;
0120   }
0121   navigation_validation_config &verbose(const bool v) {
0122     m_verbose = v;
0123     return *this;
0124   }
0125   navigation_validation_config &n_tracks(std::size_t n) {
0126     m_n_tracks = n;
0127     return *this;
0128   }
0129   navigation_validation_config &p_range(const darray<scalar_type, 2> pr) {
0130     m_p_range = pr;
0131     return *this;
0132   }
0133   navigation_validation_config &B_vector(const vector3_type &B) {
0134     m_B = B;
0135     return *this;
0136   }
0137   navigation_validation_config &B_vector(const scalar_type B0,
0138                                          const scalar_type B1,
0139                                          const scalar_type B2) {
0140     m_B = vector3_type{B0, B1, B2};
0141     return *this;
0142   }
0143   /// @}
0144 };
0145 
0146 }  // namespace detray::test