ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Material.hpp
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file Material.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 <limits>
13 
15 
16 namespace Acts {
17 
31 class Material {
32  public:
34  enum Param {
35  eX0 = 0,
36  eL0 = 1,
37  eAr = 2,
38  eZ = 3,
39  eRho = 4,
40  };
41 
43  Material() = default;
51  constexpr Material(float X0_, float L0_, float Ar_, float Z_, float rho_)
52  : m_x0(X0_), m_l0(L0_), m_ar(Ar_), m_z(Z_), m_rho(rho_) {}
55 
56  Material(Material&& mat) = default;
57  Material(const Material& mat) = default;
58  ~Material() = default;
59  Material& operator=(Material&& mat) = default;
60  Material& operator=(const Material& mat) = default;
61 
63  constexpr operator bool() const { return 0.0f < m_ar; }
64 
66  constexpr float X0() const { return m_x0; }
68  constexpr float L0() const { return m_l0; }
70  constexpr float Ar() const { return m_ar; }
72  constexpr float Z() const { return m_z; }
74  constexpr float massDensity() const { return m_rho; }
79  float molarElectronDensity() const;
81  float meanExcitationEnergy() const;
82 
85 
86  private:
87  float m_x0 = std::numeric_limits<float>::infinity();
88  float m_l0 = std::numeric_limits<float>::infinity();
89  float m_ar = 0.0f;
90  float m_z = 0.0f;
91  float m_rho = 0.0f;
92 
93  friend constexpr bool operator==(const Material& lhs, const Material& rhs) {
94  return (lhs.m_x0 == rhs.m_x0) and (lhs.m_l0 == rhs.m_l0) and
95  (lhs.m_ar == rhs.m_ar) and (lhs.m_z == rhs.m_z) and
96  (lhs.m_rho == rhs.m_rho);
97  }
98  friend constexpr bool operator!=(const Material& lhs, const Material& rhs) {
99  return !(lhs == rhs);
100  }
101 };
102 
103 std::ostream& operator<<(std::ostream& os, const Material& material);
104 
105 } // namespace Acts