Skip to content

Commit

Permalink
Merge pull request cms-sw#5527 from fruboes/HLTPFJetAveFilterWithEtaR…
Browse files Browse the repository at this point in the history
…anges

New HLT jet ptave filter allowing to specify eta ranges for tagging/probeing jet
  • Loading branch information
ktf committed Sep 25, 2014
2 parents 1cb5987 + 9e90a07 commit 5f5fa1b
Show file tree
Hide file tree
Showing 3 changed files with 192 additions and 0 deletions.
45 changes: 45 additions & 0 deletions HLTrigger/JetMET/interface/HLTDiJetAveEtaFilter.h
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
138 changes: 138 additions & 0 deletions HLTrigger/JetMET/src/HLTDiJetAveEtaFilter.cc
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;
}
9 changes: 9 additions & 0 deletions HLTrigger/JetMET/src/SealModule.cc
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@
#include "HLTrigger/JetMET/interface/HLTDiJetAveFilter.h"
#include "HLTrigger/JetMET/src/HLTDiJetAveFilter.cc"
//
#include "HLTrigger/JetMET/interface/HLTDiJetAveEtaFilter.h"
#include "HLTrigger/JetMET/src/HLTDiJetAveEtaFilter.cc"
//
#include "HLTrigger/JetMET/interface/HLTJetSortedVBFFilter.h"
#include "HLTrigger/JetMET/src/HLTJetSortedVBFFilter.cc"
//
Expand Down Expand Up @@ -92,6 +95,9 @@ typedef HLTAlphaTFilter< PFJet> HLTAlphaTPFJetFilter;
typedef HLTDiJetAveFilter<CaloJet> HLTDiCaloJetAveFilter;
typedef HLTDiJetAveFilter< PFJet> HLTDiPFJetAveFilter;

typedef HLTDiJetAveEtaFilter<CaloJet> HLTDiCaloJetAveEtaFilter;
typedef HLTDiJetAveEtaFilter< PFJet> HLTDiPFJetAveEtaFilter;

typedef HLTJetSortedVBFFilter<CaloJet> HLTCaloJetSortedVBFFilter;
typedef HLTJetSortedVBFFilter< PFJet> HLTPFJetSortedVBFFilter;

Expand Down Expand Up @@ -194,6 +200,9 @@ DEFINE_FWK_MODULE(HLTPFJetsCleanedFromLeadingLeptons);
DEFINE_FWK_MODULE(HLTDiCaloJetAveFilter);
DEFINE_FWK_MODULE(HLTDiPFJetAveFilter);

DEFINE_FWK_MODULE(HLTDiCaloJetAveEtaFilter);
DEFINE_FWK_MODULE(HLTDiPFJetAveEtaFilter);

DEFINE_FWK_MODULE(HLTCaloJetL1MatchProducer);
DEFINE_FWK_MODULE(HLTPFJetL1MatchProducer);

Expand Down

0 comments on commit 5f5fa1b

Please sign in to comment.