Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-30 08:04:29

0001 // This file is part of the ACTS project.
0002 //
0003 // Copyright (C) 2016 CERN for the benefit of the ACTS project
0004 //
0005 // This Source Code Form is subject to the terms of the Mozilla Public
0006 // License, v. 2.0. If a copy of the MPL was not distributed with this
0007 // file, You can obtain one at https://mozilla.org/MPL/2.0/.
0008 
0009 #include <boost/test/unit_test.hpp>
0010 
0011 #include "Acts/Definitions/Algebra.hpp"
0012 #include "Acts/Definitions/Direction.hpp"
0013 #include "Acts/Definitions/Tolerance.hpp"
0014 #include "Acts/Definitions/TrackParametrization.hpp"
0015 #include "Acts/Definitions/Units.hpp"
0016 #include "Acts/EventData/BoundTrackParameters.hpp"
0017 #include "Acts/EventData/ParticleHypothesis.hpp"
0018 #include "Acts/Geometry/GeometryContext.hpp"
0019 #include "Acts/MagneticField/ConstantBField.hpp"
0020 #include "Acts/MagneticField/MagneticFieldContext.hpp"
0021 #include "Acts/Propagator/ConstrainedStep.hpp"
0022 #include "Acts/Propagator/EigenStepper.hpp"
0023 #include "Acts/Propagator/RiddersStepper.hpp"
0024 #include "Acts/Surfaces/BoundaryTolerance.hpp"
0025 #include "Acts/Surfaces/CurvilinearSurface.hpp"
0026 #include "Acts/Surfaces/PlaneSurface.hpp"
0027 #include "Acts/Utilities/Intersection.hpp"
0028 #include "ActsTests/CommonHelpers/FloatComparisons.hpp"
0029 
0030 #include <memory>
0031 
0032 using namespace Acts;
0033 using namespace Acts::UnitLiterals;
0034 
0035 namespace ActsTests {
0036 
0037 using Stepper = Experimental::RiddersStepper<EigenStepper<>>;
0038 
0039 BOOST_AUTO_TEST_SUITE(PropagatorSuite)
0040 
0041 // A transport anchors the state, so a second transport at the same point does
0042 // not change the covariance again
0043 BOOST_AUTO_TEST_CASE(ridders_stepper_repeated_transport) {
0044   const GeometryContext geoCtx = GeometryContext::dangerouslyDefaultConstruct();
0045   const MagneticFieldContext magCtx;
0046 
0047   Stepper stepper(std::make_shared<ConstantBField>(Vector3(0, 0, 2_T)));
0048 
0049   BoundMatrix cov = BoundMatrix::Identity();
0050   cov(eBoundQOverP, eBoundQOverP) = 1e-4;
0051   const auto start = BoundTrackParameters::createCurvilinear(
0052       Vector4::Zero(), 0.3, 1.2, 1. / 1_GeV, cov, ParticleHypothesis::pion());
0053 
0054   Stepper::Options options(geoCtx, magCtx);
0055   options.maxStepSize = 10_mm;
0056   auto state = stepper.makeState(options);
0057   stepper.initialize(state, start);
0058 
0059   for (int i = 0; i < 20; ++i) {
0060     BOOST_REQUIRE(stepper.step(state, Direction::Forward(), nullptr).ok());
0061   }
0062 
0063   const auto surface = CurvilinearSurface(stepper.position(state) +
0064                                               5_mm * stepper.direction(state),
0065                                           stepper.direction(state))
0066                            .planeSurface();
0067 
0068   // Step all states onto the surface, like the navigator does
0069   bool onSurface = false;
0070   for (int i = 0; i < 10 && !onSurface; ++i) {
0071     onSurface =
0072         stepper.updateSurfaceStatus(
0073             state, *surface, 0, Direction::Forward(),
0074             BoundaryTolerance::Infinite(), s_onSurfaceTolerance,
0075             ConstrainedStep::Type::Navigator) == IntersectionStatus::onSurface;
0076     if (!onSurface) {
0077       BOOST_REQUIRE(stepper.step(state, Direction::Forward(), nullptr).ok());
0078     }
0079   }
0080   BOOST_REQUIRE(onSurface);
0081 
0082   const auto firstJacobian = stepper.transportToBound(state, *surface);
0083   BOOST_REQUIRE(firstJacobian.ok());
0084   const BoundMatrix firstCovariance = stepper.covariance(state).value();
0085   BOOST_CHECK(!firstJacobian->isIdentity(1e-3));
0086 
0087   const auto secondJacobian = stepper.transportToBound(state, *surface);
0088   BOOST_REQUIRE(secondJacobian.ok());
0089   CHECK_CLOSE_ABS(*secondJacobian, BoundMatrix(BoundMatrix::Identity()), 1e-6);
0090   CHECK_CLOSE_COVARIANCE(stepper.covariance(state).value(), firstCovariance,
0091                          1e-6);
0092 }
0093 
0094 BOOST_AUTO_TEST_SUITE_END()
0095 
0096 }  // namespace ActsTests