9 #include <boost/test/unit_test.hpp>
16 namespace tt = boost::test_tools;
42 double stepSize = 123.;
43 double tolerance = 234.;
56 BOOST_TEST(slsState.
jacToGlobal == BoundToFreeMatrix::Zero());
57 BOOST_TEST(slsState.
jacTransport == FreeMatrix::Identity());
58 BOOST_TEST(slsState.
derivative == FreeVector::Zero());
60 BOOST_TEST(slsState.
cov == Covariance::Zero());
61 BOOST_TEST(slsState.
pos == pos);
62 BOOST_TEST(slsState.
dir == mom.normalized());
63 BOOST_TEST(slsState.
p == mom.norm());
64 BOOST_TEST(slsState.
q == charge);
65 BOOST_TEST(slsState.
t == time);
66 BOOST_TEST(slsState.
navDir == ndir);
68 BOOST_TEST(slsState.
stepSize == ndir * stepSize);
70 BOOST_TEST(slsState.
tolerance == tolerance);
76 BOOST_TEST(slsState.
q == 0.);
83 BOOST_TEST(slsState.
jacToGlobal != BoundToFreeMatrix::Zero());
85 BOOST_TEST(slsState.
cov == cov);
95 double stepSize = 123.;
96 double tolerance = 234.;
112 BOOST_TEST(sls.
position(slsState) == slsState.
pos);
114 BOOST_TEST(sls.
momentum(slsState) == slsState.
p);
115 BOOST_TEST(sls.
charge(slsState) == slsState.
q);
116 BOOST_TEST(sls.
time(slsState) == slsState.
t);
125 BOOST_TEST(slsState.
stepSize == 1337.);
128 BOOST_TEST(slsState.
stepSize == -123.);
133 auto curvPars = std::get<0>(curvState);
138 BOOST_TEST(curvPars.covariance().has_value());
139 BOOST_TEST(*curvPars.covariance() != cov);
147 double newTime(321.);
148 sls.
update(slsState, newPos, newMom.normalized(), newMom.norm(), newTime);
149 BOOST_TEST(slsState.
pos == newPos);
150 BOOST_TEST(slsState.
dir == newMom.normalized());
151 BOOST_TEST(slsState.
p == newMom.norm());
152 BOOST_TEST(slsState.
q == charge);
153 BOOST_TEST(slsState.
t == newTime);
158 BOOST_TEST(slsState.
cov != cov);
159 BOOST_TEST(slsState.
jacToGlobal != BoundToFreeMatrix::Zero());
160 BOOST_TEST(slsState.
jacTransport == FreeMatrix::Identity());
161 BOOST_TEST(slsState.
derivative == FreeVector::Zero());
167 ps.stepping.covTransport =
false;
168 double h = sls.
step(ps).value();
169 BOOST_TEST(ps.stepping.stepSize == ndir * stepSize);
170 BOOST_TEST(ps.stepping.stepSize == h);
172 BOOST_TEST(ps.stepping.pos.norm() > newPos.norm());
173 BOOST_TEST(ps.stepping.dir == newMom.normalized());
174 BOOST_TEST(ps.stepping.p == newMom.norm());
175 BOOST_TEST(ps.stepping.q == charge);
176 BOOST_TEST(ps.stepping.t < newTime);
177 BOOST_TEST(ps.stepping.derivative == FreeVector::Zero());
178 BOOST_TEST(ps.stepping.jacTransport == FreeMatrix::Identity());
180 ps.stepping.covTransport =
true;
181 double h2 = sls.
step(ps).value();
182 BOOST_TEST(ps.stepping.stepSize == ndir * stepSize);
185 BOOST_TEST(ps.stepping.pos.norm() > newPos.norm());
186 BOOST_TEST(ps.stepping.dir == newMom.normalized());
187 BOOST_TEST(ps.stepping.p == newMom.norm());
188 BOOST_TEST(ps.stepping.q == charge);
189 BOOST_TEST(ps.stepping.t < newTime);
190 BOOST_TEST(ps.stepping.derivative != FreeVector::Zero());
191 BOOST_TEST(ps.stepping.jacTransport != FreeMatrix::Identity());
194 auto plane = Surface::makeShared<PlaneSurface>(
pos, mom.normalized());
197 stepSize, tolerance);
200 auto targetSurface = Surface::makeShared<PlaneSurface>(
201 pos + ndir * 2. * mom.normalized(), mom.normalized());
211 BOOST_TEST(slsState.
stepSize == 2.);
212 slsState.
stepSize = ndir * stepSize;
218 BOOST_TEST(slsState.
stepSize == 2.);
227 BOOST_TEST(boundPars.covariance().has_value());
228 BOOST_TEST(*boundPars.covariance() != cov);
235 -1. * charge, 2. * time, targetSurface);
236 sls.
update(slsState, bpTarget);
237 BOOST_TEST(slsState.
pos == 2. * pos);
238 BOOST_TEST(slsState.
dir == mom.normalized());
239 BOOST_TEST(slsState.
p == 2. * mom.norm());
240 BOOST_TEST(slsState.
q == 1. * charge);
241 BOOST_TEST(slsState.
t == 2. * time);
246 BOOST_TEST(slsState.
cov != cov);
247 BOOST_TEST(slsState.
jacToGlobal != BoundToFreeMatrix::Zero());
248 BOOST_TEST(slsState.
jacTransport == FreeMatrix::Identity());
249 BOOST_TEST(slsState.
derivative == FreeVector::Zero());