File indexing completed on 2026-05-27 07:23:59
0001
0002
0003
0004
0005
0006
0007
0008
0009 #pragma once
0010
0011
0012 #include "detray/definitions/algebra.hpp"
0013 #include "detray/definitions/detail/qualifiers.hpp"
0014 #include "detray/geometry/detail/tracking_surface_kernels.hpp"
0015 #include "detray/geometry/surface.hpp"
0016
0017
0018 #include <type_traits>
0019
0020 namespace detray {
0021
0022
0023 template <typename det_t>
0024 class tracking_surface : public geometry::surface<const det_t> {
0025
0026 using detector_t = std::add_const_t<det_t>;
0027
0028 using base_surface_t = geometry::surface<detector_t>;
0029
0030
0031 using kernels =
0032 detail::tracking_surface_kernels<typename detector_t::algebra_type>;
0033
0034 using free_param_vector_type = typename kernels::free_param_vector_type;
0035
0036 using bound_param_vector_type = typename kernels::bound_param_vector_type;
0037
0038 public:
0039 using algebra_type = typename base_surface_t::algebra_type;
0040 using scalar_type = typename base_surface_t::scalar_type;
0041 using point2_type = typename base_surface_t::point2_type;
0042 using point3_type = typename base_surface_t::point3_type;
0043 using vector3_type = typename base_surface_t::vector3_type;
0044 using transform3_type = typename base_surface_t::transform3_type;
0045 using context = typename base_surface_t::context;
0046
0047
0048 using base_surface_t::base_surface_t;
0049
0050
0051 DETRAY_HOST_DEVICE
0052 explicit constexpr tracking_surface(const base_surface_t sf)
0053 : base_surface_t(sf) {}
0054
0055
0056
0057 template <typename detector_type = detector_t>
0058 requires(!std::is_const_v<detector_type>)
0059
0060 DETRAY_HOST_DEVICE constexpr operator tracking_surface<const detector_type>()
0061 const {
0062 return tracking_surface<const detector_type>{this->m_detector,
0063 this->m_desc};
0064 }
0065
0066
0067 DETRAY_HOST_DEVICE
0068 constexpr auto free_to_bound_vector(
0069 const context &ctx, const free_param_vector_type &free_vec) const {
0070 return this->template visit_mask<typename kernels::free_to_bound_vector>(
0071 this->transform(ctx), free_vec);
0072 }
0073
0074
0075 DETRAY_HOST_DEVICE
0076 constexpr auto bound_to_free_vector(
0077 const context &ctx, const bound_param_vector_type &bound_vec) const {
0078 return this->template visit_mask<typename kernels::bound_to_free_vector>(
0079 this->transform(ctx), bound_vec);
0080 }
0081
0082
0083 DETRAY_HOST_DEVICE
0084 constexpr auto free_to_bound_jacobian(
0085 const context &ctx, const free_param_vector_type &free_vec) const {
0086 return this->template visit_mask<typename kernels::free_to_bound_jacobian>(
0087 this->transform(ctx), free_vec);
0088 }
0089
0090
0091 DETRAY_HOST_DEVICE
0092 constexpr auto bound_to_free_jacobian(
0093 const context &ctx, const bound_param_vector_type &bound_vec) const {
0094 return this->template visit_mask<typename kernels::bound_to_free_jacobian>(
0095 this->transform(ctx), bound_vec);
0096 }
0097
0098
0099 DETRAY_HOST_DEVICE
0100 constexpr auto path_correction(const context &ctx, const vector3_type &pos,
0101 const vector3_type &dir,
0102 const vector3_type &dtds,
0103 const scalar_type dqopds) const {
0104 return this->template visit_mask<typename kernels::path_correction>(
0105 this->transform(ctx), pos, dir, dtds, dqopds);
0106 }
0107
0108
0109 DETRAY_HOST_DEVICE
0110 constexpr auto free_to_path_derivative(const context &ctx,
0111 const vector3_type &pos,
0112 const vector3_type &dir,
0113 const vector3_type &dtds) const {
0114 return this->template visit_mask<typename kernels::free_to_path_derivative>(
0115 this->transform(ctx), pos, dir, dtds);
0116 }
0117 };
0118
0119 template <typename detector_t, typename descr_t>
0120 DETRAY_HOST_DEVICE tracking_surface(const detector_t &, const descr_t &)
0121 -> tracking_surface<detector_t>;
0122
0123 template <typename detector_t>
0124 DETRAY_HOST_DEVICE tracking_surface(const detector_t &,
0125 const geometry::identifier)
0126 -> tracking_surface<detector_t>;
0127
0128 template <typename detector_t>
0129 DETRAY_HOST_DEVICE tracking_surface(const geometry::surface<detector_t>)
0130 -> tracking_surface<detector_t>;
0131
0132 template <typename detector_t>
0133 DETRAY_HOST_DEVICE tracking_surface(const geometry::surface<const detector_t>)
0134 -> tracking_surface<detector_t>;
0135
0136 }