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/SurfaceSvgConverter.hpp"
0014 #include "Acts/Plugins/ActSVG/SvgUtils.hpp"
0015 #include "Acts/Utilities/BinningType.hpp"
0016 #include "actsvg/core.hpp"
0017 #include "actsvg/meta.hpp"
0018 
0019 #include <map>
0020 #include <memory>
0021 #include <tuple>
0022 
0023 namespace Acts {
0024 
0025 class Surface;
0026 
0027 namespace Experimental {
0028 class Portal;
0029 class DetectorVolume;
0030 }  // namespace Experimental
0031 
0032 namespace Svg {
0033 
0034 using ProtoPortal = actsvg::proto::portal<std::vector<Vector3>>;
0035 using ProtoLink = ProtoPortal::link;
0036 
0037 namespace PortalConverter {
0038 
0039 /// @brief Nested Options struct for conversion options
0040 struct Options {
0041   /// The conversion options for the surface part
0042   SurfaceConverter::Options surfaceOptions;
0043   /// Link length
0044   double linkLength = 10.;
0045   /// Link index map
0046   std::map<const Experimental::DetectorVolume*, unsigned int> volumeIndices;
0047 };
0048 
0049 /// Convert into a ProtoPortal
0050 ///
0051 /// @param gtcx is the geometry context of the conversion call
0052 /// @param portal is the detector portal to convert
0053 /// @param portalOptions is the conversion options struct
0054 ///
0055 /// @return a proto portal object
0056 ProtoPortal convert(const GeometryContext& gctx,
0057                     const Experimental::Portal& portal,
0058                     const PortalConverter::Options& portalOptions);
0059 
0060 }  // namespace PortalConverter
0061 
0062 namespace View {
0063 
0064 /// Convert into an acts::svg::object with an XY view
0065 ///
0066 /// @param portal is the DetectorVolume portal (proto representation)
0067 /// @param identification is the to be translated id_ for actsvg
0068 ///
0069 /// @return an svg object that can be written out directly to disc
0070 static inline actsvg::svg::object xy(const ProtoPortal& portal,
0071                                      const std::string& identification) {
0072   actsvg::views::x_y xyView;
0073   return actsvg::display::portal(identification, portal, xyView);
0074 }
0075 
0076 /// Convert into an acts::svg::object with an Zr view
0077 ///
0078 /// @param portal is the DetectorVolume portal (proto representation)
0079 /// @param identification is the to be translated id_ for actsvg
0080 ///
0081 /// @return an svg object that can be written out directly to disc
0082 static inline actsvg::svg::object zr(const ProtoPortal& portal,
0083                                      const std::string& identification) {
0084   actsvg::views::z_r zrView;
0085   return actsvg::display::portal(identification, portal, zrView);
0086 }
0087 
0088 }  // namespace View
0089 
0090 }  // namespace Svg
0091 
0092 }  // namespace Acts