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 // Detray test include(s)
0012 #include "detray/test/framework/test_configuration.hpp"
0013 
0014 // Vecmem include(s)
0015 #include <vecmem/memory/memory_resource.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 <concepts::algebra algebra_t>
0026 struct material_validation_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 
0032   /// Name of the test
0033   std::string m_name{"material_validation"};
0034   /// Vecmem memory resource for the device allocations
0035   vecmem::memory_resource *m_dev_mr{nullptr};
0036   /// Name of the output file, containing the complete ray material traces
0037   std::string m_material_file{"navigation_material_trace"};
0038   /// The maximal number of test tracks to run
0039   std::size_t m_n_tracks{detray::detail::invalid_value<std::size_t>()};
0040   /// Allowed relative discrepancy between truth and navigation material
0041   scalar_type m_rel_error{0.001f};
0042 
0043   /// Getters
0044   /// @{
0045   const std::string &name() const { return m_name; }
0046   vecmem::memory_resource *device_mr() const { return m_dev_mr; }
0047   const std::string &material_file() const { return m_material_file; }
0048   std::size_t n_tracks() const { return m_n_tracks; }
0049   scalar_type relative_error() const { return m_rel_error; }
0050   /// @}
0051 
0052   /// Setters
0053   /// @{
0054   material_validation_config &name(const std::string &n) {
0055     m_name = n;
0056     return *this;
0057   }
0058   material_validation_config &device_mr(vecmem::memory_resource *mr) {
0059     m_dev_mr = mr;
0060     return *this;
0061   }
0062   material_validation_config &material_file(const std::string &f) {
0063     m_material_file = f;
0064     return *this;
0065   }
0066   material_validation_config &n_tracks(std::size_t n) {
0067     m_n_tracks = n;
0068     return *this;
0069   }
0070   material_validation_config &relative_error(scalar_type re) {
0071     assert(re > 0.f);
0072     m_rel_error = re;
0073     return *this;
0074   }
0075   /// @}
0076 };
0077 
0078 }  // namespace detray::test