Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:11:14

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