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