1 #ifndef RecoTracker_PixelSeeding_plugins_alpaka_CACell_h 2 #define RecoTracker_PixelSeeding_plugins_alpaka_CACell_h 9 #include <alpaka/alpaka.hpp> 23 template <
typename TrackerTraits>
57 theInnerHitId = innerHitId;
58 theOuterHitId = outerHitId;
59 theLayerPairId_ = layerPairId;
64 theInnerZ =
hh[innerHitId].zGlobal();
65 theInnerR =
hh[innerHitId].rGlobal();
74 template <
typename TAcc>
75 ALPAKA_FN_ACC ALPAKA_FN_INLINE
__attribute__((always_inline))
int addOuterNeighbor(
82 alpaka::mem_fence(acc, alpaka::memory_scope::Grid{});
83 #ifdef ALPAKA_ACC_CPU_B_SEQ_T_SEQ_ENABLED 87 alpaka::atomicCas(acc,
96 alpaka::mem_fence(acc, alpaka::memory_scope::Grid{});
100 template <
typename TAcc>
101 ALPAKA_FN_ACC ALPAKA_FN_INLINE
__attribute__((always_inline))
int addTrack(TAcc
const& acc,
108 alpaka::mem_fence(acc, alpaka::memory_scope::Grid{});
109 #ifdef ALPAKA_ACC_CPU_B_SEQ_T_SEQ_ENABLED 113 alpaka::atomicCas(acc,
123 alpaka::mem_fence(acc, alpaka::memory_scope::Grid{});
124 return tracks().push_back(acc,
t);
144 return hh[theInnerHitId].detectorIndex();
147 return hh[theOuterHitId].detectorIndex();
154 printf(
"printing cell: on layerPair: %d, innerHitId: %d, outerHitId: %d \n",
164 const float caThetaCutBarrel,
165 const float caThetaCutForward,
189 ALPAKA_FN_ACC ALPAKA_FN_INLINE
__attribute__((always_inline))
static bool areAlignedRZ(
203 const float region_origin_radius_plus_tolerance,
204 const float maxCurv)
const {
216 if (eq.curvature() > maxCurv)
219 return std::abs(eq.dca0()) < region_origin_radius_plus_tolerance *
std::abs(eq.curvature());
222 ALPAKA_FN_ACC ALPAKA_FN_INLINE
__attribute__((always_inline))
static bool dcaCutH(
229 const float region_origin_radius_plus_tolerance,
230 const float maxCurv) {
233 if (eq.curvature() > maxCurv)
236 return std::abs(eq.dca0()) < region_origin_radius_plus_tolerance *
std::abs(eq.curvature());
242 int p = innerCell.inner_iphi(
hh);
248 auto r0 =
hh.averageGeometry().ladderR[il];
249 auto ri = innerCell.inner_r(
hh);
250 auto zi = innerCell.inner_z(
hh);
254 auto z_in_ladder =
std::abs(z0 -
hh.averageGeometry().ladderZ[il]);
269 auto r4 =
hh.averageGeometry().ladderR[il];
270 auto ri = innerCell.inner_r(
hh);
271 auto zi = innerCell.inner_z(
hh);
275 auto z_in_ladder =
std::abs(z4 -
hh.averageGeometry().ladderZ[il]);
278 auto holeP = z4 >
hh.averageGeometry().ladderMaxZ[il] && z4 <
hh.averageGeometry().endCapZ[0];
279 auto holeN = z4 <
hh.averageGeometry().ladderMinZ[il] && z4 >
hh.averageGeometry().endCapZ[1];
280 return gap || holeP || holeN;
285 template <
int DEPTH,
typename TAcc>
286 ALPAKA_FN_ACC ALPAKA_FN_INLINE
void find_ntuplets(TAcc
const& acc,
295 bool startAt0)
const {
303 printf(
"ERROR: CACellT::find_ntuplets reached full depth!\n");
306 auto doubletId =
this -
cells;
307 tmpNtuplet.push_back_unsafe(doubletId);
312 if (
cells[otherCell].isKilled())
315 cells[otherCell].template find_ntuplets<DEPTH - 1>(
320 #ifdef ONLY_TRIPLETS_IN_HOLE 322 if (tmpNtuplet.size() >= 3 || (startAt0 && hole4(
hh,
cells[tmpNtuplet[0]])) ||
323 ((!startAt0) && hole0(
hh,
cells[tmpNtuplet[0]])))
330 for (
auto c : tmpNtuplet) {
332 if (nfb < maxFB &&
cells[
c].hasFishbone()) {
341 for (
auto c : tmpNtuplet)
348 tmpNtuplet.pop_back();
354 ALPAKA_FN_ACC ALPAKA_FN_INLINE
void kill() { theStatus_ |= uint16_t(
StatusBit::kKilled); }
355 ALPAKA_FN_ACC ALPAKA_FN_INLINE
bool isKilled()
const {
return theStatus_ & uint16_t(
StatusBit::kKilled); }
357 ALPAKA_FN_ACC ALPAKA_FN_INLINE int16_t layerPairId()
const {
return theLayerPairId_; }
359 ALPAKA_FN_ACC ALPAKA_FN_INLINE
bool unused()
const {
return 0 == (uint16_t(
StatusBit::kUsed) & theStatus_); }
360 ALPAKA_FN_ACC ALPAKA_FN_INLINE
void setStatusBits(
StatusBit mask) { theStatus_ |= uint16_t(
mask); }
362 template <
typename TAcc>
365 auto old = theFishboneId;
375 ALPAKA_FN_ACC ALPAKA_FN_INLINE
auto fishboneId()
const {
return theFishboneId; }
376 ALPAKA_FN_ACC ALPAKA_FN_INLINE
bool hasFishbone()
const {
return theFishboneId !=
invalidHitId; }
382 int16_t theLayerPairId_;
394 #endif // RecoTracker_PixelSeeding_plugins_alpaka_CACell_h
float distance_13_squared
::pixelTrack::Quality Quality
ALPAKA_FN_ACC ALPAKA_FN_INLINE float inner_detIndex(const HitsConstView &hh) const
ALPAKA_FN_ACC ALPAKA_FN_INLINE TrackerTraits::cindex_type CellNeighborsVector & cellNeighbors
constexpr unsigned int inner_hit_id() const
ALPAKA_FN_ACC ALPAKA_FN_INLINE CellNeighbors & outerNeighbors()
ALPAKA_FN_ACC ALPAKA_FN_INLINE CellTracks const & tracks() const
constexpr float module_length_bpx0
cms::alpakatools::VecArray< uint32_t, TrackerTraits::maxDepth > TmpTuple
typename TrackerTraits::tindex_type tindex_type
ALPAKA_FN_ACC bool check_alignment(const HitsConstView &hh, CACellT const &otherCell, const float ptmin, const float hardCurvCut, const float caThetaCutBarrel, const float caThetaCutForward, const float dcaCutInnerTriplet, const float dcaCutOuterTriplet) const
return outerNeighbors().push_back(acc
ALPAKA_FN_ACC ALPAKA_FN_INLINE CellNeighbors const & outerNeighbors() const
ALPAKA_FN_ACC ALPAKA_FN_INLINE float outer_detIndex(const HitsConstView &hh) const
ALPAKA_FN_ACC ALPAKA_FN_INLINE float inner_y(const HitsConstView &hh) const
static constexpr auto bad
static constexpr auto invalidHitId
float tan_12_13_half_mul_distance_13_squared
ALPAKA_FN_ACC ALPAKA_FN_INLINE float float ri
ALPAKA_FN_ACC ALPAKA_FN_INLINE float inner_x(const HitsConstView &hh) const
ALPAKA_FN_ACC void print_cell() const
static constexpr auto maxCellsPerHit
ALPAKA_FN_ACC ALPAKA_FN_INLINE float outer_x(const HitsConstView &hh) const
constexpr float module_length_bpx4
ALPAKA_FN_ACC ALPAKA_FN_INLINE float float float zi
ALPAKA_FN_ACC ALPAKA_FN_INLINE float float float float ro
ALPAKA_FN_ACC ALPAKA_FN_INLINE float inner_z(const HitsConstView &hh) const
ALPAKA_FN_ACC ALPAKA_FN_INLINE auto inner_iphi(const HitsConstView &hh) const
ALPAKA_FN_ACC ALPAKA_FN_INLINE float outer_r(const HitsConstView &hh) const
constexpr uint32_t first_ladder_bpx4
caStructures::CellNeighborsT< TrackerTraits > CellNeighbors
constexpr float module_tolerance_bpx0
typename reco::TrackSoA< TrackerTraits >::HitContainer HitContainer
typename TrackerTraits::hindex_type hindex_type
std::vector< Block > Blocks
constexpr uint32_t max_ladder_bpx4
Abs< T >::type abs(const T &t)
ALPAKA_FN_ACC ALPAKA_FN_INLINE float float float float float zo
ALPAKA_FN_ACC ALPAKA_FN_INLINE void uint32_t const uint32_t CACellT< TrackerTraits > uint32_t CellNeighborsVector< TrackerTraits > CellTracksVector< TrackerTraits > HitsConstView< TrackerTraits > hh
ALPAKA_FN_ACC ALPAKA_FN_INLINE float z1
unsigned long long PtrAsInt
ALPAKA_FN_ACC ALPAKA_FN_INLINE float float float float float const float ptmin
ALPAKA_FN_ACC ALPAKA_FN_INLINE __attribute__((always_inline)) int addOuterNeighbor(const TAcc &acc
typename CACellT< TrackerTraits >::HitsConstView HitsConstView
constexpr uint32_t max_ladder_bpx0
ALPAKA_FN_ACC ALPAKA_FN_INLINE float float float float float const float const float thetaCut
typename TrackingRecHitSoA< TrackerTraits >::template TrackingRecHitSoALayout<>::ConstView TrackingRecHitSoAConstView
ALPAKA_FN_ACC ALPAKA_FN_INLINE float inner_r(const HitsConstView &hh) const
auto const & foundNtuplets
caStructures::CellTracksT< TrackerTraits > CellTracks
caStructures::CellTracksVectorT< TrackerTraits > CellTracksVector
TupleMultiplicity< TrackerTraits > const HitToTuple< TrackerTraits > const cms::cuda::AtomicPairCounter * apc
ALPAKA_FN_ACC ALPAKA_FN_INLINE TrackerTraits::cindex_type t
constexpr float module_tolerance_bpx4
ALPAKA_FN_ACC ALPAKA_FN_INLINE auto outer_iphi(const HitsConstView &hh) const
constexpr unsigned int outer_hit_id() const
ALPAKA_FN_ACC ALPAKA_FN_INLINE void init(CellNeighborsVector &cellNeighbors, CellTracksVector &cellTracks, const HitsConstView &hh, int layerPairId, hindex_type innerHitId, hindex_type outerHitId)
ALPAKA_FN_ACC ALPAKA_FN_INLINE CellTracks & tracks()
ALPAKA_ASSERT_ACC(offsets)
constexpr uint32_t first_ladder_bpx0
ALPAKA_FN_ACC ALPAKA_FN_INLINE tindex_type CellTracksVector & cellTracks
TrackingRecHitSoAConstView< TrackerTraits > HitsConstView
ALPAKA_FN_ACC ALPAKA_FN_INLINE float outer_z(const HitsConstView &hh) const
ALPAKA_FN_ACC ALPAKA_FN_INLINE float outer_y(const HitsConstView &hh) const
return tracks().push_back(acc