Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:12:45

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