Warning, file /acts/Tests/UnitTests/Core/TrackFitting/GainMatrixSmootherTests.cpp was not indexed
or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
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/TrackParametrization.hpp"
0013 #include "Acts/EventData/MultiTrajectory.hpp"
0014 #include "Acts/EventData/TrackStatePropMask.hpp"
0015 #include "Acts/EventData/VectorMultiTrajectory.hpp"
0016 #include "Acts/Geometry/GeometryContext.hpp"
0017 #include "Acts/TrackFitting/GainMatrixSmoother.hpp"
0018 #include "Acts/Utilities/Result.hpp"
0019 #include "ActsTests/CommonHelpers/FloatComparisons.hpp"
0020 
0021 #include <cmath>
0022 #include <cstddef>
0023 #include <numbers>
0024 
0025 namespace {
0026 
0027 using namespace Acts;
0028 
0029 using ParametersVector = Acts::BoundVector;
0030 using CovarianceMatrix = Acts::BoundSquareMatrix;
0031 using Jacobian = Acts::BoundMatrix;
0032 
0033 const Acts::GeometryContext tgContext;
0034 
0035 }  
0036 
0037 namespace ActsTests {
0038 
0039 BOOST_AUTO_TEST_SUITE(TrackFittingSuite)
0040 
0041 BOOST_AUTO_TEST_CASE(Smooth) {
0042   VectorMultiTrajectory traj;
0043   std::size_t ts_idx = traj.addTrackState(TrackStatePropMask::All);
0044   auto ts = traj.getTrackState(ts_idx);
0045 
0046   
0047   CovarianceMatrix covTrk;
0048   covTrk.setIdentity();
0049   covTrk.diagonal() << 0.08, 0.3, 1, 1, 1, 1;
0050   BoundVector parValues;
0051   parValues << 0.3, 0.5, std::numbers::pi / 2., 0., 1 / 100., 0.;
0052 
0053   ts.predicted() = parValues;
0054   ts.predictedCovariance() = covTrk;
0055 
0056   parValues << 0.301, 0.503, std::numbers::pi / 2., 0., 1 / 100., 0.;
0057 
0058   ts.filtered() = parValues;
0059   ts.filteredCovariance() = covTrk;
0060   ts.pathLength() = 1.;
0061   ts.jacobian().setIdentity();
0062 
0063   ts_idx = traj.addTrackState(TrackStatePropMask::All, ts_idx);
0064   ts = traj.getTrackState(ts_idx);
0065 
0066   parValues << 0.2, 0.5, std::numbers::pi / 2., 0., 1 / 100., 0.;
0067   ts.predicted() = parValues;
0068   ts.predictedCovariance() = covTrk;
0069 
0070   parValues << 0.27, 0.53, std::numbers::pi / 2., 0., 1 / 100., 0.;
0071   ts.filtered() = parValues;
0072   ts.filteredCovariance() = covTrk;
0073   ts.pathLength() = 2.;
0074   ts.jacobian().setIdentity();
0075 
0076   ts_idx = traj.addTrackState(TrackStatePropMask::All, ts_idx);
0077   ts = traj.getTrackState(ts_idx);
0078 
0079   parValues << 0.35, 0.49, std::numbers::pi / 2., 0., 1 / 100., 0.;
0080   ts.predicted() = parValues;
0081   ts.predictedCovariance() = covTrk;
0082 
0083   parValues << 0.33, 0.43, std::numbers::pi / 2., 0., 1 / 100., 0.;
0084   ts.filtered() = parValues;
0085   ts.filteredCovariance() = covTrk;
0086   ts.pathLength() = 3.;
0087   ts.jacobian().setIdentity();
0088 
0089   
0090   BOOST_CHECK(GainMatrixSmoother()(tgContext, traj, ts_idx).ok());
0091 
0092   
0093   
0094 
0095   auto ts1 = traj.getTrackState(0);
0096   BOOST_CHECK(ts1.hasSmoothed());
0097   BOOST_CHECK_NE(ts1.filtered(), ts1.smoothed());
0098 
0099   double tol = 1e-6;
0100 
0101   ParametersVector expPars;
0102   expPars << 0.3510000, 0.4730000, 1.5707963, 0.0000000, 0.0100000, 0.0000000;
0103   CovarianceMatrix expCov;
0104   expCov.setIdentity();
0105   expCov.diagonal() << 0.0800000, 0.3000000, 1.0000000, 1.0000000, 1.0000000,
0106       1.0000000;
0107   CHECK_CLOSE_ABS(ts1.smoothed(), expPars, tol);
0108   CHECK_CLOSE_ABS(ts1.smoothedCovariance(), expCov, tol);
0109 
0110   auto ts2 = traj.getTrackState(1);
0111   BOOST_CHECK(ts2.hasSmoothed());
0112   BOOST_CHECK_NE(ts2.filtered(), ts2.smoothed());
0113 
0114   expPars << 0.2500000, 0.4700000, 1.5707963, 0.0000000, 0.0100000, 0.0000000;
0115   CHECK_CLOSE_ABS(ts2.smoothed(), expPars, tol);
0116   CHECK_CLOSE_ABS(ts2.smoothedCovariance(), expCov, tol);
0117 
0118   auto ts3 = traj.getTrackState(2);
0119   BOOST_CHECK(ts3.hasSmoothed());
0120   
0121   BOOST_CHECK_EQUAL(ts3.filtered(), ts3.smoothed());
0122 
0123   expPars << 0.3300000, 0.4300000, 1.5707963, 0.0000000, 0.0100000, 0.0000000;
0124   CHECK_CLOSE_ABS(ts3.smoothed(), expPars, tol);
0125   CHECK_CLOSE_ABS(ts3.smoothedCovariance(), expCov, tol);
0126 }
0127 
0128 BOOST_AUTO_TEST_SUITE_END()
0129 
0130 }