9 #include <boost/test/unit_test.hpp>
20 namespace tt = boost::test_tools;
64 BOOST_CHECK_EQUAL(slsState.
jacToGlobal, BoundToFreeMatrix::Zero());
65 BOOST_CHECK_EQUAL(slsState.
jacTransport, FreeMatrix::Identity());
66 BOOST_CHECK_EQUAL(slsState.
derivative, FreeVector::Zero());
68 BOOST_CHECK_EQUAL(slsState.
cov, Covariance::Zero());
72 BOOST_CHECK_EQUAL(slsState.
q, charge);
74 BOOST_CHECK_EQUAL(slsState.
navDir, ndir);
76 BOOST_CHECK_EQUAL(slsState.
stepSize, ndir * stepSize);
78 BOOST_CHECK_EQUAL(slsState.
tolerance, tolerance);
85 BOOST_CHECK_EQUAL(slsState.
q, 0.);
93 BOOST_CHECK_NE(slsState.
jacToGlobal, BoundToFreeMatrix::Zero());
95 BOOST_CHECK_EQUAL(slsState.
cov, cov);
124 BOOST_CHECK_EQUAL(sls.
position(slsState), slsState.
pos);
125 BOOST_CHECK_EQUAL(sls.
direction(slsState), slsState.
dir);
126 BOOST_CHECK_EQUAL(sls.
momentum(slsState), slsState.
p);
127 BOOST_CHECK_EQUAL(sls.
charge(slsState), slsState.
q);
128 BOOST_CHECK_EQUAL(sls.
time(slsState), slsState.
t);
137 BOOST_CHECK_EQUAL(slsState.
stepSize, 1337.);
140 BOOST_CHECK_EQUAL(slsState.
stepSize, -123.);
141 BOOST_CHECK_EQUAL(sls.
outputStepSize(slsState), originalStepSize);
145 auto curvPars = std::get<0>(curvState);
150 BOOST_CHECK(curvPars.covariance().has_value());
151 BOOST_CHECK_NE(*curvPars.covariance(),
cov);
159 double newTime(321.);
160 sls.
update(slsState, newPos, newMom.normalized(), newMom.norm(), newTime);
161 BOOST_CHECK_EQUAL(slsState.
pos, newPos);
162 BOOST_CHECK_EQUAL(slsState.
dir, newMom.normalized());
163 BOOST_CHECK_EQUAL(slsState.
p, newMom.norm());
164 BOOST_CHECK_EQUAL(slsState.
q, charge);
165 BOOST_CHECK_EQUAL(slsState.
t, newTime);
170 BOOST_CHECK_NE(slsState.
cov, cov);
171 BOOST_CHECK_NE(slsState.
jacToGlobal, BoundToFreeMatrix::Zero());
172 BOOST_CHECK_EQUAL(slsState.
jacTransport, FreeMatrix::Identity());
173 BOOST_CHECK_EQUAL(slsState.
derivative, FreeVector::Zero());
179 ps.stepping.covTransport =
false;
180 double h = sls.
step(ps).value();
181 BOOST_CHECK_EQUAL(ps.stepping.stepSize, ndir * stepSize);
182 BOOST_CHECK_EQUAL(ps.stepping.stepSize, h);
184 BOOST_CHECK_GT(ps.stepping.pos.norm(), newPos.norm());
185 BOOST_CHECK_EQUAL(ps.stepping.dir, newMom.normalized());
186 BOOST_CHECK_EQUAL(ps.stepping.p, newMom.norm());
187 BOOST_CHECK_EQUAL(ps.stepping.q, charge);
188 BOOST_CHECK_LT(ps.stepping.t, newTime);
189 BOOST_CHECK_EQUAL(ps.stepping.derivative, FreeVector::Zero());
190 BOOST_CHECK_EQUAL(ps.stepping.jacTransport, FreeMatrix::Identity());
192 ps.stepping.covTransport =
true;
193 double h2 = sls.
step(ps).value();
194 BOOST_CHECK_EQUAL(ps.stepping.stepSize, ndir * stepSize);
195 BOOST_CHECK_EQUAL(h2, h);
197 BOOST_CHECK_GT(ps.stepping.pos.norm(), newPos.norm());
198 BOOST_CHECK_EQUAL(ps.stepping.dir, newMom.normalized());
199 BOOST_CHECK_EQUAL(ps.stepping.p, newMom.norm());
200 BOOST_CHECK_EQUAL(ps.stepping.q, charge);
201 BOOST_CHECK_LT(ps.stepping.t, newTime);
202 BOOST_CHECK_NE(ps.stepping.derivative, FreeVector::Zero());
203 BOOST_CHECK_NE(ps.stepping.jacTransport, FreeMatrix::Identity());
210 double absMom2 = 8.5;
225 BOOST_CHECK_NE(slsStateCopy.
jacToGlobal, BoundToFreeMatrix::Zero());
226 BOOST_CHECK_NE(slsStateCopy.
jacToGlobal, ps.stepping.jacToGlobal);
227 BOOST_CHECK_EQUAL(slsStateCopy.
jacTransport, FreeMatrix::Identity());
228 BOOST_CHECK_EQUAL(slsStateCopy.
derivative, FreeVector::Zero());
230 BOOST_CHECK_EQUAL(slsStateCopy.
cov, cov2);
231 BOOST_CHECK_EQUAL(slsStateCopy.
pos,
232 freeParams.template segment<3>(
eFreePos0));
233 BOOST_CHECK_EQUAL(slsStateCopy.
dir,
234 freeParams.template segment<3>(
eFreeDir0).normalized());
236 BOOST_CHECK_EQUAL(slsStateCopy.
q, ps.stepping.q);
237 BOOST_CHECK_EQUAL(slsStateCopy.
t, freeParams[
eFreeTime]);
238 BOOST_CHECK_EQUAL(slsStateCopy.
navDir, ndir);
240 BOOST_CHECK_EQUAL(slsStateCopy.
stepSize, ndir * stepSize2);
242 ps.stepping.previousStepSize);
243 BOOST_CHECK_EQUAL(slsStateCopy.
tolerance, ps.stepping.tolerance);
246 slsStateCopy = ps.stepping;
250 BOOST_CHECK_NE(slsStateCopy.
jacToGlobal, BoundToFreeMatrix::Zero());
251 BOOST_CHECK_NE(slsStateCopy.
jacToGlobal, ps.stepping.jacToGlobal);
252 BOOST_CHECK_EQUAL(slsStateCopy.
jacTransport, FreeMatrix::Identity());
253 BOOST_CHECK_EQUAL(slsStateCopy.
derivative, FreeVector::Zero());
255 BOOST_CHECK_EQUAL(slsStateCopy.
cov, cov2);
256 BOOST_CHECK_EQUAL(slsStateCopy.
pos,
257 freeParams.template segment<3>(
eFreePos0));
258 BOOST_CHECK_EQUAL(slsStateCopy.
dir,
259 freeParams.template segment<3>(
eFreeDir0));
260 BOOST_CHECK_EQUAL(slsStateCopy.
p,
std::abs(1. / freeParams[eFreeQOverP]));
261 BOOST_CHECK_EQUAL(slsStateCopy.
q, ps.stepping.q);
262 BOOST_CHECK_EQUAL(slsStateCopy.
t, freeParams[eFreeTime]);
263 BOOST_CHECK_EQUAL(slsStateCopy.
navDir, ndir);
265 BOOST_CHECK_EQUAL(slsStateCopy.
stepSize,
268 ps.stepping.previousStepSize);
269 BOOST_CHECK_EQUAL(slsStateCopy.
tolerance, ps.stepping.tolerance);
272 slsStateCopy = ps.stepping;
276 BOOST_CHECK_NE(slsStateCopy.
jacToGlobal, BoundToFreeMatrix::Zero());
277 BOOST_CHECK_NE(slsStateCopy.
jacToGlobal, ps.stepping.jacToGlobal);
278 BOOST_CHECK_EQUAL(slsStateCopy.
jacTransport, FreeMatrix::Identity());
279 BOOST_CHECK_EQUAL(slsStateCopy.
derivative, FreeVector::Zero());
281 BOOST_CHECK_EQUAL(slsStateCopy.
cov, cov2);
282 BOOST_CHECK_EQUAL(slsStateCopy.
pos,
283 freeParams.template segment<3>(
eFreePos0));
284 BOOST_CHECK_EQUAL(slsStateCopy.
dir,
285 freeParams.template segment<3>(
eFreeDir0).normalized());
286 BOOST_CHECK_EQUAL(slsStateCopy.
p,
std::abs(1. / freeParams[eFreeQOverP]));
287 BOOST_CHECK_EQUAL(slsStateCopy.
q, ps.stepping.q);
288 BOOST_CHECK_EQUAL(slsStateCopy.
t, freeParams[eFreeTime]);
293 ps.stepping.previousStepSize);
294 BOOST_CHECK_EQUAL(slsStateCopy.
tolerance, ps.stepping.tolerance);
297 auto plane = Surface::makeShared<PlaneSurface>(
pos, dir);
299 charge / absMom, cov);
301 stepSize, tolerance);
305 Surface::makeShared<PlaneSurface>(pos + ndir * 2. * dir, dir);
328 CHECK_CLOSE_ABS(boundPars.position(tgContext), bp.position(tgContext), 1
e-6);
332 BOOST_CHECK(boundPars.covariance().has_value());
333 BOOST_CHECK_NE(*boundPars.covariance(),
cov);
340 BOOST_CHECK_NE(slsState.
cov, cov);
341 BOOST_CHECK_NE(slsState.
jacToGlobal, BoundToFreeMatrix::Zero());
342 BOOST_CHECK_EQUAL(slsState.
jacTransport, FreeMatrix::Identity());
343 BOOST_CHECK_EQUAL(slsState.
derivative, FreeVector::Zero());
347 bp.referenceSurface(),
tgContext, bp.parameters());
353 sls.
update(slsState, freeParams, 2 * (*bp.covariance()));
357 BOOST_CHECK_EQUAL(slsState.
q, 1. * charge);