Skip to content

Commit a0aa0a6

Browse files
committed
Make sure hitmap is filled also without RECO
1 parent 86caca1 commit a0aa0a6

File tree

1 file changed

+34
-4
lines changed

1 file changed

+34
-4
lines changed

Fireworks/Calo/interface/FWHeatmapProxyBuilderTemplate.h

Lines changed: 34 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ class FWHeatmapProxyBuilderTemplate : public FWSimpleProxyBuilder {
4444
// ---------- member functions ---------------------------
4545

4646
protected:
47-
const std::unordered_map<DetId, const HGCRecHit*>* hitmap;
47+
std::unordered_map<DetId, const HGCRecHit*>* hitmap = new std::unordered_map<DetId, const HGCRecHit*>;
4848

4949
static constexpr uint8_t gradient_steps = 9;
5050
static constexpr uint8_t gradient[3][gradient_steps] = {{static_cast<uint8_t>(0.2082 * 255),
@@ -93,11 +93,41 @@ class FWHeatmapProxyBuilderTemplate : public FWSimpleProxyBuilder {
9393

9494
void build(const FWEventItem* iItem, TEveElementList* product, const FWViewContext* vc) override {
9595
if (item()->getConfig()->template value<bool>("Heatmap")) {
96+
hitmap->clear();
97+
98+
edm::Handle<HGCRecHitCollection> recHitHandleEE;
99+
edm::Handle<HGCRecHitCollection> recHitHandleFH;
100+
edm::Handle<HGCRecHitCollection> recHitHandleBH;
101+
96102
const edm::EventBase* event = iItem->getEvent();
97103

98-
edm::Handle<std::unordered_map<DetId, const HGCRecHit*>> hitMapHandle;
99-
event->getByLabel(edm::InputTag("hgcalRecHitMapProducer"), hitMapHandle);
100-
hitmap = &*hitMapHandle;
104+
event->getByLabel(edm::InputTag("HGCalRecHit", "HGCEERecHits"), recHitHandleEE);
105+
event->getByLabel(edm::InputTag("HGCalRecHit", "HGCHEFRecHits"), recHitHandleFH);
106+
event->getByLabel(edm::InputTag("HGCalRecHit", "HGCHEBRecHits"), recHitHandleBH);
107+
108+
if (recHitHandleEE.isValid()) {
109+
const auto& rechitsEE = *recHitHandleEE;
110+
111+
for (unsigned int i = 0; i < rechitsEE.size(); ++i) {
112+
(*hitmap)[rechitsEE[i].detid().rawId()] = &rechitsEE[i];
113+
}
114+
}
115+
116+
if (recHitHandleFH.isValid()) {
117+
const auto& rechitsFH = *recHitHandleFH;
118+
119+
for (unsigned int i = 0; i < rechitsFH.size(); ++i) {
120+
(*hitmap)[rechitsFH[i].detid().rawId()] = &rechitsFH[i];
121+
}
122+
}
123+
124+
if (recHitHandleBH.isValid()) {
125+
const auto& rechitsBH = *recHitHandleBH;
126+
127+
for (unsigned int i = 0; i < rechitsBH.size(); ++i) {
128+
(*hitmap)[rechitsBH[i].detid().rawId()] = &rechitsBH[i];
129+
}
130+
}
101131
}
102132

103133
FWSimpleProxyBuilder::build(iItem, product, vc);

0 commit comments

Comments
 (0)