EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
AccumulatedMaterialSlab.cpp
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file AccumulatedMaterialSlab.cpp
1 // This file is part of the Acts project.
2 //
3 // Copyright (C) 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  float pathCorrection) {
15  // scale the recorded material to the equivalence contribution along the
16  // surface normal
17  slab.scaleThickness(1 / pathCorrection);
19 }
20 
22  // average only real tracks or if empty tracks are allowed.
23  if (useEmptyTrack or (0 < m_trackAverage.thickness())) {
24  if (m_totalCount == 0u) {
25  m_totalAverage = m_trackAverage;
26  } else {
27  double weightTotal = m_totalCount / (m_totalCount + 1.0);
28  double weightTrack = 1 / (m_totalCount + 1.0);
29  // average such that each track contributes equally.
30  MaterialSlab fromTotal(m_totalAverage.material(),
31  weightTotal * m_totalAverage.thickness());
32  MaterialSlab fromTrack(m_trackAverage.material(),
33  weightTrack * m_trackAverage.thickness());
34  m_totalAverage = detail::combineSlabs(fromTotal, fromTrack);
35  }
36  m_totalCount += 1;
37  }
38  // reset track average
39  m_trackAverage = MaterialSlab();
40 }
41 
42 std::pair<Acts::MaterialSlab, unsigned int>
44  return {m_totalAverage, m_totalCount};
45 }