File indexing completed on 2025-12-13 09:21:19
0001
0002
0003
0004
0005
0006
0007
0008
0009 #include "Acts/Geometry/ReferenceGenerators.hpp"
0010
0011 #include "Acts/Utilities/VectorHelpers.hpp"
0012
0013 const std::vector<Acts::Vector3> Acts::PolyhedronReferenceGenerator::references(
0014 const GeometryContext& gctx, const Surface& surface) const {
0015
0016 std::vector<Vector3> rPositions;
0017 auto pHedron = surface.polyhedronRepresentation(gctx, nSegements);
0018 rPositions.insert(rPositions.end(), pHedron.vertices.begin(),
0019 pHedron.vertices.end());
0020
0021
0022 Vector3 bc(0., 0., 0.);
0023 std::ranges::for_each(rPositions, [&](const auto& p) { bc += p; });
0024 bc *= 1. / rPositions.size();
0025
0026
0027 if (expansionValue != 0.0) {
0028 std::ranges::for_each(rPositions, [&](auto& p) {
0029 p += expansionValue * Vector3(p - bc).normalized();
0030 });
0031 }
0032
0033
0034 if (addBarycenter) {
0035 rPositions.push_back(bc);
0036 }
0037 return rPositions;
0038 }
0039
0040 const std::vector<Acts::Vector3> Acts::ProjectedReferenceGenerator::references(
0041 const GeometryContext& gctx, const Surface& surface) const {
0042 if (referenceSurface == nullptr) {
0043 throw std::invalid_argument(
0044 "ProjectedReferenceGenerator: reference surface is nullptr.");
0045 }
0046
0047
0048 std::vector<Vector3> tPositions;
0049 auto pHedron = surface.polyhedronRepresentation(gctx, nSegements);
0050 tPositions.insert(tPositions.end(), pHedron.vertices.begin(),
0051 pHedron.vertices.end());
0052
0053
0054 std::vector<Vector3> rPositions;
0055 Vector3 rCog;
0056
0057 for (const auto& lp : luminousRegion) {
0058 for (const auto& tp : tPositions) {
0059
0060 Vector3 rayDirection = (tp - lp).normalized();
0061 auto refMultiIntersections =
0062 referenceSurface->intersect(gctx, lp, rayDirection);
0063
0064 rPositions.push_back(refMultiIntersections.closestForward().position());
0065 rCog += rPositions.back();
0066 }
0067 }
0068
0069
0070 rCog /= rPositions.size();
0071
0072
0073 if (expansionValue != 0.0) {
0074 std::ranges::for_each(rPositions, [&](auto& p) {
0075 p += expansionValue * Vector3(p - rCog).normalized();
0076 });
0077 }
0078
0079 return rPositions;
0080 }