Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-12-11 09:40:21

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 #pragma once
0010 
0011 #include "Acts/Definitions/Algebra.hpp"
0012 #include "Acts/Geometry/GeometryContext.hpp"
0013 #include "ActsPlugins/ActSVG/SvgUtils.hpp"
0014 #include <actsvg/core.hpp>
0015 #include <actsvg/meta.hpp>
0016 
0017 namespace Acts {
0018 
0019 class Surface;
0020 }  // namespace Acts
0021 
0022 namespace ActsPlugins::Svg {
0023 
0024 using ProtoSurface = actsvg::proto::surface<std::vector<Acts::Vector3>>;
0025 
0026 namespace SurfaceConverter {
0027 
0028 /// Nested Options struct
0029 struct Options {
0030   /// A The style for the surfaces
0031   Style style = defaultSensitiveStyle;
0032   /// Indicate if you want to draw this as a template surface
0033   bool templateSurface = false;
0034 };
0035 
0036 /// Convert into a svg::proto surface
0037 ///
0038 /// @param gtcx is the geometry context of the conversion call
0039 /// @param surface is the surface to convert
0040 /// @param cOption is the conversion options struct
0041 ///
0042 /// @return a proto surface object
0043 ProtoSurface convert(const Acts::GeometryContext& gctx,
0044                      const Acts::Surface& surface,
0045                      const SurfaceConverter::Options& cOptions);
0046 
0047 }  // namespace SurfaceConverter
0048 
0049 namespace View {
0050 
0051 /// Convert into an ActsPlugins::Svg::object with an x-y view
0052 ///
0053 /// @param pSurface is the proto object
0054 /// @param identification is the to be translated id_ for actsvg
0055 ///
0056 /// @return an svg object that can be written out directly to disc
0057 static inline actsvg::svg::object xy(const ProtoSurface& pSurface,
0058                                      const std::string& identification) {
0059   actsvg::views::x_y xyView;
0060   return actsvg::display::surface(identification, pSurface, xyView);
0061 }
0062 
0063 /// Convert into an ActsPlugins::Svg::object with an z-r view
0064 ///
0065 /// @param pSurface is the proto object
0066 /// @param identification is the to be translated id_ for actsvg
0067 ///
0068 /// @return an svg object that can be written out directly to disc
0069 static inline actsvg::svg::object zr(const ProtoSurface& pSurface,
0070                                      const std::string& identification) {
0071   actsvg::views::z_r zrView;
0072   return actsvg::display::surface(identification, pSurface, zrView);
0073 }
0074 
0075 /// Convert into an ActsPlugins::Svg::object with an z-phi view
0076 ///
0077 /// @param pSurface is the proto object
0078 /// @param identification is the to be translated id_ for actsvg
0079 ///
0080 /// @return an svg object that can be written out directly to disc
0081 static inline actsvg::svg::object zphi(const ProtoSurface& pSurface,
0082                                        const std::string& identification) {
0083   actsvg::views::z_phi zphiView;
0084   return actsvg::display::surface(identification, pSurface, zphiView);
0085 }
0086 
0087 /// Convert into an ActsPlugins::Svg::object with an z-rphi view
0088 ///
0089 /// @param pSurface is the proto object
0090 /// @param identification is the to be translated id_ for actsvg
0091 ///
0092 /// @note it captures the radii[0u] element for plotting
0093 ///
0094 /// @return an svg object that can be written out directly to disc
0095 static inline actsvg::svg::object zrphi(const ProtoSurface& pSurface,
0096                                         const std::string& identification) {
0097   actsvg::views::z_rphi zrphiView;
0098   zrphiView._fixed_r = pSurface._radii[0u];
0099   return actsvg::display::surface(identification, pSurface, zrphiView);
0100 }
0101 
0102 }  // namespace View
0103 
0104 namespace Sheet {
0105 
0106 /// Convert into an ActsPlugins::Svg::object with an XY sheet
0107 ///
0108 /// @param pSurface is the proto object
0109 /// @param identification is the to be translated id_ for actsvg
0110 ///
0111 /// @return an svg object that can be written out directly to disc
0112 static inline actsvg::svg::object xy(const ProtoSurface& pSurface,
0113                                      const std::string& identification) {
0114   return actsvg::display::surface_sheet_xy(identification, pSurface);
0115 }
0116 
0117 }  // namespace Sheet
0118 
0119 }  // namespace ActsPlugins::Svg