1+ // This file is part of the ACTS project.
2+ //
3+ // Copyright (C) 2016 CERN for the benefit of the ACTS project
4+ //
5+ // This Source Code Form is subject to the terms of the Mozilla Public
6+ // License, v. 2.0. If a copy of the MPL was not distributed with this
7+ // file, You can obtain one at https://mozilla.org/MPL/2.0/.
8+
9+ #pragma once
10+
11+ #include < memory>
12+ #include < string>
13+
14+ #include < vecmem/memory/cuda/device_memory_resource.hpp>
15+ #include < vecmem/memory/cuda/host_memory_resource.hpp>
16+ #include < vecmem/memory/host_memory_resource.hpp>
17+ #include < vecmem/utils/cuda/async_copy.hpp>
18+ #include < vecmem/utils/copy.hpp>
19+
20+ #include " traccc/ambiguity_resolution/greedy_ambiguity_resolution_algorithm.hpp"
21+ #include " traccc/clusterization/clustering_config.hpp"
22+ #include " traccc/cuda/ambiguity_resolution/greedy_ambiguity_resolution_algorithm.hpp"
23+ #include " traccc/cuda/clusterization/clusterization_algorithm.hpp"
24+ #include " traccc/cuda/clusterization/measurement_sorting_algorithm.hpp"
25+ #include " traccc/cuda/finding/combinatorial_kalman_filter_algorithm.hpp"
26+ #include " traccc/cuda/fitting/kalman_fitting_algorithm.hpp"
27+ #include " traccc/cuda/seeding/seed_parameter_estimation_algorithm.hpp"
28+ #include " traccc/cuda/seeding/silicon_pixel_spacepoint_formation_algorithm.hpp"
29+ #include " traccc/cuda/seeding/triplet_seeding_algorithm.hpp"
30+ #include " traccc/cuda/utils/make_magnetic_field.hpp"
31+ #include " traccc/cuda/utils/stream.hpp"
32+ #include " traccc/device/container_d2h_copy_alg.hpp"
33+ #include " traccc/edm/silicon_cell_collection.hpp"
34+ #include " traccc/edm/track_collection.hpp"
35+ #include " traccc/edm/track_parameters.hpp"
36+ #include " traccc/geometry/detector.hpp"
37+ #include " traccc/geometry/detector_buffer.hpp"
38+ #include " traccc/geometry/detector_conditions_description.hpp"
39+ #include " traccc/geometry/detector_design_description.hpp"
40+ #include " traccc/geometry/host_detector.hpp"
41+ #include " traccc/io/read_cells.hpp"
42+ #include " traccc/io/read_detector.hpp"
43+ #include " traccc/io/read_detector_description.hpp"
44+ #include " traccc/io/read_magnetic_field.hpp"
45+ #include " traccc/seeding/detail/seeding_config.hpp"
46+ #include " traccc/seeding/detail/track_params_estimation_config.hpp"
47+ #include " traccc/utils/propagation.hpp"
48+
49+ namespace ActsExamples {
50+
51+ // / Holds all GPU/host objects that must outlive the per-event calls.
52+ // / Constructed once at algorithm initialisation, reused for every event.
53+ struct TracccChain {
54+ vecmem::host_memory_resource host_mr;
55+ vecmem::cuda::host_memory_resource cuda_host_mr;
56+ vecmem::cuda::device_memory_resource device_mr;
57+ traccc::memory_resource mr;
58+ traccc::cuda::stream stream;
59+ vecmem::cuda::async_copy copy;
60+ vecmem::copy host_copy;
61+
62+ traccc::detector_design_description::host host_det_descr;
63+ traccc::detector_conditions_description::host host_det_cond;
64+
65+ traccc::detector_design_description::buffer device_det_descr;
66+ traccc::detector_conditions_description::buffer device_det_cond;
67+
68+ traccc::host_detector host_detector;
69+ traccc::detector_buffer device_detector;
70+
71+ traccc::magnetic_field host_field;
72+ traccc::magnetic_field device_field;
73+
74+ traccc::seedfinder_config seedfinder_cfg;
75+ traccc::seedfilter_config seedfilter_cfg;
76+ traccc::spacepoint_grid_config spacepoint_grid_cfg;
77+ traccc::track_params_estimation_config track_params_cfg;
78+ traccc::finding_config finding_cfg;
79+ traccc::fitting_config fitting_cfg;
80+ traccc::host::greedy_ambiguity_resolution_algorithm::config_type
81+ resolution_cfg;
82+
83+ traccc::cuda::clusterization_algorithm ca_cuda;
84+ traccc::cuda::measurement_sorting_algorithm ms_cuda;
85+ traccc::cuda::silicon_pixel_spacepoint_formation_algorithm sf_cuda;
86+ traccc::cuda::triplet_seeding_algorithm sa_cuda;
87+ traccc::cuda::seed_parameter_estimation_algorithm tp_cuda;
88+ traccc::cuda::combinatorial_kalman_filter_algorithm finding_cuda;
89+ traccc::cuda::greedy_ambiguity_resolution_algorithm resolution_cuda;
90+ traccc::cuda::kalman_fitting_algorithm fitting_cuda;
91+
92+ TracccChain (const std::string& detector_file,
93+ const std::string& digitization_file,
94+ const std::string& conditions_file,
95+ const std::string& material_file,
96+ const std::string& grid_file,
97+ const std::string& bfield_file);
98+ };
99+
100+ // / Per-event output counters.
101+ struct EventResult {
102+ std::size_t n_cells = 0 ;
103+ std::size_t n_measurements = 0 ;
104+ std::size_t n_spacepoints = 0 ;
105+ std::size_t n_seeds = 0 ;
106+ std::size_t n_found_tracks = 0 ;
107+ std::size_t n_resolved_tracks = 0 ;
108+ std::size_t n_fitted_tracks = 0 ;
109+ };
110+
111+ EventResult processEvent (std::shared_ptr<TracccChain> chain,
112+ const std::string& data_directory,
113+ std::size_t event_id);
114+
115+ } // namespace ActsExamples
0 commit comments