forked from cms-sw/cmssw
-
Notifications
You must be signed in to change notification settings - Fork 0
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 cms-sw#5527 from fruboes/HLTPFJetAveFilterWithEtaR…
…anges New HLT jet ptave filter allowing to specify eta ranges for tagging/probeing jet
- Loading branch information
Showing
3 changed files
with
192 additions
and
0 deletions.
There are no files selected for viewing
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,45 @@ | ||
#ifndef HLTDiJetAveEtaFilter_h | ||
#define HLTDiJetAveEtaFilter_h | ||
|
||
/** \class HLTDiJetAveEtaFilter | ||
* | ||
* \author Tomasz Fruboes | ||
* based on HLTDiJetAveFilter | ||
*/ | ||
|
||
#include "DataFormats/HLTReco/interface/TriggerTypeDefs.h" | ||
#include "HLTrigger/HLTcore/interface/HLTFilter.h" | ||
#include "DataFormats/HLTReco/interface/TriggerFilterObjectWithRefs.h" | ||
|
||
namespace edm { | ||
class ConfigurationDescriptions; | ||
} | ||
|
||
// | ||
// class declaration | ||
// | ||
|
||
template<typename T> | ||
class HLTDiJetAveEtaFilter : public HLTFilter { | ||
|
||
public: | ||
explicit HLTDiJetAveEtaFilter(const edm::ParameterSet&); | ||
~HLTDiJetAveEtaFilter(); | ||
static void fillDescriptions(edm::ConfigurationDescriptions & descriptions); | ||
virtual bool hltFilter(edm::Event&, const edm::EventSetup&, trigger::TriggerFilterObjectWithRefs & filterproduct) const override; | ||
|
||
private: | ||
edm::EDGetTokenT<std::vector<T>> m_theJetToken; | ||
edm::InputTag inputJetTag_; // input tag identifying jets | ||
double minPtJet_; | ||
double minPtAve_; | ||
//double minPtJet3_; | ||
double minDphi_; | ||
double tagEtaMin_; | ||
double tagEtaMax_; | ||
double probeEtaMin_; | ||
double probeEtaMax_; | ||
int triggerType_; | ||
}; | ||
|
||
#endif //HLTDiJetAveEtaFilter_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,138 @@ | ||
/** \class HLTDiJetAveEtaFilter | ||
* | ||
* | ||
* \author Tomasz Fruboes | ||
* based on HLTDiJetAveFilter | ||
*/ | ||
|
||
#include "HLTrigger/JetMET/interface/HLTDiJetAveEtaFilter.h" | ||
|
||
#include "DataFormats/Common/interface/Ref.h" | ||
#include "DataFormats/Common/interface/Handle.h" | ||
#include "DataFormats/Math/interface/deltaPhi.h" | ||
|
||
#include "FWCore/Framework/interface/ESHandle.h" | ||
#include "FWCore/Framework/interface/EventSetup.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 "FWCore/Utilities/interface/InputTag.h" | ||
|
||
#include<typeinfo> | ||
|
||
// | ||
// constructors and destructor | ||
// | ||
template<typename T> | ||
HLTDiJetAveEtaFilter<T>::HLTDiJetAveEtaFilter(const edm::ParameterSet& iConfig) : HLTFilter(iConfig), | ||
inputJetTag_ (iConfig.template getParameter< edm::InputTag > ("inputJetTag")), | ||
minPtJet_ (iConfig.template getParameter<double> ("minPtJet")), | ||
minPtAve_ (iConfig.template getParameter<double> ("minPtAve")), | ||
//minPtJet3_ (iConfig.template getParameter<double> ("minPtJet3")), | ||
minDphi_ (iConfig.template getParameter<double> ("minDphi")), | ||
tagEtaMin_ (iConfig.template getParameter<double> ("minTagEta")), | ||
tagEtaMax_ (iConfig.template getParameter<double> ("maxTagEta")), | ||
probeEtaMin_ (iConfig.template getParameter<double> ("minProbeEta")), | ||
probeEtaMax_ (iConfig.template getParameter<double> ("maxProbeEta")), | ||
triggerType_ (iConfig.template getParameter<int> ("triggerType")) | ||
{ | ||
m_theJetToken = consumes<std::vector<T>>(inputJetTag_); | ||
LogDebug("") << "HLTDiJetAveEtaFilter: Input/minPtAve/minDphi/triggerType : " | ||
<< inputJetTag_.encode() << " " | ||
<< minPtAve_ << " " | ||
//<< minPtJet3_ << " " | ||
<< minDphi_ << " " | ||
<< triggerType_; | ||
} | ||
|
||
template<typename T> | ||
HLTDiJetAveEtaFilter<T>::~HLTDiJetAveEtaFilter(){} | ||
|
||
template<typename T> | ||
void | ||
HLTDiJetAveEtaFilter<T>::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { | ||
edm::ParameterSetDescription desc; | ||
makeHLTFilterDescription(desc); | ||
desc.add<edm::InputTag>("inputJetTag",edm::InputTag("hltIterativeCone5CaloJets")); | ||
desc.add<double>("minPtAve",100.0); | ||
desc.add<double>("minPtJet",50.0); | ||
//desc.add<double>("minPtJet3",99999.0); | ||
desc.add<double>("minDphi",-1.0); | ||
desc.add<double>("minTagEta", -1.); | ||
desc.add<double>("maxTagEta", 1.4); | ||
desc.add<double>("minProbeEta", 2.7); | ||
desc.add<double>("maxProbeEta", 5.5); | ||
desc.add<int>("triggerType",trigger::TriggerJet); | ||
descriptions.add(std::string("hlt")+std::string(typeid(HLTDiJetAveEtaFilter<T>).name()),desc); | ||
} | ||
|
||
// ------------ method called to produce the data ------------ | ||
template<typename T> | ||
bool | ||
HLTDiJetAveEtaFilter<T>::hltFilter(edm::Event& iEvent, const edm::EventSetup& iSetup, trigger::TriggerFilterObjectWithRefs & filterproduct) const | ||
{ | ||
using namespace std; | ||
using namespace edm; | ||
using namespace reco; | ||
using namespace trigger; | ||
|
||
typedef vector<T> TCollection; | ||
typedef Ref<TCollection> TRef; | ||
|
||
// The filter object | ||
if (saveTags()) filterproduct.addCollectionTag(inputJetTag_); | ||
|
||
// get hold of collection of objects | ||
Handle<TCollection> objects; | ||
iEvent.getByToken (m_theJetToken,objects); | ||
|
||
int n(0); | ||
|
||
if(objects->size() > 1){ // events with two or more jets | ||
typename TCollection::const_iterator iProbe ( objects->begin() ); | ||
typename TCollection::const_iterator iEnd ( objects->end() ); | ||
for (; iProbe!=iEnd; ++iProbe) { | ||
if (iProbe->pt() < minPtJet_) continue; | ||
|
||
// for easier trigger efficiency evaluation save all probe/tag | ||
// objects passing the minPT/eta criteria (outer loop) | ||
float eta = std::abs(iProbe->eta()); | ||
bool isGood = false; // probe or tag | ||
bool isProbe = false; | ||
if ( eta > probeEtaMin_ && eta < probeEtaMax_ ){ | ||
isGood = true; | ||
isProbe = true; | ||
} | ||
if ( eta > tagEtaMin_ && eta < tagEtaMax_ ){ | ||
isGood = true; | ||
} | ||
if (isGood){ | ||
filterproduct.addObject(triggerType_, TRef(objects,distance(objects->begin(),iProbe))); | ||
} | ||
|
||
if (!isProbe) continue; | ||
|
||
typename TCollection::const_iterator iTag ( objects->begin() ); | ||
for (;iTag != iEnd; ++iTag){ | ||
if (iTag==iProbe) continue; | ||
if (iTag->pt() < minPtJet_) continue; | ||
float eta2 = std::abs(iTag->eta()); | ||
if ( eta2 < tagEtaMin_ || eta2 > tagEtaMax_ ) continue; | ||
double dphi = std::abs(deltaPhi(iProbe->phi(),iTag->phi() )); | ||
if (dphi<minDphi_) { | ||
continue; | ||
} | ||
|
||
double ptAve = (iProbe->pt() + iTag->pt())/2; | ||
if (ptAve<minPtAve_ ) { | ||
continue; | ||
} | ||
++n; | ||
} | ||
} | ||
} // events with two or more jets | ||
// filter decision | ||
bool accept(n>=1); | ||
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