Skip to content

Commit 13459d3

Browse files
committed
Test momentum
1 parent 17ff2eb commit 13459d3

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

tests/integration_tests/cpu/propagator/propagator.cpp

+21
Original file line numberDiff line numberDiff line change
@@ -508,6 +508,7 @@ TEST_P(PropagatorWithRkStepperDirectNavigator, direct_navigator) {
508508
// Propagate the entire detector
509509
// state.do_debug = true;
510510
ASSERT_TRUE(p.propagate(state, actor_states));
511+
// std::cout << "Normal Navigation" << std::endl;
511512
// std::cout << state.debug_stream.str() << std::endl;
512513

513514
if (seqs_device.size() > 0) {
@@ -518,8 +519,13 @@ TEST_P(PropagatorWithRkStepperDirectNavigator, direct_navigator) {
518519
direct_propagator_t::state direct_forward_state(track, bfield, det,
519520
seqs_device);
520521

522+
// direct_forward_state.do_debug = true;
521523
ASSERT_TRUE(
522524
direct_p.propagate(direct_forward_state, direct_actor_states));
525+
// std::cout << "Direct navigaiton in forward direction" <<
526+
// std::endl; std::cout << direct_forward_state.debug_stream.str()
527+
// << std::endl;
528+
523529
// Check if all surfaces in the sequence are encountered
524530
ASSERT_TRUE(direct_forward_state._navigation.is_complete());
525531

@@ -529,6 +535,21 @@ TEST_P(PropagatorWithRkStepperDirectNavigator, direct_navigator) {
529535
direct_backward_state._navigation.set_direction(
530536
detray::navigation::direction::e_backward);
531537

538+
const auto ptc = state._stepping.particle_hypothesis();
539+
ASSERT_EQ(
540+
ptc.pdg_num(),
541+
direct_forward_state._stepping.particle_hypothesis().pdg_num());
542+
const auto q = ptc.charge();
543+
544+
// The initial momentum should be higher than the momentum at the
545+
// last surface
546+
ASSERT_GE(track.p(q),
547+
static_cast<float>(state._stepping.bound_params().p(q)));
548+
ASSERT_FLOAT_EQ(
549+
static_cast<float>(state._stepping.bound_params().p(q)),
550+
static_cast<float>(
551+
direct_forward_state._stepping.bound_params().p(q)));
552+
532553
ASSERT_TRUE(
533554
direct_p.propagate(direct_backward_state, direct_actor_states));
534555
// Check if all surfaces in the sequence are encountered

0 commit comments

Comments
 (0)