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::kMaxDepthHB, submitPVValidationJobs::params, DiMuonV_cfg::threshold, and HLT_2024v13_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  if (topology.cutsFromDB()) {
63  threshold = topology.noiseThreshold()[HCAL::detId2denseId(detId)];
64  } else {
65  if (subdet == HcalBarrel) {
66  threshold = params.energyThresholds()[depth - 1];
67  } else if (subdet == HcalEndcap) {
68  threshold = params.energyThresholds()[depth - 1 + HCAL::kMaxDepthHB];
69  } else {
70  printf("Rechit with detId %u has invalid subdetector %u!\n", detId, subdet);
71  return false;
72  }
73  }
74  return rh.energy() >= threshold;
75  }

◆ 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 78 of file PFRecHitProducerKernel.dev.cc.

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

81  {
82  // Reject ECAL recHits below energy threshold
83  if (rh.energy() < params.energyThresholds()[ECAL::detId2denseId(rh.detId())])
84  return false;
85 
86  // Reject ECAL recHits of bad quality
87  if ((ECAL::checkFlag(rh.flags(), ECAL::Flags::kOutOfTime) && rh.energy() > params.cleaningThreshold()) ||
89  ECAL::checkFlag(rh.flags(), ECAL::Flags::kDiWeird))
90  return false;
91 
92  return true;
93  }
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 96 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.

98  {
99  pfrh.detId() = rh.detId();
100  pfrh.denseId() = HCAL::detId2denseId(rh.detId());
101  pfrh.energy() = rh.energy();
102  pfrh.time() = rh.timeM0();
103  pfrh.depth() = HCAL::getDepth(pfrh.detId());
104  const uint32_t subdet = getSubdet(pfrh.detId());
105  if (subdet == HcalBarrel)
106  pfrh.layer() = PFLayer::HCAL_BARREL1;
107  else if (subdet == HcalEndcap)
108  pfrh.layer() = PFLayer::HCAL_ENDCAP;
109  else
110  pfrh.layer() = PFLayer::NONE;
111  }

◆ 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 114 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.

116  {
117  pfrh.detId() = rh.detId();
118  pfrh.denseId() = ECAL::detId2denseId(rh.detId());
119  pfrh.energy() = rh.energy();
120  pfrh.time() = rh.time();
121  pfrh.depth() = 1;
122  const uint32_t subdet = getSubdet(pfrh.detId());
123  if (subdet == EcalBarrel)
124  pfrh.layer() = PFLayer::ECAL_BARREL;
125  else if (subdet == EcalEndcap)
126  pfrh.layer() = PFLayer::ECAL_ENDCAP;
127  else
128  pfrh.layer() = PFLayer::NONE;
129  }

◆ 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_2024v13_cff::pfRecHits, FastTrackerRecHitMaskProducer_cfi::recHits, HLT_2024v13_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)