From a786461090a73f356a9e02eac5099e46dff8f8ba Mon Sep 17 00:00:00 2001 From: Tomasz Date: Wed, 17 Sep 2014 12:03:21 +0200 Subject: [PATCH 1/7] New HLTDiJetAveEtaFilter filter --- .../JetMET/interface/HLTDiJetAveEtaFilter.h | 44 ++++++ HLTrigger/JetMET/src/HLTDiJetAveEtaFilter.cc | 126 ++++++++++++++++++ HLTrigger/JetMET/src/SealModule.cc | 6 + 3 files changed, 176 insertions(+) create mode 100644 HLTrigger/JetMET/interface/HLTDiJetAveEtaFilter.h create mode 100644 HLTrigger/JetMET/src/HLTDiJetAveEtaFilter.cc diff --git a/HLTrigger/JetMET/interface/HLTDiJetAveEtaFilter.h b/HLTrigger/JetMET/interface/HLTDiJetAveEtaFilter.h new file mode 100644 index 0000000000000..15b67a286c458 --- /dev/null +++ b/HLTrigger/JetMET/interface/HLTDiJetAveEtaFilter.h @@ -0,0 +1,44 @@ +#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 +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> m_theJetToken; + edm::InputTag inputJetTag_; // input tag identifying jets + double minPtAve_; + //double minPtJet3_; + double minDphi_; + double tagEtaMin_; + double tagEtaMax_; + double probeEtaMin_; + double probeEtaMax_; + int triggerType_; +}; + +#endif //HLTDiJetAveEtaFilter_h diff --git a/HLTrigger/JetMET/src/HLTDiJetAveEtaFilter.cc b/HLTrigger/JetMET/src/HLTDiJetAveEtaFilter.cc new file mode 100644 index 0000000000000..f2f03e6d27cc2 --- /dev/null +++ b/HLTrigger/JetMET/src/HLTDiJetAveEtaFilter.cc @@ -0,0 +1,126 @@ +/** \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 + +// +// constructors and destructor +// +template +HLTDiJetAveEtaFilter::HLTDiJetAveEtaFilter(const edm::ParameterSet& iConfig) : HLTFilter(iConfig), + inputJetTag_ (iConfig.template getParameter< edm::InputTag > ("inputJetTag")), + minPtAve_ (iConfig.template getParameter ("minPtAve")), + //minPtJet3_ (iConfig.template getParameter ("minPtJet3")), + minDphi_ (iConfig.template getParameter ("minDphi")), + tagEtaMin_ (iConfig.template getParameter ("minTagEta")), + tagEtaMax_ (iConfig.template getParameter ("maxTagEta")), + probeEtaMin_ (iConfig.template getParameter ("minProbeEta")), + probeEtaMax_ (iConfig.template getParameter ("maxProbeEta")), + triggerType_ (iConfig.template getParameter ("triggerType")) +{ + m_theJetToken = consumes>(inputJetTag_); + LogDebug("") << "HLTDiJetAveEtaFilter: Input/minPtAve/minPtJet3/minDphi/triggerType : " + << inputJetTag_.encode() << " " + << minPtAve_ << " " + //<< minPtJet3_ << " " + << minDphi_ << " " + << triggerType_; +} + +template +HLTDiJetAveEtaFilter::~HLTDiJetAveEtaFilter(){} + +template +void +HLTDiJetAveEtaFilter::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { + edm::ParameterSetDescription desc; + makeHLTFilterDescription(desc); + desc.add("inputJetTag",edm::InputTag("hltIterativeCone5CaloJets")); + desc.add("minPtAve",100.0); + //desc.add("minPtJet3",99999.0); + desc.add("minDphi",-1.0); + desc.add("minTagEta", -1.); + desc.add("maxTagEta", 1.4); + desc.add("minProbeEta", 2.7); + desc.add("maxProbeEta", 5.5); + desc.add("triggerType",trigger::TriggerJet); + descriptions.add(std::string("hlt")+std::string(typeid(HLTDiJetAveEtaFilter).name()),desc); +} + +// ------------ method called to produce the data ------------ +template +bool +HLTDiJetAveEtaFilter::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 TCollection; + typedef Ref TRef; + + // The filter object + if (saveTags()) filterproduct.addCollectionTag(inputJetTag_); + + // get hold of collection of objects + Handle objects; + iEvent.getByToken (m_theJetToken,objects); + + // look at all candidates, check cuts and add to filter object + int n(0); + + if(objects->size() > 1){ // events with two or more jets + std::map tags; // since eta ranges can overlap + std::map probes; + typename TCollection::const_iterator i ( objects->begin() ); + int cnt = 0; + for (; i<=(objects->begin()+objects->size()); i++) { + float eta = std::abs(i->eta()); + if ( eta > tagEtaMin_ && eta < tagEtaMax_ ){ + tags[cnt] = TRef(objects,distance(objects->begin(),i)); + } + if ( eta > probeEtaMin_ && eta < probeEtaMax_ ){ + probes[cnt] = TRef(objects,distance(objects->begin(),i)); + } + ++cnt; + } + typename std::map::const_iterator iTag = tags.begin(); + typename std::map::const_iterator iTagE = tags.end(); + typename std::map::const_iterator iProbe = probes.begin(); + typename std::map::const_iterator iProbeE = probes.end(); + for(;iTag != iTagE; ++iTag){ + for(;iProbe != iProbeE; ++iProbe){ + if (iTag->first == iProbe->first) continue; // not the same jet + double dphi = std::abs(deltaPhi(iTag->second->phi(),iProbe->second->phi() )); + if (dphisecond->pt(), iProbe->second->pt())/2; + if (ptAvesecond); + filterproduct.addObject(triggerType_, iProbe->second); + ++n; + } + } + } // events with two or more jets + // filter decision + bool accept(n>=1); + return accept; +} diff --git a/HLTrigger/JetMET/src/SealModule.cc b/HLTrigger/JetMET/src/SealModule.cc index a8eef44523654..f555d02505ba0 100644 --- a/HLTrigger/JetMET/src/SealModule.cc +++ b/HLTrigger/JetMET/src/SealModule.cc @@ -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" // @@ -92,6 +95,9 @@ typedef HLTAlphaTFilter< PFJet> HLTAlphaTPFJetFilter; typedef HLTDiJetAveFilter HLTDiCaloJetAveFilter; typedef HLTDiJetAveFilter< PFJet> HLTDiPFJetAveFilter; +typedef HLTDiJetAveEtaFilter HLTDiCaloJetAveEtaFilter; +typedef HLTDiJetAveEtaFilter< PFJet> HLTDiPFJetAveEtaFilter; + typedef HLTJetSortedVBFFilter HLTCaloJetSortedVBFFilter; typedef HLTJetSortedVBFFilter< PFJet> HLTPFJetSortedVBFFilter; From 6c0770d5618026824a35a02a650f490076db5e85 Mon Sep 17 00:00:00 2001 From: Tomasz Date: Tue, 23 Sep 2014 11:53:37 +0200 Subject: [PATCH 2/7] Fixes after testing --- .../JetMET/interface/HLTDiJetAveEtaFilter.h | 1 + HLTrigger/JetMET/src/HLTDiJetAveEtaFilter.cc | 53 +++++++++++++++---- HLTrigger/JetMET/src/SealModule.cc | 3 ++ 3 files changed, 48 insertions(+), 9 deletions(-) diff --git a/HLTrigger/JetMET/interface/HLTDiJetAveEtaFilter.h b/HLTrigger/JetMET/interface/HLTDiJetAveEtaFilter.h index 15b67a286c458..8d489533a2380 100644 --- a/HLTrigger/JetMET/interface/HLTDiJetAveEtaFilter.h +++ b/HLTrigger/JetMET/interface/HLTDiJetAveEtaFilter.h @@ -31,6 +31,7 @@ class HLTDiJetAveEtaFilter : public HLTFilter { private: edm::EDGetTokenT> m_theJetToken; edm::InputTag inputJetTag_; // input tag identifying jets + double minPtJet_; double minPtAve_; //double minPtJet3_; double minDphi_; diff --git a/HLTrigger/JetMET/src/HLTDiJetAveEtaFilter.cc b/HLTrigger/JetMET/src/HLTDiJetAveEtaFilter.cc index f2f03e6d27cc2..c1197dc1a77be 100644 --- a/HLTrigger/JetMET/src/HLTDiJetAveEtaFilter.cc +++ b/HLTrigger/JetMET/src/HLTDiJetAveEtaFilter.cc @@ -27,6 +27,7 @@ template HLTDiJetAveEtaFilter::HLTDiJetAveEtaFilter(const edm::ParameterSet& iConfig) : HLTFilter(iConfig), inputJetTag_ (iConfig.template getParameter< edm::InputTag > ("inputJetTag")), + minPtJet_ (iConfig.template getParameter ("minPtJet")), minPtAve_ (iConfig.template getParameter ("minPtAve")), //minPtJet3_ (iConfig.template getParameter ("minPtJet3")), minDphi_ (iConfig.template getParameter ("minDphi")), @@ -37,7 +38,7 @@ HLTDiJetAveEtaFilter::HLTDiJetAveEtaFilter(const edm::ParameterSet& iConfig) triggerType_ (iConfig.template getParameter ("triggerType")) { m_theJetToken = consumes>(inputJetTag_); - LogDebug("") << "HLTDiJetAveEtaFilter: Input/minPtAve/minPtJet3/minDphi/triggerType : " + LogDebug("") << "HLTDiJetAveEtaFilter: Input/minPtAve/minDphi/triggerType : " << inputJetTag_.encode() << " " << minPtAve_ << " " //<< minPtJet3_ << " " @@ -55,6 +56,7 @@ HLTDiJetAveEtaFilter::fillDescriptions(edm::ConfigurationDescriptions& descri makeHLTFilterDescription(desc); desc.add("inputJetTag",edm::InputTag("hltIterativeCone5CaloJets")); desc.add("minPtAve",100.0); + desc.add("minPtJet",50.0); //desc.add("minPtJet3",99999.0); desc.add("minDphi",-1.0); desc.add("minTagEta", -1.); @@ -88,39 +90,72 @@ HLTDiJetAveEtaFilter::hltFilter(edm::Event& iEvent, const edm::EventSetup& iS // look at all candidates, check cuts and add to filter object int n(0); + //std::cout << "--- " << minPtJet_ << std::endl; if(objects->size() > 1){ // events with two or more jets std::map tags; // since eta ranges can overlap std::map probes; typename TCollection::const_iterator i ( objects->begin() ); + typename TCollection::const_iterator iEnd ( objects->end() ); int cnt = 0; - for (; i<=(objects->begin()+objects->size()); i++) { + for (; i!=iEnd; ++i) { + ++cnt; + + if (i->pt() < minPtJet_) continue; float eta = std::abs(i->eta()); + bool isGood = false; if ( eta > tagEtaMin_ && eta < tagEtaMax_ ){ + //std::cout << "Tag: " << cnt << " " << eta << " " << i->pt() << " " << i->phi() << std::endl; tags[cnt] = TRef(objects,distance(objects->begin(),i)); + isGood = true; } if ( eta > probeEtaMin_ && eta < probeEtaMax_ ){ + //std::cout << "Probe: " << cnt << " " << eta << " " << i->pt() << " " << i->phi() << std::endl; probes[cnt] = TRef(objects,distance(objects->begin(),i)); + isGood = true; + } + if (isGood){ // for easier efficiency evaluation + filterproduct.addObject(triggerType_, TRef(objects,distance(objects->begin(),i))); } - ++cnt; } + if (probes.size() == 0) return false; + typename std::map::const_iterator iTag = tags.begin(); typename std::map::const_iterator iTagE = tags.end(); typename std::map::const_iterator iProbe = probes.begin(); typename std::map::const_iterator iProbeE = probes.end(); + //std::cout <<"Tags: " << tags.size() << std::endl; + //std::cout <<"Probes: " << probes.size() << std::endl; for(;iTag != iTagE; ++iTag){ + iProbe = probes.begin(); + //std::cout << "With tag " << iTag -> first << std::endl; for(;iProbe != iProbeE; ++iProbe){ - if (iTag->first == iProbe->first) continue; // not the same jet + //std::cout << "C " << iTag->first << " " << iProbe->first << std::endl; + + if (iTag->first == iProbe->first) { + //std::cout << "Skip same\n" ; + continue; // not the same jet + } double dphi = std::abs(deltaPhi(iTag->second->phi(),iProbe->second->phi() )); - if (dphisecond->pt(), iProbe->second->pt())/2; - if (ptAvesecond); - filterproduct.addObject(triggerType_, iProbe->second); + if (dphisecond->pt() + iProbe->second->pt())/2; + if (ptAvesecond->eta() << " " << iTag->second->pt() << std::endl; + //std::cout << " Probe: " << iProbe->second->eta() << " " << iProbe->second->pt() << std::endl; + //filterproduct.addObject(triggerType_, iTag->second); + //filterproduct.addObject(triggerType_, iProbe->second); ++n; } } } // events with two or more jets // filter decision bool accept(n>=1); + //std::cout << "ACC: " << accept << std::endl; return accept; } diff --git a/HLTrigger/JetMET/src/SealModule.cc b/HLTrigger/JetMET/src/SealModule.cc index f555d02505ba0..35786ef45e8d7 100644 --- a/HLTrigger/JetMET/src/SealModule.cc +++ b/HLTrigger/JetMET/src/SealModule.cc @@ -200,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); From 53d5146969ff3ab46df896b5e25764313daae275 Mon Sep 17 00:00:00 2001 From: Tomasz Date: Wed, 24 Sep 2014 14:47:47 +0200 Subject: [PATCH 3/7] Clean out couts --- HLTrigger/JetMET/src/HLTDiJetAveEtaFilter.cc | 16 +--------------- 1 file changed, 1 insertion(+), 15 deletions(-) diff --git a/HLTrigger/JetMET/src/HLTDiJetAveEtaFilter.cc b/HLTrigger/JetMET/src/HLTDiJetAveEtaFilter.cc index c1197dc1a77be..73651d951e7f6 100644 --- a/HLTrigger/JetMET/src/HLTDiJetAveEtaFilter.cc +++ b/HLTrigger/JetMET/src/HLTDiJetAveEtaFilter.cc @@ -90,7 +90,6 @@ HLTDiJetAveEtaFilter::hltFilter(edm::Event& iEvent, const edm::EventSetup& iS // look at all candidates, check cuts and add to filter object int n(0); - //std::cout << "--- " << minPtJet_ << std::endl; if(objects->size() > 1){ // events with two or more jets std::map tags; // since eta ranges can overlap std::map probes; @@ -104,12 +103,10 @@ HLTDiJetAveEtaFilter::hltFilter(edm::Event& iEvent, const edm::EventSetup& iS float eta = std::abs(i->eta()); bool isGood = false; if ( eta > tagEtaMin_ && eta < tagEtaMax_ ){ - //std::cout << "Tag: " << cnt << " " << eta << " " << i->pt() << " " << i->phi() << std::endl; tags[cnt] = TRef(objects,distance(objects->begin(),i)); isGood = true; } if ( eta > probeEtaMin_ && eta < probeEtaMax_ ){ - //std::cout << "Probe: " << cnt << " " << eta << " " << i->pt() << " " << i->phi() << std::endl; probes[cnt] = TRef(objects,distance(objects->begin(),i)); isGood = true; } @@ -123,31 +120,21 @@ HLTDiJetAveEtaFilter::hltFilter(edm::Event& iEvent, const edm::EventSetup& iS typename std::map::const_iterator iTagE = tags.end(); typename std::map::const_iterator iProbe = probes.begin(); typename std::map::const_iterator iProbeE = probes.end(); - //std::cout <<"Tags: " << tags.size() << std::endl; - //std::cout <<"Probes: " << probes.size() << std::endl; for(;iTag != iTagE; ++iTag){ iProbe = probes.begin(); - //std::cout << "With tag " << iTag -> first << std::endl; for(;iProbe != iProbeE; ++iProbe){ - //std::cout << "C " << iTag->first << " " << iProbe->first << std::endl; - if (iTag->first == iProbe->first) { - //std::cout << "Skip same\n" ; continue; // not the same jet } double dphi = std::abs(deltaPhi(iTag->second->phi(),iProbe->second->phi() )); if (dphisecond->pt() + iProbe->second->pt())/2; if (ptAvesecond->eta() << " " << iTag->second->pt() << std::endl; - //std::cout << " Probe: " << iProbe->second->eta() << " " << iProbe->second->pt() << std::endl; + // moved into first loop //filterproduct.addObject(triggerType_, iTag->second); //filterproduct.addObject(triggerType_, iProbe->second); ++n; @@ -156,6 +143,5 @@ HLTDiJetAveEtaFilter::hltFilter(edm::Event& iEvent, const edm::EventSetup& iS } // events with two or more jets // filter decision bool accept(n>=1); - //std::cout << "ACC: " << accept << std::endl; return accept; } From 11aa587a4fa641ea0a34f747204a240db1f62a02 Mon Sep 17 00:00:00 2001 From: Tomasz Date: Wed, 24 Sep 2014 15:31:38 +0200 Subject: [PATCH 4/7] Rewrite in more efficienct way --- HLTrigger/JetMET/src/HLTDiJetAveEtaFilter.cc | 52 ++++++++------------ 1 file changed, 20 insertions(+), 32 deletions(-) diff --git a/HLTrigger/JetMET/src/HLTDiJetAveEtaFilter.cc b/HLTrigger/JetMET/src/HLTDiJetAveEtaFilter.cc index 73651d951e7f6..b9d0c64133c1f 100644 --- a/HLTrigger/JetMET/src/HLTDiJetAveEtaFilter.cc +++ b/HLTrigger/JetMET/src/HLTDiJetAveEtaFilter.cc @@ -87,56 +87,44 @@ HLTDiJetAveEtaFilter::hltFilter(edm::Event& iEvent, const edm::EventSetup& iS Handle objects; iEvent.getByToken (m_theJetToken,objects); - // look at all candidates, check cuts and add to filter object int n(0); if(objects->size() > 1){ // events with two or more jets - std::map tags; // since eta ranges can overlap - std::map probes; - typename TCollection::const_iterator i ( objects->begin() ); + typename TCollection::const_iterator iTag ( objects->begin() ); typename TCollection::const_iterator iEnd ( objects->end() ); - int cnt = 0; - for (; i!=iEnd; ++i) { - ++cnt; + for (; iTag!=iEnd; ++iTag) { + if (iTag->pt() < minPtJet_) continue; - if (i->pt() < minPtJet_) continue; - float eta = std::abs(i->eta()); - bool isGood = false; + // for easier trigger efficiency evaluation save all tag/probe + // objects passing the minPT/eta criteria (outer loop) + float eta = std::abs(iTag->eta()); + bool isGood = false; // tag or probe + bool isTag = false; if ( eta > tagEtaMin_ && eta < tagEtaMax_ ){ - tags[cnt] = TRef(objects,distance(objects->begin(),i)); isGood = true; + isTag = true; } if ( eta > probeEtaMin_ && eta < probeEtaMax_ ){ - probes[cnt] = TRef(objects,distance(objects->begin(),i)); isGood = true; } - if (isGood){ // for easier efficiency evaluation - filterproduct.addObject(triggerType_, TRef(objects,distance(objects->begin(),i))); + if (isGood){ + filterproduct.addObject(triggerType_, TRef(objects,distance(objects->begin(),iTag))); } - } - if (probes.size() == 0) return false; - - typename std::map::const_iterator iTag = tags.begin(); - typename std::map::const_iterator iTagE = tags.end(); - typename std::map::const_iterator iProbe = probes.begin(); - typename std::map::const_iterator iProbeE = probes.end(); - for(;iTag != iTagE; ++iTag){ - iProbe = probes.begin(); - for(;iProbe != iProbeE; ++iProbe){ - if (iTag->first == iProbe->first) { - continue; // not the same jet - } - double dphi = std::abs(deltaPhi(iTag->second->phi(),iProbe->second->phi() )); + + if (!isTag) continue; + + typename TCollection::const_iterator iProbe ( iTag ); + ++iProbe; + for (;iProbe != iEnd; ++iProbe){ + double dphi = std::abs(deltaPhi(iTag->phi(),iProbe->phi() )); if (dphisecond->pt() + iProbe->second->pt())/2; + + double ptAve = (iTag->pt() + iProbe->pt())/2; if (ptAvesecond); - //filterproduct.addObject(triggerType_, iProbe->second); ++n; } } From 2db75f5b41a909efcf77ac82c03479d0f6ec82db Mon Sep 17 00:00:00 2001 From: Tomasz Date: Wed, 24 Sep 2014 15:50:28 +0200 Subject: [PATCH 5/7] Add missing pt and eta checks for probe jet --- HLTrigger/JetMET/src/HLTDiJetAveEtaFilter.cc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/HLTrigger/JetMET/src/HLTDiJetAveEtaFilter.cc b/HLTrigger/JetMET/src/HLTDiJetAveEtaFilter.cc index b9d0c64133c1f..303494a1d0bc0 100644 --- a/HLTrigger/JetMET/src/HLTDiJetAveEtaFilter.cc +++ b/HLTrigger/JetMET/src/HLTDiJetAveEtaFilter.cc @@ -116,6 +116,9 @@ HLTDiJetAveEtaFilter::hltFilter(edm::Event& iEvent, const edm::EventSetup& iS typename TCollection::const_iterator iProbe ( iTag ); ++iProbe; for (;iProbe != iEnd; ++iProbe){ + if (iProbe->pt() < minPtJet_) continue; + float eta2 = std::abs(iProbe->eta()); + if ( eta2 < probeEtaMin_ || eta2 > probeEtaMax_ ) continue; double dphi = std::abs(deltaPhi(iTag->phi(),iProbe->phi() )); if (dphi Date: Thu, 25 Sep 2014 08:49:25 +0200 Subject: [PATCH 6/7] Fix inner loop --- HLTrigger/JetMET/src/HLTDiJetAveEtaFilter.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/HLTrigger/JetMET/src/HLTDiJetAveEtaFilter.cc b/HLTrigger/JetMET/src/HLTDiJetAveEtaFilter.cc index 303494a1d0bc0..aaf0357418edd 100644 --- a/HLTrigger/JetMET/src/HLTDiJetAveEtaFilter.cc +++ b/HLTrigger/JetMET/src/HLTDiJetAveEtaFilter.cc @@ -113,9 +113,9 @@ HLTDiJetAveEtaFilter::hltFilter(edm::Event& iEvent, const edm::EventSetup& iS if (!isTag) continue; - typename TCollection::const_iterator iProbe ( iTag ); - ++iProbe; + typename TCollection::const_iterator iProbe ( objects->begin() ); for (;iProbe != iEnd; ++iProbe){ + if (iProbe==iTag) continue; if (iProbe->pt() < minPtJet_) continue; float eta2 = std::abs(iProbe->eta()); if ( eta2 < probeEtaMin_ || eta2 > probeEtaMax_ ) continue; From 9e90a072b2fcdcbff87fa91f61ec494a06cf38a1 Mon Sep 17 00:00:00 2001 From: Tomasz Date: Thu, 25 Sep 2014 10:23:13 +0200 Subject: [PATCH 7/7] Switch tag/probe loops --- HLTrigger/JetMET/src/HLTDiJetAveEtaFilter.cc | 40 ++++++++++---------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/HLTrigger/JetMET/src/HLTDiJetAveEtaFilter.cc b/HLTrigger/JetMET/src/HLTDiJetAveEtaFilter.cc index aaf0357418edd..b9dfa8d15e58e 100644 --- a/HLTrigger/JetMET/src/HLTDiJetAveEtaFilter.cc +++ b/HLTrigger/JetMET/src/HLTDiJetAveEtaFilter.cc @@ -90,41 +90,41 @@ HLTDiJetAveEtaFilter::hltFilter(edm::Event& iEvent, const edm::EventSetup& iS int n(0); if(objects->size() > 1){ // events with two or more jets - typename TCollection::const_iterator iTag ( objects->begin() ); + typename TCollection::const_iterator iProbe ( objects->begin() ); typename TCollection::const_iterator iEnd ( objects->end() ); - for (; iTag!=iEnd; ++iTag) { - if (iTag->pt() < minPtJet_) continue; + for (; iProbe!=iEnd; ++iProbe) { + if (iProbe->pt() < minPtJet_) continue; - // for easier trigger efficiency evaluation save all tag/probe + // for easier trigger efficiency evaluation save all probe/tag // objects passing the minPT/eta criteria (outer loop) - float eta = std::abs(iTag->eta()); - bool isGood = false; // tag or probe - bool isTag = false; - if ( eta > tagEtaMin_ && eta < tagEtaMax_ ){ + float eta = std::abs(iProbe->eta()); + bool isGood = false; // probe or tag + bool isProbe = false; + if ( eta > probeEtaMin_ && eta < probeEtaMax_ ){ isGood = true; - isTag = true; + isProbe = true; } - if ( eta > probeEtaMin_ && eta < probeEtaMax_ ){ + if ( eta > tagEtaMin_ && eta < tagEtaMax_ ){ isGood = true; } if (isGood){ - filterproduct.addObject(triggerType_, TRef(objects,distance(objects->begin(),iTag))); + filterproduct.addObject(triggerType_, TRef(objects,distance(objects->begin(),iProbe))); } - if (!isTag) continue; + if (!isProbe) continue; - typename TCollection::const_iterator iProbe ( objects->begin() ); - for (;iProbe != iEnd; ++iProbe){ - if (iProbe==iTag) continue; - if (iProbe->pt() < minPtJet_) continue; - float eta2 = std::abs(iProbe->eta()); - if ( eta2 < probeEtaMin_ || eta2 > probeEtaMax_ ) continue; - double dphi = std::abs(deltaPhi(iTag->phi(),iProbe->phi() )); + 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 (dphipt() + iProbe->pt())/2; + double ptAve = (iProbe->pt() + iTag->pt())/2; if (ptAve