CMS 3D CMS Logo

List of all members | Public Member Functions
ALPAKA_ACCELERATOR_NAMESPACE::FillRhfIndex Class Reference

Public Member Functions

template<typename TAcc , typename = std::enable_if_t<alpaka::isAccelerator<TAcc>>>
ALPAKA_FN_ACC void operator() (const TAcc &acc, const reco::PFRecHitHostCollection::ConstView pfRecHits, reco::PFClusteringVarsDeviceCollection::View pfClusteringVars, reco::PFRecHitFractionDeviceCollection::View fracView) const
 

Detailed Description

Definition at line 1317 of file PFClusterSoAProducerKernel.dev.cc.

Member Function Documentation

◆ operator()()

template<typename TAcc , typename = std::enable_if_t<alpaka::isAccelerator<TAcc>>>
ALPAKA_FN_ACC void ALPAKA_ACCELERATOR_NAMESPACE::FillRhfIndex::operator() ( const TAcc &  acc,
const reco::PFRecHitHostCollection::ConstView  pfRecHits,
reco::PFClusteringVarsDeviceCollection::View  pfClusteringVars,
reco::PFRecHitFractionDeviceCollection::View  fracView 
) const
inline

Definition at line 1320 of file PFClusterSoAProducerKernel.dev.cc.

References cms::cudacompat::atomicAdd(), HLT_2024v12_cff::fraction, mps_fire::i, dqmiolumiharvest::j, dqmdumpme::k, HLT_2024v12_cff::pfRecHits, fileCollector::seed, and cms::alpakatools::uniform_elements_nd().

1323  {
1324  const int nRH = pfRecHits.size();
1325 
1326  for (auto index : uniform_elements_nd(acc, {nRH, nRH})) {
1327  const int i = index[0u]; // i is a seed index
1328  const int j = index[1u]; // j is NOT a seed
1329  int topoId = pfClusteringVars[i].pfrh_topoId();
1330  if (topoId > -1 && pfClusteringVars[i].pfrh_isSeed() && topoId == pfClusteringVars[j].pfrh_topoId()) {
1331  if (!pfClusteringVars[j].pfrh_isSeed()) { // NOT a seed
1332  int k = alpaka::atomicAdd(
1333  acc, &pfClusteringVars[i].rhCount(), 1); // Increment the number of rechit fractions for this seed
1334  auto fraction = fracView[pfClusteringVars[i].seedFracOffsets() + k];
1335  fraction.pfrhIdx() = j;
1336  fraction.pfcIdx() = pfClusteringVars[i].rhIdxToSeedIdx();
1337  } else if (i == j) { // i==j is a seed rechit index
1338  auto seed = fracView[pfClusteringVars[i].seedFracOffsets()];
1339  seed.pfrhIdx() = j;
1340  seed.frac() = 1;
1341  seed.pfcIdx() = pfClusteringVars[i].rhIdxToSeedIdx();
1342  }
1343  }
1344  }
1345  }
ALPAKA_FN_ACC auto uniform_elements_nd(TAcc const &acc)
Definition: workdivision.h:575
T1 atomicAdd(T1 *a, T2 b)
Definition: cudaCompat.h:61