File indexing completed on 2025-01-18 09:13:04
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 "Acts/Tests/CommonHelpers/FloatComparisons.hpp"
0018 #include "ActsFatras/Digitization/PlanarSurfaceDrift.hpp"
0019
0020 #include <array>
0021 #include <memory>
0022
0023 namespace ActsFatras {
0024
0025 BOOST_AUTO_TEST_SUITE(Digitization)
0026
0027 BOOST_AUTO_TEST_CASE(PlanarSurfaceDrift) {
0028 Acts::GeometryContext geoCtx;
0029
0030 ActsFatras::PlanarSurfaceDrift psd;
0031
0032 Acts::Vector3 cPosition = Acts::Vector3(10., 50., 12.);
0033 Acts::Vector3 cNormal = Acts::Vector3(1., 1., 1.).normalized();
0034
0035 auto planeSurface =
0036 Acts::CurvilinearSurface(cPosition, cNormal).planeSurface();
0037
0038 double depletion = 0.250;
0039
0040
0041 Acts::Vector3 noDrift(0., 0., 0.);
0042 Acts::Vector3 holeDrift = Acts::Vector3(0.5, 0., 1.).normalized();
0043 Acts::Vector3 chargeDrift = Acts::Vector3(0.5, 0., -1.).normalized();
0044
0045
0046
0047
0048 auto noDriftSegment = psd.toReadout(geoCtx, *planeSurface, depletion,
0049 cPosition, cNormal, noDrift);
0050
0051 CHECK_CLOSE_ABS(noDriftSegment[0].x(), 0., Acts::s_epsilon);
0052 CHECK_CLOSE_ABS(noDriftSegment[0].y(), 0., Acts::s_epsilon);
0053 CHECK_CLOSE_ABS(noDriftSegment[1].x(), 0., Acts::s_epsilon);
0054 CHECK_CLOSE_ABS(noDriftSegment[1].y(), 0., Acts::s_epsilon);
0055
0056 Acts::Vector3 particleDir = Acts::Vector3(2., 1., 1.).normalized();
0057
0058
0059
0060
0061 noDriftSegment = psd.toReadout(geoCtx, *planeSurface, depletion, cPosition,
0062 particleDir, noDrift);
0063
0064 CHECK_CLOSE_ABS(noDriftSegment[0].x(), -noDriftSegment[1].x(),
0065 Acts::s_epsilon);
0066 CHECK_CLOSE_ABS(noDriftSegment[0].y(), -noDriftSegment[1].y(),
0067 Acts::s_epsilon);
0068
0069
0070
0071
0072
0073
0074
0075 auto driftedSegment = psd.toReadout(geoCtx, *planeSurface, depletion,
0076 cPosition, particleDir, holeDrift);
0077
0078 BOOST_CHECK(std::abs(driftedSegment[0].x() - driftedSegment[1].x()) >
0079 Acts::s_epsilon);
0080 BOOST_CHECK(std::abs(driftedSegment[0].y() - driftedSegment[1].y()) >
0081 Acts::s_epsilon);
0082 CHECK_CLOSE_ABS(noDriftSegment[1].x(), driftedSegment[1].x(),
0083 Acts::s_epsilon);
0084 CHECK_CLOSE_ABS(noDriftSegment[1].y(), driftedSegment[1].y(),
0085 Acts::s_epsilon);
0086 BOOST_CHECK(std::abs(driftedSegment[0].x() - noDriftSegment[0].x()) >
0087 Acts::s_epsilon);
0088 CHECK_CLOSE_ABS(driftedSegment[0].y(), noDriftSegment[0].y(),
0089 Acts::s_epsilon);
0090
0091
0092
0093
0094
0095
0096
0097 driftedSegment = psd.toReadout(geoCtx, *planeSurface, depletion, cPosition,
0098 particleDir, chargeDrift);
0099
0100 BOOST_CHECK(std::abs(driftedSegment[0].x() - driftedSegment[1].x()) >
0101 Acts::s_epsilon);
0102 BOOST_CHECK(std::abs(driftedSegment[0].y() - driftedSegment[1].y()) >
0103 Acts::s_epsilon);
0104 CHECK_CLOSE_ABS(noDriftSegment[0].x(), driftedSegment[0].x(),
0105 Acts::s_epsilon);
0106 CHECK_CLOSE_ABS(noDriftSegment[0].y(), driftedSegment[0].y(),
0107 Acts::s_epsilon);
0108 BOOST_CHECK(std::abs(driftedSegment[1].x() - noDriftSegment[1].x()) >
0109 Acts::s_epsilon);
0110 CHECK_CLOSE_ABS(driftedSegment[1].y(), noDriftSegment[1].y(),
0111 Acts::s_epsilon);
0112 }
0113
0114 BOOST_AUTO_TEST_SUITE_END()
0115
0116 }