Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-10-08 08:27:17

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/Material/ISurfaceMaterial.hpp"
0013 #include "Acts/Material/MaterialSlab.hpp"
0014 #include "Acts/Utilities/BinUtility.hpp"
0015 #include "Acts/Utilities/MultiAxisSpec.hpp"
0016 
0017 #include <iosfwd>
0018 #include <optional>
0019 #include <stdexcept>
0020 #include <string>
0021 #include <vector>
0022 
0023 namespace Acts {
0024 
0025 /// @addtogroup material
0026 /// @{
0027 
0028 ///
0029 /// @brief proxy to SurfaceMaterial hand over BinUtility or other suitable
0030 /// binning description
0031 ///
0032 /// The ProtoSurfaceMaterial class acts as a proxy to the SurfaceMaterial
0033 /// to mark the layers and surfaces on which the material should be mapped on
0034 /// at construction time of the geometry and to hand over the granularity of
0035 /// of the material map with the bin Utility.
0036 template <typename BinningType>
0037 class ProtoSurfaceMaterialT : public ISurfaceMaterial {
0038  public:
0039   /// Constructor without binningType - homogeneous material
0040   ProtoSurfaceMaterialT() = default;
0041 
0042   /// Constructor with BinningType
0043   /// @param binning a binning description for the material map binning
0044   /// @param materialKey Optional stable identity of the material assignment
0045   /// @param mappingType is the type of surface mapping associated to the surface
0046   explicit ProtoSurfaceMaterialT(
0047       const BinningType& binning,
0048       MappingType mappingType = MappingType::Default,
0049       std::optional<std::string> materialKey = std::nullopt)
0050       : ISurfaceMaterial(1., mappingType),
0051         m_binning(binning),
0052         m_materialKey(std::move(materialKey)) {
0053     if (m_materialKey && m_materialKey->empty()) {
0054       throw std::invalid_argument("Material key must not be empty");
0055     }
0056   }
0057 
0058   /// Copy constructor
0059   ///
0060   /// @param smproxy The source proxy
0061   ProtoSurfaceMaterialT(const ProtoSurfaceMaterialT<BinningType>& smproxy) =
0062       default;
0063 
0064   /// Copy move constructor
0065   ///
0066   /// @param smproxy The source proxy
0067   ProtoSurfaceMaterialT(ProtoSurfaceMaterialT<BinningType>&& smproxy) noexcept =
0068       default;
0069 
0070   /// Destructor
0071   ~ProtoSurfaceMaterialT() override = default;
0072 
0073   /// Assignment operator
0074   ///
0075   /// @param smproxy The source proxy
0076   /// @return Reference to this object
0077   ProtoSurfaceMaterialT<BinningType>& operator=(
0078       const ProtoSurfaceMaterialT<BinningType>& smproxy) = default;
0079 
0080   /// Assignment move operator
0081   ///
0082   /// @param smproxy The source proxy
0083   /// @return Reference to this object
0084   ProtoSurfaceMaterialT<BinningType>& operator=(
0085       ProtoSurfaceMaterialT<BinningType>&& smproxy) noexcept = default;
0086 
0087   /// Scale operation - dummy implementation
0088   ///
0089   /// @return Reference to this object
0090   ProtoSurfaceMaterialT<BinningType>& scale(double /*factor*/) final {
0091     return (*this);
0092   }
0093 
0094   /// Stable identity of the material assignment, if configured
0095   /// @return Optional stable material assignment key
0096   const std::optional<std::string>& materialKey() const {
0097     return m_materialKey;
0098   }
0099 
0100   /// Return the BinUtility
0101   /// @return Reference to the binning
0102   const BinningType& binning() const { return (m_binning); }
0103 
0104   /// Return method for full material description of the Surface - from local
0105   /// coordinates
0106   ///
0107   /// @return will return dummy material
0108   const MaterialSlab& materialSlab(const Vector2& /*lp*/) const final {
0109     return (m_materialSlab);
0110   }
0111 
0112   /// @copydoc ISurfaceMaterial::localAxisDirections() const
0113   std::vector<AxisDirection> localAxisDirections() const final { return {}; }
0114 
0115   using ISurfaceMaterial::materialSlab;
0116 
0117   /// Output Method for std::ostream, to be overloaded by child classes
0118   ///
0119   /// @param sl is the output stream
0120   /// @return The output stream
0121   std::ostream& toStream(std::ostream& sl) const final {
0122     sl << "Acts::ProtoSurfaceMaterial : " << std::endl;
0123     sl << m_binning << std::endl;
0124     return sl;
0125   }
0126 
0127  private:
0128   /// A binning description
0129   BinningType m_binning;
0130 
0131   std::optional<std::string> m_materialKey;
0132 
0133   /// Dummy material properties
0134   MaterialSlab m_materialSlab = MaterialSlab::Nothing();
0135 };
0136 
0137 /// @brief Type alias for a prototype surface material using BinUtility
0138 /// A surface material implementation that uses BinUtility for binning
0139 using ProtoSurfaceMaterial = ProtoSurfaceMaterialT<Acts::BinUtility>;
0140 
0141 /// @brief Type alias for a prototype surface material using a multi-axis
0142 /// binning description
0143 /// A surface material implementation that carries a MultiAxisSpec2D whose
0144 /// deferred axes are resolved against the surface during material mapping
0145 using ProtoGridSurfaceMaterial = ProtoSurfaceMaterialT<MultiAxisSpec2D>;
0146 
0147 /// @}
0148 
0149 }  // namespace Acts