File indexing completed on 2026-04-09 07:47:17
0001
0002
0003
0004
0005
0006
0007
0008
0009 #pragma once
0010
0011 #include "Acts/Definitions/Algebra.hpp"
0012 #include "Acts/Surfaces/AnnulusBounds.hpp"
0013 #include "Acts/Surfaces/DiscSurface.hpp"
0014 #include "Acts/Surfaces/DiscTrapezoidBounds.hpp"
0015 #include "Acts/Surfaces/PlaneSurface.hpp"
0016 #include "Acts/Surfaces/RadialBounds.hpp"
0017 #include "Acts/Surfaces/RectangleBounds.hpp"
0018 #include "Acts/Surfaces/TrapezoidBounds.hpp"
0019 #include "Acts/Utilities/BinUtility.hpp"
0020 #include "Acts/Utilities/BinningType.hpp"
0021 #include "Acts/Utilities/MathHelpers.hpp"
0022
0023 #include <numbers>
0024 #include <tuple>
0025 #include <vector>
0026
0027 #include "BoundRandomValues.hpp"
0028
0029 namespace ActsFatras {
0030
0031 using Randomizer = std::function<Acts::Vector2(double, double)>;
0032
0033 using PlanarTestBed =
0034 std::tuple<std::string, std::shared_ptr<const Acts::Surface>,
0035 Acts::BinUtility, Randomizer>;
0036
0037
0038 struct PlanarSurfaceTestBeds {
0039
0040
0041
0042
0043
0044
0045 std::vector<PlanarTestBed> operator()(double rScale) const {
0046 double irScale = (2. - rScale);
0047
0048
0049 double xhalf = 3.;
0050 double yhalf = 6.5;
0051 auto rectangle = std::make_shared<Acts::RectangleBounds>(xhalf, yhalf);
0052 auto rSurface = Acts::Surface::makeShared<Acts::PlaneSurface>(
0053 Acts::Transform3::Identity(), rectangle);
0054 Acts::BinUtility pixelated(15, -xhalf, xhalf, Acts::open,
0055 Acts::AxisDirection::AxisX);
0056 pixelated += Acts::BinUtility(26, -yhalf, yhalf, Acts::open,
0057 Acts::AxisDirection::AxisY);
0058 RectangleRandom rRandom(xhalf * rScale, yhalf * rScale);
0059
0060
0061 double xhalfminy = 2.;
0062 double xhalfmaxy = 3.5;
0063 yhalf = 4.;
0064 auto trapezoid =
0065 std::make_shared<Acts::TrapezoidBounds>(xhalfminy, xhalfmaxy, yhalf);
0066 auto tSurface = Acts::Surface::makeShared<Acts::PlaneSurface>(
0067 Acts::Transform3::Identity(), trapezoid);
0068 Acts::BinUtility stripsX(35, -xhalfmaxy, xhalfmaxy, Acts::open,
0069 Acts::AxisDirection::AxisX);
0070 stripsX += Acts::BinUtility(1, -yhalf, yhalf, Acts::open,
0071 Acts::AxisDirection::AxisY);
0072 TrapezoidRandom tRandom(xhalfminy * rScale, xhalfmaxy * rScale,
0073 yhalf * rScale);
0074
0075
0076 double rmin = 2.;
0077 double rmax = 7.5;
0078 double xmin = 2.;
0079 double xmax = 3.5;
0080 double ymax = Acts::fastCathetus(rmax, xmax);
0081 double alpha = std::max(std::atan2(xmin, rmin), std::atan2(xmax, ymax));
0082
0083 auto discTrapezoid =
0084 std::make_shared<Acts::DiscTrapezoidBounds>(xmin, xmax, rmin, rmax);
0085 auto dtSurface = Acts::Surface::makeShared<Acts::DiscSurface>(
0086 Acts::Transform3::Identity(), discTrapezoid);
0087 Acts::BinUtility stripsPhi(1, rmin, rmax, Acts::open,
0088 Acts::AxisDirection::AxisR);
0089 stripsPhi += Acts::BinUtility(25, std::numbers::pi / 2. - alpha,
0090 std::numbers::pi / 2. + alpha, Acts::open,
0091 Acts::AxisDirection::AxisPhi);
0092 TrapezoidRandom dtRandom(xmin * rScale, xmax * rScale, rmin * irScale,
0093 ymax * rScale);
0094
0095
0096 auto discRadial = std::make_shared<Acts::RadialBounds>(
0097 rmin, rmax, std::numbers::pi / 4., std::numbers::pi / 2.);
0098 auto dSurface = Acts::Surface::makeShared<Acts::DiscSurface>(
0099 Acts::Transform3::Identity(), discRadial);
0100 Acts::BinUtility rphiseg(10, rmin, rmax, Acts::open,
0101 Acts::AxisDirection::AxisR);
0102 rphiseg +=
0103 Acts::BinUtility(20, (std::numbers::pi / 2. - std::numbers::pi / 4.),
0104 (std::numbers::pi / 2. + std::numbers::pi / 4.),
0105 Acts::open, Acts::AxisDirection::AxisPhi);
0106
0107 DiscRandom dRandom(
0108 rmin * irScale, rmax * rScale,
0109 (std::numbers::pi / 2. - std::numbers::pi / 4.) * irScale,
0110 (std::numbers::pi / 2. + std::numbers::pi / 4.) * rScale);
0111
0112
0113 rmin = 2.5;
0114 rmax = 5.5;
0115 Acts::Vector2 aorigin(0.1, -0.3);
0116 double phimin = -0.25;
0117 double phimax = 0.38;
0118 auto annulus = std::make_shared<Acts::AnnulusBounds>(rmin, rmax, phimin,
0119 phimax, aorigin);
0120 auto aSurface = Acts::Surface::makeShared<Acts::DiscSurface>(
0121 Acts::Transform3::Identity() *
0122 Acts::Translation3(-aorigin.x(), -aorigin.y(), 0.),
0123 annulus);
0124
0125 auto vertices = annulus->vertices(72);
0126 std::ranges::for_each(vertices, [&](Acts::Vector2& v) {
0127 double r = Acts::VectorHelpers::perp(v);
0128 rmin = std::min(rmin, r);
0129 rmax = std::max(rmax, r);
0130 });
0131
0132 Acts::BinUtility stripsPhiA(1, rmin, rmax, Acts::open,
0133 Acts::AxisDirection::AxisR);
0134 stripsPhiA += Acts::BinUtility(12, phimin, phimax, Acts::open,
0135 Acts::AxisDirection::AxisPhi);
0136 AnnulusRandom aRandom(rmin * irScale, rmax * rScale, phimin * rScale,
0137 phimax * rScale, aorigin.x(), aorigin.y());
0138
0139 return {{"Rectangle", std::move(rSurface), pixelated, rRandom},
0140 {"Trapezoid", std::move(tSurface), stripsX, tRandom},
0141 {"DiscTrapezoid", std::move(dtSurface), stripsPhi, dtRandom},
0142 {"DiscRadial", std::move(dSurface), rphiseg, dRandom},
0143 {"Annulus", std::move(aSurface), stripsPhiA, aRandom}};
0144 }
0145 };
0146
0147 }