From 79aeb854f19f97424a126daaa24fcf360abeb64d Mon Sep 17 00:00:00 2001 From: Shima Shimizu Date: Tue, 20 Feb 2024 13:54:52 +0900 Subject: [PATCH 1/6] proper treatment of annulus measurements in track_state --- core/include/traccc/edm/track_state.hpp | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/core/include/traccc/edm/track_state.hpp b/core/include/traccc/edm/track_state.hpp index 4b17dae433..0d65f40824 100644 --- a/core/include/traccc/edm/track_state.hpp +++ b/core/include/traccc/edm/track_state.hpp @@ -77,7 +77,11 @@ struct track_state { "The measurement dimension should be 1 or 2"); matrix_type ret; - matrix_operator().element(ret, 0, 0) = m_measurement.local[0]; + if(m_measurement.subs.get_indices()[0]==0) + matrix_operator().element(ret, 0, 0) = m_measurement.local[0]; + else + matrix_operator().element(ret, 0, 0) = m_measurement.local[1]; + if constexpr (D == 2u) { matrix_operator().element(ret, 1, 0) = m_measurement.local[1]; } @@ -91,7 +95,11 @@ struct track_state { "The measurement dimension should be 1 or 2"); matrix_type ret; - matrix_operator().element(ret, 0, 0) = m_measurement.variance[0]; + if(m_measurement.subs.get_indices()[0]==0) + matrix_operator().element(ret, 0, 0) = m_measurement.variance[0]; + else + matrix_operator().element(ret, 0, 0) = m_measurement.variance[1]; + if constexpr (D == 2u) { matrix_operator().element(ret, 0, 1) = 0.f; matrix_operator().element(ret, 1, 0) = 0.f; @@ -176,4 +184,4 @@ using track_state_collection_types = collection_types>; using track_state_container_types = container_types, track_state>; -} // namespace traccc \ No newline at end of file +} // namespace traccc From 35a2ec1e9365d3b510679f61225829d60d607124 Mon Sep 17 00:00:00 2001 From: Shima Shimizu Date: Tue, 20 Feb 2024 14:01:59 +0900 Subject: [PATCH 2/6] proper treatment of annulus measurements in track_state --- core/include/traccc/edm/track_state.hpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/core/include/traccc/edm/track_state.hpp b/core/include/traccc/edm/track_state.hpp index 0d65f40824..761d9bfeb0 100644 --- a/core/include/traccc/edm/track_state.hpp +++ b/core/include/traccc/edm/track_state.hpp @@ -77,10 +77,10 @@ struct track_state { "The measurement dimension should be 1 or 2"); matrix_type ret; - if(m_measurement.subs.get_indices()[0]==0) - matrix_operator().element(ret, 0, 0) = m_measurement.local[0]; - else - matrix_operator().element(ret, 0, 0) = m_measurement.local[1]; + if (m_measurement.subs.get_indices()[0] == 0) + matrix_operator().element(ret, 0, 0) = m_measurement.local[0]; + else + matrix_operator().element(ret, 0, 0) = m_measurement.local[1]; if constexpr (D == 2u) { matrix_operator().element(ret, 1, 0) = m_measurement.local[1]; @@ -95,10 +95,10 @@ struct track_state { "The measurement dimension should be 1 or 2"); matrix_type ret; - if(m_measurement.subs.get_indices()[0]==0) - matrix_operator().element(ret, 0, 0) = m_measurement.variance[0]; - else - matrix_operator().element(ret, 0, 0) = m_measurement.variance[1]; + if (m_measurement.subs.get_indices()[0] == 0) + matrix_operator().element(ret, 0, 0) = m_measurement.variance[0]; + else + matrix_operator().element(ret, 0, 0) = m_measurement.variance[1]; if constexpr (D == 2u) { matrix_operator().element(ret, 0, 1) = 0.f; From afeec162fe30c98cde47a6f4638d603b07e028e0 Mon Sep 17 00:00:00 2001 From: Shima Shimizu Date: Thu, 22 Feb 2024 11:32:03 +0900 Subject: [PATCH 3/6] explicit use of subspace indices --- core/include/traccc/edm/track_state.hpp | 37 +++++++++++++++++-------- 1 file changed, 25 insertions(+), 12 deletions(-) diff --git a/core/include/traccc/edm/track_state.hpp b/core/include/traccc/edm/track_state.hpp index 761d9bfeb0..7005cd9085 100644 --- a/core/include/traccc/edm/track_state.hpp +++ b/core/include/traccc/edm/track_state.hpp @@ -77,13 +77,16 @@ struct track_state { "The measurement dimension should be 1 or 2"); matrix_type ret; - if (m_measurement.subs.get_indices()[0] == 0) + if (m_measurement.subs.get_indices()[0] == e_bound_loc0) { matrix_operator().element(ret, 0, 0) = m_measurement.local[0]; - else + if constexpr (D == 2u) { + matrix_operator().element(ret, 1, 0) = m_measurement.local[1]; + } + } else if (m_measurement.subs.get_indices()[0] == e_bound_loc1) { matrix_operator().element(ret, 0, 0) = m_measurement.local[1]; - - if constexpr (D == 2u) { - matrix_operator().element(ret, 1, 0) = m_measurement.local[1]; + if constexpr (D == 2u) { + matrix_operator().element(ret, 1, 0) = m_measurement.local[0]; + } } return ret; } @@ -95,15 +98,25 @@ struct track_state { "The measurement dimension should be 1 or 2"); matrix_type ret; - if (m_measurement.subs.get_indices()[0] == 0) + if (m_measurement.subs.get_indices()[0] == e_bound_loc0) { + matrix_operator().element(ret, 0, 0) = m_measurement.variance[0]; - else - matrix_operator().element(ret, 0, 0) = m_measurement.variance[1]; + if constexpr (D == 2u) { + matrix_operator().element(ret, 0, 1) = 0.f; + matrix_operator().element(ret, 1, 0) = 0.f; + matrix_operator().element(ret, 1, 1) = + m_measurement.variance[1]; + } - if constexpr (D == 2u) { - matrix_operator().element(ret, 0, 1) = 0.f; - matrix_operator().element(ret, 1, 0) = 0.f; - matrix_operator().element(ret, 1, 1) = m_measurement.variance[1]; + } else if (m_measurement.subs.get_indices()[0] == e_bound_loc1) { + + matrix_operator().element(ret, 0, 0) = m_measurement.variance[1]; + if constexpr (D == 2u) { + matrix_operator().element(ret, 0, 1) = 0.f; + matrix_operator().element(ret, 1, 0) = 0.f; + matrix_operator().element(ret, 1, 1) = + m_measurement.variance[0]; + } } return ret; } From 5175ea76e2572c3876836a197499f681b0b44ca6 Mon Sep 17 00:00:00 2001 From: Shima Shimizu Date: Thu, 22 Feb 2024 15:29:10 +0900 Subject: [PATCH 4/6] additional else to avoid uninitialized use of matrix ret --- core/include/traccc/edm/track_state.hpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/core/include/traccc/edm/track_state.hpp b/core/include/traccc/edm/track_state.hpp index 7005cd9085..4bb7e2307d 100644 --- a/core/include/traccc/edm/track_state.hpp +++ b/core/include/traccc/edm/track_state.hpp @@ -87,7 +87,13 @@ struct track_state { if constexpr (D == 2u) { matrix_operator().element(ret, 1, 0) = m_measurement.local[0]; } + } else { // same as e_bound_loc0 + matrix_operator().element(ret, 0, 0) = m_measurement.local[0]; + if constexpr (D == 2u) { + matrix_operator().element(ret, 1, 0) = m_measurement.local[1]; + } } + return ret; } @@ -117,6 +123,15 @@ struct track_state { matrix_operator().element(ret, 1, 1) = m_measurement.variance[0]; } + } else { // same as e_bound_loc0 + + matrix_operator().element(ret, 0, 0) = m_measurement.variance[0]; + if constexpr (D == 2u) { + matrix_operator().element(ret, 0, 1) = 0.f; + matrix_operator().element(ret, 1, 0) = 0.f; + matrix_operator().element(ret, 1, 1) = + m_measurement.variance[1]; + } } return ret; } From 9e1179673633c6d1ddcf375654c22b2bf8379cfe Mon Sep 17 00:00:00 2001 From: Shima Shimizu Date: Thu, 22 Feb 2024 23:05:25 +0900 Subject: [PATCH 5/6] insert assert in else blocks --- core/include/traccc/edm/track_state.hpp | 22 ++++++++-------------- 1 file changed, 8 insertions(+), 14 deletions(-) diff --git a/core/include/traccc/edm/track_state.hpp b/core/include/traccc/edm/track_state.hpp index 4bb7e2307d..7e6833e014 100644 --- a/core/include/traccc/edm/track_state.hpp +++ b/core/include/traccc/edm/track_state.hpp @@ -87,11 +87,10 @@ struct track_state { if constexpr (D == 2u) { matrix_operator().element(ret, 1, 0) = m_measurement.local[0]; } - } else { // same as e_bound_loc0 - matrix_operator().element(ret, 0, 0) = m_measurement.local[0]; - if constexpr (D == 2u) { - matrix_operator().element(ret, 1, 0) = m_measurement.local[1]; - } + } else { + assert( + "The measurement index out of e_bound_loc0 and e_bound_loc1 " + "should not happen."); } return ret; @@ -123,15 +122,10 @@ struct track_state { matrix_operator().element(ret, 1, 1) = m_measurement.variance[0]; } - } else { // same as e_bound_loc0 - - matrix_operator().element(ret, 0, 0) = m_measurement.variance[0]; - if constexpr (D == 2u) { - matrix_operator().element(ret, 0, 1) = 0.f; - matrix_operator().element(ret, 1, 0) = 0.f; - matrix_operator().element(ret, 1, 1) = - m_measurement.variance[1]; - } + } else { + assert( + "The measurement index out of e_bound_loc0 and e_bound_loc1 " + "should not happen."); } return ret; } From fec868d6f4716392247c86836169f7f9f4f737ee Mon Sep 17 00:00:00 2001 From: Shima Shimizu Date: Thu, 22 Feb 2024 23:26:51 +0900 Subject: [PATCH 6/6] avoid error messages of uninitialized use of matrices --- core/include/traccc/edm/track_state.hpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/core/include/traccc/edm/track_state.hpp b/core/include/traccc/edm/track_state.hpp index 7e6833e014..26d0776bc7 100644 --- a/core/include/traccc/edm/track_state.hpp +++ b/core/include/traccc/edm/track_state.hpp @@ -91,6 +91,10 @@ struct track_state { assert( "The measurement index out of e_bound_loc0 and e_bound_loc1 " "should not happen."); + matrix_operator().element(ret, 0, 0) = m_measurement.local[0]; + if constexpr (D == 2u) { + matrix_operator().element(ret, 1, 0) = m_measurement.local[1]; + } } return ret; @@ -126,6 +130,13 @@ struct track_state { assert( "The measurement index out of e_bound_loc0 and e_bound_loc1 " "should not happen."); + matrix_operator().element(ret, 0, 0) = m_measurement.variance[0]; + if constexpr (D == 2u) { + matrix_operator().element(ret, 0, 1) = 0.f; + matrix_operator().element(ret, 1, 0) = 0.f; + matrix_operator().element(ret, 1, 1) = + m_measurement.variance[1]; + } } return ret; }