Back to home page

EIC code displayed by LXR

 
 

    


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

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/algebra.hpp"
0013 #include "detray/geometry/shapes/line.hpp"
0014 
0015 // Detray test include(s)
0016 #include "detray/options/options_handling.hpp"
0017 #include "detray/test/common/build_wire_chamber.hpp"
0018 
0019 // Boost
0020 #include "detray/options/boost_program_options.hpp"
0021 
0022 // System include(s)
0023 #include <string>
0024 
0025 namespace detray::options {
0026 
0027 namespace detail {
0028 
0029 /// Add options that are independent of the wire surface shape
0030 template <concepts::scalar scalar_t, typename wire_shape_t>
0031 void add_wire_chamber_options(
0032     boost::program_options::options_description &desc,
0033     const wire_chamber_config<scalar_t, wire_shape_t> &cfg) {
0034   desc.add_options()(
0035       "layers",
0036       boost::program_options::value<unsigned int>()->default_value(
0037           cfg.n_layers()),
0038       "number of layers")("half_z",
0039                           boost::program_options::value<float>()->default_value(
0040                               static_cast<float>(cfg.half_z())),
0041                           "half length z of the chamber [mm]")(
0042       "cell_size",
0043       boost::program_options::value<float>()->default_value(
0044           static_cast<float>(cfg.cell_size())),
0045       "half length of the wire cells/straw tubes [mm]")(
0046       "stereo_angle",
0047       boost::program_options::value<float>()->default_value(
0048           static_cast<float>(cfg.stereo_angle())),
0049       "abs. stereo angle [rad]")(
0050       "mat_radius",
0051       boost::program_options::value<float>()->default_value(
0052           static_cast<float>(cfg.mat_radius())),
0053       "radius of material rods [mm]");
0054 }
0055 
0056 /// Configure options that are independent of the wire surface shape
0057 template <concepts::scalar scalar_t, typename wire_shape_t>
0058 void configure_wire_chamber_options(
0059     const boost::program_options::variables_map &vm,
0060     wire_chamber_config<scalar_t, wire_shape_t> &cfg) {
0061   cfg.n_layers(vm["layers"].as<unsigned int>());
0062   cfg.half_z(vm["half_z"].as<float>());
0063   cfg.cell_size(vm["cell_size"].as<float>());
0064   cfg.stereo_angle(vm["stereo_angle"].as<float>());
0065   cfg.mat_radius(vm["mat_radius"].as<float>());
0066 }
0067 
0068 }  // namespace detail
0069 
0070 /// Add options for the wire chamber with wire cells
0071 /// @{
0072 template <>
0073 void add_options<wire_chamber_config<float, detray::line_square>>(
0074     boost::program_options::options_description &desc,
0075     const wire_chamber_config<float, detray::line_square> &cfg) {
0076   detail::add_wire_chamber_options(desc, cfg);
0077 }
0078 template <>
0079 void add_options<wire_chamber_config<double, detray::line_square>>(
0080     boost::program_options::options_description &desc,
0081     const wire_chamber_config<double, detray::line_square> &cfg) {
0082   detail::add_wire_chamber_options(desc, cfg);
0083 }
0084 /// @}
0085 
0086 /// Add options for the wire chamber with straw tubes
0087 /// @{
0088 template <>
0089 void add_options<wire_chamber_config<float, detray::line_circular>>(
0090     boost::program_options::options_description &desc,
0091     const wire_chamber_config<float, detray::line_circular> &cfg) {
0092   detail::add_wire_chamber_options(desc, cfg);
0093 }
0094 template <>
0095 void add_options<wire_chamber_config<double, detray::line_circular>>(
0096     boost::program_options::options_description &desc,
0097     const wire_chamber_config<double, detray::line_circular> &cfg) {
0098   detail::add_wire_chamber_options(desc, cfg);
0099 }
0100 /// @}
0101 
0102 /// Configure the detray wire chamber with wire cells
0103 /// @{
0104 template <>
0105 void configure_options<wire_chamber_config<float, detray::line_square>>(
0106     const boost::program_options::variables_map &vm,
0107     wire_chamber_config<float, detray::line_square> &cfg) {
0108   detail::configure_wire_chamber_options(vm, cfg);
0109 }
0110 template <>
0111 void configure_options<wire_chamber_config<double, detray::line_square>>(
0112     const boost::program_options::variables_map &vm,
0113     wire_chamber_config<double, detray::line_square> &cfg) {
0114   detail::configure_wire_chamber_options(vm, cfg);
0115 }
0116 /// @}
0117 
0118 /// Configure the detray wire chamber with straw tubes
0119 /// @{
0120 template <>
0121 void configure_options<wire_chamber_config<float, detray::line_circular>>(
0122     const boost::program_options::variables_map &vm,
0123     wire_chamber_config<float, detray::line_circular> &cfg) {
0124   detail::configure_wire_chamber_options(vm, cfg);
0125 }
0126 template <>
0127 void configure_options<wire_chamber_config<double, detray::line_circular>>(
0128     const boost::program_options::variables_map &vm,
0129     wire_chamber_config<double, detray::line_circular> &cfg) {
0130   detail::configure_wire_chamber_options(vm, cfg);
0131 }
0132 /// @}
0133 
0134 }  // namespace detray::options