Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-05-29 07:46:31

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 /// Base class for diamond  shaped portal shells, e.g
0021 /// single volumes with polygon shape or stacked (multiple) volumes (TODO)
0022 class DiamondPortalShell : public PortalShellBase {
0023  public:
0024   /// Type alias for the face enumeration
0025   using Face = DiamondVolumeBounds::Face;
0026 
0027   using enum DiamondVolumeBounds::Face;
0028 
0029   /// Retrieve a shared_ptr for the portal associated to the given face. Can be
0030   /// nullptr if unset.
0031   /// @param face The face to retrieve the portal for
0032   /// @return The portal associated to the face
0033   virtual std::shared_ptr<Portal> portalPtr(Face face) = 0;
0034 
0035   /// Set the portal associated to the given face.
0036   /// @param portal The portal to set
0037   /// @param face The face to set the portal
0038   virtual void setPortal(std::shared_ptr<Portal> portal, Face face) = 0;
0039 
0040   /// @copydoc PortalShellBase::fill
0041   void fill(TrackingVolume& volume) override;
0042 };
0043 // Output stream operator for the CuboidPortalShell::Face enum
0044 /// @param os The output stream
0045 /// @param face The face to output
0046 /// @return The output stream
0047 std::ostream& operator<<(std::ostream& os, DiamondPortalShell::Face face);
0048 
0049 /// Implementation of a portal shell class for a single convex polygon volume
0050 class SingleDiamondPortalShell : public DiamondPortalShell {
0051  public:
0052   /// Constructor of a convex polygon shape portal shell for the given volume
0053   /// @param gctx The current geometry context object, e.g. alignment
0054   /// @param volume The tracking volume this portal shell is associated with
0055   explicit SingleDiamondPortalShell(const GeometryContext& gctx,
0056                                     TrackingVolume& volume);
0057 
0058   /// @copydoc DiamondPortalShell::portalPtr
0059   std::shared_ptr<Portal> portalPtr(Face face) override;
0060 
0061   /// @copydoc DiamondPortalShell::setPortal
0062   void setPortal(std::shared_ptr<Portal> portal, Face face) override;
0063 
0064   /// @copydoc PortalShellBase::applyToVolume
0065   void applyToVolume() override;
0066 
0067   /// @copydoc PortalShellBase::isValid
0068   bool isValid() const override;
0069 
0070   /// @copydoc PortalShellBase::size
0071   std::size_t size() const override;
0072 
0073   /// @copydoc PortalShellBase::label
0074   std::string label() const override;
0075 
0076  private:
0077   std::array<std::shared_ptr<Portal>, 8> m_portals;
0078 
0079   TrackingVolume* m_volume{nullptr};
0080 };
0081 }  // namespace Acts