Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-11-23 09:33:26

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