File indexing completed on 2026-11-30 09:27:18
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/Units.hpp"
0013 #include "Acts/EventData/BoundTrackParameters.hpp"
0014 #include "Acts/EventData/ParticleHypothesis.hpp"
0015 #include "Acts/Geometry/GeometryContext.hpp"
0016 #include "Acts/Geometry/GeometryIdentifier.hpp"
0017 #include "Acts/MagneticField/ConstantBField.hpp"
0018 #include "Acts/MagneticField/MagneticFieldContext.hpp"
0019 #include "Acts/Propagator/ActorList.hpp"
0020 #include "Acts/Propagator/DefaultActor.hpp"
0021 #include "Acts/Propagator/EigenStepper.hpp"
0022 #include "Acts/Propagator/Propagator.hpp"
0023 #include "Acts/Propagator/SurfaceCollector.hpp"
0024 #include "Acts/Propagator/TryAllNavigator.hpp"
0025 #include "Acts/Utilities/Logger.hpp"
0026 #include "ActsTests/CommonHelpers/CylindricalTrackingGeometry.hpp"
0027
0028 #include <cmath>
0029 #include <vector>
0030
0031 using namespace Acts;
0032 using namespace Acts::UnitLiterals;
0033
0034 namespace ActsTests {
0035
0036 BOOST_AUTO_TEST_SUITE(PropagatorSuite)
0037
0038
0039
0040
0041
0042
0043
0044 BOOST_AUTO_TEST_CASE(TryAllNavigatorKeepsTargetBehind) {
0045 const auto gctx = GeometryContext::dangerouslyDefaultConstruct();
0046 const MagneticFieldContext mctx;
0047 CylindricalTrackingGeometry cGeometry(gctx);
0048 auto geometry = cGeometry();
0049
0050 using Stepper = EigenStepper<>;
0051 using TryAll = Experimental::TryAllNavigator;
0052 auto bField = std::make_shared<ConstantBField>(Vector3(0., 0., 2_T));
0053 Propagator<Stepper, TryAll> propagator(
0054 Stepper(bField), TryAll({geometry, true, true, false}),
0055 getDefaultLogger("Prop", Logging::INFO));
0056
0057 const double pT = 25_MeV;
0058 const double cotTheta = 0.05;
0059 const double theta = std::atan2(1., cotTheta);
0060 const double charge = -1.;
0061 const double phi = 0.3;
0062 const auto start = BoundTrackParameters::createCurvilinear(
0063 Vector4::Zero(), phi, theta, charge * std::sin(theta) / pT, std::nullopt,
0064 ParticleHypothesis::pion());
0065
0066 using Actors = ActorList<DefaultActor, SurfaceCollector<>>;
0067 Propagator<Stepper, TryAll>::Options<Actors> options(gctx, mctx);
0068
0069 options.pathLimit = 787_mm;
0070 options.loopProtection = false;
0071 options.maxSteps = 100000;
0072 auto& collector = options.actor.get<SurfaceCollector<>>();
0073 collector.selector.selectSensitive = true;
0074 collector.selector.selectMaterial = false;
0075
0076 auto state = propagator.makeState(options);
0077 auto result = propagator.propagate(state, start);
0078 BOOST_REQUIRE(result.ok());
0079 const auto& hits = state.actor.get<SurfaceCollector<>::State>().collected;
0080
0081
0082
0083
0084 auto sensitive = [](GeometryIdentifier::Value layer,
0085 GeometryIdentifier::Value sen) {
0086 return GeometryIdentifier().withVolume(3).withLayer(layer).withSensitive(
0087 sen);
0088 };
0089 std::vector<GeometryIdentifier> expected = {
0090 sensitive(2, 122), sensitive(2, 106), sensitive(4, 247),
0091 sensitive(4, 248), sensitive(4, 253)};
0092 for (int turn = 0; turn < 2; ++turn) {
0093 expected.insert(expected.end(),
0094 {sensitive(2, 128), sensitive(2, 122), sensitive(4, 247),
0095 sensitive(4, 248), sensitive(4, 253)});
0096 }
0097 expected.push_back(sensitive(2, 128));
0098
0099 std::vector<GeometryIdentifier> collected;
0100 for (const auto& hit : hits) {
0101 collected.push_back(hit.surface->geometryId());
0102 }
0103 BOOST_CHECK_EQUAL_COLLECTIONS(collected.begin(), collected.end(),
0104 expected.begin(), expected.end());
0105 }
0106
0107 BOOST_AUTO_TEST_SUITE_END()
0108
0109 }