14 #include "../Utilities/Arrays.hpp"
18 #include "vecmem/containers/data/jagged_vector_view.hpp"
19 #include "vecmem/containers/data/vector_view.hpp"
20 #include "vecmem/containers/device_vector.hpp"
21 #include "vecmem/containers/jagged_device_vector.hpp"
22 #include "vecmem/memory/atomic.hpp"
25 #include <CL/sycl.hpp>
30 namespace Acts::Sycl::detail {
37 vecmem::data::vector_view<uint32_t> sumBotTopCombView,
38 const uint32_t numTripletSearchThreads,
const uint32_t firstMiddle,
39 const uint32_t lastMiddle,
40 vecmem::data::jagged_vector_view<const uint32_t> midTopDupletView,
41 vecmem::data::vector_view<uint32_t> sumBotMidView,
42 vecmem::data::vector_view<uint32_t> sumTopMidView,
43 vecmem::data::vector_view<detail::DeviceLinEqCircle> linearBotView,
44 vecmem::data::vector_view<detail::DeviceLinEqCircle> linearTopView,
45 vecmem::data::vector_view<const detail::DeviceSpacePoint> middleSPsView,
46 vecmem::data::vector_view<uint32_t> indTopDupletview,
47 vecmem::data::vector_view<uint32_t> countTripletsView,
49 vecmem::data::vector_view<detail::DeviceTriplet> curvImpactView)
68 const uint32_t
idx = item.get_global_linear_id();
73 const auto sumCombUptoFirstMiddle = sumBotTopCombPrefix[
m_firstMiddle];
81 if (idx + sumCombUptoFirstMiddle < sumBotTopCombPrefix[mid]) {
88 vecmem::jagged_device_vector<const uint32_t> midTopDuplets(
90 const auto numT = midTopDuplets.at(mid).size();
91 const auto threadIdxForMiddleSP =
92 (idx - sumBotTopCombPrefix[mid] + sumCombUptoFirstMiddle);
141 const auto ib = sumBotMidPrefix[mid] + (threadIdxForMiddleSP / numT);
142 const auto it = sumTopMidPrefix[mid] + (threadIdxForMiddleSP % numT);
143 vecmem::device_vector<detail::DeviceLinEqCircle> deviceLinBot(
146 const auto linBotEq = deviceLinBot[
ib];
147 const auto linTopEq = deviceLinTop[
it];
148 const vecmem::device_vector<const detail::DeviceSpacePoint> middleSPs(
150 const auto midSP = middleSPs[mid];
152 const auto Vb = linBotEq.v;
153 const auto Ub = linBotEq.u;
154 const auto Erb = linBotEq.er;
155 const auto cotThetab = linBotEq.cotTheta;
156 const auto iDeltaRb = linBotEq.iDeltaR;
158 const auto Vt = linTopEq.v;
159 const auto Ut = linTopEq.u;
160 const auto Ert = linTopEq.er;
161 const auto cotThetat = linTopEq.cotTheta;
162 const auto iDeltaRt = linTopEq.iDeltaR;
164 const auto rM = midSP.r;
165 const auto varianceRM = midSP.varR;
166 const auto varianceZM = midSP.varZ;
168 auto iSinTheta2 = (1.f + cotThetab * cotThetab);
170 scatteringInRegion2 *=
172 auto error2 = Ert + Erb +
173 2.f * (cotThetab * cotThetat * varianceRM + varianceZM) *
175 auto deltaCotTheta = cotThetab - cotThetat;
176 auto deltaCotTheta2 = deltaCotTheta * deltaCotTheta;
178 deltaCotTheta = cl::sycl::abs(deltaCotTheta);
179 auto error = cl::sycl::sqrt(error2);
180 auto dCotThetaMinusError2 =
181 deltaCotTheta2 + error2 - 2.f * deltaCotTheta *
error;
184 if ((!(deltaCotTheta2 - error2 > 0.
f) ||
185 !(dCotThetaMinusError2 > scatteringInRegion2)) &&
187 auto A = (Vt - Vb) / dU;
188 auto S2 = 1.f +
A *
A;
189 auto B = Vb - A * Ub;
192 auto iHelixDiameter2 = B2 / S2;
194 auto p2scatter = pT2scatter * iSinTheta2;
195 auto Im = cl::sycl::abs((A - B * rM) * rM);
198 !((deltaCotTheta2 - error2 > 0.f) &&
202 vecmem::device_vector<uint32_t> deviceIndTopDuplets(
204 const auto top = deviceIndTopDuplets[
it];
207 vecmem::device_vector<uint32_t> deviceCountTriplets(
209 vecmem::atomic obj(&deviceCountTriplets[
ib]);
210 auto t = obj.fetch_add(1);
230 const auto tripletIdx =
231 sumBotTopCombPrefix[mid] - sumCombUptoFirstMiddle +
232 (((idx - sumBotTopCombPrefix[mid] + sumCombUptoFirstMiddle) /
238 T.curvature = B / cl::sycl::sqrt(S2);
241 vecmem::device_vector<detail::DeviceTriplet> deviceCurvImpact(
243 deviceCurvImpact[tripletIdx] =
T;