Skip to content

Commit 3654a64

Browse files
authored
Merge pull request #1051 from krasznaa/InhomBFieldThroughput-main-20250702
Inhomogeneous Magnetic Field Throughput Applications, main branch (2025.07.02.)
2 parents 819ddb0 + 5e21d07 commit 3654a64

11 files changed

+43
-24
lines changed

examples/run/alpaka/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ add_library( traccc_examples_alpaka STATIC
3636
"full_chain_algorithm.cpp" )
3737
target_link_libraries( traccc_examples_alpaka
3838
PUBLIC vecmem::core detray::core detray::detectors
39-
traccc::core traccc::device_common traccc::alpaka ${EXTRA_LIBS})
39+
traccc::core traccc::device_common traccc::alpaka traccc_examples_common ${EXTRA_LIBS})
4040

4141
traccc_add_executable( throughput_st_alpaka "throughput_st.cpp"
4242
LINK_LIBRARIES indicators::indicators ${LIBRARIES} ${DETRAY} traccc_examples_alpaka )

examples/run/alpaka/full_chain_algorithm.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ full_chain_algorithm::full_chain_algorithm(
2222
const seedfilter_config& filter_config,
2323
const finding_algorithm::config_type& finding_config,
2424
const fitting_algorithm::config_type& fitting_config,
25-
const silicon_detector_description::host& det_descr,
25+
const silicon_detector_description::host& det_descr, const bfield& field,
2626
host_detector_type* detector, std::unique_ptr<const traccc::Logger> logger)
2727
: messaging(logger->clone()),
2828
m_queue(),
@@ -32,8 +32,7 @@ full_chain_algorithm::full_chain_algorithm(
3232
std::make_unique<::vecmem::binary_page_memory_resource>(
3333
m_vecmem_objects.device_mr())),
3434
m_field_vec{0.f, 0.f, finder_config.bFieldInZ},
35-
m_field(traccc::construct_const_bfield<host_detector_type::scalar_type>(
36-
m_field_vec)),
35+
m_field(field),
3736
m_det_descr(det_descr),
3837
m_device_det_descr(
3938
static_cast<silicon_detector_description::buffer::size_type>(

examples/run/alpaka/full_chain_algorithm.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ class full_chain_algorithm
8383
const finding_algorithm::config_type& finding_config,
8484
const fitting_algorithm::config_type& fitting_config,
8585
const silicon_detector_description::host& det_descr,
86-
host_detector_type* detector,
86+
const bfield& field, host_detector_type* detector,
8787
std::unique_ptr<const traccc::Logger> logger);
8888

8989
/// Copy constructor

examples/run/common/throughput_mt.ipp

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

88
#pragma once
99

10+
// Local include(s).
11+
#include "make_magnetic_field.hpp"
12+
1013
// Project include(s)
1114
#include "traccc/geometry/detector.hpp"
1215

1316
// Command line option include(s).
1417
#include "traccc/options/clusterization.hpp"
1518
#include "traccc/options/detector.hpp"
1619
#include "traccc/options/input_data.hpp"
20+
#include "traccc/options/magnetic_field.hpp"
1721
#include "traccc/options/program_options.hpp"
1822
#include "traccc/options/threading.hpp"
1923
#include "traccc/options/throughput.hpp"
@@ -65,6 +69,7 @@ int throughput_mt(std::string_view description, int argc, char* argv[],
6569

6670
// Program options.
6771
opts::detector detector_opts;
72+
opts::magnetic_field bfield_opts;
6873
opts::input_data input_opts;
6974
opts::clusterization clusterization_opts;
7075
opts::track_seeding seeding_opts;
@@ -75,9 +80,9 @@ int throughput_mt(std::string_view description, int argc, char* argv[],
7580
opts::threading threading_opts;
7681
opts::program_options program_opts{
7782
description,
78-
{detector_opts, input_opts, clusterization_opts, seeding_opts,
79-
finding_opts, propagation_opts, fitting_opts, throughput_opts,
80-
threading_opts},
83+
{detector_opts, bfield_opts, input_opts, clusterization_opts,
84+
seeding_opts, finding_opts, propagation_opts, fitting_opts,
85+
throughput_opts, threading_opts},
8186
argc,
8287
argv,
8388
logger().cloneWithSuffix("Options")};
@@ -103,6 +108,9 @@ int throughput_mt(std::string_view description, int argc, char* argv[],
103108
detector_opts.material_file, detector_opts.grid_file);
104109
}
105110

111+
// Construct the magnetic field object.
112+
traccc::bfield field{details::make_magnetic_field(bfield_opts)};
113+
106114
// Read in all input events into memory.
107115
vecmem::vector<edm::silicon_cell_collection::host> input{&uncached_host_mr};
108116
{
@@ -174,6 +182,7 @@ int throughput_mt(std::string_view description, int argc, char* argv[],
174182
finding_cfg,
175183
fitting_cfg,
176184
det_descr,
185+
field,
177186
(detector_opts.use_detray_detector ? &detector : nullptr),
178187
logger().clone()});
179188
}

examples/run/common/throughput_st.ipp

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

88
#pragma once
99

10+
// Local include(s).
11+
#include "make_magnetic_field.hpp"
12+
1013
// Project include(s)
1114
#include "traccc/geometry/detector.hpp"
1215

1316
// Command line option include(s).
1417
#include "traccc/options/clusterization.hpp"
1518
#include "traccc/options/detector.hpp"
1619
#include "traccc/options/input_data.hpp"
20+
#include "traccc/options/magnetic_field.hpp"
1721
#include "traccc/options/program_options.hpp"
1822
#include "traccc/options/throughput.hpp"
1923
#include "traccc/options/track_finding.hpp"
@@ -54,6 +58,7 @@ int throughput_st(std::string_view description, int argc, char* argv[],
5458

5559
// Program options.
5660
opts::detector detector_opts;
61+
opts::magnetic_field bfield_opts;
5762
opts::input_data input_opts;
5863
opts::clusterization clusterization_opts;
5964
opts::track_seeding seeding_opts;
@@ -63,8 +68,9 @@ int throughput_st(std::string_view description, int argc, char* argv[],
6368
opts::throughput throughput_opts;
6469
opts::program_options program_opts{
6570
description,
66-
{detector_opts, input_opts, clusterization_opts, seeding_opts,
67-
finding_opts, propagation_opts, fitting_opts, throughput_opts},
71+
{detector_opts, bfield_opts, input_opts, clusterization_opts,
72+
seeding_opts, finding_opts, propagation_opts, fitting_opts,
73+
throughput_opts},
6874
argc,
6975
argv,
7076
logger->cloneWithSuffix("Options")};
@@ -92,6 +98,9 @@ int throughput_st(std::string_view description, int argc, char* argv[],
9298
detector_opts.material_file, detector_opts.grid_file);
9399
}
94100

101+
// Construct the magnetic field object.
102+
traccc::bfield field{details::make_magnetic_field(bfield_opts)};
103+
95104
vecmem::memory_resource& alg_host_mr =
96105
use_host_caching
97106
? static_cast<vecmem::memory_resource&>(*cached_host_mr)
@@ -131,7 +140,7 @@ int throughput_st(std::string_view description, int argc, char* argv[],
131140
std::unique_ptr<FULL_CHAIN_ALG> alg = std::make_unique<FULL_CHAIN_ALG>(
132141
alg_host_mr, clustering_cfg, seeding_opts.seedfinder,
133142
spacepoint_grid_config{seeding_opts.seedfinder},
134-
seeding_opts.seedfilter, finding_cfg, fitting_cfg, det_descr,
143+
seeding_opts.seedfilter, finding_cfg, fitting_cfg, det_descr, field,
135144
(detector_opts.use_detray_detector ? &detector : nullptr),
136145
logger->clone("FullChainAlg"));
137146

examples/run/cpu/full_chain_algorithm.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,12 @@ full_chain_algorithm::full_chain_algorithm(
1717
const seedfilter_config& filter_config,
1818
const finding_algorithm::config_type& finding_config,
1919
const fitting_algorithm::config_type& fitting_config,
20-
const silicon_detector_description::host& det_descr,
20+
const silicon_detector_description::host& det_descr, const bfield& field,
2121
detector_type* detector, std::unique_ptr<const traccc::Logger> logger)
2222
: messaging(logger->clone()),
2323
m_copy{std::make_unique<vecmem::copy>()},
2424
m_field_vec{0.f, 0.f, finder_config.bFieldInZ},
25-
m_field(
26-
traccc::construct_const_bfield<typename detector_type::scalar_type>(
27-
m_field_vec)),
25+
m_field(field),
2826
m_det_descr(det_descr),
2927
m_detector(detector),
3028
m_clusterization(mr, logger->cloneWithSuffix("ClusteringAlg")),

examples/run/cpu/full_chain_algorithm.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ class full_chain_algorithm : public algorithm<track_state_container_types::host(
7676
const finding_algorithm::config_type& finding_config,
7777
const fitting_algorithm::config_type& fitting_config,
7878
const silicon_detector_description::host& det_descr,
79-
detector_type* detector,
79+
const bfield& field, detector_type* detector,
8080
std::unique_ptr<const traccc::Logger> logger);
8181

8282
/// Reconstruct track parameters in the entire detector

examples/run/cuda/full_chain_algorithm.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@
88
// Local include(s).
99
#include "full_chain_algorithm.hpp"
1010

11+
// Project include(s).
12+
#include "traccc/cuda/utils/make_bfield.hpp"
13+
1114
// CUDA include(s).
1215
#include <cuda_runtime_api.h>
1316

@@ -35,7 +38,7 @@ full_chain_algorithm::full_chain_algorithm(
3538
const seedfilter_config& filter_config,
3639
const finding_algorithm::config_type& finding_config,
3740
const fitting_algorithm::config_type& fitting_config,
38-
const silicon_detector_description::host& det_descr,
41+
const silicon_detector_description::host& det_descr, const bfield& field,
3942
host_detector_type* detector, std::unique_ptr<const traccc::Logger> logger)
4043
: messaging(logger->clone()),
4144
m_host_mr(host_mr),
@@ -45,8 +48,7 @@ full_chain_algorithm::full_chain_algorithm(
4548
std::make_unique<vecmem::binary_page_memory_resource>(m_device_mr)),
4649
m_copy(m_stream.cudaStream()),
4750
m_field_vec{0.f, 0.f, finder_config.bFieldInZ},
48-
m_field(traccc::construct_const_bfield<host_detector_type::scalar_type>(
49-
m_field_vec)),
51+
m_field(make_bfield(field)),
5052
m_det_descr(det_descr),
5153
m_device_det_descr(
5254
static_cast<silicon_detector_description::buffer::size_type>(

examples/run/cuda/full_chain_algorithm.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ class full_chain_algorithm
8484
const finding_algorithm::config_type& finding_config,
8585
const fitting_algorithm::config_type& fitting_config,
8686
const silicon_detector_description::host& det_descr,
87-
host_detector_type* detector,
87+
const bfield& field, host_detector_type* detector,
8888
std::unique_ptr<const traccc::Logger> logger);
8989

9090
/// Copy constructor

examples/run/sycl/full_chain_algorithm.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ class full_chain_algorithm
8080
const finding_algorithm::config_type& finding_config,
8181
const fitting_algorithm::config_type& fitting_config,
8282
const silicon_detector_description::host& det_descr,
83-
host_detector_type* detector,
83+
const bfield& field, host_detector_type* detector,
8484
std::unique_ptr<const traccc::Logger> logger);
8585

8686
/// Copy constructor

0 commit comments

Comments
 (0)