forked from acts-project/traccc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfull_chain_algorithm.hpp
165 lines (143 loc) · 6.1 KB
/
full_chain_algorithm.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
/** TRACCC library, part of the ACTS project (R&D line)
*
* (c) 2022-2024 CERN for the benefit of the ACTS project
*
* Mozilla Public License Version 2.0
*/
#pragma once
// Project include(s).
#include "traccc/edm/silicon_cell_collection.hpp"
#include "traccc/finding/combinatorial_kalman_filter_algorithm.hpp"
#include "traccc/fitting/fitting_algorithm.hpp"
#include "traccc/fitting/kalman_filter/kalman_fitter.hpp"
#include "traccc/geometry/detector.hpp"
#include "traccc/geometry/silicon_detector_description.hpp"
#include "traccc/sycl/clusterization/clusterization_algorithm.hpp"
#include "traccc/sycl/seeding/seeding_algorithm.hpp"
#include "traccc/sycl/seeding/spacepoint_formation_algorithm.hpp"
#include "traccc/sycl/seeding/track_params_estimation.hpp"
#include "traccc/utils/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"
// VecMem include(s).
#include <vecmem/memory/binary_page_memory_resource.hpp>
#include <vecmem/memory/memory_resource.hpp>
#include <vecmem/memory/sycl/device_memory_resource.hpp>
#include <vecmem/utils/sycl/async_copy.hpp>
// System include(s).
#include <memory>
namespace traccc::sycl {
namespace details {
/// Internal data type used by @c traccc::sycl::full_chain_algorithm
struct full_chain_algorithm_data;
} // namespace details
/// Algorithm performing the full chain of track reconstruction
///
/// At least as much as is implemented in the project at any given moment.
///
class full_chain_algorithm
: public algorithm<bound_track_parameters_collection_types::host(
const edm::silicon_cell_collection::host&)> {
public:
/// @name (For now dummy...) Type declaration(s)
/// @{
/// (Host) Detector type used during track finding and fitting
using host_detector_type = traccc::default_detector::host;
/// (Device) Detector type used during track finding and fitting
using device_detector_type = traccc::default_detector::device;
/// Stepper type used by the track finding and fitting algorithms
using stepper_type =
detray::rk_stepper<detray::bfield::const_field_t::view_t,
device_detector_type::algebra_type,
detray::constrained_step<>>;
/// Navigator type used by the track finding and fitting algorithms
using navigator_type = detray::navigator<const device_detector_type>;
/// Spacepoint formation algorithm type
using spacepoint_formation_algorithm =
traccc::sycl::spacepoint_formation_algorithm<
traccc::default_detector::device>;
/// Clustering algorithm type
using clustering_algorithm = clusterization_algorithm;
/// Track finding algorithm type
using finding_algorithm =
traccc::host::combinatorial_kalman_filter_algorithm;
/// Track fitting algorithm type
using fitting_algorithm = traccc::fitting_algorithm<
traccc::kalman_fitter<stepper_type, navigator_type>>;
/// @}
/// Algorithm constructor
///
/// @param mr The memory resource to use for the intermediate and result
/// objects
///
full_chain_algorithm(vecmem::memory_resource& host_mr,
const clustering_config& clustering_config,
const seedfinder_config& finder_config,
const spacepoint_grid_config& grid_config,
const seedfilter_config& filter_config,
const finding_algorithm::config_type& finding_config,
const fitting_algorithm::config_type& fitting_config,
const silicon_detector_description::host& det_descr,
host_detector_type* detector = nullptr);
/// Copy constructor
///
/// An explicit copy constructor is necessary because in the MT tests
/// we do want to copy such objects, but a default copy-constructor can
/// not be generated for them.
///
/// @param parent The parent algorithm chain to copy
///
full_chain_algorithm(const full_chain_algorithm& parent);
/// Algorithm destructor
~full_chain_algorithm();
/// Reconstruct track parameters in the entire detector
///
/// @param cells The cells for every detector module in the event
/// @return The track parameters reconstructed
///
output_type operator()(
const edm::silicon_cell_collection::host& cells) const override;
private:
/// Private data object
std::unique_ptr<details::full_chain_algorithm_data> m_data;
/// Host memory resource
std::reference_wrapper<vecmem::memory_resource> m_host_mr;
/// Device memory resource
vecmem::sycl::device_memory_resource m_device_mr;
/// Device caching memory resource
mutable vecmem::binary_page_memory_resource m_cached_device_mr;
/// Memory copy object
mutable vecmem::sycl::async_copy m_copy;
/// Detector description
std::reference_wrapper<const silicon_detector_description::host>
m_det_descr;
/// Detector description buffer
silicon_detector_description::buffer m_device_det_descr;
/// Host detector
host_detector_type* m_detector;
/// Buffer holding the detector's payload on the device
host_detector_type::buffer_type m_device_detector;
/// View of the detector's payload on the device
host_detector_type::view_type m_device_detector_view;
/// @name Sub-algorithms used by this full-chain algorithm
/// @{
/// Clusterization algorithm
clusterization_algorithm m_clusterization;
/// Spacepoint formation algorithm
spacepoint_formation_algorithm m_spacepoint_formation;
/// Seeding algorithm
seeding_algorithm m_seeding;
/// Track parameter estimation algorithm
track_params_estimation m_track_parameter_estimation;
/// Configs
clustering_config m_clustering_config;
seedfinder_config m_finder_config;
spacepoint_grid_config m_grid_config;
seedfilter_config m_filter_config;
/// @}
}; // class full_chain_algorithm
} // namespace traccc::sycl