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

Fix the duplicated HF channels #11704

Merged
merged 1 commit into from Oct 11, 2015
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
11 changes: 10 additions & 1 deletion EventFilter/HcalRawToDigi/plugins/HcalRawToDigi.cc
Expand Up @@ -9,6 +9,7 @@ using namespace std;
#include "CalibFormats/HcalObjects/interface/HcalDbRecord.h"
#include "FWCore/MessageLogger/interface/MessageLogger.h"
#include <iostream>
#include <unordered_set>

HcalRawToDigi::HcalRawToDigi(edm::ParameterSet const& conf):
unpacker_(conf.getUntrackedParameter<int>("HcalFirstFED",int(FEDNumbering::MINHCALFEDID)),conf.getParameter<int>("firstSample"),conf.getParameter<int>("lastSample")),
Expand Down Expand Up @@ -175,6 +176,14 @@ void HcalRawToDigi::produce(edm::Event& e, const edm::EventSetup& es)

stats_.n++;

// check HF duplication
std::unordered_set<uint32_t> cacheForHFdup;
unsigned int cntHFdup = 0;
for( auto & hf_digi : hf ){
if( ! cacheForHFdup.insert(hf_digi.id().rawId()).second ) cntHFdup++;
}
if( cntHFdup ) edm::LogError("HcalRawToDigi") << "Duplicated HF digis found for "<<cntHFdup<<" times"<<std::endl;

// Step B: encapsulate vectors in actual collections
std::auto_ptr<HBHEDigiCollection> hbhe_prod(new HBHEDigiCollection());
std::auto_ptr<HFDigiCollection> hf_prod(new HFDigiCollection());
Expand All @@ -187,7 +196,7 @@ void HcalRawToDigi::produce(edm::Event& e, const edm::EventSetup& es)
std::auto_ptr<QIE10DigiCollection> qie10_prod(colls.qie10);

hbhe_prod->swap_contents(hbhe);
hf_prod->swap_contents(hf);
if( !cntHFdup ) hf_prod->swap_contents(hf);
ho_prod->swap_contents(ho);
htp_prod->swap_contents(htp);
hotp_prod->swap_contents(hotp);
Expand Down