ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
MaterialProperties.hpp
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file MaterialProperties.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 
11 #include <iosfwd>
12 #include <vector>
13 
15 
16 namespace Acts {
17 
24  public:
26  MaterialProperties() = default;
37  MaterialProperties(float X0, float L0, float Ar, float Z, float rho,
38  float thickness);
43  MaterialProperties(const Material& material, float thickness);
50  MaterialProperties(const std::vector<MaterialProperties>& layers);
51  ~MaterialProperties() = default;
52 
53  MaterialProperties(MaterialProperties&& mprop) = default;
54  MaterialProperties(const MaterialProperties&) = default;
57 
59  void scaleThickness(float scale);
60 
62  constexpr operator bool() const {
63  return m_material and (0.0f < m_thickness);
64  }
65 
67  constexpr const Material& material() const { return m_material; }
69  constexpr float thickness() const { return m_thickness; }
71  constexpr float thicknessInX0() const { return m_thicknessInX0; }
73  constexpr float thicknessInL0() const { return m_thicknessInL0; }
74 
75  private:
77  float m_thickness = 0.0f;
78  float m_thicknessInX0 = 0.0f;
79  float m_thicknessInL0 = 0.0f;
80 
81  friend constexpr bool operator==(const MaterialProperties& lhs,
82  const MaterialProperties& rhs) {
83  // t/X0 and t/L0 are dependent variables and need not be checked
84  return (lhs.m_material == rhs.m_material) and
85  (lhs.m_thickness == rhs.m_thickness);
86  }
87  friend constexpr bool operator!=(const MaterialProperties& lhs,
88  const MaterialProperties& rhs) {
89  return !(lhs == rhs);
90  }
91 };
92 
93 std::ostream& operator<<(std::ostream& os,
94  const MaterialProperties& materialProperties);
95 
96 // Useful typedefs
97 using MaterialPropertiesVector = std::vector<MaterialProperties>;
98 using MaterialPropertiesMatrix = std::vector<MaterialPropertiesVector>;
99 
100 } // namespace Acts