9 #include <boost/test/unit_test.hpp>
20 #include <boost/optional/optional_io.hpp>
36 auto plane1 = Surface::makeShared<PlaneSurface>(Vector3D::UnitX() * 1,
38 auto plane2 = Surface::makeShared<PlaneSurface>(Vector3D::UnitX() * 2,
40 auto plane3 = Surface::makeShared<PlaneSurface>(Vector3D::UnitX() * 3,
44 cov << 0.04, 0, 0, 0.1;
47 plane1, {}, std::move(cov), -0.1, 0.45));
49 cov << 0.04, 0, 0, 0.1;
52 plane2, {}, std::move(cov), -0.2, 0.35));
54 cov << 0.04, 0, 0, 0.1;
57 plane3, {}, std::move(cov), -0.05, 0.25));
64 auto ts = traj.getTrackState(ts_idx);
65 ts.setReferenceSurface(plane1);
70 covTrk.diagonal() << 0.08, 0.3, 1, 1, 1, 1;
72 parValues << 0.3, 0.5, 0.5 *
M_PI, 0., 1 / 100., 0.;
74 ts.predicted() = parValues;
75 ts.predictedCovariance() = covTrk;
77 parValues << 0.301, 0.503, 0.5 *
M_PI, 0., 1 / 100., 0.;
79 ts.filtered() = parValues;
80 ts.filteredCovariance() = covTrk;
82 ts.jacobian().setIdentity();
84 ts_idx = traj.addTrackState(TrackStatePropMask::All, ts_idx);
85 ts = traj.getTrackState(ts_idx);
86 ts.setReferenceSurface(plane2);
88 parValues << 0.2, 0.5, 0.5 *
M_PI, 0., 1 / 100., 0.;
89 ts.predicted() = parValues;
90 ts.predictedCovariance() = covTrk;
92 parValues << 0.27, 0.53, 0.5 *
M_PI, 0., 1 / 100., 0.;
93 ts.filtered() = parValues;
94 ts.filteredCovariance() = covTrk;
96 ts.jacobian().setIdentity();
98 ts_idx = traj.addTrackState(TrackStatePropMask::All, ts_idx);
99 ts = traj.getTrackState(ts_idx);
100 ts.setReferenceSurface(plane3);
102 parValues << 0.35, 0.49, 0.5 *
M_PI, 0., 1 / 100., 0.;
103 ts.predicted() = parValues;
104 ts.predictedCovariance() = covTrk;
106 parValues << 0.33, 0.43, 0.5 *
M_PI, 0., 1 / 100., 0.;
107 ts.filtered() = parValues;
108 ts.filteredCovariance() = covTrk;
109 ts.pathLength() = 3.;
110 ts.jacobian().setIdentity();
115 BOOST_CHECK(gms(
tgContext, traj, ts_idx).ok());
120 auto ts1 = traj.getTrackState(0);
121 BOOST_CHECK(ts1.hasSmoothed());
122 BOOST_CHECK_NE(ts1.filtered(), ts1.smoothed());
127 expPars << 0.3510000, 0.4730000, 1.5707963, 0.0000000, 0.0100000, 0.0000000;
130 expCov.setIdentity();
131 expCov.diagonal() << 0.0800000, 0.3000000, 1.0000000, 1.0000000, 1.0000000,
135 auto ts2 = traj.getTrackState(1);
136 BOOST_CHECK(ts2.hasSmoothed());
137 BOOST_CHECK_NE(ts2.filtered(), ts2.smoothed());
139 expPars << 0.2500000, 0.4700000, 1.5707963, 0.0000000, 0.0100000, 0.0000000;
143 auto ts3 = traj.getTrackState(2);
144 BOOST_CHECK(ts3.hasSmoothed());
146 BOOST_CHECK_EQUAL(ts3.filtered(), ts3.smoothed());
148 expPars << 0.3300000, 0.4300000, 1.5707963, 0.0000000, 0.0100000, 0.0000000;