Skip to content

Commit 31e756d

Browse files
committed
update to detray v0.104.1
1 parent acf74f5 commit 31e756d

File tree

16 files changed

+123
-35
lines changed

16 files changed

+123
-35
lines changed

core/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ traccc_add_library( traccc_core core TYPE SHARED
8080
# Finding algorithmic code
8181
"include/traccc/finding/candidate_link.hpp"
8282
"include/traccc/finding/finding_config.hpp"
83+
"include/traccc/finding/propagation_data.hpp"
8384
"include/traccc/finding/actors/ckf_aborter.hpp"
8485
"include/traccc/finding/actors/interaction_register.hpp"
8586
"include/traccc/finding/details/combinatorial_kalman_filter_types.hpp"

core/include/traccc/finding/details/combinatorial_kalman_filter.hpp

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -126,8 +126,10 @@ combinatorial_kalman_filter(
126126
std::vector<std::pair<unsigned int, unsigned int>> tips;
127127

128128
// Create propagator
129+
auto prop_cfg{config.propagation};
130+
prop_cfg.navigation.estimate_scattering_noise = false;
129131
traccc::details::ckf_propagator_t<detector_t, bfield_t> propagator(
130-
config.propagation);
132+
prop_cfg);
131133

132134
// Create the input seeds container.
133135
bound_track_parameters_collection_types::const_device seeds{seeds_view};
@@ -141,7 +143,6 @@ combinatorial_kalman_filter(
141143

142144
for (unsigned int step = 0u; step < config.max_track_candidates_per_track;
143145
step++) {
144-
145146
TRACCC_VERBOSE("Starting step "
146147
<< step + 1 << " / "
147148
<< config.max_track_candidates_per_track);
@@ -248,7 +249,7 @@ combinatorial_kalman_filter(
248249
auto trk_state =
249250
edm::make_track_state<algebra_type>(measurements, meas_id);
250251

251-
const bool is_line = sf.template visit_mask<is_line_visitor>();
252+
const bool is_line = detail::is_line(sf);
252253

253254
// Run the Kalman update on a copy of the track parameters
254255
const kalman_fitter_status res =
@@ -484,8 +485,8 @@ combinatorial_kalman_filter(
484485
traccc::details::ckf_interactor_t::state s2;
485486
typename interaction_register<
486487
traccc::details::ckf_interactor_t>::state s1{s2};
487-
// typename detray::parameter_resetter<
488-
// typename detector_t::algebra_type>::state s3{};
488+
typename detray::parameter_resetter<
489+
typename detector_t::algebra_type>::state s3{prop_cfg};
489490
typename detray::momentum_aborter<scalar_type>::state s4{};
490491
typename ckf_aborter::state s5;
491492
// Update the actor config
@@ -495,7 +496,8 @@ combinatorial_kalman_filter(
495496
s5.max_count = config.max_step_counts_for_next_surface;
496497

497498
// Propagate to the next surface
498-
propagator.propagate(propagation, detray::tie(s0, s1, s2, s4, s5));
499+
propagator.propagate(propagation,
500+
detray::tie(s0, s1, s2, s3, s4, s5));
499501

500502
// If a surface found, add the parameter for the next
501503
// step
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
2+
/** TRACCC library, part of the ACTS project (R&D line)
3+
*
4+
* (c) 2025 CERN for the benefit of the ACTS project
5+
*
6+
* Mozilla Public License Version 2.0
7+
*/
8+
9+
#pragma once
10+
11+
// Detray include(s).
12+
#include <detray/definitions/indexing.hpp>
13+
14+
namespace traccc {
15+
16+
/// Data from the propagation loop that has to be kept between CKF steps
17+
struct propagation_data {
18+
/// The surface that was visited before the current one (overlaps
19+
/// resolution)
20+
detray::dindex prev_surface{detray::dindex_invalid};
21+
/// The current sirface the CKF stopped at (validation purposes)
22+
detray::dindex current_surface{detray::dindex_invalid};
23+
24+
/// Is the current surface hit in the extended tolerance band?
25+
bool is_edge{false};
26+
};
27+
28+
} // namespace traccc

core/include/traccc/fitting/details/kalman_fitting.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ typename edm::track_container<algebra_t>::host kalman_fitting(
8888
result_tracks_device.at(result_tracks_device.size() - 1),
8989
typename edm::track_state_collection<algebra_t>::device{
9090
vecmem::get_data(result.states)},
91-
measurements, seqs_buffer);
91+
measurements, seqs_buffer, fitter.config().propagation);
9292

9393
// Run the fitter. The status that it returns is not used here. The main
9494
// failure modes are saved onto the fitted track itself. Not sure what

core/include/traccc/fitting/kalman_filter/is_line_visitor.hpp

Lines changed: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,20 +7,31 @@
77

88
#pragma once
99

10+
#include <detray/geometry/mask.hpp>
1011
#include <detray/geometry/shapes/line.hpp>
12+
#include <detray/geometry/surface.hpp>
1113

1214
#include "traccc/definitions/qualifiers.hpp"
1315

14-
namespace traccc {
16+
namespace traccc::detail {
1517

16-
struct is_line_visitor {
17-
template <typename mask_group_t, typename index_t>
18-
[[nodiscard]] TRACCC_HOST_DEVICE inline bool operator()(
19-
const mask_group_t& /*mask_group*/, const index_t& /*index*/) const {
20-
using shape_type = typename mask_group_t::value_type::shape;
21-
return std::is_same_v<shape_type, detray::line<true>> ||
22-
std::is_same_v<shape_type, detray::line<false>>;
18+
/// @returns true if the surface has "line" shape
19+
template <typename detector_t>
20+
[[nodiscard]] TRACCC_HOST_DEVICE bool constexpr is_line(
21+
const detray::geometry::surface<detector_t> sf) {
22+
using algebra_t = typename detector_t::algebra_type;
23+
using straw_tube = detray::mask<detray::line<false>, algebra_t>;
24+
using wire_cell = detray::mask<detray::line<true>, algebra_t>;
25+
26+
if constexpr (detector_t::masks::template is_defined<straw_tube>() ||
27+
detector_t::masks::template is_defined<wire_cell>()) {
28+
return (sf.shape_id() ==
29+
detector_t::masks::template get_id<straw_tube>()) ||
30+
(sf.shape_id() ==
31+
detector_t::masks::template get_id<wire_cell>());
32+
} else {
33+
return false;
2334
}
2435
};
2536

26-
} // namespace traccc
37+
} // namespace traccc::detail

core/include/traccc/fitting/kalman_filter/kalman_actor.hpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ struct kalman_actor : detray::actor {
164164
// Run Kalman Gain Updater
165165
const auto sf = navigation.get_surface();
166166

167-
const bool is_line = sf.template visit_mask<is_line_visitor>();
167+
const bool is_line = detail::is_line(sf);
168168

169169
kalman_fitter_status res = kalman_fitter_status::SUCCESS;
170170

@@ -215,7 +215,9 @@ struct kalman_actor : detray::actor {
215215
actor_state.next();
216216

217217
// Flag renavigation of the current candidate
218-
navigation.set_high_trust();
218+
if (math::fabs(navigation()) > 1.f * unit<float>::um) {
219+
navigation.set_high_trust();
220+
}
219221
}
220222
}
221223
};

core/include/traccc/fitting/kalman_filter/kalman_fitter.hpp

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -110,28 +110,31 @@ class kalman_fitter {
110110
track_states,
111111
const measurement_collection_types::const_device& measurements,
112112
vecmem::data::vector_view<detray::geometry::barcode>
113-
sequence_buffer)
113+
sequence_buffer,
114+
const detray::propagation::config& prop_cfg)
114115
: m_fit_actor_state{track, track_states, measurements},
115116
m_sequencer_state(
116117
vecmem::device_vector<detray::geometry::barcode>(
117118
sequence_buffer)),
119+
m_parameter_resetter{prop_cfg},
118120
m_fit_res{track},
119121
m_sequence_buffer(sequence_buffer) {}
120122

121123
/// @return the actor chain state
122124
TRACCC_HOST_DEVICE
123125
typename forward_actor_chain_type::state_ref_tuple operator()() {
124126
return detray::tie(m_aborter_state, m_interactor_state,
125-
m_fit_actor_state, m_sequencer_state,
126-
m_step_aborter_state);
127+
m_fit_actor_state, m_parameter_resetter,
128+
m_sequencer_state, m_step_aborter_state);
127129
}
128130

129131
/// @return the actor chain state
130132
TRACCC_HOST_DEVICE
131133
typename backward_actor_chain_type::state_ref_tuple
132134
backward_actor_state() {
133135
return detray::tie(m_aborter_state, m_fit_actor_state,
134-
m_interactor_state, m_step_aborter_state);
136+
m_interactor_state, m_parameter_resetter,
137+
m_step_aborter_state);
135138
}
136139

137140
/// Individual actor states
@@ -140,6 +143,7 @@ class kalman_fitter {
140143
typename forward_fit_actor::state m_fit_actor_state;
141144
typename barcode_sequencer::state m_sequencer_state;
142145
kalman_step_aborter::state m_step_aborter_state{};
146+
typename resetter::state m_parameter_resetter{};
143147

144148
/// Fitting result per track
145149
typename edm::track_collection<algebra_type>::device::proxy_type

device/common/include/traccc/finding/device/impl/find_tracks.ipp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ TRACCC_HOST_DEVICE inline void find_tracks(
209209

210210
const detray::tracking_surface sf{det, in_par.surface_link()};
211211

212-
const bool is_line = sf.template visit_mask<is_line_visitor>();
212+
const bool is_line = detail::is_line(sf);
213213

214214
// Run the Kalman update
215215
const kalman_fitter_status res =

device/common/include/traccc/finding/device/impl/propagate_to_next_surface.ipp

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,9 @@ TRACCC_HOST_DEVICE inline void propagate_to_next_surface(
6262
const bound_track_parameters<> in_par = params.at(param_id);
6363

6464
// Create propagator
65-
propagator_t propagator(cfg.propagation);
65+
auto prop_cfg{cfg.propagation};
66+
prop_cfg.navigation.estimate_scattering_noise = false;
67+
propagator_t propagator(prop_cfg);
6668

6769
// Create propagator state
6870
typename propagator_t::state propagation(in_par, payload.field_data, det);
@@ -87,9 +89,8 @@ TRACCC_HOST_DEVICE inline void propagate_to_next_surface(
8789
typename detray::detail::tuple_element<2, actor_tuple_type>::type::state s2{
8890
s3};
8991
// Parameter resetter
90-
// typename detray::detail::tuple_element<4, actor_tuple_type>::type::state
91-
// s4{
92-
// cfg.propagation};
92+
typename detray::detail::tuple_element<4, actor_tuple_type>::type::state s4{
93+
prop_cfg};
9394
// Momentum aborter
9495
typename detray::detail::tuple_element<5, actor_tuple_type>::type::state s5;
9596
// CKF aborter
@@ -101,7 +102,7 @@ TRACCC_HOST_DEVICE inline void propagate_to_next_surface(
101102
s5.min_p(static_cast<scalar_t>(cfg.min_p));
102103

103104
// Propagate to the next surface
104-
propagator.propagate(propagation, detray::tie(s0, s2, s3, s5, s6));
105+
propagator.propagate(propagation, detray::tie(s0, s2, s3, s4, s5, s6));
105106

106107
// If a surface found, add the parameter for the next step
107108
if (s6.success) {

device/common/include/traccc/fitting/device/fit_backward.hpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,8 @@ TRACCC_HOST_DEVICE inline void fit_backward(
3939
if (param_liveness.at(param_id) > 0u) {
4040
typename fitter_t::state fitter_state(
4141
track, tracks.states, tracks.measurements,
42-
*(payload.barcodes_view.ptr() + param_id));
42+
*(payload.barcodes_view.ptr() + param_id),
43+
fitter.config().propagation);
4344

4445
kalman_fitter_status fit_status = fitter.smooth(fitter_state);
4546

0 commit comments

Comments
 (0)