54 auto view = product->view();
55 const int calEnums[2] = {CAL::kSubdetectorBarrelId, CAL::kSubdetectorEndcapId};
56 for (
const auto subdet : calEnums) {
62 std::variant<EcalBarrelTopology, EcalEndcapTopology> topoVar;
71 for (
auto const detId :
geom.getValidDetIds(CAL::kDetectorId, subdet)) {
72 const uint32_t denseId = CAL::detId2denseId(
detId);
73 assert(denseId < CAL::kSize);
76 if constexpr (std::is_same_v<CAL, HCAL>) {
77 view.cutsFromDB() =
false;
79 view.cutsFromDB() =
true;
82 std::unique_ptr<HcalPFCuts>
prod = std::make_unique<HcalPFCuts>(pfCuts);
83 prod->setTopo(&htopo);
85 view.seedThreshold(denseId) =
prod->getValues(
detId.rawId())->seedThreshold();
90 view.positionX(denseId) =
pos.x();
91 view.positionY(denseId) =
pos.y();
92 view.positionZ(denseId) =
pos.z();
94 for (uint32_t
n = 0;
n < 8;
n++) {
96 if (CAL::detIdInRange(neighDetId))
97 view.neighbours(denseId)(
n) = CAL::detId2denseId(neighDetId);
99 view.neighbours(denseId)(
n) = 0xffffffff;
105 if constexpr (std::is_same_v<CAL, HCAL>) {
106 for (
const auto subdet : calEnums)
107 for (
auto const detId :
geom.getValidDetIds(CAL::kDetectorId, subdet)) {
108 const uint32_t denseId = CAL::detId2denseId(
detId);
109 for (uint32_t
n = 0;
n < 8;
n++) {
110 if (
view.neighbours(denseId)[
n] == 0xffffffff)
113 view.neighbours(
view.neighbours(denseId)[
n]);
114 if (
std::find(neighboursOfNeighbour.begin(), neighboursOfNeighbour.end(), denseId) ==
115 neighboursOfNeighbour.end())
116 view.neighbours(denseId)[
n] = 0xffffffff;
122 LogDebug(
"PFRecHitTopologyESProducer").log([&](
auto&
log) {
123 for (
const auto subdet : calEnums)
124 for (
const auto detId :
geom.getValidDetIds(CAL::kDetectorId, subdet)) {
125 const uint32_t denseId = CAL::detId2denseId(
detId);
126 log.format(
"detId:{} denseId:{} pos:{},{},{} neighbours:{},{},{},{};{},{},{},{}\n",
129 view[denseId].positionX(),
130 view[denseId].positionY(),
131 view[denseId].positionZ(),
132 view[denseId].neighbours()(0),
133 view[denseId].neighbours()(1),
134 view[denseId].neighbours()(2),
135 view[denseId].neighbours()(3),
136 view[denseId].neighbours()(4),
137 view[denseId].neighbours()(5),
138 view[denseId].neighbours()(6),
139 view[denseId].neighbours()(7));
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Eigen::Matrix< uint32_t, 8, 1 > PFRecHitsTopologyNeighbours
edm::ESGetToken< HcalTopology, HcalRecNumberingRecord > hcalToken_
virtual std::shared_ptr< const CaloCellGeometry > getGeometry(const DetId &id) const
Get the cell geometry of a given detector id. Should return false if not found.
uint32_t getNeighbourDetId(const uint32_t detId, const uint32_t direction, const CaloSubdetectorTopology &topo)
edm::ESGetToken< CaloGeometry, CaloGeometryRecord > geomToken_
edm::ESGetToken< HcalPFCuts, HcalPFCutsRcd > hcalCutsToken_