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, 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,
uint32_t *__restrict__  nSeeds 
) const
inline

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

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

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