From ce1b3639eccba7611d37bdee8c1c5d584a5684cb Mon Sep 17 00:00:00 2001 From: beomki-yeo <63090140+beomki-yeo@users.noreply.github.com> Date: Wed, 9 Oct 2024 11:45:19 +0200 Subject: [PATCH 1/2] Allow spacepoint formation only for 2D pixel measurements (#727) --- .../traccc/seeding/detail/spacepoint_formation.hpp | 5 +++++ core/include/traccc/seeding/impl/spacepoint_formation.ipp | 8 ++++++++ .../seeding/impl/spacepoint_formation_algorithm.ipp | 5 +++-- .../traccc/seeding/device/impl/form_spacepoints.ipp | 4 +++- 4 files changed, 19 insertions(+), 3 deletions(-) diff --git a/core/include/traccc/seeding/detail/spacepoint_formation.hpp b/core/include/traccc/seeding/detail/spacepoint_formation.hpp index 2cee88f1d5..dc702d0838 100644 --- a/core/include/traccc/seeding/detail/spacepoint_formation.hpp +++ b/core/include/traccc/seeding/detail/spacepoint_formation.hpp @@ -14,6 +14,11 @@ namespace traccc::details { +/// Function helping with checking a measurement obejct for spacepoint creation +/// +/// @param[in] measurement The input measurement +TRACCC_HOST_DEVICE inline bool is_valid_measurement(const measurement& meas); + /// Function helping with filling/setting up a spacepoint object /// /// @param[in] det The tracking geometry diff --git a/core/include/traccc/seeding/impl/spacepoint_formation.ipp b/core/include/traccc/seeding/impl/spacepoint_formation.ipp index 3e13fafc03..f41e41261f 100644 --- a/core/include/traccc/seeding/impl/spacepoint_formation.ipp +++ b/core/include/traccc/seeding/impl/spacepoint_formation.ipp @@ -15,6 +15,14 @@ namespace traccc::details { +TRACCC_HOST_DEVICE inline bool is_valid_measurement(const measurement& meas) { + // We use 2D (pixel) measurements only for spacepoint creation + if (meas.meas_dim == 2u) { + return true; + } + return false; +} + template TRACCC_HOST_DEVICE inline spacepoint create_spacepoint( const detector_t& det, const measurement& meas) { diff --git a/core/include/traccc/seeding/impl/spacepoint_formation_algorithm.ipp b/core/include/traccc/seeding/impl/spacepoint_formation_algorithm.ipp index 23fcc1450e..f25a5e9604 100644 --- a/core/include/traccc/seeding/impl/spacepoint_formation_algorithm.ipp +++ b/core/include/traccc/seeding/impl/spacepoint_formation_algorithm.ipp @@ -31,8 +31,9 @@ spacepoint_formation_algorithm::operator()( // Set up each spacepoint in the result container. for (const auto& meas : measurements) { - - result.push_back(details::create_spacepoint(det, meas)); + if (details::is_valid_measurement(meas)) { + result.push_back(details::create_spacepoint(det, meas)); + } } // Return the created container. diff --git a/device/common/include/traccc/seeding/device/impl/form_spacepoints.ipp b/device/common/include/traccc/seeding/device/impl/form_spacepoints.ipp index 7c1b1941e8..64ab39d5b6 100644 --- a/device/common/include/traccc/seeding/device/impl/form_spacepoints.ipp +++ b/device/common/include/traccc/seeding/device/impl/form_spacepoints.ipp @@ -39,7 +39,9 @@ TRACCC_HOST_DEVICE inline void form_spacepoints( const auto& meas = measurements.at(globalIndex); // Fill the spacepoint using the common function. - spacepoints.push_back(details::create_spacepoint(det, meas)); + if (details::is_valid_measurement(meas)) { + spacepoints.push_back(details::create_spacepoint(det, meas)); + } } } // namespace traccc::device From 2f06dc94eace78c4c9647d74d7b34c6986d201e0 Mon Sep 17 00:00:00 2001 From: beomki-yeo <63090140+beomki-yeo@users.noreply.github.com> Date: Thu, 10 Oct 2024 11:51:44 +0200 Subject: [PATCH 2/2] Fix the bug that the particle hypothesis is not changed as intended (#733) --- core/include/traccc/fitting/kalman_filter/kalman_actor.hpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/include/traccc/fitting/kalman_filter/kalman_actor.hpp b/core/include/traccc/fitting/kalman_filter/kalman_actor.hpp index 12ba2a9ef8..920f31f6fc 100644 --- a/core/include/traccc/fitting/kalman_filter/kalman_actor.hpp +++ b/core/include/traccc/fitting/kalman_filter/kalman_actor.hpp @@ -113,8 +113,8 @@ struct kalman_actor : detray::actor { // Change the charge of hypothesized particles when the sign of qop // is changed (This rarely happens when qop is set with a poor seed // resolution) - detail::correct_particle_hypothesis(stepping._ptc, - trk_state.filtered()); + propagation.set_particle(detail::correct_particle_hypothesis( + stepping._ptc, propagation._stepping._bound_params)); // Update iterator actor_state.next();