File indexing completed on 2025-10-24 08:20:48
0001
0002
0003
0004
0005
0006
0007
0008
0009 #include <boost/test/unit_test.hpp>
0010
0011 #include "Acts/Definitions/Algebra.hpp"
0012 #include "Acts/Definitions/Tolerance.hpp"
0013 #include "Acts/Geometry/GeometryContext.hpp"
0014 #include "Acts/Surfaces/CurvilinearSurface.hpp"
0015 #include "Acts/Surfaces/PlaneSurface.hpp"
0016 #include "Acts/Surfaces/Surface.hpp"
0017 #include "ActsFatras/Digitization/PlanarSurfaceDrift.hpp"
0018 #include "ActsTests/CommonHelpers/FloatComparisons.hpp"
0019
0020 #include <array>
0021 #include <memory>
0022
0023 using namespace ActsFatras;
0024 using namespace Acts;
0025
0026 namespace ActsTests {
0027
0028 BOOST_AUTO_TEST_SUITE(DigitizationSuite)
0029
0030 BOOST_AUTO_TEST_CASE(PlanarSurfaceDriftCase) {
0031 GeometryContext geoCtx;
0032
0033 PlanarSurfaceDrift psd;
0034
0035 Vector3 cPosition = Vector3(10., 50., 12.);
0036 Vector3 cNormal = Vector3(1., 1., 1.).normalized();
0037
0038 std::shared_ptr<PlaneSurface> planeSurface =
0039 CurvilinearSurface(cPosition, cNormal).planeSurface();
0040
0041 double depletion = 0.250;
0042
0043
0044 Vector3 noDrift(0., 0., 0.);
0045 Vector3 holeDrift = Vector3(0.5, 0., 1.).normalized();
0046 Vector3 chargeDrift = Vector3(0.5, 0., -1.).normalized();
0047
0048
0049
0050
0051 auto noDriftSegment = psd.toReadout(geoCtx, *planeSurface, depletion,
0052 cPosition, cNormal, noDrift);
0053
0054 CHECK_CLOSE_ABS(noDriftSegment[0].x(), 0., s_epsilon);
0055 CHECK_CLOSE_ABS(noDriftSegment[0].y(), 0., s_epsilon);
0056 CHECK_CLOSE_ABS(noDriftSegment[1].x(), 0., s_epsilon);
0057 CHECK_CLOSE_ABS(noDriftSegment[1].y(), 0., s_epsilon);
0058
0059 Vector3 particleDir = Vector3(2., 1., 1.).normalized();
0060
0061
0062
0063
0064 noDriftSegment = psd.toReadout(geoCtx, *planeSurface, depletion, cPosition,
0065 particleDir, noDrift);
0066
0067 CHECK_CLOSE_ABS(noDriftSegment[0].x(), -noDriftSegment[1].x(), s_epsilon);
0068 CHECK_CLOSE_ABS(noDriftSegment[0].y(), -noDriftSegment[1].y(), s_epsilon);
0069
0070
0071
0072
0073
0074
0075
0076 auto driftedSegment = psd.toReadout(geoCtx, *planeSurface, depletion,
0077 cPosition, particleDir, holeDrift);
0078
0079 BOOST_CHECK(std::abs(driftedSegment[0].x() - driftedSegment[1].x()) >
0080 s_epsilon);
0081 BOOST_CHECK(std::abs(driftedSegment[0].y() - driftedSegment[1].y()) >
0082 s_epsilon);
0083 CHECK_CLOSE_ABS(noDriftSegment[1].x(), driftedSegment[1].x(), s_epsilon);
0084 CHECK_CLOSE_ABS(noDriftSegment[1].y(), driftedSegment[1].y(), s_epsilon);
0085 BOOST_CHECK(std::abs(driftedSegment[0].x() - noDriftSegment[0].x()) >
0086 s_epsilon);
0087 CHECK_CLOSE_ABS(driftedSegment[0].y(), noDriftSegment[0].y(), s_epsilon);
0088
0089
0090
0091
0092
0093
0094
0095 driftedSegment = psd.toReadout(geoCtx, *planeSurface, depletion, cPosition,
0096 particleDir, chargeDrift);
0097
0098 BOOST_CHECK(std::abs(driftedSegment[0].x() - driftedSegment[1].x()) >
0099 s_epsilon);
0100 BOOST_CHECK(std::abs(driftedSegment[0].y() - driftedSegment[1].y()) >
0101 s_epsilon);
0102 CHECK_CLOSE_ABS(noDriftSegment[0].x(), driftedSegment[0].x(), s_epsilon);
0103 CHECK_CLOSE_ABS(noDriftSegment[0].y(), driftedSegment[0].y(), s_epsilon);
0104 BOOST_CHECK(std::abs(driftedSegment[1].x() - noDriftSegment[1].x()) >
0105 s_epsilon);
0106 CHECK_CLOSE_ABS(driftedSegment[1].y(), noDriftSegment[1].y(), s_epsilon);
0107 }
0108
0109 BOOST_AUTO_TEST_SUITE_END()
0110
0111 }