Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-19 09:23:43

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