ACTS
Experiment-independent tracking
Loading...
Searching...
No Matches
link.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/core/concepts.hpp"
13#include "detray/geometry/surface.hpp"
14
15// Plugin include(s)
16#include "detray/plugins/svgtools/utils/link_utils.hpp"
17#include "detray/plugins/svgtools/utils/surface_kernels.hpp"
18
19// Actsvg includes(s)
20#include "actsvg/proto/portal.hpp"
21
22// System include(s)
23#include <vector>
24
25namespace detray::svgtools::conversion {
26
28template <concepts::detector detector_t>
29inline auto links(const typename detector_t::geometry_context& context,
30 const detector_t& detector,
31 const detray::geometry::surface<detector_t>& d_portal) {
32 using point3_container_t = std::vector<typename detector_t::point3_type>;
33 using p_link_t = typename actsvg::proto::portal<point3_container_t>::link;
34
35 std::vector<p_link_t> pt_links{};
36 typename detector_t::vector3_type dir{};
37
38 // Length of link arrow is currently hardcoded.
39 constexpr double link_length = 4.;
40
41 for (std::size_t i = 0u; i < d_portal.n_masks(); ++i) {
42 const auto [start, end] = svgtools::utils::link_points(
43 context, detector, d_portal, dir, link_length, i);
44
45 p_link_t p_link;
46 p_link._start = start;
47 p_link._end = end;
48 pt_links.push_back(p_link);
49 }
50
51 return pt_links;
52}
53
54} // namespace detray::svgtools::conversion
std::size_t n_masks() const
Definition surface.hpp:186