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 <array>
0031 #include <string>
0032 
0033 GTEST_TEST(svgtools, detector) {
0034   actsvg::style::stroke stroke_black = actsvg::style::stroke();
0035   // x-y axis.
0036   auto xy_axis = actsvg::draw::x_y_axes("axes", {-250, 250}, {-250, 250},
0037                                         stroke_black, "x", "y");
0038   // z-r axis.
0039   auto zr_axis = actsvg::draw::x_y_axes("axes", {-250, 250}, {-250, 250},
0040                                         stroke_black, "z", "r");
0041 
0042   // Creating the views.
0043   const actsvg::views::x_y xy;
0044   const actsvg::views::z_r zr;
0045 
0046   // Creating the detector and geomentry context.
0047   vecmem::host_memory_resource host_mr;
0048   const auto [det, names] =
0049       detray::build_toy_detector<detray::test::algebra>(host_mr);
0050 
0051   // Creating the svg generator for the detector.
0052   detray::svgtools::illustrator il{det, names};
0053   il.show_info(true);
0054 
0055   // Get the svg of the toy detetector in x-y view.
0056   const auto svg_xy = il.draw_detector(xy);
0057   // Write the svg of toy detector.
0058   detray::svgtools::write_svg("test_svgtools_detector_xy", {xy_axis, svg_xy});
0059 
0060   // Get the svg of the toy detetector in z-r view.
0061   const auto svg_zr = il.draw_detector(zr);
0062   // Write the svg of toy detector in z-r view
0063   detray::svgtools::write_svg("test_svgtools_detector_zr", {zr_axis, svg_zr});
0064 }