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/Geometry/GeometryContext.hpp"
0012 #include "ActsPlugins/ActSVG/LayerSvgConverter.hpp"
0013 #include "ActsPlugins/ActSVG/SvgUtils.hpp"
0014 #include <actsvg/core.hpp>
0015 #include <actsvg/meta.hpp>
0016 
0017 namespace Acts {
0018 
0019 class TrackingGeometry;
0020 class TrackingVolume;
0021 
0022 }  // namespace Acts
0023 
0024 namespace ActsPlugins::Svg {
0025 
0026 namespace TrackingGeometryConverter {
0027 
0028 /// Nested Options struct for the writing configuration
0029 struct Options {
0030   /// Prefix the output names
0031   std::string prefix = "";
0032   /// Write the layer conversion options
0033   Acts::GeometryHierarchyMap<LayerConverter::Options> layerOptions;
0034 };
0035 
0036 /// State object to collect geometry-wise information
0037 struct State {
0038   std::vector<actsvg::svg::object> xyCrossSection;
0039   std::vector<actsvg::svg::object> zrCrossSection;
0040 
0041   std::vector<actsvg::svg::object> finalViews;
0042 };
0043 
0044 /// Write svg files per tracking geometry
0045 ///
0046 /// @param gctx the geometry context
0047 /// @param tGeometry the tracking geometry
0048 /// @param cOptions the conversion options
0049 ///
0050 /// @return a vector of svg objects
0051 std::vector<actsvg::svg::object> convert(
0052     const Acts::GeometryContext& gctx, const Acts::TrackingGeometry& tGeometry,
0053     const Options& cOptions);
0054 
0055 /// Recursivele conversion of volumes
0056 ///
0057 /// @param gctx the geometry context
0058 /// @param tVolume the tracking volume
0059 /// @param cOptions the conversion options
0060 /// @param cState [in,out] the conversion state collecting the input
0061 ///
0062 void convert(const Acts::GeometryContext& gctx,
0063              const Acts::TrackingVolume& tVolume, const Options& cOptions,
0064              State& cState);
0065 
0066 }  // namespace TrackingGeometryConverter
0067 
0068 namespace TrackingGeometryProjections {
0069 
0070 struct Options {
0071   std::string prefix = "";
0072 
0073   TrackingGeometryConverter::Options trackingGeometryOptions;
0074 
0075   std::array<std::array<double, 2>, 2> rzAxes;
0076   std::vector<double> rzEtaLines;
0077 };
0078 
0079 /// Convert into xy and zr projections only
0080 ///
0081 /// @param gctx the geometry context
0082 /// @param tVolume the tracking volume
0083 /// @param cOptions the conversion options
0084 ///
0085 /// @note best performant if configured with options
0086 /// that omit the module info and grid info
0087 ///
0088 std::array<actsvg::svg::object, 2> convert(
0089     const Acts::GeometryContext& gctx, const Acts::TrackingGeometry& tGeometry,
0090     const Options& cOptions);
0091 }  // namespace TrackingGeometryProjections
0092 
0093 [[nodiscard("Not drawing svg outputs")]]
0094 std::vector<actsvg::svg::object> drawTrackingGeometry(
0095     const Acts::GeometryContext& gctx, const Acts::TrackingGeometry& tGeometry,
0096     std::variant<actsvg::views::x_y, actsvg::views::z_r> view,
0097     bool drawSurfaces = true, bool highlightMaterial = false);
0098 
0099 [[nodiscard("Not drawing svg outputs")]]
0100 std::vector<actsvg::svg::object> drawSurfaceArrays(
0101     const Acts::GeometryContext& gctx, const Acts::TrackingGeometry& tGeometry);
0102 
0103 }  // namespace ActsPlugins::Svg