9 #include <boost/test/unit_test.hpp>
24 using namespace Acts::UnitLiterals;
25 using namespace ActsFatras;
33 struct SterileContinuousProcess {
34 template <
typename generator_t>
37 std::vector<Particle> & )
const {
43 "Is not a continuous process");
45 "Is a point-like process");
48 struct FatalContinuousProcess {
49 template <
typename generator_t>
52 std::vector<Particle> & )
const {
57 "Is not a continuous process");
59 "Is a point-like process");
64 struct X0PointLikeProcess {
65 template <
typename generator_t>
66 std::pair<Scalar, Scalar> generatePathLimits(
67 generator_t & ,
const Particle & )
const {
68 return {0.5, std::numeric_limits<Scalar>::infinity()};
71 template <
typename generator_t>
73 std::vector<Particle> &generated)
const {
81 "Is a continuous process");
83 "Is not a point-like process");
88 struct L0PointLikeProcess {
89 template <
typename generator_t>
90 std::pair<Scalar, Scalar> generatePathLimits(
91 generator_t & ,
const Particle & )
const {
92 return {std::numeric_limits<Scalar>::infinity(), 1.5};
95 template <
typename generator_t>
97 std::vector<Particle> &generated)
const {
107 "Is a continuous process");
109 "Is not a point-like process");
112 std::ranlux48
rng{23};
116 std::vector<Particle> outgoing;
121 BOOST_AUTO_TEST_SUITE(FatrasInteractionList)
128 BOOST_CHECK(not l.
runContinuous(f.rng, f.slab, f.incoming, f.outgoing));
132 BOOST_CHECK_EQUAL(sel.x0Limit, std::numeric_limits<Scalar>::infinity());
133 BOOST_CHECK_EQUAL(sel.l0Limit, std::numeric_limits<Scalar>::infinity());
134 BOOST_CHECK_EQUAL(sel.x0Process, SIZE_MAX);
135 BOOST_CHECK_EQUAL(sel.l0Process, SIZE_MAX);
139 BOOST_CHECK(not l.
runPointLike(f.rng, 0
u, f.incoming, f.outgoing));
140 BOOST_CHECK_EQUAL(f.outgoing.size(), 0
u);
142 BOOST_CHECK(not l.
runPointLike(f.rng, SIZE_MAX, f.incoming, f.outgoing));
143 BOOST_CHECK_EQUAL(f.outgoing.size(), 0
u);
151 BOOST_CHECK(not l.
runContinuous(f.rng, f.slab, f.incoming, f.outgoing));
159 BOOST_CHECK(l.
runContinuous(f.rng, f.slab, f.incoming, f.outgoing));
167 BOOST_CHECK(physicsList.
runContinuous(f.rng, f.slab, f.incoming, f.outgoing));
169 physicsList.
disable<FatalContinuousProcess>();
171 not physicsList.
runContinuous(f.rng, f.slab, f.incoming, f.outgoing));
180 BOOST_CHECK_EQUAL(sel.x0Limit, 0.5);
181 BOOST_CHECK_EQUAL(sel.l0Limit, std::numeric_limits<Scalar>::infinity());
182 BOOST_CHECK_EQUAL(sel.x0Process, 0
u);
183 BOOST_CHECK_EQUAL(sel.l0Process, SIZE_MAX);
186 BOOST_CHECK(not l.
runPointLike(f.rng, 0
u, f.incoming, f.outgoing));
187 BOOST_CHECK_EQUAL(f.outgoing.size(), 1
u);
189 BOOST_CHECK(not l.
runPointLike(f.rng, SIZE_MAX, f.incoming, f.outgoing));
190 BOOST_CHECK_EQUAL(f.outgoing.size(), 1
u);
199 BOOST_CHECK_EQUAL(sel.x0Limit, std::numeric_limits<Scalar>::infinity());
200 BOOST_CHECK_EQUAL(sel.l0Limit, 1.5);
201 BOOST_CHECK_EQUAL(sel.x0Process, SIZE_MAX);
202 BOOST_CHECK_EQUAL(sel.l0Process, 0
u);
205 BOOST_CHECK(l.
runPointLike(f.rng, 0
u, f.incoming, f.outgoing));
206 BOOST_CHECK_EQUAL(f.outgoing.size(), 2
u);
208 BOOST_CHECK(not l.
runPointLike(f.rng, SIZE_MAX, f.incoming, f.outgoing));
209 BOOST_CHECK_EQUAL(f.outgoing.size(), 2
u);
218 BOOST_CHECK_EQUAL(sel.x0Limit, 0.5);
219 BOOST_CHECK_EQUAL(sel.l0Limit, 1.5);
220 BOOST_CHECK_EQUAL(sel.x0Process, 0
u);
221 BOOST_CHECK_EQUAL(sel.l0Process, 1
u);
224 BOOST_CHECK(not l.
runPointLike(f.rng, 0
u, f.incoming, f.outgoing));
225 BOOST_CHECK_EQUAL(f.outgoing.size(), 1
u);
227 BOOST_CHECK(l.
runPointLike(f.rng, 1
u, f.incoming, f.outgoing));
228 BOOST_CHECK_EQUAL(f.outgoing.size(), 3
u);
230 BOOST_CHECK(not l.
runPointLike(f.rng, SIZE_MAX, f.incoming, f.outgoing));
231 BOOST_CHECK_EQUAL(f.outgoing.size(), 3
u);
239 X0PointLikeProcess, L0PointLikeProcess>
243 BOOST_CHECK(l.runContinuous(f.rng, f.slab, f.incoming, f.outgoing));
245 l.
disable<FatalContinuousProcess>();
246 BOOST_CHECK(not l.runContinuous(f.rng, f.slab, f.incoming, f.outgoing));
249 l.
disable<X0PointLikeProcess>();
252 BOOST_CHECK_EQUAL(sel.x0Limit, std::numeric_limits<Scalar>::infinity());
253 BOOST_CHECK_EQUAL(sel.l0Limit, 1.5);
254 BOOST_CHECK_EQUAL(sel.x0Process, SIZE_MAX);
255 BOOST_CHECK_EQUAL(sel.l0Process, 3
u);
259 BOOST_CHECK(not l.runPointLike(f.rng, 2
u, f.incoming, f.outgoing));
260 BOOST_CHECK_EQUAL(f.outgoing.size(), 0
u);
262 BOOST_CHECK(l.runPointLike(f.rng, 3
u, f.incoming, f.outgoing));
263 BOOST_CHECK_EQUAL(f.outgoing.size(), 2
u);
267 l.disable<L0PointLikeProcess>();
269 auto sel = l.armPointLike(f.rng, f.incoming);
270 BOOST_CHECK_EQUAL(sel.x0Limit, std::numeric_limits<Scalar>::infinity());
271 BOOST_CHECK_EQUAL(sel.l0Limit, std::numeric_limits<Scalar>::infinity());
272 BOOST_CHECK_EQUAL(sel.x0Process, SIZE_MAX);
273 BOOST_CHECK_EQUAL(sel.l0Process, SIZE_MAX);
277 BOOST_CHECK(not l.runPointLike(f.rng, 2
u, f.incoming, f.outgoing));
278 BOOST_CHECK_EQUAL(f.outgoing.size(), 0
u);
280 BOOST_CHECK(not l.runPointLike(f.rng, 3
u, f.incoming, f.outgoing));
281 BOOST_CHECK_EQUAL(f.outgoing.size(), 0
u);
286 BOOST_CHECK(not l.runPointLike(f.rng, SIZE_MAX, f.incoming, f.outgoing));
287 BOOST_CHECK_EQUAL(f.outgoing.size(), 0
u);
290 BOOST_AUTO_TEST_SUITE_END()