ECCE @ 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 
11 
13  const BinUtility& binUtility, MaterialPropertiesVector fullProperties,
14  double splitFactor)
15  : ISurfaceMaterial(splitFactor), m_binUtility(binUtility) {
16  // fill the material with deep copy
17  m_fullMaterial.push_back(std::move(fullProperties));
18 }
19 
21  const BinUtility& binUtility, MaterialPropertiesMatrix fullProperties,
22  double splitFactor)
23  : ISurfaceMaterial(splitFactor),
24  m_binUtility(binUtility),
25  m_fullMaterial(std::move(fullProperties)) {}
26 
28  double scale) {
29  for (auto& materialVector : m_fullMaterial) {
30  for (auto& materialBin : materialVector) {
31  materialBin.scaleThickness(scale);
32  }
33  }
34  return (*this);
35 }
36 
38  const Vector2D& lp) const {
39  // the first bin
40  size_t ibin0 = m_binUtility.bin(lp, 0);
41  size_t ibin1 = m_binUtility.max(1) != 0u ? m_binUtility.bin(lp, 1) : 0;
42  return m_fullMaterial[ibin1][ibin0];
43 }
44 
46  const Acts::Vector3D& gp) const {
47  // the first bin
48  size_t ibin0 = m_binUtility.bin(gp, 0);
49  size_t ibin1 = m_binUtility.max(1) != 0u ? m_binUtility.bin(gp, 1) : 0;
50  return m_fullMaterial[ibin1][ibin0];
51 }
52 
53 std::ostream& Acts::BinnedSurfaceMaterial::toStream(std::ostream& sl) const {
54  sl << "Acts::BinnedSurfaceMaterial : " << std::endl;
55  sl << " - Number of Material bins [0,1] : " << m_binUtility.max(0) + 1
56  << " / " << m_binUtility.max(1) + 1 << std::endl;
57  sl << " - Parse full update material : " << std::endl; //
58  // output the full material
59  unsigned int imat1 = 0;
60  for (auto& materialVector : m_fullMaterial) {
61  unsigned int imat0 = 0;
62  // the vector iterator
63  for (auto& materialBin : materialVector) {
64  sl << " Bin [" << imat1 << "][" << imat0 << "] - " << (materialBin);
65  ++imat0;
66  }
67  ++imat1;
68  }
69  sl << " - BinUtility: " << m_binUtility << std::endl;
70  return sl;
71 }