Skip to content

Commit 8db2c76

Browse files
ref: Update to detray version 0.87.0 (acts-project#805)
* Update to detray version 0.87.0 * Remove spurious get_data call --------- Co-authored-by: Stephen Nicholas Swatman <[email protected]>
1 parent 44c38f8 commit 8db2c76

File tree

83 files changed

+354
-256
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

83 files changed

+354
-256
lines changed

benchmarks/common/benchmarks/toy_detector_benchmark.hpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
#include "traccc/definitions/common.hpp"
1010
#include "traccc/finding/finding_config.hpp"
1111
#include "traccc/fitting/fitting_config.hpp"
12+
#include "traccc/geometry/detector.hpp"
1213
#include "traccc/io/utils.hpp"
1314
#include "traccc/seeding/seeding_algorithm.hpp"
1415
#include "traccc/seeding/track_params_estimation.hpp"
@@ -17,11 +18,8 @@
1718
#include "traccc/simulation/smearing_writer.hpp"
1819

1920
// Detray include(s).
20-
#include "detray/core/detector.hpp"
2121
#include "detray/definitions/units.hpp"
2222
#include "detray/detectors/bfield.hpp"
23-
#include "detray/geometry/mask.hpp"
24-
#include "detray/geometry/shapes/rectangle2D.hpp"
2523
#include "detray/io/frontend/detector_reader.hpp"
2624
#include "detray/io/frontend/detector_writer.hpp"
2725
#include "detray/navigation/detail/ray.hpp"
@@ -68,11 +66,12 @@ class ToyDetectorBenchmark : public benchmark::Fixture {
6866
static inline const std::string sim_dir = "toy_detector_benchmark/";
6967

7068
// Detector type
71-
using detector_type = detray::detector<detray::toy_metadata>;
69+
using detector_type = traccc::toy_detector::host;
70+
using scalar_type = detector_type::scalar_type;
7271

7372
// B field value and its type
7473
// @TODO: Set B field as argument
75-
using b_field_t = covfie::field<detray::bfield::const_bknd_t>;
74+
using b_field_t = covfie::field<detray::bfield::const_bknd_t<scalar_type>>;
7675

7776
static constexpr traccc::vector3 B{0, 0,
7877
2 * detray::unit<traccc::scalar>::T};
@@ -89,10 +88,11 @@ class ToyDetectorBenchmark : public benchmark::Fixture {
8988

9089
// Build the detector
9190
auto [det, name_map] =
92-
detray::build_toy_detector(host_mr, get_toy_config());
91+
detray::build_toy_detector<traccc::default_algebra>(
92+
host_mr, get_toy_config());
9393

9494
// B field
95-
auto field = detray::bfield::create_const_field(B);
95+
auto field = detray::bfield::create_const_field<scalar_type>(B);
9696

9797
// Origin of particles
9898
using generator_type =
@@ -143,10 +143,10 @@ class ToyDetectorBenchmark : public benchmark::Fixture {
143143
detray::io::write_detector(det, name_map, writer_cfg);
144144
}
145145

146-
detray::toy_det_config get_toy_config() const {
146+
detray::toy_det_config<traccc::scalar> get_toy_config() const {
147147

148148
// Create the toy geometry
149-
detray::toy_det_config toy_cfg{};
149+
detray::toy_det_config<traccc::scalar> toy_cfg{};
150150
toy_cfg.n_brl_layers(4u).n_edc_layers(7u).do_check(false);
151151

152152
// @TODO: Increase the material budget again

benchmarks/cpu/toy_detector_cpu.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ BENCHMARK_F(ToyDetectorBenchmark, CPU)(benchmark::State& state) {
5050
sim_dir + "toy_detector_surface_grids.json");
5151

5252
// B field
53-
auto field = detray::bfield::create_const_field(B);
53+
auto field = detray::bfield::create_const_field<scalar_type>(B);
5454

5555
// Algorithms
5656
traccc::seeding_algorithm sa(seeding_cfg, grid_cfg, filter_cfg, host_mr);

benchmarks/cuda/toy_detector_cuda.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,9 @@
4343
BENCHMARK_F(ToyDetectorBenchmark, CUDA)(benchmark::State& state) {
4444

4545
// Type declarations
46-
using rk_stepper_type =
47-
detray::rk_stepper<b_field_t::view_t,
48-
typename detector_type::algebra_type,
49-
detray::constrained_step<>>;
46+
using rk_stepper_type = detray::rk_stepper<
47+
b_field_t::view_t, typename detector_type::algebra_type,
48+
detray::constrained_step<typename detector_type::scalar_type>>;
5049
using host_detector_type = traccc::default_detector::host;
5150
using device_detector_type = traccc::default_detector::device;
5251
using device_navigator_type = detray::navigator<const device_detector_type>;
@@ -73,7 +72,8 @@ BENCHMARK_F(ToyDetectorBenchmark, CUDA)(benchmark::State& state) {
7372
sim_dir + "toy_detector_surface_grids.json");
7473

7574
// B field
76-
auto field = detray::bfield::create_const_field(B);
75+
auto field =
76+
detray::bfield::create_const_field<host_detector_type::scalar_type>(B);
7777

7878
// Algorithms
7979
traccc::cuda::seeding_algorithm sa_cuda(seeding_cfg, grid_cfg, filter_cfg,

core/include/traccc/finding/combinatorial_kalman_filter_algorithm.hpp

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,14 @@ namespace traccc::host {
2828
class combinatorial_kalman_filter_algorithm
2929
: public algorithm<track_candidate_container_types::host(
3030
const default_detector::host&,
31-
const detray::bfield::const_field_t::view_t&,
31+
const detray::bfield::const_field_t<
32+
default_detector::host::scalar_type>::view_t&,
3233
const measurement_collection_types::const_view&,
3334
const bound_track_parameters_collection_types::const_view&)>,
3435
public algorithm<track_candidate_container_types::host(
3536
const telescope_detector::host&,
36-
const detray::bfield::const_field_t::view_t&,
37+
const detray::bfield::const_field_t<
38+
telescope_detector::host::scalar_type>::view_t&,
3739
const measurement_collection_types::const_view&,
3840
const bound_track_parameters_collection_types::const_view&)> {
3941

@@ -58,7 +60,8 @@ class combinatorial_kalman_filter_algorithm
5860
///
5961
output_type operator()(
6062
const default_detector::host& det,
61-
const detray::bfield::const_field_t::view_t& field,
63+
const detray::bfield::const_field_t<
64+
default_detector::host::scalar_type>::view_t& field,
6265
const measurement_collection_types::const_view& measurements,
6366
const bound_track_parameters_collection_types::const_view& seeds)
6467
const override;
@@ -75,7 +78,8 @@ class combinatorial_kalman_filter_algorithm
7578
///
7679
output_type operator()(
7780
const telescope_detector::host& det,
78-
const detray::bfield::const_field_t::view_t& field,
81+
const detray::bfield::const_field_t<
82+
telescope_detector::host::scalar_type>::view_t& field,
7983
const measurement_collection_types::const_view& measurements,
8084
const bound_track_parameters_collection_types::const_view& seeds)
8185
const override;

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,12 +65,13 @@ track_candidate_container_types::host find_tracks(
6565
*****************************************************************/
6666

6767
using algebra_type = typename navigator_t::detector_type::algebra_type;
68+
using scalar_type = detray::dscalar<algebra_type>;
6869

6970
using transporter_type = detray::parameter_transporter<algebra_type>;
7071
using interactor_type = detray::pointwise_material_interactor<algebra_type>;
7172

7273
using actor_type = detray::actor_chain<
73-
detray::tuple, detray::pathlimit_aborter, transporter_type,
74+
detray::tuple, detray::pathlimit_aborter<scalar_type>, transporter_type,
7475
interaction_register<interactor_type>, interactor_type, ckf_aborter>;
7576

7677
using propagator_type =
@@ -304,7 +305,7 @@ track_candidate_container_types::host find_tracks(
304305
.template set_constraint<detray::step::constraint::e_accuracy>(
305306
config.propagation.stepping.step_constraint);
306307

307-
detray::pathlimit_aborter::state s0;
308+
typename detray::pathlimit_aborter<scalar_type>::state s0;
308309
typename detray::parameter_transporter<algebra_type>::state s1;
309310
typename interactor_type::state s3;
310311
typename interaction_register<interactor_type>::state s2{s3};

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ class kalman_fitter {
5858
using bfield_type = typename stepper_t::magnetic_field_type;
5959

6060
// Actor types
61-
using aborter = detray::pathlimit_aborter;
61+
using aborter = detray::pathlimit_aborter<scalar_type>;
6262
using transporter = detray::parameter_transporter<algebra_type>;
6363
using interactor = detray::pointwise_material_interactor<algebra_type>;
6464
using fit_actor = traccc::kalman_actor<algebra_type, vector_type>;

core/include/traccc/fitting/kalman_fitting_algorithm.hpp

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,13 @@ namespace traccc::host {
2929
class kalman_fitting_algorithm
3030
: public algorithm<track_state_container_types::host(
3131
const default_detector::host&,
32-
const detray::bfield::const_field_t::view_t&,
32+
const detray::bfield::const_field_t<
33+
default_detector::host::scalar_type>::view_t&,
3334
const track_candidate_container_types::const_view&)>,
3435
public algorithm<track_state_container_types::host(
3536
const telescope_detector::host&,
36-
const detray::bfield::const_field_t::view_t&,
37+
const detray::bfield::const_field_t<
38+
telescope_detector::host::scalar_type>::view_t&,
3739
const track_candidate_container_types::const_view&)> {
3840

3941
public:
@@ -57,10 +59,12 @@ class kalman_fitting_algorithm
5759
///
5860
/// @return A container of the fitted track states
5961
///
60-
output_type operator()(const default_detector::host& det,
61-
const detray::bfield::const_field_t::view_t& field,
62-
const track_candidate_container_types::const_view&
63-
track_candidates) const override;
62+
output_type operator()(
63+
const default_detector::host& det,
64+
const detray::bfield::const_field_t<
65+
default_detector::host::scalar_type>::view_t& field,
66+
const track_candidate_container_types::const_view& track_candidates)
67+
const override;
6468

6569
/// Execute the algorithm
6670
///
@@ -70,10 +74,12 @@ class kalman_fitting_algorithm
7074
///
7175
/// @return A container of the fitted track states
7276
///
73-
output_type operator()(const telescope_detector::host& det,
74-
const detray::bfield::const_field_t::view_t& field,
75-
const track_candidate_container_types::const_view&
76-
track_candidates) const override;
77+
output_type operator()(
78+
const telescope_detector::host& det,
79+
const detray::bfield::const_field_t<
80+
telescope_detector::host::scalar_type>::view_t& field,
81+
const track_candidate_container_types::const_view& track_candidates)
82+
const override;
7783

7884
private:
7985
/// Algorithm configuration

core/include/traccc/geometry/detector.hpp

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,12 @@
77

88
#pragma once
99

10+
// Project include(s).
11+
#include "traccc/definitions/primitives.hpp"
12+
1013
// Detray include(s).
1114
#include <detray/core/detector.hpp>
15+
#include <detray/detectors/default_metadata.hpp>
1216
#include <detray/detectors/telescope_metadata.hpp>
1317
#include <detray/detectors/toy_metadata.hpp>
1418

@@ -38,12 +42,14 @@ struct detector {
3842
}; // struct default_detector
3943

4044
/// Default detector (also used for ODD)
41-
using default_detector = detector<detray::default_metadata>;
45+
using default_detector =
46+
detector<detray::default_metadata<traccc::default_algebra>>;
4247

4348
/// Telescope detector
44-
using telescope_detector = detector<detray::telescope_metadata<> >;
49+
using telescope_detector = detector<
50+
detray::telescope_metadata<traccc::default_algebra, detray::rectangle2D>>;
4551

4652
/// Toy detector
47-
using toy_detector = detector<detray::toy_metadata>;
53+
using toy_detector = detector<detray::toy_metadata<traccc::default_algebra>>;
4854

4955
} // namespace traccc

core/src/finding/combinatorial_kalman_filter_algorithm_constant_field_default_detector.cpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,18 @@ namespace traccc::host {
2020
combinatorial_kalman_filter_algorithm::output_type
2121
combinatorial_kalman_filter_algorithm::operator()(
2222
const default_detector::host& det,
23-
const detray::bfield::const_field_t::view_t& field,
23+
const detray::bfield::const_field_t<
24+
default_detector::host::scalar_type>::view_t& field,
2425
const measurement_collection_types::const_view& measurements,
2526
const bound_track_parameters_collection_types::const_view& seeds) const {
2627

28+
using scalar_type = default_detector::host::scalar_type;
29+
2730
// Perform the track finding using the templated implementation.
2831
return details::find_tracks<
29-
detray::rk_stepper<detray::bfield::const_field_t::view_t,
32+
detray::rk_stepper<detray::bfield::const_field_t<scalar_type>::view_t,
3033
default_detector::host::algebra_type,
31-
detray::constrained_step<>>,
34+
detray::constrained_step<scalar_type>>,
3235
detray::navigator<const default_detector::host>>(
3336
det, field, measurements, seeds, m_config);
3437
}

core/src/finding/combinatorial_kalman_filter_algorithm_constant_field_telescope_detector.cpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,18 @@ namespace traccc::host {
2020
combinatorial_kalman_filter_algorithm::output_type
2121
combinatorial_kalman_filter_algorithm::operator()(
2222
const telescope_detector::host& det,
23-
const detray::bfield::const_field_t::view_t& field,
23+
const detray::bfield::const_field_t<
24+
telescope_detector::host::scalar_type>::view_t& field,
2425
const measurement_collection_types::const_view& measurements,
2526
const bound_track_parameters_collection_types::const_view& seeds) const {
2627

28+
using scalar_type = telescope_detector::host::scalar_type;
29+
2730
// Perform the track finding using the templated implementation.
2831
return details::find_tracks<
29-
detray::rk_stepper<detray::bfield::const_field_t::view_t,
32+
detray::rk_stepper<detray::bfield::const_field_t<scalar_type>::view_t,
3033
telescope_detector::host::algebra_type,
31-
detray::constrained_step<>>,
34+
detray::constrained_step<scalar_type>>,
3235
detray::navigator<const telescope_detector::host>>(
3336
det, field, measurements, seeds, m_config);
3437
}

0 commit comments

Comments
 (0)