Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-04-17 07:46:20

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/Surfaces/RegularSurface.hpp"
0012 #include "Acts/Surfaces/SurfacePlacementBase.hpp"
0013 
0014 namespace Acts {
0015 class VolumePlacementBase;
0016 
0017 namespace detail {
0018 /// Implementation of the `SurfacePlacementBase` to synchronize the alignment
0019 /// of an alignable volume with the alignment of the boundary surfaces
0020 /// associated with the Volume.
0021 class PortalPlacement final : public SurfacePlacementBase {
0022  public:
0023   ///  Allow the VolumePlacementBase as only class to construct the portal
0024   ///  placement
0025   friend class Acts::VolumePlacementBase;
0026 
0027   /// Returns the transform to switch from the portal reference
0028   /// frame into the experiment's global frame taking the alignment
0029   /// correction into account
0030   /// @param gctx The current geometry context object, e.g. alignment
0031   const Transform3& localToGlobalTransform(
0032       const GeometryContext& gctx) const override;
0033 
0034   ///  Returns the const reference to portal surface connected with this
0035   ///  placement instance
0036   const RegularSurface& surface() const override;
0037 
0038   ///  Returns the mutable reference to portal surface connected with this
0039   ///  placement instance
0040   RegularSurface& surface() override;
0041 
0042   /// Returns the pointer to the hold surface
0043   const std::shared_ptr<RegularSurface>& surfacePtr();
0044 
0045   /// Returns the pointer to the hold surface
0046   std::shared_ptr<const RegularSurface> surfacePtr() const;
0047 
0048   /// Declares the surface object to be non-sensitive
0049   bool isSensitive() const override;
0050 
0051   ///  Returns the face index of the associated portal surface
0052   std::size_t index() const;
0053 
0054   /// Returns the transform from the portal to the associated volume reference
0055   /// frame
0056   const Transform3& portalToVolumeCenter() const;
0057 
0058   /// Delete the copy constructor
0059   PortalPlacement(const PortalPlacement& other) = delete;
0060 
0061   /// Delete the copy assignment operator
0062   PortalPlacement& operator=(const PortalPlacement& other) = delete;
0063 
0064   /// Constructor to instantiate a PortalPlacement
0065   /// @param portalIdx: Internal index to associated the portal with the
0066   ///                   i-th boundary surface of the volume
0067   /// @param portalTrf: Transform from the portal's frame into the
0068   ///                   volume (I.e. the  orientation of the portal w.r.t.
0069   ///                   volume)
0070   /// @param parent: Pointer to the parent which is hosting the placement and also
0071   ///                providing the override transforms from the portal ->
0072   ///                experiment's frame
0073   /// @param surface: Pointer to the portal surface itself which is becoming alignable
0074   ///                 with the construction of this PortalPlacement
0075   PortalPlacement(const std::size_t portalIdx, const Transform3& portalTrf,
0076                   const VolumePlacementBase* parent,
0077                   std::shared_ptr<RegularSurface> surface);
0078 
0079  private:
0080   /// Assembles the transform to switch from the portal's frame
0081   /// to the experiment's global frame which is essentially the
0082   /// same as a call of `localToGlobalTransform` but this method
0083   /// is solely intended to be used during the population stage
0084   /// of the geometry context
0085   /// @param gctx The current geometry context object, e.g. alignment
0086   Transform3 assembleFullTransform(const GeometryContext& gctx) const;
0087 
0088   /// Orientation of the portal surface w.r.t the volume
0089   Transform3 m_portalToVolumeCenter{Transform3::Identity()};
0090   /// Pointer to the surface held by the placement
0091   std::shared_ptr<RegularSurface> m_surface{};
0092   /// Pointer to the parent managing this instance
0093   const VolumePlacementBase* m_parent{nullptr};
0094   /// Internal index of the portal
0095   std::size_t m_portalIdx{0ul};
0096 };
0097 }  // namespace detail
0098 }  // namespace Acts