Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-12-14 09:20:34

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/DiamondVolumeBounds.hpp"
0013 #include "Acts/Geometry/PortalShell.hpp"
0014 #include "Acts/Geometry/TrackingVolume.hpp"
0015 #include "Acts/Utilities/AxisDefinitions.hpp"
0016 #include "Acts/Utilities/Logger.hpp"
0017 
0018 namespace Acts {
0019 
0020 /// @class DiamondPortalShell
0021 /// Base class for convrrex polygon shaped portal shells, e.g
0022 /// single volumes with polygon shape or stacked (multiple) volumes (TODO)
0023 
0024 class DiamondPortalShell : public PortalShellBase {
0025  public:
0026   using Face = DiamondVolumeBounds::Face;
0027 
0028   using enum DiamondVolumeBounds::Face;
0029 
0030   /// Retrieve a shared_ptr for the portal associated to the given face. Can be
0031   /// nullptr if unset.
0032   /// @param face The face to retrieve the portal for
0033   /// @return The portal associated to the face
0034   virtual std::shared_ptr<Portal> portalPtr(Face face) = 0;
0035 
0036   /// Set the portal associated to the given face.
0037   /// @param portal The portal to set
0038   /// @param face The face to set the portal
0039   virtual void setPortal(std::shared_ptr<Portal> portal, Face face) = 0;
0040 
0041   /// @copydoc PortalShellBase::fill
0042   void fill(TrackingVolume& volume) override;
0043 
0044   /// @brief Get the transformation matrix for this polygon shape portal shell
0045   /// @return Reference to the transformation matrix
0046   virtual const Transform3& transform() const = 0;
0047 };
0048 // Output stream operator for the CuboidPortalShell::Face enum
0049 /// @param os The output stream
0050 /// @param face The face to output
0051 /// @return The output stream
0052 std::ostream& operator<<(std::ostream& os, DiamondPortalShell::Face face);
0053 
0054 /// @class SingleDiamondPortalShell
0055 /// Implementation of a portal shell class for a single convex polygon volume
0056 class SingleDiamondPortalShell : public DiamondPortalShell {
0057  public:
0058   /// Constructor of a convex polygon shape portal shell for the given volume
0059   /// @param volume The tracking volume this portal shell is associated with
0060   explicit SingleDiamondPortalShell(TrackingVolume& volume);
0061 
0062   /// @copydoc DiamondPortalShell::portalPtr
0063   std::shared_ptr<Portal> portalPtr(Face face) override;
0064 
0065   /// @copydoc DiamondPortalShell::setPortal
0066   void setPortal(std::shared_ptr<Portal> portal, Face face) override;
0067 
0068   /// @copydoc PortalShellBase::applyToVolume
0069   void applyToVolume() override;
0070 
0071   /// @copydoc PortalShellBase::isValid
0072   bool isValid() const override;
0073 
0074   /// @copydoc PortalShellBase::size
0075   std::size_t size() const override;
0076 
0077   /// @copydoc PortalShellBase::label
0078   std::string label() const override;
0079 
0080   /// @copydoc DiamondPortalShell::transform
0081   const Transform3& transform() const override {
0082     return m_volume->transform();
0083   };
0084 
0085  private:
0086   std::array<std::shared_ptr<Portal>, 8> m_portals;
0087 
0088   TrackingVolume* m_volume{nullptr};
0089 };
0090 }  // namespace Acts