-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #12551 from mverwe/CMSSW_7_6_X_PixelFilter
pixel vs HF energy filter (76X version of #12487)
- Loading branch information
Showing
3 changed files
with
126 additions
and
0 deletions.
There are no files selected for viewing
49 changes: 49 additions & 0 deletions
49
HLTrigger/special/interface/HLTPixelActivityHFSumEnergyFilter.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
#ifndef _HLTPixelActivityHFSumEnergyFilter_H | ||
#define _HLTPixelActivityHFSumEnergyFilter_H | ||
|
||
// system include files | ||
#include <memory> | ||
|
||
// user include files | ||
#include "FWCore/Framework/interface/stream/EDFilter.h" | ||
|
||
#include "FWCore/Framework/interface/Event.h" | ||
#include "FWCore/Framework/interface/EventSetup.h" | ||
#include "FWCore/Framework/interface/MakerMacros.h" | ||
#include "FWCore/Utilities/interface/StreamID.h" | ||
|
||
#include "FWCore/ParameterSet/interface/ParameterSet.h" | ||
#include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h" | ||
#include "FWCore/ParameterSet/interface/ParameterSetDescription.h" | ||
#include "FWCore/MessageLogger/interface/MessageLogger.h" | ||
#include "DataFormats/Common/interface/Handle.h" | ||
|
||
#include "DataFormats/HLTReco/interface/TriggerTypeDefs.h" | ||
#include "DataFormats/Common/interface/DetSetVector.h" | ||
#include "DataFormats/SiPixelCluster/interface/SiPixelCluster.h" | ||
#include "DataFormats/HcalRecHit/interface/HcalRecHitCollections.h" | ||
|
||
// | ||
// class declaration | ||
// | ||
|
||
class HLTPixelActivityHFSumEnergyFilter : public edm::stream::EDFilter<> { | ||
public: | ||
explicit HLTPixelActivityHFSumEnergyFilter(const edm::ParameterSet&); | ||
~HLTPixelActivityHFSumEnergyFilter(); | ||
static void fillDescriptions(edm::ConfigurationDescriptions & descriptions); | ||
|
||
private: | ||
virtual bool filter(edm::Event& iEvent, const edm::EventSetup& iSetup) override; | ||
|
||
edm::InputTag inputTag_; // input tag identifying product containing pixel clusters | ||
edm::EDGetTokenT<edmNew::DetSetVector<SiPixelCluster> > inputToken_; | ||
edm::EDGetTokenT<HFRecHitCollection> HFHitsToken_; | ||
edm::InputTag HFHits_; | ||
double eCut_HF_; | ||
double eMin_HF_; | ||
double offset_; | ||
double slope_; | ||
}; | ||
|
||
#endif |
75 changes: 75 additions & 0 deletions
75
HLTrigger/special/src/HLTPixelActivityHFSumEnergyFilter.cc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
#include "HLTrigger/special/interface/HLTPixelActivityHFSumEnergyFilter.h" | ||
|
||
#include "FWCore/Framework/interface/Event.h" | ||
#include "FWCore/Framework/interface/EventSetup.h" | ||
#include "FWCore/MessageLogger/interface/MessageLogger.h" | ||
|
||
// | ||
// constructors and destructor | ||
// | ||
|
||
HLTPixelActivityHFSumEnergyFilter::HLTPixelActivityHFSumEnergyFilter(const edm::ParameterSet& config) : | ||
inputTag_ (config.getParameter<edm::InputTag>("inputTag")), | ||
HFHits_ (config.getParameter<edm::InputTag>("HFHitCollection")), | ||
eCut_HF_ (config.getParameter<double>("eCut_HF")), | ||
eMin_HF_ (config.getParameter<double>("eMin_HF")), | ||
offset_ (config.getParameter<double>("offset")), | ||
slope_ (config.getParameter<double>("slope")) | ||
{ | ||
inputToken_ = consumes<edmNew::DetSetVector<SiPixelCluster> >(inputTag_); | ||
HFHitsToken_ = consumes<HFRecHitCollection>(HFHits_); | ||
|
||
LogDebug("") << "Using the " << inputTag_ << " input collection"; | ||
} | ||
|
||
HLTPixelActivityHFSumEnergyFilter::~HLTPixelActivityHFSumEnergyFilter() | ||
{ | ||
} | ||
|
||
void | ||
HLTPixelActivityHFSumEnergyFilter::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { | ||
edm::ParameterSetDescription desc; | ||
desc.add<edm::InputTag>("inputTag",edm::InputTag("hltSiPixelClusters")); | ||
desc.add<edm::InputTag>("HFHitCollection",edm::InputTag("hltHfreco")); | ||
desc.add<double>("eCut_HF",0); | ||
desc.add<double>("eMin_HF",10000.); | ||
desc.add<double>("offset",-1000.); | ||
desc.add<double>("slope",0.5); | ||
descriptions.add("hltPixelActivityHFSumEnergyFilter",desc); | ||
} | ||
|
||
// | ||
// member functions | ||
// | ||
|
||
// ------------ method called to produce the data ------------ | ||
bool HLTPixelActivityHFSumEnergyFilter::filter(edm::Event& iEvent, const edm::EventSetup& iSetup) | ||
{ | ||
|
||
// get hold of products from Event | ||
edm::Handle<edmNew::DetSetVector<SiPixelCluster> > clusterColl; | ||
iEvent.getByToken(inputToken_, clusterColl); | ||
|
||
unsigned int clusterSize = clusterColl->dataSize(); | ||
LogDebug("") << "Number of clusters: " << clusterSize; | ||
|
||
edm::Handle<HFRecHitCollection> HFRecHitsH; | ||
iEvent.getByToken(HFHitsToken_,HFRecHitsH); | ||
|
||
double sumE = 0.; | ||
|
||
for (HFRecHitCollection::const_iterator it=HFRecHitsH->begin(); it!=HFRecHitsH->end(); it++) { | ||
if (it->energy()>eCut_HF_) { | ||
sumE += it->energy(); | ||
} | ||
} | ||
|
||
bool accept = false; | ||
|
||
double thres = offset_ + slope_ * sumE; | ||
double diff = clusterSize - thres; //diff = clustersize - (correlation line + offset) | ||
if(sumE>eMin_HF_ && diff < 0.) accept = true; | ||
|
||
// return with final filter decision | ||
return accept; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters