Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ensure HGCAL RecHit map is filled also without RECO #31536

Merged
merged 1 commit into from Sep 24, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
38 changes: 34 additions & 4 deletions Fireworks/Calo/interface/FWHeatmapProxyBuilderTemplate.h
Expand Up @@ -44,7 +44,7 @@ class FWHeatmapProxyBuilderTemplate : public FWSimpleProxyBuilder {
// ---------- member functions ---------------------------

protected:
const std::unordered_map<DetId, const HGCRecHit*>* hitmap;
std::unordered_map<DetId, const HGCRecHit*>* hitmap = new std::unordered_map<DetId, const HGCRecHit*>;

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

void build(const FWEventItem* iItem, TEveElementList* product, const FWViewContext* vc) override {
if (item()->getConfig()->template value<bool>("Heatmap")) {
hitmap->clear();

edm::Handle<HGCRecHitCollection> recHitHandleEE;
edm::Handle<HGCRecHitCollection> recHitHandleFH;
edm::Handle<HGCRecHitCollection> recHitHandleBH;

const edm::EventBase* event = iItem->getEvent();

edm::Handle<std::unordered_map<DetId, const HGCRecHit*>> hitMapHandle;
event->getByLabel(edm::InputTag("hgcalRecHitMapProducer"), hitMapHandle);
hitmap = &*hitMapHandle;
event->getByLabel(edm::InputTag("HGCalRecHit", "HGCEERecHits"), recHitHandleEE);
event->getByLabel(edm::InputTag("HGCalRecHit", "HGCHEFRecHits"), recHitHandleFH);
event->getByLabel(edm::InputTag("HGCalRecHit", "HGCHEBRecHits"), recHitHandleBH);

if (recHitHandleEE.isValid()) {
const auto& rechitsEE = *recHitHandleEE;

for (unsigned int i = 0; i < rechitsEE.size(); ++i) {
(*hitmap)[rechitsEE[i].detid().rawId()] = &rechitsEE[i];
}
}

if (recHitHandleFH.isValid()) {
const auto& rechitsFH = *recHitHandleFH;

for (unsigned int i = 0; i < rechitsFH.size(); ++i) {
(*hitmap)[rechitsFH[i].detid().rawId()] = &rechitsFH[i];
}
}

if (recHitHandleBH.isValid()) {
const auto& rechitsBH = *recHitHandleBH;

for (unsigned int i = 0; i < rechitsBH.size(); ++i) {
(*hitmap)[rechitsBH[i].detid().rawId()] = &rechitsBH[i];
}
}
}

FWSimpleProxyBuilder::build(iItem, product, vc);
Expand Down