ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
AccumulatedVolumeMaterial.cpp
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file AccumulatedVolumeMaterial.cpp
1 // This file is part of the Acts project.
2 //
3 // Copyright (C) 2019-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 
10 #include <iostream>
11 
13  const MaterialProperties& mat) {
14  // Replace the vacuum by matter or add matter to matter
15  if (m_totalX0 == std::numeric_limits<float>::infinity()) {
16  m_totalX0 = mat.thickness() / mat.material().X0();
17  } else {
18  m_totalX0 += mat.thickness() / mat.material().X0();
19  }
20  if (m_totalL0 == std::numeric_limits<float>::infinity()) {
21  m_totalL0 = mat.thickness() / mat.material().L0();
22  } else {
23  m_totalL0 += mat.thickness() / mat.material().L0();
24  }
25  m_totalAr += mat.material().Ar();
26  m_totalZ += mat.material().Z();
27  m_totalRho += mat.material().massDensity();
28  if (m_materialEntries == 0) {
29  m_thickness = mat.thickness();
30  } else {
31  m_thickness += mat.thickness();
32  }
34 }
35 
37  // nothing accumulated, material is vacuum
38  if (m_materialEntries == 0) {
39  return Material();
40  }
41 
42  // Create the material
43  return Material(m_thickness / m_totalX0, m_thickness / m_totalL0,
44  m_totalAr / m_materialEntries, m_totalZ / m_materialEntries,
45  m_totalRho / m_materialEntries);
46 }