Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
MaterialSlab.hpp
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file MaterialSlab.hpp
1 // This file is part of the Acts project.
2 //
3 // Copyright (C) 2016-2020 CERN for the benefit of the Acts project
4 //
5 // This Source Code Form is subject to the terms of the Mozilla Public
6 // License, v. 2.0. If a copy of the MPL was not distributed with this
7 // file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 
9 #pragma once
10 
13 
14 #include <iosfwd>
15 #include <utility>
16 #include <vector>
17 
18 namespace Acts {
19 
25 class MaterialSlab {
26  public:
28  MaterialSlab() = default;
30  MaterialSlab(float thickness);
35  MaterialSlab(const Material& material, float thickness);
42  MaterialSlab(const std::vector<MaterialSlab>& layers);
43  ~MaterialSlab() = default;
44 
45  MaterialSlab(MaterialSlab&&) = default;
46  MaterialSlab(const MaterialSlab&) = default;
47  MaterialSlab& operator=(MaterialSlab&&) = default;
48  MaterialSlab& operator=(const MaterialSlab&) = default;
49 
51  void scaleThickness(float scale);
52 
54  constexpr operator bool() const {
55  return m_material and (0.0f < m_thickness);
56  }
57 
59  constexpr const Material& material() const { return m_material; }
61  constexpr float thickness() const { return m_thickness; }
63  constexpr float thicknessInX0() const { return m_thicknessInX0; }
65  constexpr float thicknessInL0() const { return m_thicknessInL0; }
66 
67  private:
69  float m_thickness = 0.0f;
70  float m_thicknessInX0 = 0.0f;
71  float m_thicknessInL0 = 0.0f;
72 
73  friend constexpr bool operator==(const MaterialSlab& lhs,
74  const MaterialSlab& rhs) {
75  // t/X0 and t/L0 are dependent variables and need not be checked
76  return (lhs.m_material == rhs.m_material) and
77  (lhs.m_thickness == rhs.m_thickness);
78  }
79  friend constexpr bool operator!=(const MaterialSlab& lhs,
80  const MaterialSlab& rhs) {
81  return !(lhs == rhs);
82  }
83 };
84 
85 std::ostream& operator<<(std::ostream& os, const MaterialSlab& materialSlab);
86 
87 // Useful typedefs
88 using MaterialSlabVector = std::vector<MaterialSlab>;
89 using MaterialSlabMatrix = std::vector<MaterialSlabVector>;
90 
93  std::vector<std::pair<Acts::MaterialSlab, std::vector<Acts::Vector3>>>;
94 
95 } // namespace Acts