Skip to content

Commit e921ea4

Browse files
authored
Merge pull request #45238 from fwyzard/introduce_kInvalidDenseId
Introduce kInvalidDenseId for ECAL and HCAL
2 parents ddffbf2 + 825f2f9 commit e921ea4

File tree

3 files changed

+12
-6
lines changed

3 files changed

+12
-6
lines changed

RecoParticleFlow/PFRecHitProducer/plugins/alpaka/CalorimeterDefinitions.h

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
#ifndef RecoParticleFlow_PFRecHitProducer_interface_alpaka_CalorimeterDefinitions_h
22
#define RecoParticleFlow_PFRecHitProducer_interface_alpaka_CalorimeterDefinitions_h
33

4+
#include <limits>
5+
46
#include "DataFormats/DetId/interface/DetId.h"
57
#include "DataFormats/EcalDetId/interface/EcalSubdetector.h"
68
#include "DataFormats/EcalRecHit/interface/EcalRecHit.h"
@@ -97,6 +99,8 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE::particleFlowRecHitProducer {
9799
return retval + kSizeBarrel;
98100
}
99101

102+
static constexpr uint32_t kInvalidDenseId = std::numeric_limits<uint32_t>::max();
103+
100104
static constexpr uint32_t detId2denseId(uint32_t detId) {
101105
const uint32_t subdet = getSubdet(detId);
102106
if (subdet == HcalBarrel)
@@ -105,7 +109,7 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE::particleFlowRecHitProducer {
105109
return detId2denseIdHE(detId);
106110

107111
printf("invalid detId: %u\n", detId);
108-
return -1;
112+
return kInvalidDenseId;
109113
}
110114
};
111115

@@ -181,6 +185,8 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE::particleFlowRecHitProducer {
181185

182186
static constexpr bool checkFlag(uint32_t flagBits, int flag) { return flagBits & (0x1 << flag); }
183187

188+
static constexpr uint32_t kInvalidDenseId = std::numeric_limits<uint32_t>::max();
189+
184190
static constexpr uint32_t detId2denseId(uint32_t detId) {
185191
const uint32_t subdet = getSubdet(detId);
186192
if (subdet == EcalBarrel)
@@ -189,7 +195,7 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE::particleFlowRecHitProducer {
189195
return Barrel::kSize + Endcap::denseIndex(detId);
190196

191197
printf("invalid detId: %u\n", detId);
192-
return 0;
198+
return kInvalidDenseId;
193199
}
194200

195201
static constexpr bool detIdInRange(uint32_t detId) {

RecoParticleFlow/PFRecHitProducer/plugins/alpaka/PFRecHitProducerKernel.dev.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE {
152152
for (uint32_t n = 0; n < 8; n++) {
153153
pfRecHits.neighbours(i)(n) = -1;
154154
const uint32_t denseId_neighbour = topology.neighbours(denseId)(n);
155-
if (denseId_neighbour != 0xffffffff) {
155+
if (denseId_neighbour != CAL::kInvalidDenseId) {
156156
const uint32_t pfRecHit_neighbour = denseId2pfRecHit[denseId_neighbour];
157157
if (pfRecHit_neighbour != 0xffffffff)
158158
pfRecHits.neighbours(i)(n) = (int32_t)pfRecHit_neighbour;

RecoParticleFlow/PFRecHitProducer/plugins/alpaka/PFRecHitTopologyESProducer.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE {
9696
if (CAL::detIdInRange(neighDetId))
9797
view.neighbours(denseId)(n) = CAL::detId2denseId(neighDetId);
9898
else
99-
view.neighbours(denseId)(n) = 0xffffffff;
99+
view.neighbours(denseId)(n) = CAL::kInvalidDenseId;
100100
}
101101
}
102102
}
@@ -107,13 +107,13 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE {
107107
for (auto const detId : geom.getValidDetIds(CAL::kDetectorId, subdet)) {
108108
const uint32_t denseId = CAL::detId2denseId(detId);
109109
for (uint32_t n = 0; n < 8; n++) {
110-
if (view.neighbours(denseId)[n] == 0xffffffff)
110+
if (view.neighbours(denseId)[n] == CAL::kInvalidDenseId)
111111
continue;
112112
const ::reco::PFRecHitsTopologyNeighbours& neighboursOfNeighbour =
113113
view.neighbours(view.neighbours(denseId)[n]);
114114
if (std::find(neighboursOfNeighbour.begin(), neighboursOfNeighbour.end(), denseId) ==
115115
neighboursOfNeighbour.end())
116-
view.neighbours(denseId)[n] = 0xffffffff;
116+
view.neighbours(denseId)[n] = CAL::kInvalidDenseId;
117117
}
118118
}
119119
}

0 commit comments

Comments
 (0)