CMS 3D CMS Logo

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

Public Member Functions

template<typename TAcc , typename = std::enable_if_t<alpaka::isAccelerator<TAcc>>>
ALPAKA_FN_ACC void operator() (const TAcc &acc, reco::PFClusteringVarsDeviceCollection::View pfClusteringVars, const reco::PFClusterParamsDeviceCollection::ConstView pfClusParams, const reco::PFRecHitHCALTopologyDeviceCollection::ConstView topology, const reco::PFRecHitHostCollection::ConstView pfRecHits, reco::PFClusterDeviceCollection::View clusterView, reco::PFRecHitFractionDeviceCollection::View fracView, uint32_t *__restrict__ nSeeds) const
 

Detailed Description

Definition at line 1084 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::SeedingTopoThresh::operator() ( const TAcc &  acc,
reco::PFClusteringVarsDeviceCollection::View  pfClusteringVars,
const reco::PFClusterParamsDeviceCollection::ConstView  pfClusParams,
const reco::PFRecHitHCALTopologyDeviceCollection::ConstView  topology,
const reco::PFRecHitHostCollection::ConstView  pfRecHits,
reco::PFClusterDeviceCollection::View  clusterView,
reco::PFRecHitFractionDeviceCollection::View  fracView,
uint32_t *__restrict__  nSeeds 
) const
inline

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

References cms::cudacompat::atomicAdd(), cms::alpakatools::elements_with_stride(), hcalRecHitTable_cff::energy, PFLayer::HCAL_BARREL1, PFLayer::HCAL_ENDCAP, mps_fire::i, dqmdumpme::k, cms::alpakatools::once_per_grid(), HLT_2024v10_cff::pfRecHits, HLT_2024v10_cff::pt2, and HLT_2024v10_cff::topology.

1094  {
1095  const int nRH = pfRecHits.size();
1096 
1097  if (once_per_grid(acc)) {
1098  clusterView.size() = nRH;
1099  }
1100 
1101  for (auto i : elements_with_stride(acc, nRH)) {
1102  // Initialize arrays
1103  pfClusteringVars[i].pfrh_isSeed() = 0;
1104  pfClusteringVars[i].rhCount() = 0;
1105  pfClusteringVars[i].topoSeedCount() = 0;
1106  pfClusteringVars[i].topoRHCount() = 0;
1107  pfClusteringVars[i].seedFracOffsets() = -1;
1108  pfClusteringVars[i].topoSeedOffsets() = -1;
1109  pfClusteringVars[i].topoSeedList() = -1;
1110  clusterView[i].seedRHIdx() = -1;
1111 
1112  int layer = pfRecHits[i].layer();
1113  int depthOffset = pfRecHits[i].depth() - 1;
1114  float energy = pfRecHits[i].energy();
1115  Position3 pos = Position3{pfRecHits[i].x(), pfRecHits[i].y(), pfRecHits[i].z()};
1116  float seedThreshold = 9999.;
1117  float topoThreshold = 9999.;
1118 
1119  if (topology.cutsFromDB()) {
1120  seedThreshold = topology[pfRecHits[i].denseId()].seedThreshold();
1121  topoThreshold = topology[pfRecHits[i].denseId()].noiseThreshold();
1122  } else {
1123  if (layer == PFLayer::HCAL_BARREL1) {
1124  seedThreshold = pfClusParams.seedEThresholdHB_vec()[depthOffset];
1125  topoThreshold = pfClusParams.topoEThresholdHB_vec()[depthOffset];
1126  } else if (layer == PFLayer::HCAL_ENDCAP) {
1127  seedThreshold = pfClusParams.seedEThresholdHE_vec()[depthOffset];
1128  topoThreshold = pfClusParams.topoEThresholdHE_vec()[depthOffset];
1129  }
1130  }
1131 
1132  // cmssdt.cern.ch/lxr/source/DataFormats/ParticleFlowReco/interface/PFRecHit.h#0108
1133  float pt2 = energy * energy * (pos.x * pos.x + pos.y * pos.y) / (pos.x * pos.x + pos.y * pos.y + pos.z * pos.z);
1134 
1135  // Seeding threshold test
1136  if ((layer == PFLayer::HCAL_BARREL1 && energy > seedThreshold && pt2 > pfClusParams.seedPt2ThresholdHB()) ||
1137  (layer == PFLayer::HCAL_ENDCAP && energy > seedThreshold && pt2 > pfClusParams.seedPt2ThresholdHE())) {
1138  pfClusteringVars[i].pfrh_isSeed() = 1;
1139  for (int k = 0; k < 4; k++) { // Does this seed candidate have a higher energy than four neighbours
1140  if (pfRecHits[i].neighbours()(k) < 0)
1141  continue;
1142  if (energy < pfRecHits[pfRecHits[i].neighbours()(k)].energy()) {
1143  pfClusteringVars[i].pfrh_isSeed() = 0;
1144  break;
1145  }
1146  }
1147  if (pfClusteringVars[i].pfrh_isSeed())
1148  alpaka::atomicAdd(acc, nSeeds, 1u);
1149  }
1150  // Topo clustering threshold test
1151 
1152  if ((layer == PFLayer::HCAL_ENDCAP && energy > topoThreshold) ||
1153  (layer == PFLayer::HCAL_BARREL1 && energy > topoThreshold)) {
1154  pfClusteringVars[i].pfrh_passTopoThresh() = true;
1155  pfClusteringVars[i].pfrh_topoId() = i;
1156  } else {
1157  pfClusteringVars[i].pfrh_passTopoThresh() = false;
1158  pfClusteringVars[i].pfrh_topoId() = -1;
1159  }
1160  }
1161  }
ALPAKA_FN_ACC auto elements_with_stride(TAcc const &acc, TArgs... args)
Definition: workdivision.h:346
ALPAKA_FN_ACC constexpr bool once_per_grid(TAcc const &acc)
T1 atomicAdd(T1 *a, T2 b)
Definition: cudaCompat.h:61