CMS 3D CMS Logo

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

Public Member Functions

template<typename TAcc , typename = std::enable_if_t<alpaka::isAccelerator<TAcc>>>
ALPAKA_FN_ACC void operator() (TAcc const &acc, const unsigned int numer_of_clusters, float thresholdW0, float positionDeltaRho2, const HGCalSoARecHitsDeviceCollection::ConstView input_rechits_soa, const HGCalSoARecHitsExtraDeviceCollection::ConstView input_clusters_soa, HGCalSoAClustersDeviceCollection::View outputs, HGCalSoAClustersExtraDeviceCollection::View outputs_service) const
 

Detailed Description

Definition at line 84 of file HGCalLayerClustersSoAAlgoWrapper.dev.cc.

Member Function Documentation

◆ operator()()

template<typename TAcc , typename = std::enable_if_t<alpaka::isAccelerator<TAcc>>>
ALPAKA_FN_ACC void ALPAKA_ACCELERATOR_NAMESPACE::HGCalLayerClustersSoAAlgoKernelPositionByHits2::operator() ( TAcc const &  acc,
const unsigned int  numer_of_clusters,
float  thresholdW0,
float  positionDeltaRho2,
const HGCalSoARecHitsDeviceCollection::ConstView  input_rechits_soa,
const HGCalSoARecHitsExtraDeviceCollection::ConstView  input_clusters_soa,
HGCalSoAClustersDeviceCollection::View  outputs,
HGCalSoAClustersExtraDeviceCollection::View  outputs_service 
) const
inline

Definition at line 87 of file HGCalLayerClustersSoAAlgoWrapper.dev.cc.

References cms::cudacompat::atomicAdd(), d1, f, hgcal::constants::kInvalidCluster, dqm-mbProfile::log, SiStripPI::max, PatBasicFWLiteJetAnalyzer_Selector_cfg::outputs, hltHgcalLayerClustersEE_cfi::positionDeltaRho2, hltHgcalLayerClustersEE_cfi::thresholdW0, cms::alpakatools::uniform_elements(), mps_merge::weight, and x.

94  {
95  // make a strided loop over the kernel grid, covering up to "size" elements
96  for (int32_t hit_index : uniform_elements(acc, input_rechits_soa.metadata().size())) {
97  const int cluster_index = input_clusters_soa[hit_index].clusterIndex();
98 
99  // Bail out if you are not part of any cluster
100  if (cluster_index == kInvalidCluster) {
101  continue;
102  }
103  const int max_energy_index = outputs_service[cluster_index].maxEnergyIndex();
104 
105  //for silicon only just use 1+6 cells = 1.3cm for all thicknesses
106  const float d1 = input_rechits_soa[hit_index].dim1() - input_rechits_soa[max_energy_index].dim1();
107  const float d2 = input_rechits_soa[hit_index].dim2() - input_rechits_soa[max_energy_index].dim2();
108  if (std::fmaf(d1, d1, d2 * d2) > positionDeltaRho2) {
109  continue;
110  }
111  float Wi = std::max(thresholdW0 + std::log(input_rechits_soa[hit_index].weight() /
112  outputs_service[cluster_index].total_weight()),
113  0.f);
114  alpaka::atomicAdd(acc, &outputs[cluster_index].x(), input_rechits_soa[hit_index].dim1() * Wi);
115  alpaka::atomicAdd(acc, &outputs[cluster_index].y(), input_rechits_soa[hit_index].dim2() * Wi);
116  alpaka::atomicAdd(acc, &outputs_service[cluster_index].total_weight_log(), Wi);
117  } // uniform_elements
118  } // operator()
ALPAKA_FN_ACC auto uniform_elements(TAcc const &acc, TArgs... args)
Definition: workdivision.h:311
double f[11][100]
static constexpr int kInvalidCluster
static constexpr float d1
T1 atomicAdd(T1 *a, T2 b)
Definition: cudaCompat.h:61