Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2026-07-16 08:07:29

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