EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
BinnedSurfaceMaterial.cpp
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file BinnedSurfaceMaterial.cpp
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 
10 
12 
14  const BinUtility& binUtility, MaterialSlabVector fullProperties,
15  double splitFactor)
16  : ISurfaceMaterial(splitFactor), m_binUtility(binUtility) {
17  // fill the material with deep copy
18  m_fullMaterial.push_back(std::move(fullProperties));
19 }
20 
22  const BinUtility& binUtility, MaterialSlabMatrix fullProperties,
23  double splitFactor)
24  : ISurfaceMaterial(splitFactor),
25  m_binUtility(binUtility),
26  m_fullMaterial(std::move(fullProperties)) {}
27 
29  double scale) {
30  for (auto& materialVector : m_fullMaterial) {
31  for (auto& materialBin : materialVector) {
32  materialBin.scaleThickness(scale);
33  }
34  }
35  return (*this);
36 }
37 
39  const Vector2D& lp) const {
40  // the first bin
41  size_t ibin0 = m_binUtility.bin(lp, 0);
42  size_t ibin1 = m_binUtility.max(1) != 0u ? m_binUtility.bin(lp, 1) : 0;
43  return m_fullMaterial[ibin1][ibin0];
44 }
45 
47  const Acts::Vector3D& gp) const {
48  // the first bin
49  size_t ibin0 = m_binUtility.bin(gp, 0);
50  size_t ibin1 = m_binUtility.max(1) != 0u ? m_binUtility.bin(gp, 1) : 0;
51  return m_fullMaterial[ibin1][ibin0];
52 }
53 
54 std::ostream& Acts::BinnedSurfaceMaterial::toStream(std::ostream& sl) const {
55  sl << "Acts::BinnedSurfaceMaterial : " << std::endl;
56  sl << " - Number of Material bins [0,1] : " << m_binUtility.max(0) + 1
57  << " / " << m_binUtility.max(1) + 1 << std::endl;
58  sl << " - Parse full update material : " << std::endl; //
59  // output the full material
60  unsigned int imat1 = 0;
61  for (auto& materialVector : m_fullMaterial) {
62  unsigned int imat0 = 0;
63  // the vector iterator
64  for (auto& materialBin : materialVector) {
65  sl << " Bin [" << imat1 << "][" << imat0 << "] - " << (materialBin);
66  ++imat0;
67  }
68  ++imat1;
69  }
70  sl << " - BinUtility: " << m_binUtility << std::endl;
71  return sl;
72 }