Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-12-16 09:24:58

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/Propagator/ConstrainedStep.hpp"
0012 
0013 #include <limits>
0014 
0015 using namespace Acts;
0016 
0017 namespace ActsTests {
0018 
0019 BOOST_AUTO_TEST_SUITE(PropagatorSuite)
0020 
0021 // This tests the implementation of the AbortList
0022 // and the standard aborters
0023 BOOST_AUTO_TEST_CASE(ConstrainedStepTest) {
0024   // forward stepping test
0025   ConstrainedStep stepSize_p(0.25);
0026 
0027   // All of the types should be 0.25 now
0028   BOOST_CHECK_EQUAL(stepSize_p.accuracy(), std::numeric_limits<double>::max());
0029   BOOST_CHECK_EQUAL(stepSize_p.value(ConstrainedStep::Type::Navigator),
0030                     std::numeric_limits<double>::max());
0031   BOOST_CHECK_EQUAL(stepSize_p.value(ConstrainedStep::Type::Actor),
0032                     std::numeric_limits<double>::max());
0033   BOOST_CHECK_EQUAL(stepSize_p.value(ConstrainedStep::Type::User), 0.25);
0034 
0035   // Check the cast operation to double
0036   BOOST_CHECK_EQUAL(stepSize_p.value(), 0.25);
0037 
0038   // now we set the accuracy
0039   stepSize_p.setAccuracy(0.1);
0040   BOOST_CHECK_EQUAL(stepSize_p.value(), 0.1);
0041 
0042   // now we update the actor to smaller
0043   stepSize_p.update(0.05, ConstrainedStep::Type::Navigator);
0044   BOOST_CHECK_EQUAL(stepSize_p.value(), 0.05);
0045   // we increase the actor, but do not release the step size
0046   stepSize_p.update(0.15, ConstrainedStep::Type::Navigator);
0047   BOOST_CHECK_EQUAL(stepSize_p.value(), 0.05);
0048   // we increase the actor, but now DO release the step size
0049   // it falls back to the accuracy
0050   stepSize_p.release(ConstrainedStep::Type::Navigator);
0051   stepSize_p.update(0.15, ConstrainedStep::Type::Navigator);
0052   BOOST_CHECK_EQUAL(stepSize_p.value(), 0.1);
0053 
0054   // now set two and update them
0055   stepSize_p.update(0.05, ConstrainedStep::Type::User);
0056   stepSize_p.setAccuracy(0.03);
0057   BOOST_CHECK_EQUAL(stepSize_p.value(), 0.03);
0058 
0059   // now we release the accuracy - to the highest available value
0060   stepSize_p.releaseAccuracy();
0061   BOOST_CHECK_EQUAL(stepSize_p.accuracy(), std::numeric_limits<double>::max());
0062   BOOST_CHECK_EQUAL(stepSize_p.value(), 0.05);
0063 }
0064 
0065 BOOST_AUTO_TEST_SUITE_END()
0066 
0067 }  // namespace ActsTests