ACTS
Experiment-independent tracking
Loading...
Searching...
No Matches
information_section.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// Detray plugins include(s)
16#include "detray/plugins/svgtools/meta/proto/information_section.hpp"
17
18// Actsvg include(s)
19#include "actsvg/core.hpp"
20#include "actsvg/meta.hpp"
21
22// System include(s)
23#include <array>
24#include <iomanip>
25#include <sstream>
26#include <string>
27
28namespace detray::svgtools::conversion {
29
31template <concepts::point3D point3_t>
32inline std::string point_to_string(point3_t point) {
33 std::stringstream stream;
34 stream << std::fixed << std::setprecision(2) << "(" << point[0] << ", "
35 << point[1] << ", " << point[2] << ")";
36 return stream.str();
37}
38
40template <concepts::detector detector_t>
41inline auto information_section(
42 const typename detector_t::geometry_context& context,
43 const detray::geometry::surface<detector_t>& d_surface) {
44 using point3_t = typename detector_t::point3_type;
45
46 svgtools::meta::proto::information_section<point3_t> is;
47 is._title = d_surface.is_portal() ? "Portal" : "Surface";
48 const auto position =
49 d_surface.transform(context).point_to_global(d_surface.centroid());
50
51 is._info = {"Idx: " + std::to_string(d_surface.index()),
52 point_to_string(position)};
53 is._position = position;
54
55 return is;
56}
57
58} // namespace detray::svgtools::conversion
constexpr auto is_portal() const -> bool
Definition surface.hpp:158
constexpr auto centroid() const -> point3_type
Definition surface.hpp:221
constexpr auto transform(const context &ctx) const -> const transform3_type &
Definition surface.hpp:197
constexpr auto index() const -> dindex
Definition surface.hpp:124
actsvg::svg::object point(const Acts::Vector3 &pos, double size, const Style &style, unsigned int idx)
Write/create a 3D point in a given view.
Definition EventDataSvgConverter.hpp:56