Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:27:40

0001 // This file is part of the Acts project.
0002 //
0003 // Copyright (C) 2016-2020 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 http://mozilla.org/MPL/2.0/.
0008 
0009 #pragma once
0010 
0011 #include "Acts/Definitions/Algebra.hpp"
0012 #include "Acts/Material/Material.hpp"
0013 
0014 #include <iosfwd>
0015 #include <utility>
0016 #include <vector>
0017 
0018 namespace Acts {
0019 
0020 /// Material description for an object with defined thickness.
0021 ///
0022 /// This is intended to describe concrete surface materials.
0023 ///
0024 /// @see Material for a description of the available parameters.
0025 class MaterialSlab {
0026  public:
0027   /// Combine material properties of two layers by averaging them.
0028   ///
0029   /// @param layerA Input layer A to average over.
0030   /// @param layerB Input layer B to average over.
0031   ///
0032   /// @return The resulting object has the combined thickness of all layers but just
0033   ///         one set of appropriately averaged material constants.
0034   static MaterialSlab averageLayers(const MaterialSlab& layerA,
0035                                     const MaterialSlab& layerB);
0036 
0037   /// Combine material properties of multiple layers by averaging them.
0038   ///
0039   /// @param layers Input layers to average over.
0040   ///
0041   /// @return The resulting object has the combined thickness of all layers but just
0042   ///         one set of appropriately averaged material constants.
0043   static MaterialSlab averageLayers(const std::vector<MaterialSlab>& layers);
0044 
0045   /// Construct vacuum without thickness.
0046   MaterialSlab() = default;
0047   /// Construct vacuum with thickness.
0048   MaterialSlab(float thickness);
0049   /// Construct from material description.
0050   ///
0051   /// @param material  is the material description
0052   /// @param thickness is the thickness of the material
0053   MaterialSlab(const Material& material, float thickness);
0054   ~MaterialSlab() = default;
0055 
0056   MaterialSlab(MaterialSlab&&) = default;
0057   MaterialSlab(const MaterialSlab&) = default;
0058   MaterialSlab& operator=(MaterialSlab&&) = default;
0059   MaterialSlab& operator=(const MaterialSlab&) = default;
0060 
0061   /// Scale the material thickness by the given factor.
0062   void scaleThickness(float scale);
0063 
0064   /// Check if the material is valid, i.e. it is finite and not vacuum.
0065   constexpr operator bool() const { return m_material && (0.0f < m_thickness); }
0066 
0067   /// Access the (average) material parameters.
0068   constexpr const Material& material() const { return m_material; }
0069   /// Return the thickness.
0070   constexpr float thickness() const { return m_thickness; }
0071   /// Return the radiation length fraction.
0072   constexpr float thicknessInX0() const { return m_thicknessInX0; }
0073   /// Return the nuclear interaction length fraction.
0074   constexpr float thicknessInL0() const { return m_thicknessInL0; }
0075 
0076  private:
0077   Material m_material;
0078   float m_thickness = 0.0f;
0079   float m_thicknessInX0 = 0.0f;
0080   float m_thicknessInL0 = 0.0f;
0081 
0082   friend constexpr bool operator==(const MaterialSlab& lhs,
0083                                    const MaterialSlab& rhs) {
0084     // t/X0 and t/L0 are dependent variables and need not be checked
0085     return (lhs.m_material == rhs.m_material) &&
0086            (lhs.m_thickness == rhs.m_thickness);
0087   }
0088   friend constexpr bool operator!=(const MaterialSlab& lhs,
0089                                    const MaterialSlab& rhs) {
0090     return !(lhs == rhs);
0091   }
0092 };
0093 
0094 std::ostream& operator<<(std::ostream& os, const MaterialSlab& materialSlab);
0095 
0096 // Useful typedefs
0097 using MaterialSlabVector = std::vector<MaterialSlab>;
0098 using MaterialSlabMatrix = std::vector<MaterialSlabVector>;
0099 
0100 /// list of point used in the mapping of a volume
0101 using RecordedMaterialVolumePoint =
0102     std::vector<std::pair<Acts::MaterialSlab, std::vector<Acts::Vector3>>>;
0103 
0104 }  // namespace Acts