32 template <
typename external_spacepo
int_t>
38 std::unique_ptr<const Logger> incomingLogger)
39 : m_commonConfig(commonConfig),
40 m_seedFinderOptions(seedFinderOptions),
41 m_seedFilterConfig(seedFilterConfig),
42 m_tripletFilterConfig(tripletFilterConfig),
46 throw std::runtime_error(
47 "SeedFinderConfig not in ACTS internal units in "
48 "Cuda/Seeding2/SeedFinder");
50 throw std::runtime_error(
51 "SeedFinderConfig not in ACTS internal units in "
52 "Cuda/Seeding2/SeedFinder");
54 throw std::runtime_error(
55 "SeedFilterConfig not in ACTS internal units in "
56 "Cuda/Seeding2/SeedFinder");
58 throw std::runtime_error(
"Value of deltaRMaxTopSP was not initialised");
61 throw std::runtime_error(
"Value of deltaRMinTopSP was not initialised");
64 throw std::runtime_error(
"Value of deltaRMaxBottomSP was not initialised");
67 throw std::runtime_error(
"Value of deltaRMinBottomSP was not initialised");
76 throw std::runtime_error(
"Invalid CUDA device requested");
80 template <
typename external_spacepo
int_t>
81 template <
typename sp_range_t>
82 std::vector<Seed<external_spacepoint_t>>
86 const sp_range_t& bottomSPs,
const std::size_t middleSPs,
87 const sp_range_t& topSPs)
const {
90 std::vector<Seed<external_spacepoint_t>> outputVec;
97 auto spVecMaker = [&
grid](
const sp_range_t& spRange) {
98 std::vector<Acts::InternalSpacePoint<external_spacepoint_t>*> result;
99 for (std::size_t
idx : spRange) {
100 auto& collection = grid.
at(
idx);
101 for (
auto& sp : collection) {
102 result.push_back(sp.get());
108 std::vector<Acts::InternalSpacePoint<external_spacepoint_t>*> bottomSPVec(
109 spVecMaker(bottomSPs));
110 std::vector<Acts::InternalSpacePoint<external_spacepoint_t>*> topSPVec(
113 std::vector<Acts::InternalSpacePoint<external_spacepoint_t>*> middleSPVec;
115 auto& collection = grid.
at(middleSPs);
116 for (
auto& sp : collection) {
117 middleSPVec.push_back(sp.get());
122 if ((middleSPVec.size() == 0) || (bottomSPVec.size() == 0) ||
123 (topSPVec.size() == 0)) {
129 auto bottomSPArray = make_host_array<Details::SpacePoint>(bottomSPVec.size());
130 auto middleSPArray = make_host_array<Details::SpacePoint>(middleSPVec.size());
131 auto topSPArray = make_host_array<Details::SpacePoint>(topSPVec.size());
135 for (std::size_t
i = 0;
i < spVec.size(); ++
i) {
136 array[
i].
x = spVec[
i]->x();
137 array[
i].
y = spVec[
i]->y();
138 array[
i].
z = spVec[
i]->z();
139 array[
i].
radius = spVec[
i]->radius();
144 fillSPArray(bottomSPArray.get(), bottomSPVec);
145 fillSPArray(middleSPArray.get(), middleSPVec);
146 fillSPArray(topSPArray.get(), topSPVec);
149 auto bottomSPDeviceArray =
150 make_device_array<Details::SpacePoint>(bottomSPVec.size());
151 auto middleSPDeviceArray =
152 make_device_array<Details::SpacePoint>(middleSPVec.size());
153 auto topSPDeviceArray =
154 make_device_array<Details::SpacePoint>(topSPVec.size());
155 copyToDevice(bottomSPDeviceArray, bottomSPArray, bottomSPVec.size());
156 copyToDevice(middleSPDeviceArray, middleSPArray, middleSPVec.size());
157 copyToDevice(topSPDeviceArray, topSPArray, topSPVec.size());
165 auto dubletCountsHost = make_host_array<unsigned int>(middleSPVec.size());
166 memset(dubletCountsHost.get(), 0, middleSPVec.size() *
sizeof(
unsigned int));
167 auto middleBottomCounts = make_device_array<unsigned int>(middleSPVec.size());
168 copyToDevice(middleBottomCounts, dubletCountsHost, middleSPVec.size());
169 auto middleTopCounts = make_device_array<unsigned int>(middleSPVec.size());
170 copyToDevice(middleTopCounts, dubletCountsHost, middleSPVec.size());
174 auto middleBottomDublets =
175 make_device_array<std::size_t>(middleSPVec.size() * bottomSPVec.size());
176 auto middleTopDublets =
177 make_device_array<std::size_t>(middleSPVec.size() * topSPVec.size());
181 m_commonConfig.maxBlockSize, bottomSPVec.size(), bottomSPDeviceArray,
182 middleSPVec.size(), middleSPDeviceArray, topSPVec.size(),
183 topSPDeviceArray, m_commonConfig.deltaRMin, m_commonConfig.deltaRMax,
184 m_commonConfig.cotThetaMax, m_commonConfig.collisionRegionMin,
185 m_commonConfig.collisionRegionMax, middleBottomCounts,
186 middleBottomDublets, middleTopCounts, middleTopDublets);
192 middleBottomCounts, middleTopCounts);
195 if ((dubletCounts.nDublets == 0) || (dubletCounts.nTriplets == 0)) {
201 Info::instance().devices()[m_device], m_commonConfig.maxBlockSize,
202 dubletCounts, m_seedFilterConfig, m_tripletFilterConfig,
203 bottomSPVec.size(), bottomSPDeviceArray, middleSPVec.size(),
204 middleSPDeviceArray, topSPVec.size(), topSPDeviceArray,
205 middleBottomCounts, middleBottomDublets, middleTopCounts,
206 middleTopDublets, m_commonConfig.maxScatteringAngle2,
207 m_commonConfig.sigmaScattering, m_seedFinderOptions.minHelixDiameter2,
208 m_seedFinderOptions.pT2perRadius, m_commonConfig.impactMax);
209 assert(tripletCandidates.size() == middleSPVec.size());
212 std::size_t middleIndex = 0;
213 auto triplet_itr = tripletCandidates.begin();
214 auto triplet_end = tripletCandidates.end();
215 for (; triplet_itr != triplet_end; ++triplet_itr, ++middleIndex) {
220 auto& middleSP = *(middleSPVec[middleIndex]);
222 assert(triplet.bottomIndex < bottomSPVec.size());
223 auto& bottomSP = *(bottomSPVec[triplet.bottomIndex]);
224 assert(triplet.topIndex < topSPVec.size());
225 auto& topSP = *(topSPVec[triplet.topIndex]);
226 candidates.emplace_back(bottomSP, middleSP, topSP, triplet.weight, 0,
230 candidates.begin(), candidates.end(),
232 descendingByQuality);
233 std::size_t numQualitySeeds = 0;
234 m_commonConfig.seedFilter->filterSeeds_1SpFixed(
235 spacePointData, candidates, numQualitySeeds,
236 std::back_inserter(outputVec));
246 template <
typename external_spacepo
int_t>
248 std::unique_ptr<const Logger> newLogger) {