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

Run2 hbhe noise filter clean up #5389

Merged
merged 9 commits into from Sep 22, 2014
Merged
Show file tree
Hide file tree
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
2 changes: 2 additions & 0 deletions CommonTools/RecoAlgos/interface/HBHENoiseFilter.h
Expand Up @@ -41,6 +41,8 @@ class HBHENoiseFilter : public edm::EDFilter {
int minNumIsolatedNoiseChannels_;
double minIsolatedNoiseSumE_, minIsolatedNoiseSumEt_;
bool useTS4TS5_;
bool useRBXRechitR45Loose_;
bool useRBXRechitR45Tight_;

bool IgnoreTS4TS5ifJetInLowBVRegion_;
edm::InputTag jetlabel_;
Expand Down
6 changes: 5 additions & 1 deletion CommonTools/RecoAlgos/plugins/HBHENoiseFilter.cc
Expand Up @@ -49,6 +49,8 @@ HBHENoiseFilter::HBHENoiseFilter(const edm::ParameterSet& iConfig)
minIsolatedNoiseSumE_ = iConfig.getParameter<double>("minIsolatedNoiseSumE");
minIsolatedNoiseSumEt_ = iConfig.getParameter<double>("minIsolatedNoiseSumEt");
useTS4TS5_ = iConfig.getParameter<bool>("useTS4TS5");
useRBXRechitR45Loose_ = iConfig.getParameter<bool>("useRBXRechitR45Loose");
useRBXRechitR45Tight_ = iConfig.getParameter<bool>("useRBXRechitR45Tight");

IgnoreTS4TS5ifJetInLowBVRegion_ = iConfig.getParameter<bool>("IgnoreTS4TS5ifJetInLowBVRegion");
jetlabel_ = iConfig.getParameter<edm::InputTag>("jetlabel");
Expand Down Expand Up @@ -138,7 +140,9 @@ HBHENoiseFilter::filter(edm::Event& iEvent, const edm::EventSetup& iSetup)
if(summary.isolatedNoiseSumE()>=minIsolatedNoiseSumE_) return false;
if(summary.isolatedNoiseSumEt()>=minIsolatedNoiseSumEt_) return false;
// Only use TS4TS5 test if jet is not in low BV region
if(useTS4TS5_ == true && summary.HasBadRBXTS4TS5() == true && goodJetFoundInLowBVRegion==false) return false;
if(useTS4TS5_ && summary.HasBadRBXTS4TS5() == true && !goodJetFoundInLowBVRegion) return false;
if(useRBXRechitR45Loose_ && summary.HasBadRBXRechitR45Loose() == true && !goodJetFoundInLowBVRegion) return false;
if(useRBXRechitR45Tight_ && summary.HasBadRBXRechitR45Tight() == true && !goodJetFoundInLowBVRegion) return false;

return true;
}
Expand Down
Expand Up @@ -57,6 +57,8 @@ class HBHENoiseFilterResultProducer : public edm::EDProducer {
double minIsolatedNoiseSumE_, minIsolatedNoiseSumEt_;

bool useTS4TS5_;
bool useRBXRechitR45Loose_;
bool useRBXRechitR45Tight_;

bool IgnoreTS4TS5ifJetInLowBVRegion_;
edm::InputTag jetlabel_;
Expand Down Expand Up @@ -87,6 +89,8 @@ HBHENoiseFilterResultProducer::HBHENoiseFilterResultProducer(const edm::Paramete
minIsolatedNoiseSumE_ = iConfig.getParameter<double>("minIsolatedNoiseSumE");
minIsolatedNoiseSumEt_ = iConfig.getParameter<double>("minIsolatedNoiseSumEt");
useTS4TS5_ = iConfig.getParameter<bool>("useTS4TS5");
useRBXRechitR45Loose_ = iConfig.getParameter<bool>("useRBXRechitR45Loose");
useRBXRechitR45Tight_ = iConfig.getParameter<bool>("useRBXRechitR45Tight");

IgnoreTS4TS5ifJetInLowBVRegion_ = iConfig.getParameter<bool>("IgnoreTS4TS5ifJetInLowBVRegion");
jetlabel_ = iConfig.getParameter<edm::InputTag>("jetlabel");
Expand Down Expand Up @@ -170,7 +174,9 @@ HBHENoiseFilterResultProducer::produce(edm::Event& iEvent, const edm::EventSetup
if(summary.numIsolatedNoiseChannels()>=minNumIsolatedNoiseChannels_) result=false;
if(summary.isolatedNoiseSumE()>=minIsolatedNoiseSumE_) result=false;
if(summary.isolatedNoiseSumEt()>=minIsolatedNoiseSumEt_) result=false;
if(useTS4TS5_ == true && summary.HasBadRBXTS4TS5() == true && goodJetFoundInLowBVRegion==false) result = false;
if(useTS4TS5_ && summary.HasBadRBXTS4TS5() == true && !goodJetFoundInLowBVRegion) result = false;
if(useRBXRechitR45Loose_ && summary.HasBadRBXRechitR45Loose() == true && !goodJetFoundInLowBVRegion) result = false;
if(useRBXRechitR45Tight_ && summary.HasBadRBXRechitR45Tight() == true && !goodJetFoundInLowBVRegion) result = false;

std::auto_ptr<bool> pOut(new bool);
*pOut=result;
Expand Down
Expand Up @@ -15,7 +15,9 @@
minNumIsolatedNoiseChannels = cms.int32(10),
minIsolatedNoiseSumE = cms.double(50.0),
minIsolatedNoiseSumEt = cms.double(25.0),
useTS4TS5 = cms.bool(True),
useTS4TS5 = cms.bool(False),
useRBXRechitR45Loose = cms.bool(False),
useRBXRechitR45Tight = cms.bool(False),
IgnoreTS4TS5ifJetInLowBVRegion=cms.bool(True),
jetlabel = cms.InputTag('ak4PFJets'),
maxjetindex = cms.int32(0), # maximum jet index that will be checked for 'IgnoreTS4TS5ifJetInLowBVRegion'
Expand Down
4 changes: 3 additions & 1 deletion CommonTools/RecoAlgos/python/HBHENoiseFilter_cfi.py
Expand Up @@ -15,7 +15,9 @@
minNumIsolatedNoiseChannels = cms.int32(10),
minIsolatedNoiseSumE = cms.double(50.0),
minIsolatedNoiseSumEt = cms.double(25.0),
useTS4TS5 = cms.bool(True),
useTS4TS5 = cms.bool(False),
useRBXRechitR45Loose = cms.bool(False),
useRBXRechitR45Tight = cms.bool(False),
IgnoreTS4TS5ifJetInLowBVRegion=cms.bool(True),
jetlabel = cms.InputTag('ak4PFJets'),
maxjetindex = cms.int32(0), # maximum jet index that will be checked for 'IgnoreTS4TS5ifJetInLowBVRegion'
Expand Down
5 changes: 4 additions & 1 deletion DataFormats/METReco/interface/HcalNoiseHPD.h
Expand Up @@ -21,6 +21,7 @@
#include "DataFormats/Common/interface/Ref.h"
#include "DataFormats/Common/interface/RefProd.h"
#include "DataFormats/CaloTowers/interface/CaloTowerCollection.h"
#include "RecoLocalCalo/HcalRecAlgos/interface/HcalCaloFlagLabels.h"

namespace reco {

Expand Down Expand Up @@ -101,13 +102,15 @@ namespace reco {

// integral of rechit energies in the HPD with E>threshold (default is 1.5 GeV)
float recHitEnergy(float threshold=1.5) const;
float recHitEnergyFailR45(float threshold=1.5) const;

// minimum and maximum time for rechits with E>threshold (default is 10.0 GeV)
float minRecHitTime(float threshold=10.0) const;
float maxRecHitTime(float threshold=10.0) const;

// number of rechits with E>threshold (default is 1.5 GeV)
int numRecHits(float threshold=1.5) const;
int numRecHitsFailR45(float threshold=1.5) const;

//
// CaloTower accessors
Expand All @@ -133,7 +136,7 @@ namespace reco {
int maxZeros_;
std::vector<float> bigCharge_;
std::vector<float> big5Charge_;

// a vector of references to rechits
edm::RefVector<HBHERecHitCollection> rechits_;

Expand Down
2 changes: 2 additions & 0 deletions DataFormats/METReco/interface/HcalNoiseRBX.h
Expand Up @@ -79,13 +79,15 @@ namespace reco {

// sum of the energy of rechits in the RBX with E>threshold
double recHitEnergy(double theshold=1.5) const;
double recHitEnergyFailR45(double threshold=1.5) const;

// minimum and maximum time for rechits in the RBX with E>threshold
double minRecHitTime(double threshold=20.0) const;
double maxRecHitTime(double threshold=20.0) const;

// total number of rechits above some threshold in the RBX
int numRecHits(double threshold=1.5) const;
int numRecHitsFailR45(double threshold=1.5) const;

// calotower properties integrated over the entire RBX
double caloTowerHadE(void) const;
Expand Down
10 changes: 10 additions & 0 deletions DataFormats/METReco/interface/HcalNoiseSummary.h
Expand Up @@ -124,6 +124,10 @@ class HcalNoiseSummary
float TS4TS5NoiseSumE(void) const;
float TS4TS5NoiseSumEt(void) const;

int numNegativeNoiseChannels(void) const;
float NegativeNoiseSumE(void) const;
float NegativeNoiseSumEt(void) const;

int GetRecHitCount(void) const;
int GetRecHitCount15(void) const;
double GetRecHitEnergy(void) const;
Expand All @@ -132,6 +136,8 @@ class HcalNoiseSummary
double GetTotalCalibCharge(void) const;

bool HasBadRBXTS4TS5(void) const;
bool HasBadRBXRechitR45Loose(void) const;
bool HasBadRBXRechitR45Tight(void) const;

double GetCalibChargeHF(void) const;
int GetCalibCountHF(void) const;
Expand Down Expand Up @@ -179,6 +185,8 @@ class HcalNoiseSummary
float trianglenoisee_, trianglenoiseet_;
int nts4ts5noise_;
float ts4ts5noisee_, ts4ts5noiseet_;
int nnegativenoise_;
float negativenoisee_, negativenoiseet_;

int rechitCount_;
int rechitCount15_;
Expand All @@ -187,6 +195,8 @@ class HcalNoiseSummary
double calibCharge_;

bool hasBadRBXTS4TS5_;
bool hasBadRBXRechitR45Loose_;
bool hasBadRBXRechitR45Tight_;

int calibCountTS45_;
int calibCountgt15TS45_;
Expand Down
23 changes: 22 additions & 1 deletion DataFormats/METReco/src/HcalNoiseHPD.cc
Expand Up @@ -56,6 +56,7 @@ float HcalNoiseHPD::bigChargeHighest2TS(unsigned int firstts) const
return total;
}


float HcalNoiseHPD::bigChargeHighest3TS(unsigned int firstts) const
{
float total=0;
Expand Down Expand Up @@ -118,7 +119,18 @@ float HcalNoiseHPD::recHitEnergy(float threshold) const
}
return total;
}


float HcalNoiseHPD::recHitEnergyFailR45(float threshold) const
{
float total=0.0;
for(edm::RefVector<HBHERecHitCollection>::const_iterator it=rechits_.begin(); it!=rechits_.end(); ++it) {
float energy=(*it)->energy();
if((*it)->flagField(HcalCaloFlagLabels::HBHENegativeNoise))
if(energy>=threshold) total+=energy;
}
return total;
}

float HcalNoiseHPD::minRecHitTime(float threshold) const
{
float mintime=9999999;
Expand Down Expand Up @@ -149,6 +161,15 @@ int HcalNoiseHPD::numRecHits(float threshold) const
return count;
}

int HcalNoiseHPD::numRecHitsFailR45(float threshold) const
{
int count=0;
for(edm::RefVector<HBHERecHitCollection>::const_iterator it=rechits_.begin(); it!=rechits_.end(); ++it)
if((*it)->flagField(HcalCaloFlagLabels::HBHENegativeNoise))
if((*it)->energy()>=threshold) ++count;
return count;
}

const edm::RefVector<CaloTowerCollection> HcalNoiseHPD::caloTowers(void) const
{
return calotowers_;
Expand Down
16 changes: 16 additions & 0 deletions DataFormats/METReco/src/HcalNoiseRBX.cc
Expand Up @@ -104,6 +104,14 @@ double HcalNoiseRBX::recHitEnergy(double threshold) const
return total;
}

double HcalNoiseRBX::recHitEnergyFailR45(double threshold) const
{
double total=0;
for(unsigned int i=0; i<hpds_.size(); i++)
total += hpds_[i].recHitEnergyFailR45(threshold);
return total;
}

double HcalNoiseRBX::minRecHitTime(double threshold) const
{
double mintime=9999999.;
Expand Down Expand Up @@ -132,6 +140,14 @@ int HcalNoiseRBX::numRecHits(double threshold) const
return total;
}

int HcalNoiseRBX::numRecHitsFailR45(double threshold) const
{
int total=0;
for(unsigned int i=0; i<hpds_.size(); i++)
total += hpds_[i].numRecHitsFailR45(threshold);
return total;
}

double HcalNoiseRBX::caloTowerHadE(void) const
{
double h=0;
Expand Down
28 changes: 28 additions & 0 deletions DataFormats/METReco/src/HcalNoiseSummary.cc
Expand Up @@ -26,8 +26,11 @@ HcalNoiseSummary::HcalNoiseSummary()
nspikenoise_(0), spikenoisee_(0), spikenoiseet_(0),
ntrianglenoise_(0), trianglenoisee_(0), trianglenoiseet_(0),
nts4ts5noise_(0), ts4ts5noisee_(0), ts4ts5noiseet_(0),
nnegativenoise_(0), negativenoisee_(0), negativenoiseet_(0),
rechitCount_(0), rechitCount15_(0), rechitEnergy_(0), rechitEnergy15_(0), calibCharge_(0),
hasBadRBXTS4TS5_(false),
hasBadRBXRechitR45Loose_(false),
hasBadRBXRechitR45Tight_(false),
calibCountTS45_(0),
calibCountgt15TS45_(0),
calibChargeTS45_(0.),
Expand Down Expand Up @@ -281,6 +284,21 @@ float HcalNoiseSummary::TS4TS5NoiseSumEt(void) const
return ts4ts5noiseet_;
}

int HcalNoiseSummary::numNegativeNoiseChannels(void) const
{
return nnegativenoise_;
}

float HcalNoiseSummary::NegativeNoiseSumE(void) const
{
return negativenoisee_;
}

float HcalNoiseSummary::NegativeNoiseSumEt(void) const
{
return negativenoiseet_;
}

int HcalNoiseSummary::GetRecHitCount(void) const
{
return rechitCount_;
Expand Down Expand Up @@ -311,6 +329,16 @@ bool HcalNoiseSummary::HasBadRBXTS4TS5(void) const
return hasBadRBXTS4TS5_;
}

bool HcalNoiseSummary::HasBadRBXRechitR45Loose(void) const
{
return hasBadRBXRechitR45Loose_;
}

bool HcalNoiseSummary::HasBadRBXRechitR45Tight(void) const
{
return hasBadRBXRechitR45Tight_;
}

int HcalNoiseSummary::GetCalibCountTS45(void) const
{
return calibCountTS45_;
Expand Down
3 changes: 2 additions & 1 deletion DataFormats/METReco/src/classes_def.xml
Expand Up @@ -128,10 +128,11 @@
<class name="reco::HcalNoiseRBXCollection"/>
<class name="edm::Wrapper<reco::HcalNoiseRBXCollection>"/>

<class name="HcalNoiseSummary" ClassVersion="13">
<class name="HcalNoiseSummary" ClassVersion="14">
<version ClassVersion="11" checksum="664452001"/>
<version ClassVersion="12" checksum="4280559065"/>
<version ClassVersion="13" checksum="382065414"/>
<version ClassVersion="14" checksum="651605939"/>
</class>
<class name="edm::Wrapper<HcalNoiseSummary>"/>

Expand Down
2 changes: 1 addition & 1 deletion HLTrigger/JetMET/interface/HLTHcalMETNoiseCleaner.h
Expand Up @@ -49,7 +49,7 @@ class HLTHcalMETNoiseCleaner : public edm::EDFilter {
double maxRBXEMF_;

// imported from the RecoMET/METProducers/python/hcalnoiseinfoproducer_cfi
double minRecHitE_, minLowHitE_, minHighHitE_;
double minRecHitE_, minLowHitE_, minHighHitE_, minR45HitE_;

double TS4TS5EnergyThreshold_;
std::vector<std::pair<double, double> > TS4TS5UpperCut_;
Expand Down
2 changes: 1 addition & 1 deletion HLTrigger/JetMET/interface/HLTHcalMETNoiseFilter.h
Expand Up @@ -48,7 +48,7 @@ class HLTHcalMETNoiseFilter : public edm::EDFilter {
double maxRBXEMF_;

// imported from the RecoMET/METProducers/python/hcalnoiseinfoproducer_cfi
double minRecHitE_, minLowHitE_, minHighHitE_;
double minRecHitE_, minLowHitE_, minHighHitE_, minR45HitE_;

double TS4TS5EnergyThreshold_;
std::vector<std::pair<double, double> > TS4TS5UpperCut_;
Expand Down
2 changes: 1 addition & 1 deletion HLTrigger/JetMET/interface/HLTHcalTowerNoiseCleaner.h
Expand Up @@ -50,7 +50,7 @@ class HLTHcalTowerNoiseCleaner : public edm::EDProducer {
double maxRBXEMF_;

// imported from the RecoMET/METProducers/python/hcalnoiseinfoproducer_cfi
double minRecHitE_, minLowHitE_, minHighHitE_;
double minRecHitE_, minLowHitE_, minHighHitE_, minR45HitE_;

double TS4TS5EnergyThreshold_;
std::vector<std::pair<double, double> > TS4TS5UpperCut_;
Expand Down
7 changes: 6 additions & 1 deletion HLTrigger/JetMET/src/HLTHcalMETNoiseCleaner.cc
Expand Up @@ -66,6 +66,7 @@ HLTHcalMETNoiseCleaner::HLTHcalMETNoiseCleaner(const edm::ParameterSet& iConfig)
minRecHitE_(iConfig.getParameter<double>("minRecHitE")),
minLowHitE_(iConfig.getParameter<double>("minLowHitE")),
minHighHitE_(iConfig.getParameter<double>("minHighHitE")),
minR45HitE_(5.0),
TS4TS5EnergyThreshold_(iConfig.getParameter<double>("TS4TS5EnergyThreshold"))
{

Expand All @@ -85,6 +86,9 @@ HLTHcalMETNoiseCleaner::HLTHcalMETNoiseCleaner(const edm::ParameterSet& iConfig)
m_theCaloMetToken = consumes<reco::CaloMETCollection>(CaloMetCollectionTag_);
m_theHcalNoiseToken = consumes<reco::HcalNoiseRBXCollection>(HcalNoiseRBXCollectionTag_);

if(iConfig.existsAs<double>("minR45HitE"))
minR45HitE_ = iConfig.getParameter<double>("minR45HitE");

produces<reco::CaloMETCollection>();
}

Expand Down Expand Up @@ -115,6 +119,7 @@ HLTHcalMETNoiseCleaner::fillDescriptions(edm::ConfigurationDescriptions& descrip
desc.add<double>("minRecHitE",1.5);
desc.add<double>("minLowHitE",10.0);
desc.add<double>("minHighHitE",25.0);
desc.add<double>("minR45HitE",5.0);
desc.add<double>("TS4TS5EnergyThreshold",50.0);

double TS4TS5UpperThresholdArray[5] = {70, 90, 100, 400, 4000 };
Expand Down Expand Up @@ -178,7 +183,7 @@ bool HLTHcalMETNoiseCleaner::filter(edm::Event& iEvent, const edm::EventSetup& i
for(HcalNoiseRBXCollection::const_iterator it=rbxs_h->begin(); it!=rbxs_h->end(); ++it) {
const HcalNoiseRBX &rbx=(*it);
CommonHcalNoiseRBXData d(rbx, minRecHitE_, minLowHitE_, minHighHitE_, TS4TS5EnergyThreshold_,
TS4TS5UpperCut_, TS4TS5LowerCut_);
TS4TS5UpperCut_, TS4TS5LowerCut_, minR45HitE_);
data.insert(d);
}
//if 0 RBXs are in the list, just accept
Expand Down