Skip to content

Commit

Permalink
Update detray to v0.81.0
Browse files Browse the repository at this point in the history
Brings changes to the stepper states and the wire chambers.
  • Loading branch information
stephenswat committed Oct 31, 2024
1 parent 5337895 commit 921c306
Show file tree
Hide file tree
Showing 15 changed files with 71 additions and 14 deletions.
2 changes: 1 addition & 1 deletion core/include/traccc/finding/actors/ckf_aborter.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ struct ckf_aborter : detray::actor {

// Abort at the next sensitive surface
if (navigation.is_on_sensitive() &&
stepping._s > abrt_state.min_step_length) {
stepping.path_from_surface() > abrt_state.min_step_length) {
prop_state._heartbeat &= navigation.abort();
abrt_state.success = true;
}
Expand Down
9 changes: 5 additions & 4 deletions core/include/traccc/fitting/kalman_filter/kalman_actor.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ struct kalman_actor : detray::actor {

const bool res =
sf.template visit_mask<gain_matrix_updater<algebra_t>>(
trk_state, propagation._stepping._bound_params);
trk_state, propagation._stepping.bound_params());

// Abort if the Kalman update fails
if (!res) {
Expand All @@ -115,13 +115,14 @@ struct kalman_actor : detray::actor {
}

// Set full jacobian
trk_state.jacobian() = stepping._full_jacobian;
trk_state.jacobian() = stepping.full_jacobian();

// 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)
propagation.set_particle(detail::correct_particle_hypothesis(
stepping._ptc, propagation._stepping._bound_params));
stepping.particle_hypothesis(),
propagation._stepping.bound_params()));

// Update iterator
actor_state.next();
Expand All @@ -132,4 +133,4 @@ struct kalman_actor : detray::actor {
}
};

} // namespace traccc
} // namespace traccc
2 changes: 1 addition & 1 deletion core/src/finding/find_tracks.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,7 @@ track_candidate_container_types::host find_tracks(
// If a surface found, add the parameter for the next
// step
if (s4.success) {
out_params.push_back(propagation._stepping._bound_params);
out_params.push_back(propagation._stepping.bound_params());
param_to_link[step].push_back(link_id);
}
// Unless the track found a surface, it is considered a
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ TRACCC_DEVICE inline void propagate_to_next_surface(

// If a surface found, add the parameter for the next step
if (s4.success) {
params[param_id] = propagation._stepping._bound_params;
params[param_id] = propagation._stepping.bound_params();

if (payload.step == cfg.max_track_candidates_per_track - 1) {
tips.push_back({payload.step, param_id});
Expand Down
4 changes: 2 additions & 2 deletions examples/simulation/simulate_wire_chamber.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
// detray include(s).
#include "detray/detectors/bfield.hpp"
#include "detray/io/frontend/detector_writer.hpp"
#include "detray/test/utils/detectors/create_wire_chamber.hpp"
#include "detray/test/utils/detectors/build_wire_chamber.hpp"
#include "detray/test/utils/simulation/event_generator/track_generators.hpp"

// VecMem include(s).
Expand Down Expand Up @@ -62,7 +62,7 @@ int simulate(const traccc::opts::generation& generation_opts,

// Create the toy geometry
const auto [det, name_map] =
detray::create_wire_chamber(host_mr, wire_chamber_cfg);
detray::build_wire_chamber(host_mr, wire_chamber_cfg);

/***************************
* Generate simulation data
Expand Down
2 changes: 1 addition & 1 deletion extern/detray/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ message( STATUS "Building Detray as part of the TRACCC project" )

# Declare where to get Detray from.
set( TRACCC_DETRAY_SOURCE
"URL;https://github.com/acts-project/detray/archive/refs/tags/v0.79.0.tar.gz;URL_MD5;b2eb38b7a58c55f41aa5e295c21e1aeb"
"URL;https://github.com/acts-project/detray/archive/refs/tags/v0.81.0.tar.gz;URL_MD5;d66d7e95c4c00f9c82999331ab0a8d4c"
CACHE STRING "Source for Detray, when built as part of this project" )

mark_as_advanced( TRACCC_DETRAY_SOURCE )
Expand Down
4 changes: 2 additions & 2 deletions simulation/include/traccc/simulation/smearing_writer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ struct smearing_writer : detray::actor {

const auto track = stepping();
const auto pos = track.pos();
const auto mom = track.mom(stepping._ptc.charge());
const auto mom = track.mom(stepping.particle_hypothesis().charge());

const auto sf = navigation.get_surface();

Expand All @@ -138,7 +138,7 @@ struct smearing_writer : detray::actor {

// Write measurements
io::csv::measurement meas;
const auto bound_params = stepping._bound_params;
const auto bound_params = stepping.bound_params();

meas.measurement_id = writer_state.m_hit_count;
meas.geometry_id = hit.geometry_id;
Expand Down
4 changes: 2 additions & 2 deletions tests/common/tests/kalman_fitting_wire_chamber_test.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
// Detray include(s).
#include "detray/detectors/bfield.hpp"
#include "detray/io/frontend/detector_writer.hpp"
#include "detray/test/utils/detectors/create_wire_chamber.hpp"
#include "detray/test/utils/detectors/build_wire_chamber.hpp"

// System include(s)
#include <array>
Expand Down Expand Up @@ -76,7 +76,7 @@ class KalmanFittingWireChamberTests : public KalmanFittingTests {
// wire_chamber_cfg.m_thickness = 100.f * detray::unit<scalar>::um;

// Create telescope detector
auto [det, name_map] = create_wire_chamber(host_mr, wire_chamber_cfg);
auto [det, name_map] = build_wire_chamber(host_mr, wire_chamber_cfg);

// Write detector file
auto writer_cfg = detray::io::detector_writer_config{}
Expand Down
11 changes: 11 additions & 0 deletions tests/cpu/test_ckf_combinatorics_telescope.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,10 @@ TEST_P(CpuCkfCombinatoricsTelescopeTests, Run) {
writer_type>(
std::get<6>(GetParam()), n_events, host_det, field,
std::move(generator), std::move(smearer_writer_cfg), full_path);
sim.get_config().propagation.navigation.overstep_tolerance =
-100.f * unit<float>::um;
sim.get_config().propagation.navigation.max_mask_tolerance =
1.f * unit<float>::mm;
sim.run();

/*****************************
Expand All @@ -115,10 +119,17 @@ TEST_P(CpuCkfCombinatoricsTelescopeTests, Run) {
cfg_no_limit.max_num_branches_per_seed =
std::numeric_limits<unsigned int>::max();
cfg_no_limit.chi2_max = 30.f;
cfg_no_limit.propagation.navigation.overstep_tolerance =
-100.f * unit<float>::um;
cfg_no_limit.propagation.navigation.max_mask_tolerance =
1.f * unit<float>::mm;

traccc::finding_config cfg_limit;
cfg_limit.max_num_branches_per_seed = 500;
cfg_limit.chi2_max = 30.f;
cfg_limit.propagation.navigation.overstep_tolerance =
-100.f * unit<float>::um;
cfg_limit.propagation.navigation.max_mask_tolerance = 1.f * unit<float>::mm;

// Finding algorithm object
traccc::host::ckf_algorithm host_finding(cfg_no_limit);
Expand Down
9 changes: 9 additions & 0 deletions tests/cpu/test_ckf_sparse_tracks_telescope.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,10 @@ TEST_P(CkfSparseTrackTelescopeTests, Run) {
writer_type>(
ptc, n_events, host_det, field, std::move(generator),
std::move(smearer_writer_cfg), full_path);
sim.get_config().propagation.navigation.overstep_tolerance =
-100.f * unit<float>::um;
sim.get_config().propagation.navigation.max_mask_tolerance =
1.f * unit<float>::mm;
sim.run();

/*****************************
Expand All @@ -120,13 +124,18 @@ TEST_P(CkfSparseTrackTelescopeTests, Run) {
typename traccc::finding_config cfg;
cfg.ptc_hypothesis = ptc;
cfg.chi2_max = 30.f;
cfg.propagation.navigation.overstep_tolerance = -100.f * unit<float>::um;
cfg.propagation.navigation.max_mask_tolerance = 1.f * unit<float>::mm;

// Finding algorithm object
traccc::host::ckf_algorithm host_finding(cfg);

// Fitting algorithm object
typename traccc::fitting_algorithm<host_fitter_type>::config_type fit_cfg;
fit_cfg.ptc_hypothesis = ptc;
fit_cfg.propagation.navigation.overstep_tolerance =
-100.f * unit<float>::um;
fit_cfg.propagation.navigation.max_mask_tolerance = 1.f * unit<float>::mm;
traccc::fitting_algorithm<host_fitter_type> host_fitting(fit_cfg);

// Iterate over events
Expand Down
7 changes: 7 additions & 0 deletions tests/cpu/test_kalman_fitter_telescope.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,10 @@ TEST_P(KalmanFittingTelescopeTests, Run) {
writer_type>(
ptc, n_events, host_det, field, std::move(generator),
std::move(smearer_writer_cfg), full_path);
sim.get_config().propagation.navigation.overstep_tolerance =
-100.f * unit<float>::um;
sim.get_config().propagation.navigation.max_mask_tolerance =
1.f * unit<float>::mm;
sim.run();

/***************
Expand All @@ -116,6 +120,9 @@ TEST_P(KalmanFittingTelescopeTests, Run) {
// Fitting algorithm object
typename traccc::fitting_algorithm<host_fitter_type>::config_type fit_cfg;
fit_cfg.ptc_hypothesis = ptc;
fit_cfg.propagation.navigation.overstep_tolerance =
-100.f * unit<float>::um;
fit_cfg.propagation.navigation.max_mask_tolerance = 1.f * unit<float>::mm;
fitting_algorithm<host_fitter_type> fitting(fit_cfg);

// Iterate over events
Expand Down
4 changes: 4 additions & 0 deletions tests/cpu/test_simulation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,10 @@ TEST_P(TelescopeDetectorSimulation, telescope_detector_simulation) {
std::numeric_limits<float>::max();

// Run simulation
sim.get_config().propagation.navigation.overstep_tolerance =
-100.f * unit<float>::um;
sim.get_config().propagation.navigation.max_mask_tolerance =
1.f * unit<float>::mm;
sim.run();

for (std::size_t i_event{0u}; i_event < n_events; i_event++) {
Expand Down
11 changes: 11 additions & 0 deletions tests/cuda/test_ckf_combinatorics_telescope.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,10 @@ TEST_P(CudaCkfCombinatoricsTelescopeTests, Run) {
writer_type>(
ptc, n_events, host_det, field, std::move(generator),
std::move(smearer_writer_cfg), full_path);
sim.get_config().propagation.navigation.overstep_tolerance =
-100.f * unit<float>::um;
sim.get_config().propagation.navigation.max_mask_tolerance =
1.f * unit<float>::mm;
sim.run();

/*****************************
Expand Down Expand Up @@ -140,12 +144,19 @@ TEST_P(CudaCkfCombinatoricsTelescopeTests, Run) {
cfg_no_limit.ptc_hypothesis = ptc;
cfg_no_limit.max_num_branches_per_seed = 100000;
cfg_no_limit.chi2_max = 30.f;
cfg_no_limit.propagation.navigation.overstep_tolerance =
-100.f * unit<float>::um;
cfg_no_limit.propagation.navigation.max_mask_tolerance =
1.f * unit<float>::mm;

typename traccc::cuda::finding_algorithm<
rk_stepper_type, device_navigator_type>::config_type cfg_limit;
cfg_limit.ptc_hypothesis = ptc;
cfg_limit.max_num_branches_per_seed = 500;
cfg_limit.chi2_max = 30.f;
cfg_limit.propagation.navigation.overstep_tolerance =
-100.f * unit<float>::um;
cfg_limit.propagation.navigation.max_mask_tolerance = 1.f * unit<float>::mm;

// Finding algorithm object
traccc::cuda::finding_algorithm<rk_stepper_type, device_navigator_type>
Expand Down
7 changes: 7 additions & 0 deletions tests/cuda/test_kalman_fitter_telescope.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,10 @@ TEST_P(KalmanFittingTelescopeTests, Run) {
writer_type>(
ptc, n_events, host_det, field, std::move(generator),
std::move(smearer_writer_cfg), full_path);
sim.get_config().propagation.navigation.overstep_tolerance =
-100.f * unit<float>::um;
sim.get_config().propagation.navigation.max_mask_tolerance =
1.f * unit<float>::mm;
sim.run();

/***************
Expand All @@ -146,6 +150,9 @@ TEST_P(KalmanFittingTelescopeTests, Run) {
typename traccc::cuda::fitting_algorithm<device_fitter_type>::config_type
fit_cfg;
fit_cfg.ptc_hypothesis = ptc;
fit_cfg.propagation.navigation.overstep_tolerance =
-100.f * unit<float>::um;
fit_cfg.propagation.navigation.max_mask_tolerance = 1.f * unit<float>::mm;
traccc::cuda::fitting_algorithm<device_fitter_type> device_fitting(
fit_cfg, mr, copy, stream);

Expand Down
7 changes: 7 additions & 0 deletions tests/sycl/test_kalman_fitter_telescope.sycl
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,10 @@ TEST_P(KalmanFittingTelescopeTests, Run) {
writer_type>(
std::get<6>(GetParam()), n_events, host_det, field,
std::move(generator), std::move(smearer_writer_cfg), full_path);
sim.get_config().propagation.navigation.overstep_tolerance =
-100.f * unit<float>::um;
sim.get_config().propagation.navigation.max_mask_tolerance =
1.f * unit<float>::mm;
sim.run();

/***************
Expand All @@ -163,6 +167,9 @@ TEST_P(KalmanFittingTelescopeTests, Run) {
typename traccc::sycl::fitting_algorithm<device_fitter_type>::config_type
fit_cfg;
fit_cfg.ptc_hypothesis = ptc;
fit_cfg.propagation.navigation.overstep_tolerance =
-100.f * unit<float>::um;
fit_cfg.propagation.navigation.max_mask_tolerance = 1.f * unit<float>::mm;
traccc::sycl::fitting_algorithm<device_fitter_type> device_fitting(fit_cfg,
mr, &q);

Expand Down

0 comments on commit 921c306

Please sign in to comment.