Skip to content

Commit

Permalink
Merge pull request #11705 from lihux25/fix_HF_dup_chns_75X
Browse files Browse the repository at this point in the history
Fix the duplicated HF channels
  • Loading branch information
cmsbuild committed Oct 12, 2015
2 parents 0b1bdaa + a96d553 commit b955f7a
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion EventFilter/HcalRawToDigi/plugins/HcalRawToDigi.cc
Original file line number Diff line number Diff line change
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

0 comments on commit b955f7a

Please sign in to comment.