Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-10-22 07:52:52

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