CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions
ALPAKA_ACCELERATOR_NAMESPACE::PFRecHitProducerKernelConstruct< CAL > Struct Template Reference

Public Member Functions

template<>
ALPAKA_FN_ACC bool applyCuts (const typename HCAL::CaloRecHitSoATypeDevice::ConstView::const_element rh, const HCAL::ParameterType::ConstView params, const HCAL::TopologyTypeDevice::ConstView topology)
 
template<>
ALPAKA_FN_ACC bool applyCuts (const ECAL::CaloRecHitSoATypeDevice::ConstView::const_element rh, const ECAL::ParameterType::ConstView params, const ECAL::TopologyTypeDevice::ConstView topology)
 
template<>
ALPAKA_FN_ACC void constructPFRecHit (reco::PFRecHitDeviceCollection::View::element pfrh, const HCAL::CaloRecHitSoATypeDevice::ConstView::const_element rh)
 
template<>
ALPAKA_FN_ACC void constructPFRecHit (reco::PFRecHitDeviceCollection::View::element pfrh, const ECAL::CaloRecHitSoATypeDevice::ConstView::const_element rh)
 
template<typename TAcc , typename = std::enable_if_t<alpaka::isAccelerator<TAcc>>>
ALPAKA_FN_ACC void operator() (const TAcc &acc, const typename CAL::ParameterType::ConstView params, const typename CAL::TopologyTypeDevice::ConstView topology, const typename CAL::CaloRecHitSoATypeDevice::ConstView recHits, reco::PFRecHitDeviceCollection::View pfRecHits, uint32_t *__restrict__ denseId2pfRecHit, uint32_t *__restrict__ num_pfRecHits) const
 

Static Public Member Functions

static ALPAKA_FN_ACC bool applyCuts (const typename CAL::CaloRecHitSoATypeDevice::ConstView::const_element rh, const typename CAL::ParameterType::ConstView params, const typename CAL::TopologyTypeDevice::ConstView topology)
 
static ALPAKA_FN_ACC void constructPFRecHit (reco::PFRecHitDeviceCollection::View::element pfrh, const typename CAL::CaloRecHitSoATypeDevice::ConstView::const_element rh)
 

Detailed Description

template<typename CAL>
struct ALPAKA_ACCELERATOR_NAMESPACE::PFRecHitProducerKernelConstruct< CAL >

Definition at line 15 of file PFRecHitProducerKernel.dev.cc.

Member Function Documentation

◆ applyCuts() [1/3]

template<typename CAL >
static ALPAKA_FN_ACC bool ALPAKA_ACCELERATOR_NAMESPACE::PFRecHitProducerKernelConstruct< CAL >::applyCuts ( const typename CAL::CaloRecHitSoATypeDevice::ConstView::const_element  rh,
const typename CAL::ParameterType::ConstView  params,
const typename CAL::TopologyTypeDevice::ConstView  topology 
)
static

◆ applyCuts() [2/3]

template<>
ALPAKA_FN_ACC bool ALPAKA_ACCELERATOR_NAMESPACE::PFRecHitProducerKernelConstruct< HCAL >::applyCuts ( const typename HCAL::CaloRecHitSoATypeDevice::ConstView::const_element  rh,
const HCAL::ParameterType::ConstView  params,
const HCAL::TopologyTypeDevice::ConstView  topology 
)

Definition at line 53 of file PFRecHitProducerKernel.dev.cc.

References hcalRecHitTable_cff::depth, hcalRecHitTable_cff::detId, ALPAKA_ACCELERATOR_NAMESPACE::particleFlowRecHitProducer::HCAL::detId2denseId(), ALPAKA_ACCELERATOR_NAMESPACE::particleFlowRecHitProducer::HCAL::getDepth(), ALPAKA_ACCELERATOR_NAMESPACE::particleFlowRecHitProducer::getSubdet(), HcalBarrel, HcalEndcap, ALPAKA_ACCELERATOR_NAMESPACE::particleFlowRecHitProducer::HCAL::kInvalidDenseId, ALPAKA_ACCELERATOR_NAMESPACE::particleFlowRecHitProducer::HCAL::kMaxDepthHB, submitPVValidationJobs::params, DiMuonV_cfg::threshold, and HLT_2024v14_cff::topology.

56  {
57  // Reject HCAL recHits below enery threshold
58  float threshold = 9999.;
59  const uint32_t detId = rh.detId();
60  const uint32_t depth = HCAL::getDepth(detId);
61  const uint32_t subdet = getSubdet(detId);
62 
63  // skip bad channels
64  if (rh.chi2() < 0)
65  return false;
66 
67  if (topology.cutsFromDB()) {
68  const auto& denseId = HCAL::detId2denseId(detId);
69  if (denseId != HCAL::kInvalidDenseId) {
70  threshold = topology.noiseThreshold()[denseId];
71  } else {
72  printf("Encountered invalid denseId for detId %u (subdetector %u)!", detId, subdet);
73  return false;
74  }
75  } else {
76  if (subdet == HcalBarrel) {
77  threshold = params.energyThresholds()[depth - 1];
78  } else if (subdet == HcalEndcap) {
79  threshold = params.energyThresholds()[depth - 1 + HCAL::kMaxDepthHB];
80  } else {
81  printf("Rechit with detId %u has invalid subdetector %u!\n", detId, subdet);
82  return false;
83  }
84  }
85  return rh.energy() >= threshold;
86  }

◆ applyCuts() [3/3]

template<>
ALPAKA_FN_ACC bool ALPAKA_ACCELERATOR_NAMESPACE::PFRecHitProducerKernelConstruct< ECAL >::applyCuts ( const ECAL::CaloRecHitSoATypeDevice::ConstView::const_element  rh,
const ECAL::ParameterType::ConstView  params,
const ECAL::TopologyTypeDevice::ConstView  topology 
)

Definition at line 89 of file PFRecHitProducerKernel.dev.cc.

References ALPAKA_ACCELERATOR_NAMESPACE::particleFlowRecHitProducer::ECAL::checkFlag(), ALPAKA_ACCELERATOR_NAMESPACE::particleFlowRecHitProducer::ECAL::detId2denseId(), HLT_2024v14_cff::kTowerRecovered, EcalSeverityLevel::kWeird, and submitPVValidationJobs::params.

92  {
93  // Reject ECAL recHits below energy threshold
94  if (rh.energy() < params.energyThresholds()[ECAL::detId2denseId(rh.detId())])
95  return false;
96 
97  // Reject ECAL recHits of bad quality
98  if ((ECAL::checkFlag(rh.flags(), ECAL::Flags::kOutOfTime) && rh.energy() > params.cleaningThreshold()) ||
100  ECAL::checkFlag(rh.flags(), ECAL::Flags::kDiWeird))
101  return false;
102 
103  return true;
104  }
static constexpr bool checkFlag(uint32_t flagBits, int flag)

◆ constructPFRecHit() [1/3]

template<typename CAL >
static ALPAKA_FN_ACC void ALPAKA_ACCELERATOR_NAMESPACE::PFRecHitProducerKernelConstruct< CAL >::constructPFRecHit ( reco::PFRecHitDeviceCollection::View::element  pfrh,
const typename CAL::CaloRecHitSoATypeDevice::ConstView::const_element  rh 
)
static

◆ constructPFRecHit() [2/3]

template<>
ALPAKA_FN_ACC void ALPAKA_ACCELERATOR_NAMESPACE::PFRecHitProducerKernelConstruct< HCAL >::constructPFRecHit ( reco::PFRecHitDeviceCollection::View::element  pfrh,
const HCAL::CaloRecHitSoATypeDevice::ConstView::const_element  rh 
)

Definition at line 107 of file PFRecHitProducerKernel.dev.cc.

References ALPAKA_ACCELERATOR_NAMESPACE::particleFlowRecHitProducer::HCAL::detId2denseId(), ALPAKA_ACCELERATOR_NAMESPACE::particleFlowRecHitProducer::HCAL::getDepth(), ALPAKA_ACCELERATOR_NAMESPACE::particleFlowRecHitProducer::getSubdet(), PFLayer::HCAL_BARREL1, PFLayer::HCAL_ENDCAP, HcalBarrel, HcalEndcap, and PFLayer::NONE.

109  {
110  pfrh.detId() = rh.detId();
111  pfrh.denseId() = HCAL::detId2denseId(rh.detId());
112  pfrh.energy() = rh.energy();
113  pfrh.time() = rh.timeM0();
114  pfrh.depth() = HCAL::getDepth(pfrh.detId());
115  const uint32_t subdet = getSubdet(pfrh.detId());
116  if (subdet == HcalBarrel)
117  pfrh.layer() = PFLayer::HCAL_BARREL1;
118  else if (subdet == HcalEndcap)
119  pfrh.layer() = PFLayer::HCAL_ENDCAP;
120  else
121  pfrh.layer() = PFLayer::NONE;
122  }

◆ constructPFRecHit() [3/3]

template<>
ALPAKA_FN_ACC void ALPAKA_ACCELERATOR_NAMESPACE::PFRecHitProducerKernelConstruct< ECAL >::constructPFRecHit ( reco::PFRecHitDeviceCollection::View::element  pfrh,
const ECAL::CaloRecHitSoATypeDevice::ConstView::const_element  rh 
)

Definition at line 125 of file PFRecHitProducerKernel.dev.cc.

References ALPAKA_ACCELERATOR_NAMESPACE::particleFlowRecHitProducer::ECAL::detId2denseId(), PFLayer::ECAL_BARREL, PFLayer::ECAL_ENDCAP, EcalBarrel, EcalEndcap, ALPAKA_ACCELERATOR_NAMESPACE::particleFlowRecHitProducer::getSubdet(), and PFLayer::NONE.

127  {
128  pfrh.detId() = rh.detId();
129  pfrh.denseId() = ECAL::detId2denseId(rh.detId());
130  pfrh.energy() = rh.energy();
131  pfrh.time() = rh.time();
132  pfrh.depth() = 1;
133  const uint32_t subdet = getSubdet(pfrh.detId());
134  if (subdet == EcalBarrel)
135  pfrh.layer() = PFLayer::ECAL_BARREL;
136  else if (subdet == EcalEndcap)
137  pfrh.layer() = PFLayer::ECAL_ENDCAP;
138  else
139  pfrh.layer() = PFLayer::NONE;
140  }

◆ operator()()

template<typename CAL >
template<typename TAcc , typename = std::enable_if_t<alpaka::isAccelerator<TAcc>>>
ALPAKA_FN_ACC void ALPAKA_ACCELERATOR_NAMESPACE::PFRecHitProducerKernelConstruct< CAL >::operator() ( const TAcc &  acc,
const typename CAL::ParameterType::ConstView  params,
const typename CAL::TopologyTypeDevice::ConstView  topology,
const typename CAL::CaloRecHitSoATypeDevice::ConstView  recHits,
reco::PFRecHitDeviceCollection::View  pfRecHits,
uint32_t *__restrict__  denseId2pfRecHit,
uint32_t *__restrict__  num_pfRecHits 
) const
inline

Definition at line 17 of file PFRecHitProducerKernel.dev.cc.

References cms::cudacompat::atomicInc(), mps_fire::i, dqmiolumiharvest::j, submitPVValidationJobs::params, HLT_2024v14_cff::pfRecHits, FastTrackerRecHitMaskProducer_cfi::recHits, HLT_2024v14_cff::topology, and cms::alpakatools::uniform_elements().

23  {
24  // Strided loop over CaloRecHits
25  for (int32_t i : cms::alpakatools::uniform_elements(acc, recHits.metadata().size())) {
26  // Check energy thresholds/quality cuts (specialised for HCAL/ECAL)
28  continue;
29 
30  // Use atomic operation to determine index of the PFRecHit to be constructed
31  // The index needs to be unique and consequtive across all threads in all blocks.
32  // This is achieved using the alpaka::hierarchy::Blocks argument.
33  const uint32_t j = alpaka::atomicInc(acc, num_pfRecHits, 0xffffffff, alpaka::hierarchy::Blocks{});
34 
35  // Construct PFRecHit from CAL recHit (specialised for HCAL/ECAL)
37 
38  // Fill denseId -> pfRecHit index map
39  denseId2pfRecHit[CAL::detId2denseId(pfRecHits.detId(j))] = j;
40  }
41  }
ALPAKA_FN_ACC auto uniform_elements(TAcc const &acc, TArgs... args)
Definition: workdivision.h:311
static ALPAKA_FN_ACC void constructPFRecHit(reco::PFRecHitDeviceCollection::View::element pfrh, const typename CAL::CaloRecHitSoATypeDevice::ConstView::const_element rh)
T1 atomicInc(T1 *a, T2 b)
Definition: cudaCompat.h:48
std::vector< Block > Blocks
Definition: Block.h:99
static ALPAKA_FN_ACC bool applyCuts(const typename CAL::CaloRecHitSoATypeDevice::ConstView::const_element rh, const typename CAL::ParameterType::ConstView params, const typename CAL::TopologyTypeDevice::ConstView topology)