1515#include " traccc/finding/candidate_link.hpp"
1616#include " traccc/finding/details/combinatorial_kalman_filter_types.hpp"
1717#include " traccc/finding/finding_config.hpp"
18+ #include " traccc/finding/propagation_data.hpp"
1819#include " traccc/fitting/kalman_filter/gain_matrix_updater.hpp"
1920#include " traccc/fitting/kalman_filter/is_line_visitor.hpp"
2021#include " traccc/fitting/status_codes.hpp"
@@ -63,7 +64,7 @@ combinatorial_kalman_filter(
6364 const measurement_collection_types::const_view& measurements_view,
6465 const bound_track_parameters_collection_types::const_view& seeds_view,
6566 const finding_config& config, vecmem::memory_resource& mr,
66- const Logger& log) {
67+ const Logger& /* log*/ ) {
6768
6869 assert (config.min_step_length_for_next_surface >
6970 math::fabs (config.propagation .navigation .overstep_tolerance ) &&
@@ -77,7 +78,8 @@ combinatorial_kalman_filter(
7778 using scalar_type = detray::dscalar<algebra_type>;
7879
7980 // Create a logger.
80- auto logger = [&log]() -> const Logger& { return log; };
81+ // @TODO: Turn back on, once detray can use the ACTS logger
82+ // auto logger = [&log]() -> const Logger& { return log; };
8183
8284 /* ****************************************************************
8385 * Measurement Operations
@@ -144,12 +146,13 @@ combinatorial_kalman_filter(
144146 for (unsigned int step = 0u ; step < config.max_track_candidates_per_track ;
145147 step++) {
146148
147- TRACCC_VERBOSE (" Starting step "
148- << step + 1 << " / "
149- << config.max_track_candidates_per_track );
149+ TRACCC_VERBOSE_HOST (" Starting step "
150+ << step + 1 << " / "
151+ << config.max_track_candidates_per_track );
150152
151153 // Iterate over input parameters
152154 const std::size_t n_in_params = in_params.size ();
155+ TRACCC_VERBOSE_HOST (" No. Params: " << n_in_params);
153156
154157 // Terminate if there is no parameter to proceed
155158 if (n_in_params == 0 ) {
@@ -199,10 +202,13 @@ combinatorial_kalman_filter(
199202 : links[step - 1 ][param_to_link[step - 1 ][in_param_id]]
200203 .ndf_sum );
201204
202- TRACCC_VERBOSE (" Processing input parameter "
203- << in_param_id + 1 << " / " << n_in_params << " : "
204- << in_param << " (orig_param_id=" << orig_param_id
205- << " , skip_counter=" << skip_counter << " )" );
205+ TRACCC_VERBOSE_HOST (" Processing input parameter "
206+ << in_param_id + 1 << " / " << n_in_params);
207+ TRACCC_VERBOSE_HOST (" -> orig_param_id="
208+ << orig_param_id << " , skip_counter="
209+ << skip_counter << " \n Vec:\n "
210+ << in_param.vector ());
211+ TRACCC_DEBUG_HOST (" Cov:\n " << in_param.covariance ());
206212
207213 /* ************************
208214 * Material interaction
@@ -211,8 +217,8 @@ combinatorial_kalman_filter(
211217 // Get surface corresponding to bound params
212218 const detray::tracking_surface sf{det, in_param.surface_link ()};
213219
214- TRACCC_VERBOSE (
215- " free params: " << sf.bound_to_free_vector ({}, in_param));
220+ TRACCC_VERBOSE_HOST ( " Free params: \n "
221+ << sf.bound_to_free_vector ({}, in_param));
216222
217223 // Apply interactor
218224 if (sf.has_material ()) {
@@ -241,7 +247,10 @@ combinatorial_kalman_filter(
241247 best_links;
242248
243249 // Iterate over the measurements
250+ TRACCC_VERBOSE_HOST (" No. measurements: " << (up - lo));
244251 for (unsigned int meas_id = lo; meas_id < up; meas_id++) {
252+ TRACCC_VERBOSE_HOST (" Testing measurement: " << meas_id);
253+
245254 // The measurement on surface to handle.
246255 const measurement& meas = measurements.at (meas_id);
247256
@@ -258,9 +267,13 @@ combinatorial_kalman_filter(
258267
259268 const traccc::scalar chi2 = trk_state.filtered_chi2 ();
260269
270+ TRACCC_DEBUG_HOST (" KF status: " << fitter_debug_msg{res}());
271+
261272 // The chi2 from Kalman update should be less than chi2_max
262273 if (res == kalman_fitter_status::SUCCESS &&
263- chi2 < config.chi2_max ) {
274+ (chi2 < config.chi2_max )) {
275+
276+ TRACCC_VERBOSE_HOST (" Found measurement: " << meas_id);
264277
265278 best_links.push_back (
266279 {{.step = step,
@@ -285,9 +298,9 @@ combinatorial_kalman_filter(
285298 const unsigned int n_branches =
286299 std::min (config.max_num_branches_per_surface ,
287300 static_cast <unsigned int >(best_links.size ()));
288- TRACCC_VERBOSE (" Found " << n_branches << " branches for step "
289- << step << " and input parameter "
290- << in_param_id);
301+ TRACCC_VERBOSE_HOST (" Found " << n_branches << " branches for step "
302+ << step << " and input parameter "
303+ << in_param_id + 1 );
291304 for (unsigned int i = 0 ; i < n_branches; ++i) {
292305 const auto & [link, filtered_params] = best_links[i];
293306
@@ -296,9 +309,9 @@ combinatorial_kalman_filter(
296309
297310 // Add the updated parameter to the updated parameters
298311 updated_params.push_back (filtered_params);
299- TRACCC_VERBOSE (" updated_params["
300- << updated_params.size () - 1
301- << " ] = " << updated_params.back ());
312+ TRACCC_DEBUG_HOST (" updated_params["
313+ << updated_params.size () - 1
314+ << " ] = " << updated_params.back ());
302315 }
303316
304317 /* ****************************************************************
@@ -319,10 +332,12 @@ combinatorial_kalman_filter(
319332 .chi2_sum = prev_chi2_sum,
320333 .ndf_sum = prev_ndf_sum});
321334
335+ TRACCC_VERBOSE_HOST (" Hole state created" );
336+
322337 updated_params.push_back (in_param);
323- TRACCC_VERBOSE (" updated_params["
324- << updated_params.size () - 1
325- << " ] = " << updated_params.back ());
338+ TRACCC_DEBUG_HOST (" updated_params["
339+ << updated_params.size () - 1
340+ << " ] = " << updated_params.back ());
326341 }
327342 }
328343
@@ -439,6 +454,8 @@ combinatorial_kalman_filter(
439454 }
440455
441456 if (this_is_dominated) {
457+ TRACCC_VERBOSE_HOST (
458+ " Track is dead (deduplication)!" );
442459 param_liveness.at (tracks.at (i)) = 0u ;
443460 break ;
444461 }
@@ -466,11 +483,15 @@ combinatorial_kalman_filter(
466483 // link to be a tip
467484 if (links.at (step).at (link_id).n_skipped >
468485 config.max_num_skipping_per_cand ) {
486+ TRACCC_WARNING_HOST (
487+ " Create tip: Max no. of holes reached! Bound param:\n "
488+ << updated_params[link_id].vector ());
469489 tips.push_back ({step, link_id});
470490 continue ;
471491 }
472492
473493 const auto & param = updated_params[link_id];
494+
474495 // Create propagator state
475496 typename traccc::details::ckf_propagator_t <
476497 detector_t , bfield_t >::state propagation (param, field, det);
@@ -489,15 +510,19 @@ combinatorial_kalman_filter(
489510 typename detector_t ::algebra_type>::state s3{prop_cfg};
490511 typename detray::momentum_aborter<scalar_type>::state s4{};
491512 typename ckf_aborter::state s5;
513+
492514 // Update the actor config
493515 s4.min_pT (static_cast <scalar_type>(config.min_pT ));
494516 s4.min_p (static_cast <scalar_type>(config.min_p ));
495517 s5.min_step_length = config.min_step_length_for_next_surface ;
496518 s5.max_count = config.max_step_counts_for_next_surface ;
497519
498520 // Propagate to the next surface
521+ TRACCC_DEBUG_HOST (" Propagating... " );
499522 propagator.propagate (propagation,
500523 detray::tie (s0, s1, s2, s3, s4, s5));
524+ TRACCC_DEBUG_HOST (" Finished propagation: On surface "
525+ << propagation._navigation .barcode ());
501526
502527 // If a surface found, add the parameter for the next
503528 // step
@@ -511,14 +536,18 @@ combinatorial_kalman_filter(
511536 const scalar theta = out_param.theta ();
512537 if (theta <= 0 .f ||
513538 theta >= 2 .f * constant<traccc::scalar>::pi) {
539+ TRACCC_ERROR_HOST (" Theta is hit pole after propagation" );
514540 valid_track = false ;
515541 }
516542
517543 if (!std::isfinite (out_param.phi ())) {
544+ TRACCC_ERROR_HOST (
545+ " Phi is infinite after propagation (Matrix inversion)" );
518546 valid_track = false ;
519547 }
520548
521549 if (math::fabs (out_param.qop ()) == 0 .f ) {
550+ TRACCC_ERROR_HOST (" q over p is zero after propagation" );
522551 valid_track = false ;
523552 }
524553
@@ -531,13 +560,19 @@ combinatorial_kalman_filter(
531560 // tip
532561 if (!valid_track &&
533562 (step >= (config.min_track_candidates_per_track - 1u ))) {
563+ if (!s5.success ) {
564+ TRACCC_VERBOSE_HOST (" Create tip: No next sensitive found" );
565+ } else {
566+ TRACCC_VERBOSE_HOST (" Create tip: Encountered error" );
567+ }
534568 tips.push_back ({step, link_id});
535569 }
536570
537571 // If no more CKF step is expected, current candidate is
538572 // kept as a tip
539573 if (s5.success &&
540574 (step == (config.max_track_candidates_per_track - 1u ))) {
575+ TRACCC_ERROR_HOST (" Create tip: Max no. candidates" );
541576 tips.push_back ({step, link_id});
542577 }
543578 }
0 commit comments