Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-10-30 07:53:40

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