ACTS
Experiment-independent tracking
Loading...
Searching...
No Matches
intersector.hpp
1// This file is part of the ACTS project.
2//
3// Copyright (C) 2016 CERN for the benefit of the ACTS project
4//
5// This Source Code Form is subject to the terms of the Mozilla Public
6// License, v. 2.0. If a copy of the MPL was not distributed with this
7// file, You can obtain one at https://mozilla.org/MPL/2.0/.
8
9#pragma once
10
11// Project include(s)
12#include "detray/definitions/algebra.hpp"
13#include "detray/geometry/concepts.hpp"
14#include "detray/navigation/intersection/helix_intersector.hpp"
15#include "detray/navigation/intersection/intersection_config.hpp"
16#include "detray/navigation/intersection/ray_intersector.hpp"
17
18namespace detray {
19
23template <typename shape_t, concepts::algebra algebra_t,
24 bool resolve_pos = false>
27 using algebra_type = algebra_t;
32
35
38
39 // Test with int as dummy surface descriptor type
40 static_assert(
41 std::same_as<
42 typename ray_intersector_type::template intersection_type<int>,
43 typename helix_intersector_type::template intersection_type<int>>);
44
45 // Maximum number of solutions this intersector can produce
49
50 // Take the helix intersector result type, as it needs more data
53
62 template <typename S = shape_t>
64 DETRAY_HOST_DEVICE constexpr result_type point_of_intersection(
65 const detail::ray<algebra_t> &ray, const transform3_type &trf,
66 const scalar_type overstep_tol = 0.f) const {
67 return to_result_type(
68 ray_intersector_type{}.point_of_intersection(ray, trf, overstep_tol));
69 }
70
77 template <typename mask_t, typename S = shape_t>
79 DETRAY_HOST_DEVICE constexpr result_type point_of_intersection(
80 const detail::ray<algebra_t> &ray, const transform3_type &trf,
81 const mask_t &mask, const scalar_type overstep_tol = 0.f) const {
82 return to_result_type(ray_intersector_type{}.point_of_intersection(
83 ray, trf, mask, overstep_tol));
84 }
85
90 template <typename S = shape_t>
92 DETRAY_HOST_DEVICE constexpr result_type point_of_intersection(
93 const detail::helix<algebra_t> &h, const transform3_type &trf,
94 const scalar_type /*overstep_tol*/ = 0.f) const {
95 return helix_intersector_type{}.point_of_intersection(h, trf);
96 }
97
103 template <typename mask_t, typename S = shape_t>
105 DETRAY_HOST_DEVICE constexpr result_type point_of_intersection(
106 const detail::helix<algebra_t> &h, const transform3_type &trf,
107 const mask_t &mask, const scalar_type /*overstep_tol*/ = 0.f) const {
108 return helix_intersector_type{}.point_of_intersection(h, trf, mask);
109 }
110
111
120 template <typename surface_descr_t, typename mask_t>
121 DETRAY_HOST_DEVICE inline decltype(auto) operator()(
122 const detail::ray<algebra_t> &ray, const surface_descr_t &sf,
123 const mask_t &mask, const transform3_type &trf,
124 const intersection::config &cfg = {},
125 const scalar_type external_mask_tol = 0.f) const {
126 return ray_intersector_type{}(ray, sf, mask, trf, cfg, external_mask_tol);
127 }
128
136 template <typename surface_descr_t, typename mask_t>
137 DETRAY_HOST_DEVICE inline decltype(auto) operator()(
138 const detail::helix<algebra_t> &h, const surface_descr_t &sf,
139 const mask_t &mask, const transform3_type &trf,
140 const intersection::config &cfg = {},
141 const scalar_type /*unused*/ = 0.f) const {
142 return helix_intersector_type{}(h, sf, mask, trf, cfg);
143 }
144
145 private:
147 DETRAY_HOST_DEVICE
148 constexpr result_type to_result_type(
149 const ray_intersector_type::result_type &ray_results) const {
150 result_type result;
151 if constexpr (n_solutions > 1) {
152 for (std::size_t i = 0u; i < n_solutions; ++i) {
153 result[i] = typename result_type::value_type{ray_results[i]};
154 }
155 } else {
156 result = result_type{ray_results};
157 }
158 return result;
159 }
160};
161
162} // namespace detray
describes a helical trajectory in a given B-field.
Definition helix.hpp:33
describes a straight-line trajectory
Definition ray.hpp:22
Mask a region on a surface and link it to a volume.
Definition mask.hpp:46
Algebra plugin concept.
Definition concepts.hpp:147
Definition concepts.hpp:158
Detray include(s).
Definition array_operators.hpp:18
get_scalar_t< A, T > dscalar
Scalar type for algebra A and value type T.
Definition algebra.hpp:64
intersector_base< ray_intersector_impl< typename shape_t::template local_frame_type< algebra_t >, algebra_t, resolve_pos > > ray_intersector
Select the ray intersector specialization for a shape's local frame.
Definition ray_intersector.hpp:36
intersector_base< helix_intersector_impl< typename shape_t::template local_frame_type< algebra_t >, algebra_t > > helix_intersector
Select the helix intersector specialization for a shape's local frame.
Definition helix_intersector.hpp:33
get_transform3D_t< A, T > dtransform3D
Three-dimensional transform type for algebra A and value type T.
Definition algebra.hpp:84
Intersector configuration.
Definition intersection_config.hpp:21
typename helix_intersector_impl< typename shape_t::template local_frame_type< algebra_t >, algebra_t >::result_type result_type
Definition intersector_base.hpp:65
Intersection interface for detector surfaces.
Definition intersector.hpp:25
helix_intersector< shape_t, algebra_t > helix_intersector_type
How to intersect surfaces with helices.
Definition intersector.hpp:37
typename helix_intersector_type::result_type result_type
Common result representation, which accommodates helix error estimates.
Definition intersector.hpp:52
constexpr result_type point_of_intersection(const detail::ray< algebra_t > &ray, const transform3_type &trf, const scalar_type overstep_tol=0.f) const
Operator function to find intersections between ray and planar mask.
Definition intersector.hpp:64
dtransform3D< algebra_t > transform3_type
Transform type used to place surfaces in 3D.
Definition intersector.hpp:31
static constexpr std::uint8_t n_solutions
Largest number of solutions produced by either trajectory intersector.
Definition intersector.hpp:47
dscalar< algebra_t > scalar_type
Scalar type associated with the algebra policy.
Definition intersector.hpp:29
constexpr result_type point_of_intersection(const detail::ray< algebra_t > &ray, const transform3_type &trf, const mask_t &mask, const scalar_type overstep_tol=0.f) const
Intersect a ray with a cylindrical surface using its radius mask.
Definition intersector.hpp:79
algebra_t algebra_type
Algebra policy used by the intersection calculations.
Definition intersector.hpp:27
constexpr result_type point_of_intersection(const detail::helix< algebra_t > &h, const transform3_type &trf, const mask_t &mask, const scalar_type=0.f) const
Intersect a helix with a cylindrical surface using its radius mask.
Definition intersector.hpp:105
constexpr result_type point_of_intersection(const detail::helix< algebra_t > &h, const transform3_type &trf, const scalar_type=0.f) const
Intersect a helix with a planar or line surface.
Definition intersector.hpp:92
ray_intersector< shape_t, algebra_t, resolve_pos > ray_intersector_type
How to intersect surfaces with rays.
Definition intersector.hpp:34