1 #ifndef RecoTracker_LSTCore_src_alpaka_Triplet_h 2 #define RecoTracker_LSTCore_src_alpaka_Triplet_h 21 unsigned int innerSegmentIndex,
22 unsigned int outerSegmentIndex,
23 uint16_t innerInnerLowerModuleIndex,
24 uint16_t middleLowerModuleIndex,
25 uint16_t outerOuterLowerModuleIndex,
26 #ifdef CUT_VALUE_DEBUG
35 unsigned int tripletIndex) {
36 triplets.segmentIndices()[tripletIndex][0] = innerSegmentIndex;
37 triplets.segmentIndices()[tripletIndex][1] = outerSegmentIndex;
38 triplets.lowerModuleIndices()[tripletIndex][0] = innerInnerLowerModuleIndex;
39 triplets.lowerModuleIndices()[tripletIndex][1] = middleLowerModuleIndex;
40 triplets.lowerModuleIndices()[tripletIndex][2] = outerOuterLowerModuleIndex;
42 triplets.betaIn()[tripletIndex] =
__F2H(betaIn);
43 triplets.radius()[tripletIndex] = circleRadius;
44 triplets.centerX()[tripletIndex] = circleCenterX;
45 triplets.centerY()[tripletIndex] = circleCenterY;
46 triplets.logicalLayers()[tripletIndex][0] =
47 modules.layers()[innerInnerLowerModuleIndex] + (
modules.subdets()[innerInnerLowerModuleIndex] == 4) * 6;
48 triplets.logicalLayers()[tripletIndex][1] =
49 modules.layers()[middleLowerModuleIndex] + (
modules.subdets()[middleLowerModuleIndex] == 4) * 6;
50 triplets.logicalLayers()[tripletIndex][2] =
51 modules.layers()[outerOuterLowerModuleIndex] + (
modules.subdets()[outerOuterLowerModuleIndex] == 4) * 6;
53 unsigned int firstMDIndex = segments.mdIndices()[innerSegmentIndex][0];
54 unsigned int secondMDIndex = segments.mdIndices()[innerSegmentIndex][1];
55 unsigned int thirdMDIndex = segments.mdIndices()[outerSegmentIndex][1];
57 triplets.hitIndices()[tripletIndex][0] = mds.anchorHitIndices()[firstMDIndex];
58 triplets.hitIndices()[tripletIndex][1] = mds.outerHitIndices()[firstMDIndex];
59 triplets.hitIndices()[tripletIndex][2] = mds.anchorHitIndices()[secondMDIndex];
60 triplets.hitIndices()[tripletIndex][3] = mds.outerHitIndices()[secondMDIndex];
61 triplets.hitIndices()[tripletIndex][4] = mds.anchorHitIndices()[thirdMDIndex];
62 triplets.hitIndices()[tripletIndex][5] = mds.outerHitIndices()[thirdMDIndex];
63 #ifdef CUT_VALUE_DEBUG 64 triplets.zOut()[tripletIndex] = zOut;
65 triplets.rtOut()[tripletIndex] = rtOut;
66 triplets.betaInCut()[tripletIndex] = betaInCut;
70 template <
typename TAcc>
74 uint16_t innerInnerLowerModuleIndex,
75 uint16_t middleLowerModuleIndex,
76 uint16_t outerOuterLowerModuleIndex,
77 unsigned int firstMDIndex,
78 unsigned int secondMDIndex,
79 unsigned int thirdMDIndex) {
81 const float& r1 = mds.anchorRt()[firstMDIndex];
82 const float&
r2 = mds.anchorRt()[secondMDIndex];
83 const float& r3 = mds.anchorRt()[thirdMDIndex];
85 const float&
z1 = mds.anchorZ()[firstMDIndex];
86 const float&
z2 = mds.anchorZ()[secondMDIndex];
87 const float& z3 = mds.anchorZ()[thirdMDIndex];
90 const int layer1 =
modules.lstLayers()[innerInnerLowerModuleIndex];
91 const int layer2 =
modules.lstLayers()[middleLowerModuleIndex];
92 const int layer3 =
modules.lstLayers()[outerOuterLowerModuleIndex];
94 const float residual =
z2 - ((z3 -
z1) / (r3 - r1) * (
r2 - r1) +
z1);
96 if (layer1 == 12 and layer2 == 13 and layer3 == 14) {
98 }
else if (layer1 == 1 and layer2 == 2 and layer3 == 3) {
100 }
else if (layer1 == 1 and layer2 == 2 and layer3 == 7) {
102 }
else if (layer1 == 13 and layer2 == 14 and layer3 == 15) {
104 }
else if (layer1 == 14 and layer2 == 15 and layer3 == 16) {
106 }
else if (layer1 == 1 and layer2 == 7 and layer3 == 8) {
108 }
else if (layer1 == 2 and layer2 == 3 and layer3 == 4) {
110 }
else if (layer1 == 2 and layer2 == 3 and layer3 == 7) {
112 }
else if (layer1 == 2 and layer2 == 7 and layer3 == 8) {
114 }
else if (layer1 == 3 and layer2 == 4 and layer3 == 5) {
116 }
else if (layer1 == 4 and layer2 == 5 and layer3 == 6) {
118 }
else if (layer1 == 7 and layer2 == 8 and layer3 == 9) {
120 }
else if (layer1 == 8 and layer2 == 9 and layer3 == 10) {
122 }
else if (layer1 == 9 and layer2 == 10 and layer3 == 11) {
129 template <
typename TAcc>
134 uint16_t innerInnerLowerModuleIndex,
135 uint16_t middleLowerModuleIndex,
136 uint16_t outerOuterLowerModuleIndex,
137 unsigned int firstMDIndex,
138 unsigned int secondMDIndex,
139 unsigned int thirdMDIndex,
142 unsigned int innerSegmentIndex,
145 bool isPSIn = (
modules.moduleType()[innerInnerLowerModuleIndex] ==
PS);
146 bool isPSOut = (
modules.moduleType()[outerOuterLowerModuleIndex] ==
PS);
148 float rtIn = mds.anchorRt()[firstMDIndex];
149 float rtMid = mds.anchorRt()[secondMDIndex];
150 rtOut = mds.anchorRt()[thirdMDIndex];
152 float zIn = mds.anchorZ()[firstMDIndex];
153 float zMid = mds.anchorZ()[secondMDIndex];
154 zOut = mds.anchorZ()[thirdMDIndex];
158 float rtRatio_OutIn = rtOut / rtIn;
164 zIn + (zIn +
kDeltaZLum) * (rtRatio_OutIn - 1.
f) * (zIn < 0.f ? 1.f : dzDrtScale) + (zpitchIn + zpitchOut);
165 const float zLo = zIn + (zIn -
kDeltaZLum) * (rtRatio_OutIn - 1.
f) * (zIn > 0.f ? 1.f : dzDrtScale) -
166 (zpitchIn + zpitchOut);
169 if ((zOut < zLo) || (zOut > zHi))
172 float drt_OutIn = (rtOut - rtIn);
175 float drt_InSeg = rtMid - rtIn;
176 float dz_InSeg = zMid - zIn;
180 float coshEta = dr3_InSeg / drt_InSeg;
181 float dzErr = (zpitchIn + zpitchOut) * (zpitchIn + zpitchOut) * 2.f;
184 float muls2 = thetaMuls2 * 9.f / (
ptCut *
ptCut) * 16.
f;
185 dzErr += muls2 * drt_OutIn * drt_OutIn / 3.f * coshEta * coshEta;
189 const float dzMean = dz_InSeg / drt_InSeg * drt_OutIn;
190 const float zWindow =
dzErr / drt_InSeg * drt_OutIn +
191 (zpitchIn + zpitchOut);
192 const float zLoPointed = zIn + dzMean * (zIn > 0.f ? 1.f : dzDrtScale) - zWindow;
193 const float zHiPointed = zIn + dzMean * (zIn < 0.f ? 1.f : dzDrtScale) + zWindow;
198 if ((zOut < zLoPointed) || (zOut > zHiPointed))
202 float alpha_InLo =
__H2F(segments.dPhiChanges()[innerSegmentIndex]);
203 float tl_axis_x = mds.anchorX()[thirdMDIndex] - mds.anchorX()[firstMDIndex];
204 float tl_axis_y = mds.anchorY()[thirdMDIndex] - mds.anchorY()[firstMDIndex];
205 betaIn = alpha_InLo -
phi_mpi_pi(acc,
phi(acc, tl_axis_x, tl_axis_y) - mds.anchorPhi()[firstMDIndex]);
208 float drt_tl_axis =
alpaka::math::sqrt(acc, tl_axis_x * tl_axis_x + tl_axis_y * tl_axis_y);
212 (mds.anchorX()[secondMDIndex] - mds.anchorX()[firstMDIndex]) *
213 (mds.anchorX()[secondMDIndex] - mds.anchorX()[firstMDIndex]) +
214 (mds.anchorY()[secondMDIndex] - mds.anchorY()[firstMDIndex]) *
215 (mds.anchorY()[secondMDIndex] - mds.anchorY()[firstMDIndex]));
224 template <
typename TAcc>
229 uint16_t innerInnerLowerModuleIndex,
230 uint16_t middleLowerModuleIndex,
231 uint16_t outerOuterLowerModuleIndex,
232 unsigned int firstMDIndex,
233 unsigned int secondMDIndex,
234 unsigned int thirdMDIndex,
237 uint16_t innerOuterLowerModuleIndex,
238 unsigned int innerSegmentIndex,
239 unsigned int outerSegmentIndex,
242 bool isPSIn = (
modules.moduleType()[innerInnerLowerModuleIndex] ==
PS);
243 bool isPSOut = (
modules.moduleType()[outerOuterLowerModuleIndex] ==
PS);
245 float rtIn = mds.anchorRt()[firstMDIndex];
246 float rtMid = mds.anchorRt()[secondMDIndex];
247 rtOut = mds.anchorRt()[thirdMDIndex];
249 float zIn = mds.anchorZ()[firstMDIndex];
250 float zMid = mds.anchorZ()[secondMDIndex];
251 zOut = mds.anchorZ()[thirdMDIndex];
259 float zGeom = zpitchIn + zpitchOut;
265 float dLum = alpaka::math::copysign(acc,
kDeltaZLum, zIn);
266 bool isOutSgInnerMDPS =
modules.moduleType()[outerOuterLowerModuleIndex] ==
PS;
268 float zGeom1 = alpaka::math::copysign(acc, zGeom, zIn);
269 float rtLo = rtIn * (1.f + (zOut - zIn - zGeom1) / (zIn + zGeom1 + dLum) / dzDrtScale) -
273 float zInForHi = zIn - zGeom1 - dLum;
274 if (zInForHi * zIn < 0) {
275 zInForHi = alpaka::math::copysign(acc, 0.1
f, zIn);
277 float rtHi = rtIn * (1.f + (zOut - zIn + zGeom1) / zInForHi) + rtGeom1;
280 if ((rtOut < rtLo) || (rtOut > rtHi))
285 const float drtSDIn = rtMid - rtIn;
286 const float dzSDIn = zMid - zIn;
287 const float dr3SDIn =
290 const float coshEta = dr3SDIn / drtSDIn;
292 const float multDzDr = dzOutInAbs * coshEta / (coshEta * coshEta - 1.f);
294 const float kZ = (zOut - zIn) / dzSDIn;
296 zGeom1_another * zGeom1_another * drtSDIn * drtSDIn / dzSDIn / dzSDIn * (1.f - 2.f * kZ + 2.f * kZ * kZ);
297 const float thetaMuls2 = (
kMulsInGeV *
kMulsInGeV) * (0.1
f + 0.2 * (rtOut - rtIn) / 50.f) * (rIn / rtIn);
298 const float muls2 = thetaMuls2 * 9.f / (
ptCut *
ptCut) * 16.
f;
299 drtErr += muls2 * multDzDr * multDzDr / 3.f * coshEta * coshEta;
304 if ((kZ < 0) || (rtOut < rtLo) || (rtOut > rtHi))
307 float rt_InLo = mds.anchorRt()[firstMDIndex];
308 float rt_InOut = mds.anchorRt()[secondMDIndex];
310 float sdIn_alpha =
__H2F(segments.dPhiChanges()[innerSegmentIndex]);
312 float tl_axis_x = mds.anchorX()[thirdMDIndex] - mds.anchorX()[firstMDIndex];
313 float tl_axis_y = mds.anchorY()[thirdMDIndex] - mds.anchorY()[firstMDIndex];
315 betaIn = sdIn_alpha -
phi_mpi_pi(acc,
phi(acc, tl_axis_x, tl_axis_y) - mds.anchorPhi()[firstMDIndex]);
317 float betaInRHmin = betaIn;
318 float betaInRHmax = betaIn;
323 swapTemp = betaInRHmin;
324 betaInRHmin = betaInRHmax;
325 betaInRHmax = swapTemp;
329 (mds.anchorX()[secondMDIndex] - mds.anchorX()[firstMDIndex]) *
330 (mds.anchorX()[secondMDIndex] - mds.anchorX()[firstMDIndex]) +
331 (mds.anchorY()[secondMDIndex] - mds.anchorY()[firstMDIndex]) *
332 (mds.anchorY()[secondMDIndex] - mds.anchorY()[firstMDIndex]));
333 float sdIn_d = rt_InOut - rt_InLo;
343 template <
typename TAcc>
348 uint16_t innerInnerLowerModuleIndex,
349 uint16_t middleLowerModuleIndex,
350 uint16_t outerOuterLowerModuleIndex,
351 unsigned int firstMDIndex,
352 unsigned int secondMDIndex,
353 unsigned int thirdMDIndex,
356 unsigned int innerSegmentIndex,
357 unsigned int outerSegmentIndex,
360 float rtIn = mds.anchorRt()[firstMDIndex];
361 float rtMid = mds.anchorRt()[secondMDIndex];
362 rtOut = mds.anchorRt()[thirdMDIndex];
364 float zIn = mds.anchorZ()[firstMDIndex];
365 float zMid = mds.anchorZ()[secondMDIndex];
366 zOut = mds.anchorZ()[thirdMDIndex];
377 float dLum = alpaka::math::copysign(acc,
kDeltaZLum, zIn);
378 bool isOutSgOuterMDPS =
modules.moduleType()[outerOuterLowerModuleIndex] ==
PS;
379 bool isInSgInnerMDPS =
modules.moduleType()[innerInnerLowerModuleIndex] ==
PS;
381 float rtGeom = (isInSgInnerMDPS and isOutSgOuterMDPS) ? 2.
f *
kPixelPSZpitch 385 float dz = zOut - zIn;
386 const float rtLo = rtIn * (1.f +
dz / (zIn + dLum) / dzDrtScale) - rtGeom;
387 const float rtHi = rtIn * (1.f +
dz / (zIn - dLum)) + rtGeom;
390 if ((rtOut < rtLo) || (rtOut > rtHi))
393 bool isInSgOuterMDPS =
modules.moduleType()[outerOuterLowerModuleIndex] ==
PS;
395 float drtSDIn = rtMid - rtIn;
396 float dzSDIn = zMid - zIn;
400 float coshEta = dr3SDIn / drtSDIn;
402 float multDzDr = dzOutInAbs * coshEta / (coshEta * coshEta - 1.f);
404 float kZ = (zOut - zIn) / dzSDIn;
407 float muls2 = thetaMuls2 * 9.f / (
ptCut *
ptCut) * 16.
f;
412 muls2 * multDzDr * multDzDr / 3.
f * coshEta * coshEta);
415 float rtWindow = drtErr + rtGeom;
416 float rtLo_point = rtIn + drtMean / dzDrtScale - rtWindow;
417 float rtHi_point = rtIn + drtMean + rtWindow;
422 if (isInSgInnerMDPS and isInSgOuterMDPS)
424 if ((kZ < 0) || (rtOut < rtLo_point) || (rtOut > rtHi_point))
428 float rt_InLo = mds.anchorRt()[firstMDIndex];
429 float rt_InOut = mds.anchorRt()[secondMDIndex];
430 float sdIn_alpha =
__H2F(segments.dPhiChanges()[innerSegmentIndex]);
432 float tl_axis_x = mds.anchorX()[thirdMDIndex] - mds.anchorX()[firstMDIndex];
433 float tl_axis_y = mds.anchorY()[thirdMDIndex] - mds.anchorY()[firstMDIndex];
435 betaIn = sdIn_alpha -
phi_mpi_pi(acc,
phi(acc, tl_axis_x, tl_axis_y) - mds.anchorPhi()[firstMDIndex]);
437 float sdIn_alphaRHmin =
__H2F(segments.dPhiChangeMins()[innerSegmentIndex]);
438 float sdIn_alphaRHmax =
__H2F(segments.dPhiChangeMaxs()[innerSegmentIndex]);
439 float betaInRHmin = betaIn + sdIn_alphaRHmin - sdIn_alpha;
440 float betaInRHmax = betaIn + sdIn_alphaRHmax - sdIn_alpha;
445 swapTemp = betaInRHmin;
446 betaInRHmin = betaInRHmax;
447 betaInRHmax = swapTemp;
450 (mds.anchorX()[secondMDIndex] - mds.anchorX()[firstMDIndex]) *
451 (mds.anchorX()[secondMDIndex] - mds.anchorX()[firstMDIndex]) +
452 (mds.anchorY()[secondMDIndex] - mds.anchorY()[firstMDIndex]) *
453 (mds.anchorY()[secondMDIndex] - mds.anchorY()[firstMDIndex]));
454 float sdIn_d = rt_InOut - rt_InLo;
464 template <
typename TAcc>
469 uint16_t innerInnerLowerModuleIndex,
470 uint16_t middleLowerModuleIndex,
471 uint16_t outerOuterLowerModuleIndex,
472 unsigned int firstMDIndex,
473 unsigned int secondMDIndex,
474 unsigned int thirdMDIndex,
477 uint16_t innerOuterLowerModuleIndex,
478 unsigned int innerSegmentIndex,
479 unsigned int outerSegmentIndex,
482 short innerInnerLowerModuleSubdet =
modules.subdets()[innerInnerLowerModuleIndex];
483 short middleLowerModuleSubdet =
modules.subdets()[middleLowerModuleIndex];
484 short outerOuterLowerModuleSubdet =
modules.subdets()[outerOuterLowerModuleIndex];
486 if (innerInnerLowerModuleSubdet == Barrel and middleLowerModuleSubdet == Barrel and
487 outerOuterLowerModuleSubdet == Barrel) {
492 innerInnerLowerModuleIndex,
493 middleLowerModuleIndex,
494 outerOuterLowerModuleIndex,
503 }
else if (innerInnerLowerModuleSubdet == Barrel and middleLowerModuleSubdet == Barrel and
504 outerOuterLowerModuleSubdet ==
Endcap) {
509 innerInnerLowerModuleIndex,
510 middleLowerModuleIndex,
511 outerOuterLowerModuleIndex,
517 innerOuterLowerModuleIndex,
522 }
else if (innerInnerLowerModuleSubdet == Barrel and middleLowerModuleSubdet ==
Endcap and
523 outerOuterLowerModuleSubdet ==
Endcap) {
528 innerInnerLowerModuleIndex,
529 middleLowerModuleIndex,
530 outerOuterLowerModuleIndex,
536 innerOuterLowerModuleIndex,
544 else if (innerInnerLowerModuleSubdet ==
Endcap and middleLowerModuleSubdet ==
Endcap and
545 outerOuterLowerModuleSubdet ==
Endcap) {
550 innerInnerLowerModuleIndex,
551 middleLowerModuleIndex,
552 outerOuterLowerModuleIndex,
566 template <
typename TAcc>
568 TAcc
const& acc,
float x1,
float y1,
float x2,
float y2,
float x3,
float y3,
float&
g,
float&
f) {
574 float denomInv = 1.0f / ((
y1 - y3) * (x2 - x3) - (x1 - x3) * (
y2 - y3));
576 float xy1sqr = x1 * x1 +
y1 *
y1;
578 float xy2sqr = x2 * x2 +
y2 *
y2;
580 float xy3sqr = x3 * x3 + y3 * y3;
582 g = 0.5f * ((y3 -
y2) * xy1sqr + (
y1 - y3) * xy2sqr + (
y2 -
y1) * xy3sqr) * denomInv;
584 f = 0.5f * ((x2 - x3) * xy1sqr + (x3 - x1) * xy2sqr + (x1 - x2) * xy3sqr) * denomInv;
586 float c = ((x2 * y3 - x3 *
y2) * xy1sqr + (x3 *
y1 - x1 * y3) * xy2sqr + (x1 *
y2 - x2 *
y1) * xy3sqr) * denomInv;
588 if (((
y1 - y3) * (x2 - x3) - (x1 - x3) * (
y2 - y3) == 0) || (
g *
g +
f *
f -
c < 0)) {
590 printf(
"three collinear points or FATAL! r^2 < 0!\n");
599 template <
typename TAcc>
604 uint16_t innerInnerLowerModuleIndex,
605 uint16_t middleLowerModuleIndex,
606 uint16_t outerOuterLowerModuleIndex,
607 unsigned int innerSegmentIndex,
608 unsigned int outerSegmentIndex,
614 float& circleCenterX,
615 float& circleCenterY) {
617 if (segments.mdIndices()[innerSegmentIndex][1] != segments.mdIndices()[outerSegmentIndex][0])
620 unsigned int firstMDIndex = segments.mdIndices()[innerSegmentIndex][0];
621 unsigned int secondMDIndex = segments.mdIndices()[outerSegmentIndex][0];
622 unsigned int thirdMDIndex = segments.mdIndices()[outerSegmentIndex][1];
627 innerInnerLowerModuleIndex,
628 middleLowerModuleIndex,
629 outerOuterLowerModuleIndex,
638 innerInnerLowerModuleIndex,
639 middleLowerModuleIndex,
640 outerOuterLowerModuleIndex,
646 middleLowerModuleIndex,
653 float x1 = mds.anchorX()[firstMDIndex];
654 float x2 = mds.anchorX()[secondMDIndex];
655 float x3 = mds.anchorX()[thirdMDIndex];
656 float y1 = mds.anchorY()[firstMDIndex];
657 float y2 = mds.anchorY()[secondMDIndex];
658 float y3 = mds.anchorY()[thirdMDIndex];
665 template <
typename TAcc>
675 uint16_t nonZeroModules)
const {
676 auto const globalThreadIdx = alpaka::getIdx<alpaka::Grid, alpaka::Threads>(acc);
677 auto const gridThreadExtent = alpaka::getWorkDiv<alpaka::Grid, alpaka::Threads>(acc);
679 for (uint16_t innerLowerModuleArrayIdx = globalThreadIdx[0]; innerLowerModuleArrayIdx < nonZeroModules;
680 innerLowerModuleArrayIdx += gridThreadExtent[0]) {
681 uint16_t innerInnerLowerModuleIndex = index_gpu[innerLowerModuleArrayIdx];
682 if (innerInnerLowerModuleIndex >=
modules.nLowerModules())
685 uint16_t nConnectedModules =
modules.nConnectedModules()[innerInnerLowerModuleIndex];
686 if (nConnectedModules == 0)
689 unsigned int nInnerSegments = segmentsOccupancy.nSegments()[innerInnerLowerModuleIndex];
690 for (
unsigned int innerSegmentArrayIndex = globalThreadIdx[1]; innerSegmentArrayIndex < nInnerSegments;
691 innerSegmentArrayIndex += gridThreadExtent[1]) {
692 unsigned int innerSegmentIndex =
693 ranges.segmentRanges()[innerInnerLowerModuleIndex][0] + innerSegmentArrayIndex;
696 uint16_t middleLowerModuleIndex = segments.outerLowerModuleIndices()[innerSegmentIndex];
698 unsigned int nOuterSegments = segmentsOccupancy.nSegments()[middleLowerModuleIndex];
699 for (
unsigned int outerSegmentArrayIndex = globalThreadIdx[2]; outerSegmentArrayIndex < nOuterSegments;
700 outerSegmentArrayIndex += gridThreadExtent[2]) {
701 unsigned int outerSegmentIndex =
ranges.segmentRanges()[middleLowerModuleIndex][0] + outerSegmentArrayIndex;
703 uint16_t outerOuterLowerModuleIndex = segments.outerLowerModuleIndices()[outerSegmentIndex];
705 float zOut, rtOut, betaIn, betaInCut, circleRadius, circleCenterX, circleCenterY;
711 innerInnerLowerModuleIndex,
712 middleLowerModuleIndex,
713 outerOuterLowerModuleIndex,
725 unsigned int totOccupancyTriplets =
727 &tripletsOccupancy.totOccupancyTriplets()[innerInnerLowerModuleIndex],
729 alpaka::hierarchy::Threads{});
730 if (static_cast<int>(totOccupancyTriplets) >=
731 ranges.tripletModuleOccupancy()[innerInnerLowerModuleIndex]) {
733 printf(
"Triplet excess alert! Module index = %d\n", innerInnerLowerModuleIndex);
737 acc, &tripletsOccupancy.nTriplets()[innerInnerLowerModuleIndex], 1u, alpaka::hierarchy::Threads{});
738 unsigned int tripletIndex =
739 ranges.tripletModuleIndices()[innerInnerLowerModuleIndex] + tripletModuleIndex;
746 innerInnerLowerModuleIndex,
747 middleLowerModuleIndex,
748 outerOuterLowerModuleIndex,
749 #ifdef CUT_VALUE_DEBUG
768 template <
typename TAcc>
774 static_assert(std::is_same_v<TAcc, ALPAKA_ACCELERATOR_NAMESPACE::Acc1D>,
"Should be Acc1D");
775 ALPAKA_ASSERT_ACC((alpaka::getWorkDiv<alpaka::Grid, alpaka::Blocks>(acc)[0] == 1));
777 auto const globalThreadIdx = alpaka::getIdx<alpaka::Grid, alpaka::Threads>(acc);
778 auto const gridThreadExtent = alpaka::getWorkDiv<alpaka::Grid, alpaka::Threads>(acc);
781 int& nTotalTriplets = alpaka::declareSharedVar<int, __COUNTER__>(acc);
785 alpaka::syncBlockThreads(acc);
787 for (uint16_t
i = globalThreadIdx[0];
i <
modules.nLowerModules();
i += gridThreadExtent[0]) {
788 if (segmentsOccupancy.nSegments()[
i] == 0) {
789 ranges.tripletModuleIndices()[
i] = nTotalTriplets;
790 ranges.tripletModuleOccupancy()[
i] = 0;
804 else if (module_layers <= 2 && module_subdets == 4 && module_rings >= 11)
813 category_number = -1;
816 if (module_eta < 0.75
f)
818 else if (module_eta < 1.5
f)
820 else if (module_eta < 2.25
f)
822 else if (module_eta < 3.0
f)
828 if (category_number == 0 && eta_number == 0)
830 else if (category_number == 0 && eta_number == 1)
832 else if (category_number == 0 && eta_number == 2)
834 else if (category_number == 0 && eta_number == 3)
836 else if (category_number == 1 && eta_number == 0)
838 else if (category_number == 1 && eta_number == 1)
840 else if (category_number == 2 && eta_number == 1)
842 else if (category_number == 2 && eta_number == 2)
844 else if (category_number == 3 && eta_number == 1)
846 else if (category_number == 3 && eta_number == 2)
848 else if (category_number == 3 && eta_number == 3)
853 printf(
"Unhandled case in createTripletArrayRanges! Module index = %i\n",
i);
857 ranges.tripletModuleOccupancy()[
i] = occupancy;
858 unsigned int nTotT =
alpaka::atomicAdd(acc, &nTotalTriplets, occupancy, alpaka::hierarchy::Threads{});
859 ranges.tripletModuleIndices()[
i] = nTotT;
863 alpaka::syncBlockThreads(acc);
865 ranges.nTotalTrips() = nTotalTriplets;
871 template <
typename TAcc>
877 static_assert(std::is_same_v<TAcc, ALPAKA_ACCELERATOR_NAMESPACE::Acc1D>,
"Should be Acc1D");
878 ALPAKA_ASSERT_ACC((alpaka::getWorkDiv<alpaka::Grid, alpaka::Blocks>(acc)[0] == 1));
880 auto const globalThreadIdx = alpaka::getIdx<alpaka::Grid, alpaka::Threads>(acc);
881 auto const gridThreadExtent = alpaka::getWorkDiv<alpaka::Grid, alpaka::Threads>(acc);
883 for (uint16_t
i = globalThreadIdx[0];
i <
modules.nLowerModules();
i += gridThreadExtent[0]) {
884 if (tripletsOccupancy.nTriplets()[
i] == 0) {
885 ranges.tripletRanges()[
i][0] = -1;
886 ranges.tripletRanges()[
i][1] = -1;
889 ranges.tripletRanges()[
i][1] =
ranges.tripletModuleIndices()[
i] + tripletsOccupancy.nTriplets()[
i] - 1;
ALPAKA_FN_ACC ALPAKA_FN_INLINE bool passPointingConstraintEEE(TAcc const &acc, ModulesConst modules, MiniDoubletsConst mds, SegmentsConst segments, uint16_t innerInnerLowerModuleIndex, uint16_t middleLowerModuleIndex, uint16_t outerOuterLowerModuleIndex, unsigned int firstMDIndex, unsigned int secondMDIndex, unsigned int thirdMDIndex, float &zOut, float &rtOut, unsigned int innerSegmentIndex, unsigned int outerSegmentIndex, float &betaIn, float &betaInCut)
ALPAKA_STATIC_ACC_MEM_GLOBAL constexpr float k2Rinv1GeVf
ObjectRangesSoA::View ObjectRanges
const std::vector< int > & module_rings()
ALPAKA_FN_ACC void operator()(TAcc const &acc, ModulesConst modules, TripletsOccupancyConst tripletsOccupancy, ObjectRanges ranges) const
ALPAKA_FN_ACC ALPAKA_FN_INLINE bool passPointingConstraint(TAcc const &acc, ModulesConst modules, MiniDoubletsConst mds, SegmentsConst segments, uint16_t innerInnerLowerModuleIndex, uint16_t middleLowerModuleIndex, uint16_t outerOuterLowerModuleIndex, unsigned int firstMDIndex, unsigned int secondMDIndex, unsigned int thirdMDIndex, float &zOut, float &rtOut, uint16_t innerOuterLowerModuleIndex, unsigned int innerSegmentIndex, unsigned int outerSegmentIndex, float &betaIn, float &betaInCut)
ALPAKA_FN_ACC ALPAKA_FN_INLINE float computeRadiusFromThreeAnchorHits(TAcc const &acc, float x1, float y1, float x2, float y2, float x3, float y3, float &g, float &f)
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e g
ALPAKA_STATIC_ACC_MEM_GLOBAL constexpr float ptCut
ALPAKA_FN_ACC ALPAKA_FN_INLINE bool passPointingConstraintBBB(TAcc const &acc, ModulesConst modules, MiniDoubletsConst mds, SegmentsConst segments, uint16_t innerInnerLowerModuleIndex, uint16_t middleLowerModuleIndex, uint16_t outerOuterLowerModuleIndex, unsigned int firstMDIndex, unsigned int secondMDIndex, unsigned int thirdMDIndex, float &zOut, float &rtOut, unsigned int innerSegmentIndex, float &betaIn, float &betaInCut)
ALPAKA_FN_ACC ALPAKA_FN_INLINE bool passRZConstraint(TAcc const &acc, ModulesConst modules, MiniDoubletsConst mds, uint16_t innerInnerLowerModuleIndex, uint16_t middleLowerModuleIndex, uint16_t outerOuterLowerModuleIndex, unsigned int firstMDIndex, unsigned int secondMDIndex, unsigned int thirdMDIndex)
ALPAKA_FN_HOST_ACC ALPAKA_FN_INLINE float phi_mpi_pi(TAcc const &acc, float x)
ALPAKA_FN_HOST_ACC ALPAKA_FN_INLINE float phi(TAcc const &acc, float x, float y)
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e< void, edm::EventID const &, edm::Timestamp const & > We also list in braces which AR_WATCH_USING_METHOD_ is used for those or
Tan< T >::type tan(const T &t)
Abs< T >::type abs(const T &t)
MiniDoubletsSoA::ConstView MiniDoubletsConst
ALPAKA_FN_ACC ALPAKA_FN_INLINE bool passPointingConstraintBBE(TAcc const &acc, ModulesConst modules, MiniDoubletsConst mds, SegmentsConst segments, uint16_t innerInnerLowerModuleIndex, uint16_t middleLowerModuleIndex, uint16_t outerOuterLowerModuleIndex, unsigned int firstMDIndex, unsigned int secondMDIndex, unsigned int thirdMDIndex, float &zOut, float &rtOut, uint16_t innerOuterLowerModuleIndex, unsigned int innerSegmentIndex, unsigned int outerSegmentIndex, float &betaIn, float &betaInCut)
ALPAKA_FN_ACC ALPAKA_FN_INLINE void addTripletToMemory(ModulesConst modules, MiniDoubletsConst mds, SegmentsConst segments, Triplets &triplets, unsigned int innerSegmentIndex, unsigned int outerSegmentIndex, uint16_t innerInnerLowerModuleIndex, uint16_t middleLowerModuleIndex, uint16_t outerOuterLowerModuleIndex, float betaIn, float betaInCut, float circleRadius, float circleCenterX, float circleCenterY, unsigned int tripletIndex)
ModulesSoA::ConstView ModulesConst
const std::vector< int > & module_layers()
TripletsOccupancySoA::View TripletsOccupancy
ALPAKA_STATIC_ACC_MEM_GLOBAL constexpr float kMulsInGeV
ALPAKA_STATIC_ACC_MEM_GLOBAL constexpr float kPixelPSZpitch
const std::vector< int > & module_subdets()
ALPAKA_STATIC_ACC_MEM_GLOBAL constexpr float kStrip2SZpitch
TripletsSoA::View Triplets
SegmentsOccupancySoA::ConstView SegmentsOccupancyConst
TripletsOccupancySoA::ConstView TripletsOccupancyConst
ObjectRangesSoA::ConstView ObjectRangesConst
ALPAKA_STATIC_ACC_MEM_GLOBAL constexpr float kSinAlphaMax
SegmentsSoA::ConstView SegmentsConst
ALPAKA_FN_ACC void operator()(TAcc const &acc, ModulesConst modules, ObjectRanges ranges, SegmentsOccupancyConst segmentsOccupancy) const
ALPAKA_FN_ACC ALPAKA_FN_INLINE bool runTripletConstraintsAndAlgo(TAcc const &acc, ModulesConst modules, MiniDoubletsConst mds, SegmentsConst segments, uint16_t innerInnerLowerModuleIndex, uint16_t middleLowerModuleIndex, uint16_t outerOuterLowerModuleIndex, unsigned int innerSegmentIndex, unsigned int outerSegmentIndex, float &zOut, float &rtOut, float &betaIn, float &betaInCut, float &circleRadius, float &circleCenterX, float &circleCenterY)
ALPAKA_STATIC_ACC_MEM_GLOBAL constexpr float kDeltaZLum
ALPAKA_ASSERT_ACC(offsets)
T1 atomicAdd(T1 *a, T2 b)
ALPAKA_FN_ACC void operator()(TAcc const &acc, ModulesConst modules, MiniDoubletsConst mds, SegmentsConst segments, SegmentsOccupancyConst segmentsOccupancy, Triplets triplets, TripletsOccupancy tripletsOccupancy, ObjectRangesConst ranges, uint16_t *index_gpu, uint16_t nonZeroModules) const