12 #include <type_traits>
16 template <
typename external_spacepo
int_t>
19 : m_config(std::move(config)) {
38 template <
typename external_spacepo
int_t>
39 template <
typename sp_range_t>
40 std::vector<Seed<external_spacepoint_t>>
42 sp_range_t bottomSPs, sp_range_t middleSPs, sp_range_t topSPs)
const {
43 std::vector<Seed<external_spacepoint_t>> outputVec;
58 &seedFilterConfig.deltaInvHelixDiameter);
60 &seedFilterConfig.impactWeightFactor);
69 std::vector<const Acts::InternalSpacePoint<external_spacepoint_t>*>
71 std::vector<const Acts::InternalSpacePoint<external_spacepoint_t>*>
73 std::vector<const Acts::InternalSpacePoint<external_spacepoint_t>*> topSPvec;
80 for (
auto sp : middleSPs) {
82 middleSPvec.push_back(sp);
84 for (
auto sp : bottomSPs) {
86 bottomSPvec.push_back(sp);
88 for (
auto sp : topSPs) {
90 topSPvec.push_back(sp);
97 if (nSpM == 0 || nSpB == 0 || nSpT == 0)
105 auto fillMatrix = [](
auto& mat,
auto& id,
auto sp) {
106 mat.set(
id, 0, sp->x());
107 mat.set(
id, 1, sp->y());
108 mat.set(
id, 2, sp->z());
109 mat.set(
id, 3, sp->radius());
110 mat.set(
id, 4, sp->varianceR());
111 mat.set(
id, 5, sp->varianceZ());
116 for (
auto sp : middleSPs) {
117 fillMatrix(spMmat_cpu, mIdx, sp);
120 for (
auto sp : bottomSPs) {
121 fillMatrix(spBmat_cpu, bIdx, sp);
124 for (
auto sp : topSPs) {
125 fillMatrix(spTmat_cpu, tIdx, sp);
139 nSpBcompPerSpM_cuda.zeros();
141 nSpTcompPerSpM_cuda.zeros();
149 dim3 DS_GridSize(nSpM, 1, 1);
151 searchDoublet(DS_GridSize, DS_BlockSize, nSpM_cuda.get(), spMmat_cuda.get(),
152 nSpB_cuda.get(), spBmat_cuda.get(), nSpT_cuda.get(),
153 spTmat_cuda.get(), deltaRMin_cuda.get(), deltaRMax_cuda.get(),
154 cotThetaMax_cuda.get(), collisionRegionMin_cuda.get(),
155 collisionRegionMax_cuda.get(), nSpMcomp_cuda.get(),
156 nSpBcompPerSpMMax_cuda.get(), nSpTcompPerSpMMax_cuda.get(),
157 nSpBcompPerSpM_cuda.get(), nSpTcompPerSpM_cuda.get(),
158 McompIndex_cuda.get(), BcompIndex_cuda.get(),
159 tmpBcompIndex_cuda.get(), TcompIndex_cuda.get(),
160 tmpTcompIndex_cuda.get());
175 (*nSpMcomp_cpu.get()) * 6);
177 (*nSpMcomp_cpu.get()) * 6);
179 (*nSpMcomp_cpu.get()) * 6);
181 (*nSpMcomp_cpu.get()) * 6);
183 dim3 TC_GridSize(*nSpMcomp_cpu.get(), 1, 1);
187 TC_GridSize, TC_BlockSize, nSpM_cuda.get(), spMmat_cuda.get(),
188 McompIndex_cuda.get(), nSpB_cuda.get(), spBmat_cuda.get(),
189 nSpBcompPerSpMMax_cuda.get(), BcompIndex_cuda.get(), nSpT_cuda.get(),
190 spTmat_cuda.get(), nSpTcompPerSpMMax_cuda.get(), TcompIndex_cuda.get(),
191 spMcompMat_cuda.get(), spBcompMatPerSpM_cuda.get(),
192 circBcompMatPerSpM_cuda.get(), spTcompMatPerSpM_cuda.get(),
193 circTcompMatPerSpM_cuda.get());
199 const int nTrplPerSpMLimit =
205 &nTrplPerSpBLimit_cuda);
208 nTrplPerSpM_cuda.zeros();
210 *nSpMcomp_cpu.get());
212 nTrplPerSpM_cpu.
zeros();
215 cudaStream_t cuStream;
216 ACTS_CUDA_ERROR_CHECK(cudaStreamCreate(&cuStream));
218 for (
int i_m = 0; i_m <= *nSpMcomp_cpu.get(); i_m++) {
219 cudaStreamSynchronize(cuStream);
222 if (i_m < *nSpMcomp_cpu.get()) {
223 int mIndex = *McompIndex_cpu.
get(i_m);
224 int* nSpBcompPerSpM = nSpBcompPerSpM_cpu.
get(mIndex);
225 int* nSpTcompPerSpM = nSpTcompPerSpM_cpu.
get(mIndex);
227 dim3 TS_GridSize(*nSpBcompPerSpM, 1, 1);
232 TS_GridSize, TS_BlockSize, nSpTcompPerSpM_cpu.
get(mIndex),
233 nSpTcompPerSpM_cuda.get(mIndex), nSpMcomp_cuda.get(),
234 spMcompMat_cuda.get(i_m, 0), nSpBcompPerSpMMax_cuda.get(),
235 BcompIndex_cuda.get(0, i_m), circBcompMatPerSpM_cuda.get(0, 6 * i_m),
236 nSpTcompPerSpMMax_cuda.get(), TcompIndex_cuda.get(0, i_m),
237 spTcompMatPerSpM_cuda.get(0, 6 * i_m),
238 circTcompMatPerSpM_cuda.get(0, 6 * i_m),
240 maxScatteringAngle2_cuda.get(), sigmaScattering_cuda.get(),
241 minHelixDiameter2_cuda.get(), pT2perRadius_cuda.get(),
242 impactMax_cuda.get(), nTrplPerSpMLimit_cuda.get(),
243 nTrplPerSpBLimit_cpu.
get(), nTrplPerSpBLimit_cuda.get(),
244 deltaInvHelixDiameter_cuda.get(), impactWeightFactor_cuda.get(),
245 filterDeltaRMin_cuda.get(), compatSeedWeight_cuda.get(),
246 compatSeedLimit_cpu.
get(), compatSeedLimit_cuda.get(),
248 nTrplPerSpM_cuda.get(i_m), TripletsPerSpM_cuda.get(0, i_m),
250 nTrplPerSpM_cpu.copyD2H(nTrplPerSpM_cuda.get(i_m), 1, i_m, &cuStream);
252 TripletsPerSpM_cpu.copyD2H(TripletsPerSpM_cuda.get(0, i_m),
253 nTrplPerSpMLimit, nTrplPerSpMLimit * i_m,
260 float, std::unique_ptr<const InternalSeed<external_spacepoint_t>>>>
263 for (
int i = 0; i < *nTrplPerSpM_cpu.get(i_m - 1); i++) {
264 auto& triplet = *TripletsPerSpM_cpu.get(i, i_m - 1);
265 int mIndex = *McompIndex_cpu.
get(i_m - 1);
266 int bIndex = triplet.bIndex;
267 int tIndex = triplet.tIndex;
269 auto& bottomSP = *bottomSPvec[bIndex];
270 auto& middleSP = *middleSPvec[mIndex];
271 auto& topSP = *topSPvec[tIndex];
272 if (m_experimentCuts !=
nullptr) {
275 m_experimentCuts->seedWeight(bottomSP, middleSP, topSP);
277 if (!m_experimentCuts->singleSeedCut(triplet.weight, bottomSP,
286 seedsPerSpM.push_back(std::make_pair(
289 bottomSP, middleSP, topSP, Zob)));
295 ACTS_CUDA_ERROR_CHECK(cudaStreamDestroy(cuStream));