Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
ReferenceGenerators.hpp
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file ReferenceGenerators.hpp
1 // This file is part of the Acts project.
2 //
3 // Copyright (C) 2023 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 
16 
17 #include <vector>
18 
19 namespace Acts {
20 namespace Experimental {
21 namespace detail {
22 
34  const std::vector<Vector3> references(const GeometryContext& gctx,
35  const Surface& surface) const {
36  return {surface.center(gctx)};
37  }
38 };
39 
46 template <BinningValue bVAL = BinningValue::binValues>
54  const std::vector<Vector3> references(const GeometryContext& gctx,
55  const Surface& surface) const {
56  return {surface.binningPosition(gctx, bVAL)};
57  }
58 };
59 
70 template <size_t nSEGS = 1u, bool aBARY = true>
78  const std::vector<Vector3> references(const GeometryContext& gctx,
79  const Surface& surface) const {
80  // Create the return vector
81  std::vector<Vector3> rPositions;
82  auto pHedron = surface.polyhedronRepresentation(gctx, nSEGS);
83  rPositions.insert(rPositions.end(), pHedron.vertices.begin(),
84  pHedron.vertices.end());
85  // Add the barycenter if configured
86  if constexpr (aBARY) {
87  Vector3 bc(0., 0., 0.);
88  std::for_each(rPositions.begin(), rPositions.end(),
89  [&](const auto& p) { bc += p; });
90  bc *= 1. / rPositions.size();
91  rPositions.push_back(bc);
92  }
93  return rPositions;
94  }
95 };
96 
97 } // namespace detail
98 } // namespace Experimental
99 } // namespace Acts