Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

De-Template Track Finding, main branch (2024.10.01.) #722

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion benchmarks/common/benchmarks/toy_detector_benchmark.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

// Traccc include(s).
#include "traccc/definitions/common.hpp"
#include "traccc/finding/finding_algorithm.hpp"
#include "traccc/finding/finding_config.hpp"
#include "traccc/fitting/fitting_algorithm.hpp"
#include "traccc/io/utils.hpp"
#include "traccc/seeding/seeding_algorithm.hpp"
Expand Down
10 changes: 5 additions & 5 deletions benchmarks/cpu/toy_detector_cpu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#include "traccc/geometry/detector.hpp"

// Traccc algorithm include(s).
#include "traccc/finding/finding_algorithm.hpp"
#include "traccc/finding/ckf_algorithm.hpp"
#include "traccc/fitting/fitting_algorithm.hpp"
#include "traccc/seeding/seeding_algorithm.hpp"
#include "traccc/seeding/track_params_estimation.hpp"
Expand Down Expand Up @@ -62,8 +62,7 @@ BENCHMARK_F(ToyDetectorBenchmark, CPU)(benchmark::State& state) {
// Algorithms
traccc::seeding_algorithm sa(seeding_cfg, grid_cfg, filter_cfg, host_mr);
traccc::track_params_estimation tp(host_mr);
traccc::finding_algorithm<rk_stepper_type, host_navigator_type>
host_finding(finding_cfg);
traccc::host::ckf_algorithm host_finding(finding_cfg);
traccc::fitting_algorithm<host_fitter_type> host_fitting(fitting_cfg);

for (auto _ : state) {
Expand All @@ -82,8 +81,9 @@ BENCHMARK_F(ToyDetectorBenchmark, CPU)(benchmark::State& state) {
auto params = tp(spacepoints_per_event, seeds, B);

// Track finding with CKF
auto track_candidates =
host_finding(det, field, measurements_per_event, params);
auto track_candidates = host_finding(
det, field, vecmem::get_data(measurements_per_event),
vecmem::get_data(params));

// Track fitting with KF
auto track_states = host_fitting(det, field, track_candidates);
Expand Down
11 changes: 7 additions & 4 deletions core/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,14 @@ traccc_add_library( traccc_core core TYPE SHARED
"src/clusterization/clusterization_algorithm.cpp"
# Finding algorithmic code
"include/traccc/finding/candidate_link.hpp"
"include/traccc/finding/ckf_aborter.hpp"
"include/traccc/finding/finding_algorithm.hpp"
"include/traccc/finding/finding_algorithm.ipp"
"include/traccc/finding/finding_config.hpp"
"include/traccc/finding/interaction_register.hpp"
"include/traccc/finding/actors/ckf_aborter.hpp"
"include/traccc/finding/actors/interaction_register.hpp"
"src/finding/find_tracks.hpp"
"include/traccc/finding/ckf_algorithm.hpp"
"src/finding/ckf_algorithm.cpp"
"src/finding/ckf_algorithm_defdet_cfield.cpp"
"src/finding/ckf_algorithm_teldet_cfield.cpp"
# Fitting algorithmic code
"include/traccc/fitting/kalman_filter/gain_matrix_smoother.hpp"
"include/traccc/fitting/kalman_filter/gain_matrix_updater.hpp"
Expand Down
89 changes: 89 additions & 0 deletions core/include/traccc/finding/ckf_algorithm.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
/** TRACCC library, part of the ACTS project (R&D line)
*
* (c) 2024 CERN for the benefit of the ACTS project
*
* Mozilla Public License Version 2.0
*/

#pragma once

// Project include(s).
#include "traccc/edm/measurement.hpp"
#include "traccc/edm/track_candidate.hpp"
#include "traccc/edm/track_parameters.hpp"
#include "traccc/finding/finding_config.hpp"
#include "traccc/geometry/detector.hpp"
#include "traccc/utils/algorithm.hpp"

// Detray include(s).
#include <detray/detectors/bfield.hpp>

namespace traccc::host {

/// CKF track finding algorithm
///
/// This is the main host-based track finding algorithm of the project. More
/// documentation to be written later...
///
class ckf_algorithm
: public algorithm<track_candidate_container_types::host(
const default_detector::host&,
const detray::bfield::const_field_t::view_t&,
const measurement_collection_types::const_view&,
const bound_track_parameters_collection_types::const_view&)>,
public algorithm<track_candidate_container_types::host(
const telescope_detector::host&,
const detray::bfield::const_field_t::view_t&,
const measurement_collection_types::const_view&,
const bound_track_parameters_collection_types::const_view&)> {

public:
/// Configuration type
using config_type = finding_config;
/// Output type
using output_type = track_candidate_container_types::host;

/// Constructor with the algorithm's configuration
ckf_algorithm(const config_type& config);

/// Execute the algorithm
///
/// @param det The (default) detector object
/// @param field The (constant) magnetic field object
/// @param measurements All measurements in an event
/// @param seeds All seeds in an event to start the track finding
/// with
///
/// @return A container of the found track candidates
///
output_type operator()(
const default_detector::host& det,
const detray::bfield::const_field_t::view_t& field,
const measurement_collection_types::const_view& measurements,
const bound_track_parameters_collection_types::const_view& seeds)
const override;

/// Execute the algorithm
///
/// @param det The (telescope) detector object
/// @param field The (constant) magnetic field object
/// @param measurements All measurements in an event
/// @param seeds All seeds in an event to start the track finding
/// with
///
/// @return A container of the found track candidates
///
output_type operator()(
const telescope_detector::host& det,
const detray::bfield::const_field_t::view_t& field,
const measurement_collection_types::const_view& measurements,
const bound_track_parameters_collection_types::const_view& seeds)
const override;

private:
/// Algorithm configuration
config_type m_config;

}; // class ckf_algorithm

} // namespace traccc::host
103 changes: 0 additions & 103 deletions core/include/traccc/finding/finding_algorithm.hpp

This file was deleted.

15 changes: 15 additions & 0 deletions core/src/finding/ckf_algorithm.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/** TRACCC library, part of the ACTS project (R&D line)
*
* (c) 2024 CERN for the benefit of the ACTS project
*
* Mozilla Public License Version 2.0
*/

// Local include(s).
#include "traccc/finding/ckf_algorithm.hpp"

namespace traccc::host {

ckf_algorithm::ckf_algorithm(const config_type& config) : m_config{config} {}

} // namespace traccc::host
36 changes: 36 additions & 0 deletions core/src/finding/ckf_algorithm_defdet_cfield.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/** TRACCC library, part of the ACTS project (R&D line)
*
* (c) 2024 CERN for the benefit of the ACTS project
*
* Mozilla Public License Version 2.0
*/

// Local include(s).
#include "find_tracks.hpp"
#include "traccc/finding/ckf_algorithm.hpp"

// Detray include(s).
#include <detray/core/detector.hpp>
#include <detray/detectors/bfield.hpp>
#include <detray/navigation/navigator.hpp>
#include <detray/propagator/propagator.hpp>
#include <detray/propagator/rk_stepper.hpp>

namespace traccc::host {

ckf_algorithm::output_type ckf_algorithm::operator()(
const default_detector::host& det,
const detray::bfield::const_field_t::view_t& field,
const measurement_collection_types::const_view& measurements,
const bound_track_parameters_collection_types::const_view& seeds) const {

// Perform the track finding using the templated implementation.
return details::find_tracks<
detray::rk_stepper<detray::bfield::const_field_t::view_t,
default_detector::host::algebra_type,
detray::constrained_step<>>,
detray::navigator<const default_detector::host>>(
det, field, measurements, seeds, m_config);
}

} // namespace traccc::host
36 changes: 36 additions & 0 deletions core/src/finding/ckf_algorithm_teldet_cfield.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/** TRACCC library, part of the ACTS project (R&D line)
*
* (c) 2024 CERN for the benefit of the ACTS project
*
* Mozilla Public License Version 2.0
*/

// Local include(s).
#include "find_tracks.hpp"
#include "traccc/finding/ckf_algorithm.hpp"

// Detray include(s).
#include <detray/core/detector.hpp>
#include <detray/detectors/bfield.hpp>
#include <detray/navigation/navigator.hpp>
#include <detray/propagator/propagator.hpp>
#include <detray/propagator/rk_stepper.hpp>

namespace traccc::host {

ckf_algorithm::output_type ckf_algorithm::operator()(
const telescope_detector::host& det,
const detray::bfield::const_field_t::view_t& field,
const measurement_collection_types::const_view& measurements,
const bound_track_parameters_collection_types::const_view& seeds) const {

// Perform the track finding using the templated implementation.
return details::find_tracks<
detray::rk_stepper<detray::bfield::const_field_t::view_t,
telescope_detector::host::algebra_type,
detray::constrained_step<>>,
detray::navigator<const telescope_detector::host>>(
det, field, measurements, seeds, m_config);
}

} // namespace traccc::host
Loading
Loading