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/Geometry/GeometryContext.hpp"
0012 #include "Acts/Geometry/GeometryHierarchyMap.hpp"
0013 #include "Acts/Plugins/ActSVG/IndexedSurfacesSvgConverter.hpp"
0014 #include "Acts/Plugins/ActSVG/PortalSvgConverter.hpp"
0015 #include "Acts/Plugins/ActSVG/SvgUtils.hpp"
0016 #include <actsvg/core.hpp>
0017 #include <actsvg/meta.hpp>
0018 
0019 #include <map>
0020 #include <string>
0021 #include <tuple>
0022 
0023 namespace Acts {
0024 
0025 namespace Experimental {
0026 class DetectorVolume;
0027 class Portal;
0028 }  // namespace Experimental
0029 
0030 namespace Svg {
0031 
0032 using ProtoVolume = actsvg::proto::volume<std::vector<Vector3>>;
0033 
0034 namespace DetectorVolumeConverter {
0035 
0036 /// A nested options class for the layer conversion
0037 struct Options {
0038   /// The Portal indices
0039   std::map<const Experimental::Portal*, unsigned int> portalIndices;
0040   /// The Portal converter options
0041   PortalConverter::Options portalOptions;
0042   /// The Surface converter options
0043   SurfaceConverter::Options surfaceOptions;
0044   /// The Grid converter options
0045   IndexedSurfacesConverter::Options indexedSurfacesOptions;
0046 };
0047 
0048 /// Write/create the detector volume
0049 ///
0050 /// @param gctx the geometry context
0051 /// @param dVolume the detector volumeto be displayed
0052 /// @param volumeOptions the conversion objects
0053 ///
0054 /// @return a vector of svg objects
0055 std::tuple<ProtoVolume, ProtoIndexedSurfaceGrid> convert(
0056     const GeometryContext& gctx, const Experimental::DetectorVolume& dVolume,
0057     const Options& volumeOptions);
0058 
0059 }  // namespace DetectorVolumeConverter
0060 
0061 namespace View {
0062 
0063 /// Convert into an acts::svg::object with an XY view
0064 ///
0065 /// @param volume is the DetectorVolume (proto representation)
0066 /// @param identification is the to be translated id_ for actsvg
0067 /// @param displayPortals is a directory whether portals should be displayed
0068 ///
0069 /// @return an svg object that can be written out directly to disc
0070 static inline actsvg::svg::object xy(const ProtoVolume& volume,
0071                                      const std::string& identification,
0072                                      bool displayPortals = true) {
0073   actsvg::views::x_y xyView;
0074   return actsvg::display::volume(identification, volume, xyView,
0075                                  displayPortals);
0076 }
0077 
0078 /// Convert into an acts::svg::object with an Zr view
0079 ///
0080 /// @param volume is the DetectorVolume (proto representation)
0081 /// @param identification is the to be translated id_ for actsvg
0082 /// @param displayPortals is a directory whether portals should be displayed
0083 ///
0084 /// @return an svg object that can be written out directly to disc
0085 static inline actsvg::svg::object zr(const ProtoVolume& volume,
0086                                      const std::string& identification,
0087                                      bool displayPortals = true) {
0088   actsvg::views::z_r zrView;
0089   return actsvg::display::volume(identification, volume, zrView,
0090                                  displayPortals);
0091 }
0092 
0093 }  // namespace View
0094 
0095 }  // namespace Svg
0096 
0097 }  // namespace Acts