Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-12-16 09:23:01

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/Geometry/Volume.hpp"
0014 #include "Acts/Visualization/IVisualization3D.hpp"
0015 #include "Acts/Visualization/ViewConfig.hpp"
0016 
0017 #include <filesystem>
0018 #include <string>
0019 
0020 namespace Acts {
0021 
0022 class Layer;
0023 class Surface;
0024 class SurfaceArray;
0025 class TrackingVolume;
0026 struct Polyhedron;
0027 class IVisualization3D;
0028 
0029 struct GeometryView3D {
0030   /// Helper method to draw Polyhedron objects
0031   ///
0032   /// @param [in,out] helper The visualization helper
0033   /// @param polyhedron The surface to be drawn
0034   /// @param viewConfig The drawing configuration
0035   static void drawPolyhedron(IVisualization3D& helper,
0036                              const Polyhedron& polyhedron,
0037                              const ViewConfig& viewConfig = s_viewVolume);
0038 
0039   /// Helper method to draw Surface objects
0040   ///
0041   /// @param [in,out] helper The visualization helper
0042   /// @param surface The surface to be drawn
0043   /// @param gctx The geometry context for which it is drawn
0044   /// @param transform An option additional transform
0045   /// @param viewConfig The drawing configuration
0046   static void drawSurface(IVisualization3D& helper, const Surface& surface,
0047                           const GeometryContext& gctx,
0048                           const Transform3& transform = Transform3::Identity(),
0049                           const ViewConfig& viewConfig = s_viewSensitive);
0050 
0051   /// Helper method to draw SurfaceArray objects
0052   ///
0053   /// @param [in,out] helper The visualization helper
0054   /// @param surfaceArray The surface to be drawn
0055   /// @param gctx The geometry context for which it is drawn
0056   /// @param transform An option additional transform
0057   /// @param sensitiveConfig The drawing configuration for sensitive surfaces
0058   /// @param passiveConfig The drawing configuration for passive surfaces
0059   /// @param gridConfig The drawing configuration for grid
0060   /// @param outputDir Directory to write to
0061   static void drawSurfaceArray(
0062       IVisualization3D& helper, const SurfaceArray& surfaceArray,
0063       const GeometryContext& gctx,
0064       const Transform3& transform = Transform3::Identity(),
0065       const ViewConfig& sensitiveConfig = s_viewSensitive,
0066       const ViewConfig& passiveConfig = s_viewPassive,
0067       const ViewConfig& gridConfig = s_viewGrid,
0068       const std::filesystem::path& outputDir = std::filesystem::path("."));
0069 
0070   /// Helper method to draw Volume objects
0071   ///
0072   /// @param [in,out] helper The visualization helper
0073   /// @param volume The volume to be drawn
0074   /// @param gctx The geometry context for which it is drawn
0075   /// @param transform An option additional transform
0076   /// @param viewConfig The drawing configuration for boundary surfaces
0077   static void drawVolume(IVisualization3D& helper, const Volume& volume,
0078                          const GeometryContext& gctx,
0079                          const Transform3& transform = Transform3::Identity(),
0080                          const ViewConfig& viewConfig = s_viewVolume);
0081 
0082   /// Helper method to draw Layer objects
0083   ///
0084   /// @param [in,out] helper The visualization helper
0085   /// @param layer The tracking layer to be drawn
0086   /// @param gctx The geometry context for which it is drawn
0087   /// @param layerConfig The drawing configuration for passive surfaces
0088   /// @param sensitiveConfig The drawing configuration for sensitive surfaces
0089   /// @param gridConfig The drawing configuration for grid display
0090   /// @param outputDir Directory to write to
0091   static void drawLayer(
0092       IVisualization3D& helper, const Layer& layer, const GeometryContext& gctx,
0093       const ViewConfig& layerConfig = s_viewPassive,
0094       const ViewConfig& sensitiveConfig = s_viewSensitive,
0095       const ViewConfig& gridConfig = s_viewGrid,
0096       const std::filesystem::path& outputDir = std::filesystem::path("."));
0097 
0098   /// Helper method to draw TrackingVolume objects
0099   ///
0100   /// @param [in,out] helper The visualization helper
0101   /// @param tVolume The tracking volume to be drawn
0102   /// @param gctx The geometry context for which it is drawn
0103   /// @param containerView The drawing configuration for a container volume
0104   /// @param volumeView The drawing configuration for the navigation level
0105   /// volume
0106   /// @param layerView The drawing configuration for passive surfaces
0107   /// @param sensitiveView The drawing configuration for sensitive surfaces
0108   /// @param gridView The drawing configuration for grid display
0109   /// @param writeIt The prescription to write it or not
0110   /// @param tag The (optional) additional output tag
0111   /// @param outputDir Directory to write to
0112   static void drawTrackingVolume(
0113       IVisualization3D& helper, const TrackingVolume& tVolume,
0114       const GeometryContext& gctx,
0115       const ViewConfig& containerView = s_viewVolume,
0116       const ViewConfig& volumeView = s_viewVolume,
0117       const ViewConfig& layerView = s_viewPassive,
0118       const ViewConfig& sensitiveView = s_viewSensitive,
0119       const ViewConfig& gridView = s_viewGrid, bool writeIt = true,
0120       const std::string& tag = "",
0121       const std::filesystem::path& outputDir = std::filesystem::path("."));
0122 
0123   /// Helper method to draw lines - base for all lines
0124   ///
0125   /// @param [in,out] helper The visualization helper
0126   /// @param start The start point
0127   /// @param end The end point
0128   /// @param arrows [ -1 | 0 | 1 | 2 ] = [ start | none | end | both ]
0129   /// @param arrowLength wrt halflength
0130   /// @param arrowWidth wrt thickness
0131   /// @param viewConfig The drawing configuration for this segment
0132   static void drawSegmentBase(IVisualization3D& helper, const Vector3& start,
0133                               const Vector3& end, int arrows = 0,
0134                               double arrowLength = 0., double arrowWidth = 0.,
0135                               const ViewConfig& viewConfig = s_viewLine);
0136 
0137   /// Convenience function : line
0138   ///
0139   /// @param [in,out] helper The visualization helper
0140   /// @param start The start point
0141   /// @param end The end point
0142   /// @param viewConfig The drawing configuration for this segment
0143   static void drawSegment(IVisualization3D& helper, const Vector3& start,
0144                           const Vector3& end,
0145                           const ViewConfig& viewConfig = s_viewLine);
0146 
0147   /// Convenience function : arrow pointing back
0148   ///
0149   /// @param [in,out] helper The visualization helper
0150   /// @param start The start point
0151   /// @param end The end point
0152   /// @param arrowLength wrt thickness
0153   /// @param arrowWidth wrt thickness
0154   /// @param viewConfig The drawing configuration for this segment
0155   static void drawArrowBackward(IVisualization3D& helper, const Vector3& start,
0156                                 const Vector3& end, double arrowLength,
0157                                 double arrowWidth,
0158                                 const ViewConfig& viewConfig = s_viewLine);
0159 
0160   /// Convenience function : arrow pointing forward
0161   ///
0162   /// @param [in,out] helper The visualization helper
0163   /// @param start The start point
0164   /// @param end The end point
0165   /// @param arrowLength wrt thickness
0166   /// @param arrowWidth wrt thickness
0167   /// @param viewConfig The drawing configuration for this segment
0168   static void drawArrowForward(IVisualization3D& helper, const Vector3& start,
0169                                const Vector3& end, double arrowLength,
0170                                double arrowWidth,
0171                                const ViewConfig& viewConfig = s_viewLine);
0172 
0173   /// Convenience function : arrow pointing both directions
0174   ///
0175   /// @param [in,out] helper The visualization helper
0176   /// @param start The start point
0177   /// @param end The end point
0178   /// @param arrowLength wrt thickness
0179   /// @param arrowWidth wrt thickness
0180   /// @param viewConfig The drawing configuration for this segment
0181   static void drawArrowsBoth(IVisualization3D& helper, const Vector3& start,
0182                              const Vector3& end, double arrowLength,
0183                              double arrowWidth,
0184                              const ViewConfig& viewConfig = s_viewLine);
0185 };
0186 
0187 }  // namespace Acts