Back to home page

EIC code displayed by LXR

 
 

    


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

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 // Project include(s)
0010 #include "detray/core/detector.hpp"
0011 
0012 // Detray plugin include(s)
0013 #include "detray/plugins/svgtools/illustrator.hpp"
0014 #include "detray/plugins/svgtools/writer.hpp"
0015 
0016 // Detray test include(s)
0017 #include "detray/test/common/build_toy_detector.hpp"
0018 #include "detray/test/framework/types.hpp"
0019 
0020 // Vecmem include(s)
0021 #include <vecmem/memory/host_memory_resource.hpp>
0022 
0023 // Actsvg include(s)
0024 #include <actsvg/core.hpp>
0025 
0026 // GTest include(s).
0027 #include <gtest/gtest.h>
0028 
0029 // System include(s)
0030 #include <string>
0031 
0032 GTEST_TEST(svgtools, landmarks) {
0033   // Axes.
0034   const auto axes =
0035       actsvg::draw::x_y_axes("axes", {-250, 250}, {-250, 250},
0036                              actsvg::style::stroke(), "axis1", "axis2");
0037 
0038   // Creating the view.
0039   const actsvg::views::x_y xy;
0040   const actsvg::views::z_r zr;
0041 
0042   // Creating the detector and geomentry context.
0043   vecmem::host_memory_resource host_mr;
0044   const auto [det, names] =
0045       detray::build_toy_detector<detray::test::algebra>(host_mr);
0046   using detector_t = decltype(det);
0047 
0048   using point = typename detector_t::point3_type;
0049 
0050   // Creating the illustrator class.
0051   const detray::svgtools::illustrator il{det, names};
0052 
0053   // Sometimes its useful to be able to just draw a point while debugging.
0054   // For this the draw_landmark function is available.
0055   const point test_point{100, 50, 20};
0056 
0057   const auto svg_xy = il.draw_landmark("landmark", test_point, xy);
0058   const auto svg_zr = il.draw_landmark("landmark", test_point, zr);
0059   detray::svgtools::write_svg("test_svgtools_landmark.svg",
0060                               {svg_xy, svg_zr, axes});
0061 }