Back to home page

EIC code displayed by LXR

 
 

    


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

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 // Detray plugin include(s)
0012 #include "detray/plugins/svgtools/styling/styling.hpp"
0013 
0014 // Detray test include(s)
0015 #include "detray/test/framework/test_configuration.hpp"
0016 
0017 // System include(s)
0018 #include <limits>
0019 #include <memory>
0020 #include <string>
0021 
0022 namespace detray::test {
0023 
0024 /// @brief Configuration for a detector scan test.
0025 template <typename track_generator_t, concepts::algebra algebra_t>
0026 struct detector_scan_config
0027     : public detray::test::configuration<dscalar<algebra_t>> {
0028   using scalar_type = dscalar<algebra_t>;
0029   using vector3_type = dvector3D<algebra_t>;
0030   using base_type = detray::test::configuration<scalar_type>;
0031   using trk_gen_config_t = typename track_generator_t::configuration;
0032 
0033   /// Name of the test
0034   std::string m_name{"detector_scan"};
0035   /// Name of the input file, containing the complete ray scan traces
0036   std::string m_intersection_file{"truth_intersections"};
0037   std::string m_track_param_file{"truth_trk_parameters"};
0038   /// Mask tolerance for the intersectors
0039   scalar_type m_mask_tol{std::numeric_limits<scalar_type>::epsilon()};
0040   /// B-field vector for helix
0041   vector3_type m_B{0.f * unit<scalar_type>::T, 0.f * unit<scalar_type>::T,
0042                    2.f * unit<scalar_type>::T};
0043   /// Configuration of the ray generator
0044   trk_gen_config_t m_trk_gen_cfg{};
0045   /// Perform overlaps removal (needed for detector converted from ACTS)
0046   bool m_overlaps_removal{true};
0047   /// Tolerance for overlaps
0048   float m_overlaps_tol{1e-4f * unit<float>::mm};
0049   /// Write intersection points for plotting
0050   bool m_write_inters{false};
0051   /// Visualization style to be applied to the svgs
0052   detray::svgtools::styling::style m_style =
0053       detray::svgtools::styling::tableau_colorblind::style;
0054 
0055   /// Getters
0056   /// @{
0057   const std::string &name() const { return m_name; }
0058   const std::string &intersection_file() const { return m_intersection_file; }
0059   const std::string &track_param_file() const { return m_track_param_file; }
0060   scalar_type mask_tolerance() const { return m_mask_tol; }
0061   const vector3_type &B_vector() { return m_B; }
0062   bool write_intersections() const { return m_write_inters; }
0063   trk_gen_config_t &track_generator() { return m_trk_gen_cfg; }
0064   const trk_gen_config_t &track_generator() const { return m_trk_gen_cfg; }
0065   bool overlaps_removal() const { return m_overlaps_removal; }
0066   float overlaps_tol() const { return m_overlaps_tol; }
0067   const auto &svg_style() const { return m_style; }
0068   /// @}
0069 
0070   /// Setters
0071   /// @{
0072   detector_scan_config &name(const std::string_view n) {
0073     m_name = n;
0074     return *this;
0075   }
0076   detector_scan_config &intersection_file(const std::string_view f) {
0077     m_intersection_file = f;
0078     return *this;
0079   }
0080   detector_scan_config &track_param_file(const std::string_view f) {
0081     m_track_param_file = f;
0082     return *this;
0083   }
0084   detector_scan_config &mask_tolerance(const scalar_type tol) {
0085     m_mask_tol = tol;
0086     return *this;
0087   }
0088   detector_scan_config &B_vector(const vector3_type &B) {
0089     m_B = B;
0090     return *this;
0091   }
0092   detector_scan_config &B_vector(const scalar_type B0, const scalar_type B1,
0093                                  const scalar_type B2) {
0094     m_B = vector3_type{B0, B1, B2};
0095     return *this;
0096   }
0097   detector_scan_config &overlaps_removal(const bool o) {
0098     m_overlaps_removal = o;
0099     return *this;
0100   }
0101   detector_scan_config &overlaps_tol(const scalar_type tol) {
0102     m_overlaps_tol = static_cast<float>(tol);
0103     return *this;
0104   }
0105   detector_scan_config &write_intersections(const bool do_write) {
0106     m_write_inters = do_write;
0107     return *this;
0108   }
0109   /// @}
0110 };
0111 
0112 }  // namespace detray::test