diff --git a/HLTrigger/Egamma/plugins/BuildFile.xml b/HLTrigger/Egamma/plugins/BuildFile.xml index dd7398eaed809..ecf72b45c80c8 100644 --- a/HLTrigger/Egamma/plugins/BuildFile.xml +++ b/HLTrigger/Egamma/plugins/BuildFile.xml @@ -12,6 +12,7 @@ + diff --git a/HLTrigger/Egamma/plugins/HLTDisplacedEgammaFilter.cc b/HLTrigger/Egamma/plugins/HLTDisplacedEgammaFilter.cc index c68819dd294e7..9c637465d46c8 100644 --- a/HLTrigger/Egamma/plugins/HLTDisplacedEgammaFilter.cc +++ b/HLTrigger/Egamma/plugins/HLTDisplacedEgammaFilter.cc @@ -4,18 +4,16 @@ * \author Monica Vazquez Acosta (CERN) * */ +#include #include "HLTDisplacedEgammaFilter.h" #include "DataFormats/Common/interface/Handle.h" +#include "DataFormats/Math/interface/deltaR.h" +#include "DataFormats/RecoCandidate/interface/RecoEcalCandidate.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" #include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h" -#include "DataFormats/RecoCandidate/interface/RecoEcalCandidate.h" #include "RecoEcal/EgammaCoreTools/interface/EcalClusterTools.h" -#include "DataFormats/Math/interface/LorentzVector.h" -// -// constructors and destructor -// HLTDisplacedEgammaFilter::HLTDisplacedEgammaFilter(const edm::ParameterSet& iConfig) : HLTFilter(iConfig) { inputTag_ = iConfig.getParameter("inputTag"); ncandcut_ = iConfig.getParameter("ncandcut"); @@ -23,7 +21,11 @@ HLTDisplacedEgammaFilter::HLTDisplacedEgammaFilter(const edm::ParameterSet& iCon inputTrk = iConfig.getParameter("inputTrack"); trkPtCut = iConfig.getParameter("trackPtCut"); - trkdRCut = iConfig.getParameter("trackdRCut"); + + // track dR^2 threshold with sign + auto const trkDrCut = iConfig.getParameter("trackdRCut"); + trkDr2Cut = trkDrCut * std::abs(trkDrCut); + maxTrkCut = iConfig.getParameter("maxTrackCut"); rechitsEB = iConfig.getParameter("RecHitsEB"); @@ -41,13 +43,12 @@ HLTDisplacedEgammaFilter::HLTDisplacedEgammaFilter(const edm::ParameterSet& iCon inputToken_ = consumes(inputTag_); rechitsEBToken_ = consumes(rechitsEB); rechitsEEToken_ = consumes(rechitsEE); + if (useTrackVeto) { inputTrkToken_ = consumes(inputTrk); } } -HLTDisplacedEgammaFilter::~HLTDisplacedEgammaFilter() = default; - void HLTDisplacedEgammaFilter::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { edm::ParameterSetDescription desc; makeHLTFilterDescription(desc); @@ -139,9 +140,8 @@ bool HLTDisplacedEgammaFilter::hltFilter(edm::Event& iEvent, for (auto const& it : *tracks) { if (it.pt() < trkPtCut) continue; - LorentzVector trkP4(it.px(), it.py(), it.pz(), it.p()); - double dR = ROOT::Math::VectorUtil::DeltaR(trkP4, ref->p4()); - if (dR < trkdRCut) + auto const dR2 = reco::deltaR2(it.eta(), it.phi(), ref->eta(), ref->phi()); + if (dR2 < trkDr2Cut) nTrk++; if (nTrk > maxTrkCut) break; @@ -156,9 +156,7 @@ bool HLTDisplacedEgammaFilter::hltFilter(edm::Event& iEvent, } // filter decision - bool accept(n >= ncandcut_); - - return accept; + return (n >= ncandcut_); } // declare this class as a framework plugin diff --git a/HLTrigger/Egamma/plugins/HLTDisplacedEgammaFilter.h b/HLTrigger/Egamma/plugins/HLTDisplacedEgammaFilter.h index d12f90d1a0eb7..661d9f4cf7023 100644 --- a/HLTrigger/Egamma/plugins/HLTDisplacedEgammaFilter.h +++ b/HLTrigger/Egamma/plugins/HLTDisplacedEgammaFilter.h @@ -1,5 +1,5 @@ -#ifndef HLTDisplacedEgammaFilter_h -#define HLTDisplacedEgammaFilter_h +#ifndef HLTrigger_Egamma_HLTDisplacedEgammaFilter_h +#define HLTrigger_Egamma_HLTDisplacedEgammaFilter_h /** \class HLTDisplacedEgammaFilter * @@ -7,24 +7,19 @@ * */ -#include "HLTrigger/HLTcore/interface/HLTFilter.h" - #include "DataFormats/HLTReco/interface/TriggerFilterObjectWithRefs.h" #include "DataFormats/EcalRecHit/interface/EcalRecHitCollections.h" #include "DataFormats/TrackReco/interface/Track.h" #include "DataFormats/TrackReco/interface/TrackFwd.h" - -// -// class decleration -// -typedef math::XYZTLorentzVector LorentzVector; -#include +#include "HLTrigger/HLTcore/interface/HLTFilter.h" class HLTDisplacedEgammaFilter : public HLTFilter { public: explicit HLTDisplacedEgammaFilter(const edm::ParameterSet&); - ~HLTDisplacedEgammaFilter() override; + ~HLTDisplacedEgammaFilter() override = default; + static void fillDescriptions(edm::ConfigurationDescriptions& descriptions); + bool hltFilter(edm::Event&, const edm::EventSetup&, trigger::TriggerFilterObjectWithRefs& filterproduct) const override; @@ -51,8 +46,8 @@ class HLTDisplacedEgammaFilter : public HLTFilter { edm::InputTag inputTrk; edm::EDGetTokenT inputTrkToken_; double trkPtCut; - double trkdRCut; + double trkDr2Cut; int maxTrkCut; }; -#endif //HLTDisplacedEgammaFilter_h +#endif diff --git a/HLTrigger/HLTfilters/plugins/BuildFile.xml b/HLTrigger/HLTfilters/plugins/BuildFile.xml index cb29742c3a0b3..323d6b58e4f1c 100644 --- a/HLTrigger/HLTfilters/plugins/BuildFile.xml +++ b/HLTrigger/HLTfilters/plugins/BuildFile.xml @@ -11,6 +11,7 @@ + diff --git a/HLTrigger/HLTfilters/plugins/HLTDoublet.cc b/HLTrigger/HLTfilters/plugins/HLTDoublet.cc index 21493e81f98b4..e9abd468b7b8a 100644 --- a/HLTrigger/HLTfilters/plugins/HLTDoublet.cc +++ b/HLTrigger/HLTfilters/plugins/HLTDoublet.cc @@ -6,25 +6,20 @@ * \author Martin Grunewald * */ +#include -#include "FWCore/ParameterSet/interface/ParameterSet.h" -#include "HLTDoublet.h" - +#include "DataFormats/Candidate/interface/Particle.h" #include "DataFormats/Common/interface/Handle.h" - #include "DataFormats/Common/interface/Ref.h" #include "DataFormats/HLTReco/interface/TriggerFilterObjectWithRefs.h" - -#include "DataFormats/Candidate/interface/Particle.h" - +#include "DataFormats/Math/interface/deltaPhi.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" - +#include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "FWCore/ParameterSet/interface/ParameterSetDescription.h" #include "HLTrigger/HLTcore/interface/defaultModuleLabel.h" -#include +#include "HLTDoublet.h" -// -// constructors and destructor -// template HLTDoublet::HLTDoublet(const edm::ParameterSet& iConfig) : HLTFilter(iConfig), @@ -36,36 +31,40 @@ HLTDoublet::HLTDoublet(const edm::ParameterSet& iConfig) inputToken2_(consumes(inputTag2_)), triggerType1_(iConfig.template getParameter("triggerType1")), triggerType2_(iConfig.template getParameter("triggerType2")), - min_Dphi_(iConfig.template getParameter("MinDphi")), - max_Dphi_(iConfig.template getParameter("MaxDphi")), min_Deta_(iConfig.template getParameter("MinDeta")), max_Deta_(iConfig.template getParameter("MaxDeta")), - min_Minv_(iConfig.template getParameter("MinMinv")), - max_Minv_(iConfig.template getParameter("MaxMinv")), - min_DelR_(iConfig.template getParameter("MinDelR")), - max_DelR_(iConfig.template getParameter("MaxDelR")), + min_Dphi_(iConfig.template getParameter("MinDphi")), + max_Dphi_(iConfig.template getParameter("MaxDphi")), + // min Delta-R^2 threshold with sign + min_DelR2_(iConfig.template getParameter("MinDelR") * + std::abs(iConfig.template getParameter("MinDelR"))), + // max Delta-R^2 threshold with sign + max_DelR2_(iConfig.template getParameter("MaxDelR") * + std::abs(iConfig.template getParameter("MaxDelR"))), min_Pt_(iConfig.template getParameter("MinPt")), max_Pt_(iConfig.template getParameter("MaxPt")), + min_Minv_(iConfig.template getParameter("MinMinv")), + max_Minv_(iConfig.template getParameter("MaxMinv")), min_N_(iConfig.template getParameter("MinN")), same_(inputTag1_.encode() == inputTag2_.encode()), // same collections to be compared? - cutdphi_(min_Dphi_ <= max_Dphi_), // cut active? cutdeta_(min_Deta_ <= max_Deta_), // cut active? - cutminv_(min_Minv_ <= max_Minv_), // cut active? - cutdelr_(min_DelR_ <= max_DelR_), // cut active? - cutpt_(min_Pt_ <= max_Pt_) // cut active? + cutdphi_(min_Dphi_ <= max_Dphi_), // cut active? + cutdelr2_(min_DelR2_ <= max_DelR2_), // cut active? + cutpt_(min_Pt_ <= max_Pt_), // cut active? + cutminv_(min_Minv_ <= max_Minv_) // cut active? { - LogDebug("") << "InputTags and cuts : " << inputTag1_.encode() << " " << inputTag2_.encode() << triggerType1_ << " " - << triggerType2_ << " Dphi [" << min_Dphi_ << " " << max_Dphi_ << "]" - << " Deta [" << min_Deta_ << " " << max_Deta_ << "]" - << " Minv [" << min_Minv_ << " " << max_Minv_ << "]" - << " DelR [" << min_DelR_ << " " << max_DelR_ << "]" - << " Pt [" << min_Pt_ << " " << max_Pt_ << "]" - << " MinN =" << min_N_ << " same/dphi/deta/minv/delr/pt " << same_ << cutdphi_ << cutdeta_ << cutminv_ - << cutdelr_ << cutpt_; + LogDebug("HLTDoublet") << "InputTags and cuts:\n inputTag1=" << inputTag1_.encode() + << " inputTag2=" << inputTag2_.encode() << " triggerType1=" << triggerType1_ + << " triggerType2=" << triggerType2_ << "\n Deta [" << min_Deta_ << ", " << max_Deta_ << "]" + << " Dphi [" << min_Dphi_ << ", " << max_Dphi_ << "]" + << " DelR2 [" << min_DelR2_ << ", " << max_DelR2_ << "]" + << " Pt [" << min_Pt_ << ", " << max_Pt_ << "]" + << " Minv [" << min_Minv_ << ", " << max_Minv_ << "]" + << " MinN=" << min_N_ << "\n same=" << same_ << " cut_deta=" << cutdeta_ + << " cutdphi=" << cutdphi_ << " cut_delr2=" << cutdelr2_ << " cut_pt=" << cutpt_ + << " cut_minv=" << cutminv_; } -template -HLTDoublet::~HLTDoublet() = default; template void HLTDoublet::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { edm::ParameterSetDescription desc; @@ -78,16 +77,16 @@ void HLTDoublet::fillDescriptions(edm::ConfigurationDescriptions& descri desc.add("inputTag2", edm::InputTag("hltFiltered22")); desc.add("triggerType1", 0); desc.add("triggerType2", 0); - desc.add("MinDphi", +1.0); - desc.add("MaxDphi", -1.0); desc.add("MinDeta", +1.0); desc.add("MaxDeta", -1.0); - desc.add("MinMinv", +1.0); - desc.add("MaxMinv", -1.0); + desc.add("MinDphi", +1.0); + desc.add("MaxDphi", -1.0); desc.add("MinDelR", +1.0); desc.add("MaxDelR", -1.0); desc.add("MinPt", +1.0); desc.add("MaxPt", -1.0); + desc.add("MinMinv", +1.0); + desc.add("MaxMinv", -1.0); desc.add("MinN", 1); descriptions.add(defaultModuleLabel>(), desc); } @@ -112,7 +111,7 @@ bool HLTDoublet::hltFilter(edm::Event& iEvent, bool accept(false); - LogVerbatim("HLTDoublet") << " XXX " << moduleLabel() << " 0 " << std::endl; + LogVerbatim("HLTDoublet") << " XXX " << moduleLabel() << " 0 "; std::vector coll1; std::vector coll2; @@ -129,8 +128,7 @@ bool HLTDoublet::hltFilter(edm::Event& iEvent, InputTag tagOld; for (unsigned int i = 0; i < originTag1_.size(); ++i) { filterproduct.addCollectionTag(originTag1_[i]); - LogVerbatim("HLTDoublet") << " XXX " << moduleLabel() << " 1a/" << i << " " << originTag1_[i].encode() - << std::endl; + LogVerbatim("HLTDoublet") << " XXX " << moduleLabel() << " 1a/" << i << " " << originTag1_[i].encode(); } tagOld = InputTag(); for (size_type i1 = 0; i1 != n1; ++i1) { @@ -143,13 +141,12 @@ bool HLTDoublet::hltFilter(edm::Event& iEvent, if (tagOld.encode() != tagNew.encode()) { filterproduct.addCollectionTag(tagNew); tagOld = tagNew; - LogVerbatim("HLTDoublet") << " XXX " << moduleLabel() << " 1b " << tagNew.encode() << std::endl; + LogVerbatim("HLTDoublet") << " XXX " << moduleLabel() << " 1b " << tagNew.encode(); } } for (unsigned int i = 0; i < originTag2_.size(); ++i) { filterproduct.addCollectionTag(originTag2_[i]); - LogVerbatim("HLTDoublet") << " XXX " << moduleLabel() << " 2a/" << i << " " << originTag2_[i].encode() - << std::endl; + LogVerbatim("HLTDoublet") << " XXX " << moduleLabel() << " 2a/" << i << " " << originTag2_[i].encode(); } tagOld = InputTag(); for (size_type i2 = 0; i2 != n2; ++i2) { @@ -162,7 +159,7 @@ bool HLTDoublet::hltFilter(edm::Event& iEvent, if (tagOld.encode() != tagNew.encode()) { filterproduct.addCollectionTag(tagNew); tagOld = tagNew; - LogVerbatim("HLTDoublet") << " XXX " << moduleLabel() << " 2b " << tagNew.encode() << std::endl; + LogVerbatim("HLTDoublet") << " XXX " << moduleLabel() << " 2b " << tagNew.encode(); } } } @@ -182,29 +179,36 @@ bool HLTDoublet::hltFilter(edm::Event& iEvent, r2 = coll2[i2]; p2 = r2->p4(); - double Dphi(std::abs(p1.phi() - p2.phi())); - if (Dphi > M_PI) - Dphi = 2.0 * M_PI - Dphi; + if (cutdeta_ or cutdphi_ or cutdelr2_) { + double const Deta = std::abs(p1.eta() - p2.eta()); + if (cutdeta_ and (min_Deta_ > Deta or Deta > max_Deta_)) + continue; - double Deta(std::abs(p1.eta() - p2.eta())); + double const Dphi = std::abs(reco::deltaPhi(p1.phi(), p2.phi())); + if (cutdphi_ and (min_Dphi_ > Dphi or Dphi > max_Dphi_)) + continue; - p = p1 + p2; - double Minv(std::abs(p.mass())); - double Pt(p.pt()); - - double DelR(sqrt(Dphi * Dphi + Deta * Deta)); - - if (((!cutdphi_) || ((min_Dphi_ <= Dphi) && (Dphi <= max_Dphi_))) && - ((!cutdeta_) || ((min_Deta_ <= Deta) && (Deta <= max_Deta_))) && - ((!cutminv_) || ((min_Minv_ <= Minv) && (Minv <= max_Minv_))) && - ((!cutdelr_) || ((min_DelR_ <= DelR) && (DelR <= max_DelR_))) && - ((!cutpt_) || ((min_Pt_ <= Pt) && (Pt <= max_Pt_)))) { - n++; - filterproduct.addObject(triggerType1_, r1); - filterproduct.addObject(triggerType2_, r2); + double const DelR2 = Deta * Deta + Dphi * Dphi; + if (cutdelr2_ and (min_DelR2_ > DelR2 or DelR2 > max_DelR2_)) + continue; } + + p = p1 + p2; + + double const Pt = p.pt(); + if (cutpt_ and (min_Pt_ > Pt or Pt > max_Pt_)) + continue; + + double const Minv = std::abs(p.mass()); + if (cutminv_ and (min_Minv_ > Minv or Minv > max_Minv_)) + continue; + + n++; + filterproduct.addObject(triggerType1_, r1); + filterproduct.addObject(triggerType2_, r2); } } + // filter decision accept = (n >= min_N_); } diff --git a/HLTrigger/HLTfilters/plugins/HLTDoublet.h b/HLTrigger/HLTfilters/plugins/HLTDoublet.h index 8c9d84378a745..e360596f6dbaf 100644 --- a/HLTrigger/HLTfilters/plugins/HLTDoublet.h +++ b/HLTrigger/HLTfilters/plugins/HLTDoublet.h @@ -1,5 +1,5 @@ -#ifndef HLTDoublet_h -#define HLTDoublet_h +#ifndef HLTrigger_HLTfilters_HLTDoublet_h +#define HLTrigger_HLTfilters_HLTDoublet_h /** \class HLTDoublet * @@ -19,28 +19,35 @@ #include "DataFormats/Common/interface/Ref.h" #include "HLTrigger/HLTcore/interface/HLTFilter.h" -#include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h" -#include + #include + +namespace edm { + class ConfigurationDescriptions; +} + namespace trigger { class TriggerFilterObjectWithRefs; } -// -// class declaration -// - template class HLTDoublet : public HLTFilter { public: explicit HLTDoublet(const edm::ParameterSet&); - ~HLTDoublet() override; + ~HLTDoublet() override = default; + static void fillDescriptions(edm::ConfigurationDescriptions& descriptions); + bool hltFilter(edm::Event&, const edm::EventSetup&, trigger::TriggerFilterObjectWithRefs& filterproduct) const override; private: + typedef std::vector T1Collection; + typedef edm::Ref T1Ref; + typedef std::vector T2Collection; + typedef edm::Ref T2Ref; + // configuration const std::vector originTag1_; // input tag identifying originals 1st product const std::vector originTag2_; // input tag identifying originals 2nd product @@ -50,22 +57,18 @@ class HLTDoublet : public HLTFilter { const edm::EDGetTokenT inputToken2_; const int triggerType1_; const int triggerType2_; - const double min_Dphi_, max_Dphi_; // Delta phi window - const double min_Deta_, max_Deta_; // Delta eta window - const double min_Minv_, max_Minv_; // Minv(1,2) window - const double min_DelR_, max_DelR_; // Delta R window - const double min_Pt_, max_Pt_; // Pt(1,2) window - const int min_N_; // number of pairs passing cuts required + const double min_Deta_, max_Deta_; // Delta eta window + const double min_Dphi_, max_Dphi_; // Delta phi window + const double min_DelR2_, max_DelR2_; // Delta R^2 window + const double min_Pt_, max_Pt_; // Pt(1,2) window + const double min_Minv_, max_Minv_; // Minv(1,2) window + const int min_N_; // number of pairs passing cuts required // calculated from configuration in c'tor - const bool same_; // 1st and 2nd product are one and the same - const bool cutdphi_, cutdeta_, cutminv_, cutdelr_, cutpt_; // cuts are on=true or off=false - - // - typedef std::vector T1Collection; - typedef edm::Ref T1Ref; - typedef std::vector T2Collection; - typedef edm::Ref T2Ref; + // 1st and 2nd product are one and the same + const bool same_; + // cuts are on=true or off=false + const bool cutdeta_, cutdphi_, cutdelr2_, cutpt_, cutminv_; }; -#endif //HLTDoublet_h +#endif // HLTrigger_HLTfilters_HLTDoublet_h diff --git a/HLTrigger/JetMET/BuildFile.xml b/HLTrigger/JetMET/BuildFile.xml index 585433e4dd13b..b8859874a2e11 100644 --- a/HLTrigger/JetMET/BuildFile.xml +++ b/HLTrigger/JetMET/BuildFile.xml @@ -1,3 +1,4 @@ + diff --git a/HLTrigger/JetMET/interface/HLTCATopTagFilter.h b/HLTrigger/JetMET/interface/HLTCATopTagFilter.h index a98aaff561baa..5c45372e403f2 100644 --- a/HLTrigger/JetMET/interface/HLTCATopTagFilter.h +++ b/HLTrigger/JetMET/interface/HLTCATopTagFilter.h @@ -16,8 +16,6 @@ #include "DataFormats/Math/interface/deltaR.h" #include "DataFormats/JetReco/interface/BasicJet.h" #include "DataFormats/Candidate/interface/CompositeCandidate.h" -#include "CommonTools/CandUtils/interface/AddFourMomenta.h" -#include "DataFormats/Candidate/interface/CandMatchMap.h" #include "DataFormats/HLTReco/interface/TriggerTypeDefs.h" #include "HLTrigger/HLTcore/interface/HLTFilter.h" #include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h" diff --git a/HLTrigger/JetMET/interface/HLTCAWZTagFilter.h b/HLTrigger/JetMET/interface/HLTCAWZTagFilter.h index 30935213425d5..da232b1710860 100644 --- a/HLTrigger/JetMET/interface/HLTCAWZTagFilter.h +++ b/HLTrigger/JetMET/interface/HLTCAWZTagFilter.h @@ -14,8 +14,6 @@ #include "DataFormats/JetReco/interface/BasicJet.h" #include "DataFormats/JetReco/interface/CaloJet.h" #include "DataFormats/Candidate/interface/CompositeCandidate.h" -#include "CommonTools/CandUtils/interface/AddFourMomenta.h" -#include "DataFormats/Candidate/interface/CandMatchMap.h" #include "DataFormats/HLTReco/interface/TriggerTypeDefs.h" #include "HLTrigger/HLTcore/interface/HLTFilter.h" #include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h" diff --git a/HLTrigger/JetMET/interface/HLTHPDFilter.h b/HLTrigger/JetMET/interface/HLTHPDFilter.h index e461d7712826f..bde6159859882 100644 --- a/HLTrigger/JetMET/interface/HLTHPDFilter.h +++ b/HLTrigger/JetMET/interface/HLTHPDFilter.h @@ -1,5 +1,5 @@ -#ifndef HLTHPDFilter_h -#define HLTHPDFilter_h +#ifndef HLTrigger_JetMET_HLTHPDFilter_h +#define HLTrigger_JetMET_HLTHPDFilter_h /** \class HLTHPDFilter * @@ -35,4 +35,4 @@ class HLTHPDFilter : public edm::stream::EDFilter<> { double mRBXSpikeUnbalanceThreshold; }; -#endif //HLTHPDFilter_h +#endif diff --git a/HLTrigger/JetMET/interface/HLTJetCollForElePlusJets.h b/HLTrigger/JetMET/interface/HLTJetCollForElePlusJets.h index e86a096aacf33..daba1c4166cc0 100644 --- a/HLTrigger/JetMET/interface/HLTJetCollForElePlusJets.h +++ b/HLTrigger/JetMET/interface/HLTJetCollForElePlusJets.h @@ -1,5 +1,5 @@ -#ifndef HLTJetCollForElePlusJets_h -#define HLTJetCollForElePlusJets_h +#ifndef HLTrigger_JetMET_HLTJetCollForElePlusJets_h +#define HLTrigger_JetMET_HLTJetCollForElePlusJets_h /** \class HLTJetCollForElePlusJets * @@ -17,30 +17,21 @@ */ // user include files +#include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/Frameworkfwd.h" #include "FWCore/Framework/interface/stream/EDProducer.h" - -#include "FWCore/Framework/interface/Event.h" - -#include "FWCore/ParameterSet/interface/ParameterSet.h" - #include "DataFormats/HLTReco/interface/TriggerFilterObjectWithRefs.h" -#include "DataFormats/JetReco/interface/CaloJetCollection.h" -#include "DataFormats/JetReco/interface/PFJetCollection.h" namespace edm { class ConfigurationDescriptions; } -// -// class declaration -// - template class HLTJetCollForElePlusJets : public edm::stream::EDProducer<> { public: explicit HLTJetCollForElePlusJets(const edm::ParameterSet&); - ~HLTJetCollForElePlusJets() override; + ~HLTJetCollForElePlusJets() override = default; + static void fillDescriptions(edm::ConfigurationDescriptions& descriptions); private: @@ -54,12 +45,9 @@ class HLTJetCollForElePlusJets : public edm::stream::EDProducer<> { double minJetPt_; // jet pt threshold in GeV double maxAbsJetEta_; // jet |eta| range unsigned int minNJets_; // number of required jets passing cuts after cleaning - - double minDeltaR_; //min dR for jets and electrons not to match - - double minSoftJetPt_; // jet pt threshold for the soft jet in the VBF pair - double minDeltaEta_; // pseudorapidity separation for the VBF pair - - // ----------member data --------------------------- + double minDeltaR2_; // min dR^2 (with sign) for jets and electrons not to match + double minSoftJetPt_; // jet pt threshold for the soft jet in the VBF pair + double minDeltaEta_; // pseudorapidity separation for the VBF pair }; -#endif //HLTJetCollForElePlusJets_h + +#endif diff --git a/HLTrigger/JetMET/interface/HLTJetCollectionsForBoostedLeptonPlusJets.h b/HLTrigger/JetMET/interface/HLTJetCollectionsForBoostedLeptonPlusJets.h index 21dfd8a2201d9..0c49db40dad0a 100644 --- a/HLTrigger/JetMET/interface/HLTJetCollectionsForBoostedLeptonPlusJets.h +++ b/HLTrigger/JetMET/interface/HLTJetCollectionsForBoostedLeptonPlusJets.h @@ -1,5 +1,5 @@ -#ifndef HLTJetCollectionsForBoostedLeptonPlusJets_h -#define HLTJetCollectionsForBoostedLeptonPlusJets_h +#ifndef HLTrigger_JetMET_HLTJetCollectionsForBoostedLeptonPlusJets_h +#define HLTrigger_JetMET_HLTJetCollectionsForBoostedLeptonPlusJets_h /** \class HLTJetCollectionsForBoostedLeptonPlusJets * @@ -16,26 +16,15 @@ * */ -// user include files +#include "DataFormats/HLTReco/interface/TriggerFilterObjectWithRefs.h" +#include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/Frameworkfwd.h" #include "FWCore/Framework/interface/stream/EDProducer.h" -#include "FWCore/Framework/interface/Event.h" - -#include "FWCore/ParameterSet/interface/ParameterSet.h" - -#include "DataFormats/HLTReco/interface/TriggerFilterObjectWithRefs.h" - -#include "DataFormats/JetReco/interface/PFJetCollection.h" - namespace edm { class ConfigurationDescriptions; } -// -// class declaration -// - template class HLTJetCollectionsForBoostedLeptonPlusJets : public edm::stream::EDProducer<> { public: @@ -51,8 +40,7 @@ class HLTJetCollectionsForBoostedLeptonPlusJets : public edm::stream::EDProducer edm::InputTag hltLeptonTag; edm::InputTag sourceJetTag; - double minDeltaR_; //min dR to consider cleaning - - // ----------member data --------------------------- + double minDeltaR2_; // min dR^2 (with sign) to consider cleaning }; -#endif //HLTJetCollectionsForBoostedLeptonPlusJets_h + +#endif diff --git a/HLTrigger/JetMET/interface/HLTJetCollectionsForLeptonPlusJets.h b/HLTrigger/JetMET/interface/HLTJetCollectionsForLeptonPlusJets.h index 9aa95422a2fe0..52d51ae2108c4 100644 --- a/HLTrigger/JetMET/interface/HLTJetCollectionsForLeptonPlusJets.h +++ b/HLTrigger/JetMET/interface/HLTJetCollectionsForLeptonPlusJets.h @@ -1,5 +1,5 @@ -#ifndef HLTJetCollectionsForLeptonPlusJets_h -#define HLTJetCollectionsForLeptonPlusJets_h +#ifndef HLTrigger_JetMET_HLTJetCollectionsForLeptonPlusJets_h +#define HLTrigger_JetMET_HLTJetCollectionsForLeptonPlusJets_h /** \class HLTJetCollectionsForLeptonPlusJets * @@ -17,17 +17,11 @@ */ // user include files +#include "DataFormats/HLTReco/interface/TriggerFilterObjectWithRefs.h" +#include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/Frameworkfwd.h" #include "FWCore/Framework/interface/stream/EDProducer.h" -#include "FWCore/Framework/interface/Event.h" - -#include "FWCore/ParameterSet/interface/ParameterSet.h" - -#include "DataFormats/HLTReco/interface/TriggerFilterObjectWithRefs.h" -#include "DataFormats/JetReco/interface/CaloJetCollection.h" -#include "DataFormats/JetReco/interface/PFJetCollection.h" - namespace edm { class ConfigurationDescriptions; } @@ -40,7 +34,7 @@ template class HLTJetCollectionsForLeptonPlusJets : public edm::stream::EDProducer<> { public: explicit HLTJetCollectionsForLeptonPlusJets(const edm::ParameterSet&); - ~HLTJetCollectionsForLeptonPlusJets() override; + ~HLTJetCollectionsForLeptonPlusJets() override = default; static void fillDescriptions(edm::ConfigurationDescriptions& descriptions); private: @@ -51,8 +45,7 @@ class HLTJetCollectionsForLeptonPlusJets : public edm::stream::EDProducer<> { edm::InputTag hltLeptonTag; edm::InputTag sourceJetTag; - double minDeltaR_; //min dR for jets and leptons not to match - - // ----------member data --------------------------- + double minDeltaR2_; // min dR^2 (with sign) for jets and leptons not to match }; -#endif //HLTJetCollectionsForLeptonPlusJets_h + +#endif diff --git a/HLTrigger/JetMET/interface/HLTJetL1MatchProducer.h b/HLTrigger/JetMET/interface/HLTJetL1MatchProducer.h index b3230c1fdddf0..8b82096aa3495 100644 --- a/HLTrigger/JetMET/interface/HLTJetL1MatchProducer.h +++ b/HLTrigger/JetMET/interface/HLTJetL1MatchProducer.h @@ -34,8 +34,7 @@ class HLTJetL1MatchProducer : public edm::stream::EDProducer<> { edm::InputTag L1TauJets_; edm::InputTag L1CenJets_; edm::InputTag L1ForJets_; - // std::string jetType_; - double DeltaR_; // DeltaR(HLT,L1) + double DeltaR2_; // DeltaR2(HLT,L1) with sign }; #endif diff --git a/HLTrigger/JetMET/interface/HLTJetL1TMatchProducer.h b/HLTrigger/JetMET/interface/HLTJetL1TMatchProducer.h index 71cdc0e411c9e..77d9e7b1ff5da 100644 --- a/HLTrigger/JetMET/interface/HLTJetL1TMatchProducer.h +++ b/HLTrigger/JetMET/interface/HLTJetL1TMatchProducer.h @@ -20,19 +20,19 @@ template class HLTJetL1TMatchProducer : public edm::stream::EDProducer<> { public: - explicit HLTJetL1TMatchProducer(const edm::ParameterSet &); - ~HLTJetL1TMatchProducer() override; - static void fillDescriptions(edm::ConfigurationDescriptions &descriptions); - virtual void beginJob(); - void produce(edm::Event &, const edm::EventSetup &) override; + explicit HLTJetL1TMatchProducer(const edm::ParameterSet&); + ~HLTJetL1TMatchProducer() override = default; + + static void fillDescriptions(edm::ConfigurationDescriptions& descriptions); + + void produce(edm::Event&, const edm::EventSetup&) override; private: - edm::EDGetTokenT> m_theJetToken; - edm::EDGetTokenT m_theL1JetToken; edm::InputTag jetsInput_; edm::InputTag L1Jets_; - // std::string jetType_; - double DeltaR_; // DeltaR(HLT,L1) + double DeltaR2_; // DeltaR2(HLT,L1) with sign + edm::EDGetTokenT> m_theJetToken; + edm::EDGetTokenT m_theL1JetToken; }; #endif diff --git a/HLTrigger/JetMET/interface/HLTJetSortedVBFFilter.h b/HLTrigger/JetMET/interface/HLTJetSortedVBFFilter.h index f9e38b0121ac2..ac71b6adb1a18 100644 --- a/HLTrigger/JetMET/interface/HLTJetSortedVBFFilter.h +++ b/HLTrigger/JetMET/interface/HLTJetSortedVBFFilter.h @@ -36,9 +36,12 @@ class HLTJetSortedVBFFilter : public HLTFilter { static bool comparator(const Jpair& l, const Jpair& r) { return l.first < r.first; } explicit HLTJetSortedVBFFilter(const edm::ParameterSet&); - ~HLTJetSortedVBFFilter() override; + ~HLTJetSortedVBFFilter() override = default; + static void fillDescriptions(edm::ConfigurationDescriptions& descriptions); + static float findCSV(const typename std::vector::const_iterator& jet, const reco::JetTagCollection& jetTags); + bool hltFilter(edm::Event&, const edm::EventSetup&, trigger::TriggerFilterObjectWithRefs& filterproduct) const override; diff --git a/HLTrigger/JetMET/plugins/HLTJetHbbFilter.cc b/HLTrigger/JetMET/plugins/HLTJetHbbFilter.cc index 8b09869adeb1b..2b2492737b4ad 100644 --- a/HLTrigger/JetMET/plugins/HLTJetHbbFilter.cc +++ b/HLTrigger/JetMET/plugins/HLTJetHbbFilter.cc @@ -5,16 +5,15 @@ * \author Ann Wang * */ - -#include +#include #include +#include #include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h" #include "FWCore/ParameterSet/interface/ParameterSetDescription.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" #include "FWCore/Framework/interface/MakerMacros.h" #include "DataFormats/Common/interface/Handle.h" -#include "DataFormats/Math/interface/deltaPhi.h" #include "DataFormats/Math/interface/deltaR.h" #include "DataFormats/Common/interface/RefToBase.h" #include "DataFormats/HLTReco/interface/TriggerTypeDefs.h" @@ -78,12 +77,12 @@ void HLTJetHbbFilter::fillDescriptions(edm::ConfigurationDescriptions& descri template float HLTJetHbbFilter::findCSV(const typename std::vector::const_iterator& jet, const reco::JetTagCollection& jetTags) { - float minDr = 0.1; //matching jet tag with jet + float minDr2 = 0.01f; //matching jet tag with jet float tmpCSV = -20; for (auto jetb = jetTags.begin(); (jetb != jetTags.end()); ++jetb) { - float tmpDr = reco::deltaR(*jet, *(jetb->first)); - if (tmpDr < minDr) { - minDr = tmpDr; + float tmpDr2 = reco::deltaR2(*jet, *(jetb->first)); + if (tmpDr2 < minDr2) { + minDr2 = tmpDr2; tmpCSV = jetb->second; } } diff --git a/HLTrigger/JetMET/src/HLTHPDFilter.cc b/HLTrigger/JetMET/src/HLTHPDFilter.cc index babb9dcd45b90..29b2604a8ce17 100644 --- a/HLTrigger/JetMET/src/HLTHPDFilter.cc +++ b/HLTrigger/JetMET/src/HLTHPDFilter.cc @@ -4,31 +4,17 @@ * Fedor Ratnikov (UMd) May 19, 2008 */ -#include "HLTrigger/JetMET/interface/HLTHPDFilter.h" - #include - #include - -#include +#include #include "DataFormats/Common/interface/Handle.h" -#include "FWCore/MessageLogger/interface/MessageLogger.h" -#include "FWCore/Framework/interface/ESHandle.h" -#include "FWCore/Framework/interface/Event.h" -#include "FWCore/Framework/interface/EventSetup.h" - -#include "Geometry/Records/interface/IdealGeometryRecord.h" -#include "Geometry/CaloTopology/interface/HcalTopology.h" - -#include "FWCore/ServiceRegistry/interface/Service.h" -#include "CommonTools/UtilAlgos/interface/TFileService.h" -#include "TH1F.h" -#include "TH2F.h" - +#include "DataFormats/HcalDetId/interface/HcalDetId.h" #include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" #include "FWCore/ParameterSet/interface/ParameterSetDescription.h" #include "FWCore/Utilities/interface/InputTag.h" +#include "HLTrigger/JetMET/interface/HLTHPDFilter.h" namespace { enum Partition { HBM = 0, HBP = 1, HEM = 2, HEP = 3 }; diff --git a/HLTrigger/JetMET/src/HLTJetCollForElePlusJets.cc b/HLTrigger/JetMET/src/HLTJetCollForElePlusJets.cc index 56f8939a9df64..57031428c0e61 100644 --- a/HLTrigger/JetMET/src/HLTJetCollForElePlusJets.cc +++ b/HLTrigger/JetMET/src/HLTJetCollForElePlusJets.cc @@ -1,15 +1,18 @@ -#include "HLTrigger/JetMET/interface/HLTJetCollForElePlusJets.h" - -#include "FWCore/Framework/interface/MakerMacros.h" +#include +#include +#include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "FWCore/ParameterSet/interface/ParameterSetDescription.h" #include "DataFormats/Common/interface/Handle.h" - -#include "DataFormats/RecoCandidate/interface/RecoCandidate.h" -#include "DataFormats/RecoCandidate/interface/RecoEcalCandidate.h" #include "DataFormats/EgammaCandidates/interface/Electron.h" #include "DataFormats/EgammaReco/interface/SuperCluster.h" -#include "TVector3.h" +#include "DataFormats/RecoCandidate/interface/RecoCandidate.h" +#include "DataFormats/RecoCandidate/interface/RecoEcalCandidate.h" #include "HLTrigger/HLTcore/interface/defaultModuleLabel.h" +#include "HLTrigger/JetMET/interface/HLTJetCollForElePlusJets.h" + +#include template HLTJetCollForElePlusJets::HLTJetCollForElePlusJets(const edm::ParameterSet& iConfig) @@ -18,7 +21,8 @@ HLTJetCollForElePlusJets::HLTJetCollForElePlusJets(const edm::ParameterSet& i minJetPt_(iConfig.getParameter("MinJetPt")), maxAbsJetEta_(iConfig.getParameter("MaxAbsJetEta")), minNJets_(iConfig.getParameter("MinNJets")), - minDeltaR_(iConfig.getParameter("minDeltaR")), + // minimum delta-R^2 threshold with sign + minDeltaR2_(iConfig.getParameter("minDeltaR") * std::abs(iConfig.getParameter("minDeltaR"))), //Only for VBF minSoftJetPt_(iConfig.getParameter("MinSoftJetPt")), minDeltaEta_(iConfig.getParameter("MinDeltaEta")) { @@ -28,12 +32,6 @@ HLTJetCollForElePlusJets::HLTJetCollForElePlusJets(const edm::ParameterSet& i produces(); } -template -HLTJetCollForElePlusJets::~HLTJetCollForElePlusJets() { - // do anything here that needs to be done at desctruction time - // (e.g. close files, deallocate resources etc.) -} - template void HLTJetCollForElePlusJets::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { edm::ParameterSetDescription desc; @@ -116,28 +114,37 @@ void HLTJetCollForElePlusJets::produce(edm::Event& iEvent, const edm::EventSe bool foundSolution(false); - for (auto& EleP : ElePs) { + for (auto const& EleP : ElePs) { bool VBFJetPair = false; std::vector store_jet; TRefVector refVector; for (unsigned int j = 0; j < theJetCollection.size(); j++) { TVector3 JetP(theJetCollection[j].px(), theJetCollection[j].py(), theJetCollection[j].pz()); - double DR = EleP.DeltaR(JetP); - if (JetP.Pt() > minJetPt_ && std::abs(JetP.Eta()) < maxAbsJetEta_ && DR > minDeltaR_) { + double const Deta = EleP.Eta() - JetP.Eta(); + double const Dphi = EleP.DeltaPhi(JetP); + double const DR2 = Deta * Deta + Dphi * Dphi; + + if (JetP.Pt() > minJetPt_ && std::abs(JetP.Eta()) < maxAbsJetEta_ && DR2 > minDeltaR2_) { store_jet.push_back(j); // The VBF part of the filter if (minDeltaEta_ > 0) { for (unsigned int k = j + 1; k < theJetCollection.size(); k++) { TVector3 SoftJetP(theJetCollection[k].px(), theJetCollection[k].py(), theJetCollection[k].pz()); - double softDR = EleP.DeltaR(SoftJetP); - if (SoftJetP.Pt() > minSoftJetPt_ && std::abs(SoftJetP.Eta()) < maxAbsJetEta_ && softDR > minDeltaR_) - if (std::abs(SoftJetP.Eta() - JetP.Eta()) > minDeltaEta_) { - store_jet.push_back(k); - VBFJetPair = true; - } + if (std::abs(SoftJetP.Eta() - JetP.Eta()) <= minDeltaEta_) { + continue; + } + + double const softDeta = EleP.Eta() - SoftJetP.Eta(); + double const softDphi = EleP.DeltaPhi(SoftJetP); + double const softDR2 = softDeta * softDeta + softDphi * softDphi; + + if (SoftJetP.Pt() > minSoftJetPt_ && std::abs(SoftJetP.Eta()) < maxAbsJetEta_ && softDR2 > minDeltaR2_) { + store_jet.push_back(k); + VBFJetPair = true; + } } } } diff --git a/HLTrigger/JetMET/src/HLTJetCollectionsForBoostedLeptonPlusJets.cc b/HLTrigger/JetMET/src/HLTJetCollectionsForBoostedLeptonPlusJets.cc index 65080277e095c..cef8d0a049cad 100644 --- a/HLTrigger/JetMET/src/HLTJetCollectionsForBoostedLeptonPlusJets.cc +++ b/HLTrigger/JetMET/src/HLTJetCollectionsForBoostedLeptonPlusJets.cc @@ -1,29 +1,31 @@ +#include #include #include -#include "TVector3.h" - -#include "FWCore/Framework/interface/MakerMacros.h" -#include "DataFormats/RecoCandidate/interface/RecoEcalCandidate.h" -#include "DataFormats/EgammaCandidates/interface/Electron.h" -#include "DataFormats/RecoCandidate/interface/RecoChargedCandidate.h" -#include "DataFormats/RecoCandidate/interface/RecoChargedCandidateFwd.h" -#include "DataFormats/RecoCandidate/interface/RecoCandidate.h" +#include "CommonTools/Utils/interface/PtComparator.h" #include "DataFormats/Common/interface/Handle.h" +#include "DataFormats/EgammaCandidates/interface/Electron.h" #include "DataFormats/EgammaReco/interface/SuperCluster.h" -#include "DataFormats/Math/interface/deltaR.h" #include "DataFormats/JetReco/interface/PFJet.h" +#include "DataFormats/Math/interface/deltaR.h" #include "DataFormats/ParticleFlowCandidate/interface/PFCandidate.h" +#include "DataFormats/RecoCandidate/interface/RecoCandidate.h" +#include "DataFormats/RecoCandidate/interface/RecoChargedCandidate.h" +#include "DataFormats/RecoCandidate/interface/RecoChargedCandidateFwd.h" +#include "DataFormats/RecoCandidate/interface/RecoEcalCandidate.h" +#include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "FWCore/ParameterSet/interface/ParameterSetDescription.h" #include "HLTrigger/JetMET/interface/HLTJetCollectionsForBoostedLeptonPlusJets.h" #include "HLTrigger/HLTcore/interface/defaultModuleLabel.h" -#include "CommonTools/Utils/interface/PtComparator.h" template HLTJetCollectionsForBoostedLeptonPlusJets::HLTJetCollectionsForBoostedLeptonPlusJets( const edm::ParameterSet& iConfig) : hltLeptonTag(iConfig.getParameter("HltLeptonTag")), sourceJetTag(iConfig.getParameter("SourceJetTag")), - minDeltaR_(iConfig.getParameter("minDeltaR")) { + // minimum delta-R^2 threshold with sign + minDeltaR2_(iConfig.getParameter("minDeltaR") * std::abs(iConfig.getParameter("minDeltaR"))) { using namespace edm; using namespace std; @@ -107,12 +109,12 @@ void HLTJetCollectionsForBoostedLeptonPlusJets::produce(edm::Event& iEv for (size_t candNr = 0; candNr < muonCands.size(); candNr++) { if (std::find(usedCands.begin(), usedCands.end(), candNr) != usedCands.end()) continue; - if (deltaR((*muonCands[candNr]), cleanedJet) <= minDeltaR_) { + if (reco::deltaR2((*muonCands[candNr]), cleanedJet) <= minDeltaR2_) { std::vector> pfConstituents = cleanedJet.getPFConstituents(); for (std::vector>::const_iterator i_candidate = pfConstituents.begin(); i_candidate != pfConstituents.end(); ++i_candidate) { - if (deltaR((*muonCands[candNr]), (**i_candidate)) < 0.001) { + if (reco::deltaR2((*muonCands[candNr]), (**i_candidate)) < 1e-6) { cleanedJet.setP4(cleanedJet.p4() - muonCands[candNr]->p4()); usedCands.push_back(candNr); break; @@ -131,12 +133,12 @@ void HLTJetCollectionsForBoostedLeptonPlusJets::produce(edm::Event& iEv for (size_t candNr = 0; candNr < eleCands.size(); candNr++) { if (std::find(usedCands.begin(), usedCands.end(), candNr) != usedCands.end()) continue; - if (deltaR((*eleCands[candNr]), cleanedJet) <= minDeltaR_) { + if (reco::deltaR2((*eleCands[candNr]), cleanedJet) <= minDeltaR2_) { std::vector> pfConstituents = cleanedJet.getPFConstituents(); for (std::vector>::const_iterator i_candidate = pfConstituents.begin(); i_candidate != pfConstituents.end(); ++i_candidate) { - if (deltaR((*eleCands[candNr]), (**i_candidate)) < 0.001) { + if (reco::deltaR2((*eleCands[candNr]), (**i_candidate)) < 1e-6) { cleanedJet.setP4(cleanedJet.p4() - eleCands[candNr]->p4()); usedCands.push_back(candNr); break; @@ -155,12 +157,12 @@ void HLTJetCollectionsForBoostedLeptonPlusJets::produce(edm::Event& iEv for (size_t candNr = 0; candNr < photonCands.size(); candNr++) { if (std::find(usedCands.begin(), usedCands.end(), candNr) != usedCands.end()) continue; - if (deltaR((*photonCands[candNr]), cleanedJet) <= minDeltaR_) { + if (reco::deltaR2((*photonCands[candNr]), cleanedJet) <= minDeltaR2_) { std::vector> pfConstituents = cleanedJet.getPFConstituents(); for (std::vector>::const_iterator i_candidate = pfConstituents.begin(); i_candidate != pfConstituents.end(); ++i_candidate) { - if (deltaR((*photonCands[candNr]), (**i_candidate)) < 0.001) { + if (reco::deltaR2((*photonCands[candNr]), (**i_candidate)) < 1e-6) { cleanedJet.setP4(cleanedJet.p4() - photonCands[candNr]->p4()); usedCands.push_back(candNr); break; @@ -179,12 +181,12 @@ void HLTJetCollectionsForBoostedLeptonPlusJets::produce(edm::Event& iEv for (size_t candNr = 0; candNr < clusCands.size(); candNr++) { if (std::find(usedCands.begin(), usedCands.end(), candNr) != usedCands.end()) continue; - if (deltaR((*clusCands[candNr]), cleanedJet) <= minDeltaR_) { + if (reco::deltaR2((*clusCands[candNr]), cleanedJet) <= minDeltaR2_) { std::vector> pfConstituents = cleanedJet.getPFConstituents(); for (std::vector>::const_iterator i_candidate = pfConstituents.begin(); i_candidate != pfConstituents.end(); ++i_candidate) { - if (deltaR((*clusCands[candNr]), (**i_candidate)) < 0.001) { + if (reco::deltaR2((*clusCands[candNr]), (**i_candidate)) < 1e-6) { cleanedJet.setP4(cleanedJet.p4() - clusCands[candNr]->p4()); usedCands.push_back(candNr); break; @@ -204,7 +206,7 @@ void HLTJetCollectionsForBoostedLeptonPlusJets::produce(edm::Event& iEv JetCollection const& jets = *cleanedJetHandle; JetRefVector cleanedJetRefs; - + cleanedJetRefs.reserve(jets.size()); for (unsigned iJet = 0; iJet < jets.size(); ++iJet) { cleanedJetRefs.push_back(JetRef(cleanedJetHandle, iJet)); } diff --git a/HLTrigger/JetMET/src/HLTJetCollectionsForLeptonPlusJets.cc b/HLTrigger/JetMET/src/HLTJetCollectionsForLeptonPlusJets.cc index 2018c93717f9f..821bdf4bf730f 100644 --- a/HLTrigger/JetMET/src/HLTJetCollectionsForLeptonPlusJets.cc +++ b/HLTrigger/JetMET/src/HLTJetCollectionsForLeptonPlusJets.cc @@ -1,25 +1,25 @@ -#include "HLTrigger/JetMET/interface/HLTJetCollectionsForLeptonPlusJets.h" - -#include "FWCore/Framework/interface/MakerMacros.h" - -#include "DataFormats/RecoCandidate/interface/RecoEcalCandidate.h" -#include "DataFormats/EgammaCandidates/interface/Electron.h" -#include "DataFormats/RecoCandidate/interface/RecoChargedCandidate.h" -#include "DataFormats/RecoCandidate/interface/RecoChargedCandidateFwd.h" - -#include "DataFormats/RecoCandidate/interface/RecoCandidate.h" +#include #include "DataFormats/Common/interface/Handle.h" - +#include "DataFormats/EgammaCandidates/interface/Electron.h" #include "DataFormats/EgammaReco/interface/SuperCluster.h" #include "DataFormats/Math/interface/deltaR.h" +#include "DataFormats/RecoCandidate/interface/RecoCandidate.h" +#include "DataFormats/RecoCandidate/interface/RecoChargedCandidate.h" +#include "DataFormats/RecoCandidate/interface/RecoChargedCandidateFwd.h" +#include "DataFormats/RecoCandidate/interface/RecoEcalCandidate.h" +#include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "FWCore/ParameterSet/interface/ParameterSetDescription.h" #include "HLTrigger/HLTcore/interface/defaultModuleLabel.h" +#include "HLTrigger/JetMET/interface/HLTJetCollectionsForLeptonPlusJets.h" template HLTJetCollectionsForLeptonPlusJets::HLTJetCollectionsForLeptonPlusJets(const edm::ParameterSet& iConfig) : hltLeptonTag(iConfig.getParameter("HltLeptonTag")), sourceJetTag(iConfig.getParameter("SourceJetTag")), - minDeltaR_(iConfig.getParameter("minDeltaR")) { + // minimum delta-R^2 threshold with sign + minDeltaR2_(iConfig.getParameter("minDeltaR") * std::abs(iConfig.getParameter("minDeltaR"))) { using namespace edm; using namespace std; typedef vector, jetType, refhelper::FindUsingAdvance, jetType>>> @@ -29,12 +29,6 @@ HLTJetCollectionsForLeptonPlusJets::HLTJetCollectionsForLeptonPlusJets( produces(); } -template -HLTJetCollectionsForLeptonPlusJets::~HLTJetCollectionsForLeptonPlusJets() { - // do anything here that needs to be done at desctruction time - // (e.g. close files, deallocate resources etc.) -} - template void HLTJetCollectionsForLeptonPlusJets::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { edm::ParameterSetDescription desc; @@ -86,10 +80,10 @@ void HLTJetCollectionsForLeptonPlusJets::produce(edm::Event& iEvent, co unique_ptr allSelections(new JetCollectionVector()); if (!clusCands.empty()) { // try trigger clusters - for (auto& clusCand : clusCands) { + for (auto const& clusCand : clusCands) { JetRefVector refVector; for (unsigned int j = 0; j < theJetCollection.size(); j++) { - if (deltaR(clusCand->superCluster()->position(), theJetCollection[j]) > minDeltaR_) + if (reco::deltaR2(clusCand->superCluster()->position(), theJetCollection[j]) > minDeltaR2_) refVector.push_back(JetRef(theJetCollectionHandle, j)); } allSelections->push_back(refVector); @@ -97,10 +91,10 @@ void HLTJetCollectionsForLeptonPlusJets::produce(edm::Event& iEvent, co } if (!eleCands.empty()) { // try electrons - for (auto& eleCand : eleCands) { + for (auto const& eleCand : eleCands) { JetRefVector refVector; for (unsigned int j = 0; j < theJetCollection.size(); j++) { - if (deltaR(eleCand->superCluster()->position(), theJetCollection[j]) > minDeltaR_) + if (reco::deltaR2(eleCand->superCluster()->position(), theJetCollection[j]) > minDeltaR2_) refVector.push_back(JetRef(theJetCollectionHandle, j)); } allSelections->push_back(refVector); @@ -108,10 +102,10 @@ void HLTJetCollectionsForLeptonPlusJets::produce(edm::Event& iEvent, co } if (!photonCands.empty()) { // try photons - for (auto& photonCand : photonCands) { + for (auto const& photonCand : photonCands) { JetRefVector refVector; for (unsigned int j = 0; j < theJetCollection.size(); j++) { - if (deltaR(photonCand->superCluster()->position(), theJetCollection[j]) > minDeltaR_) + if (reco::deltaR2(photonCand->superCluster()->position(), theJetCollection[j]) > minDeltaR2_) refVector.push_back(JetRef(theJetCollectionHandle, j)); } allSelections->push_back(refVector); @@ -119,10 +113,10 @@ void HLTJetCollectionsForLeptonPlusJets::produce(edm::Event& iEvent, co } if (!muonCands.empty()) { // muons - for (auto& muonCand : muonCands) { + for (auto const& muonCand : muonCands) { JetRefVector refVector; for (unsigned int j = 0; j < theJetCollection.size(); j++) { - if (deltaR(muonCand->p4(), theJetCollection[j]) > minDeltaR_) + if (reco::deltaR2(muonCand->p4(), theJetCollection[j]) > minDeltaR2_) refVector.push_back(JetRef(theJetCollectionHandle, j)); } allSelections->push_back(refVector); diff --git a/HLTrigger/JetMET/src/HLTJetL1MatchProducer.cc b/HLTrigger/JetMET/src/HLTJetL1MatchProducer.cc index 44800b475fdaf..70bda8efa2695 100644 --- a/HLTrigger/JetMET/src/HLTJetL1MatchProducer.cc +++ b/HLTrigger/JetMET/src/HLTJetL1MatchProducer.cc @@ -1,13 +1,14 @@ -#include +#include +#include -#include "HLTrigger/JetMET/interface/HLTJetL1MatchProducer.h" #include "DataFormats/Common/interface/Handle.h" +#include "DataFormats/Math/interface/deltaR.h" #include "FWCore/Framework/interface/ESHandle.h" -#include "DataFormats/Math/interface/deltaPhi.h" - #include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" #include "FWCore/ParameterSet/interface/ParameterSetDescription.h" #include "HLTrigger/HLTcore/interface/defaultModuleLabel.h" +#include "HLTrigger/JetMET/interface/HLTJetL1MatchProducer.h" template HLTJetL1MatchProducer::HLTJetL1MatchProducer(const edm::ParameterSet& iConfig) { @@ -15,7 +16,10 @@ HLTJetL1MatchProducer::HLTJetL1MatchProducer(const edm::ParameterSet& iConfig L1TauJets_ = iConfig.template getParameter("L1TauJets"); L1CenJets_ = iConfig.template getParameter("L1CenJets"); L1ForJets_ = iConfig.template getParameter("L1ForJets"); - DeltaR_ = iConfig.template getParameter("DeltaR"); + + // minimum delta-R^2 threshold with sign + auto const DeltaR = iConfig.template getParameter("DeltaR"); + DeltaR2_ = DeltaR * std::abs(DeltaR); typedef std::vector TCollection; m_theJetToken = consumes(jetsInput_); @@ -44,53 +48,54 @@ void HLTJetL1MatchProducer::fillDescriptions(edm::ConfigurationDescriptions& template void HLTJetL1MatchProducer::produce(edm::Event& iEvent, const edm::EventSetup& iSetup) { - typedef std::vector TCollection; - - edm::Handle jets; - iEvent.getByToken(m_theJetToken, jets); - - std::unique_ptr result(new TCollection); + auto const& jets = iEvent.get(m_theJetToken); - edm::Handle l1TauJets; - iEvent.getByToken(m_theL1TauJetToken, l1TauJets); + auto result = std::make_unique>(); + result->reserve(jets.size()); - edm::Handle l1CenJets; - iEvent.getByToken(m_theL1CenJetToken, l1CenJets); + auto const& l1TauJets = iEvent.get(m_theL1TauJetToken); + auto const& l1CenJets = iEvent.get(m_theL1CenJetToken); + auto const& l1ForJets = iEvent.get(m_theL1ForJetToken); - edm::Handle l1ForJets; - iEvent.getByToken(m_theL1ForJetToken, l1ForJets); - - typename TCollection::const_iterator jet_iter; - for (jet_iter = jets->begin(); jet_iter != jets->end(); ++jet_iter) { + for (auto const& jet : jets) { bool isMatched = false; - //std::cout << "FL: l1TauJets.size = " << l1TauJets->size() << std::endl; - for (unsigned int jetc = 0; jetc < l1TauJets->size(); ++jetc) { - const double deltaeta = jet_iter->eta() - (*l1TauJets)[jetc].eta(); - const double deltaphi = deltaPhi(jet_iter->phi(), (*l1TauJets)[jetc].phi()); - //std::cout << "FL: sqrt(2) = " << sqrt(2) << std::endl; - if (sqrt(deltaeta * deltaeta + deltaphi * deltaphi) < DeltaR_) + for (auto const& l1t_obj : l1TauJets) { + if (reco::deltaR2(jet.eta(), jet.phi(), l1t_obj.eta(), l1t_obj.phi()) < DeltaR2_) { isMatched = true; + break; + } } - for (unsigned int jetc = 0; jetc < l1CenJets->size(); ++jetc) { - const double deltaeta = jet_iter->eta() - (*l1CenJets)[jetc].eta(); - const double deltaphi = deltaPhi(jet_iter->phi(), (*l1CenJets)[jetc].phi()); - if (sqrt(deltaeta * deltaeta + deltaphi * deltaphi) < DeltaR_) - isMatched = true; + if (isMatched) { + result->emplace_back(jet); + continue; } - for (unsigned int jetc = 0; jetc < l1ForJets->size(); ++jetc) { - const double deltaeta = jet_iter->eta() - (*l1ForJets)[jetc].eta(); - const double deltaphi = deltaPhi(jet_iter->phi(), (*l1ForJets)[jetc].phi()); - if (sqrt(deltaeta * deltaeta + deltaphi * deltaphi) < DeltaR_) + for (auto const& l1t_obj : l1CenJets) { + if (reco::deltaR2(jet.eta(), jet.phi(), l1t_obj.eta(), l1t_obj.phi()) < DeltaR2_) { isMatched = true; + break; + } } - if (isMatched == true) - result->push_back(*jet_iter); + if (isMatched) { + result->emplace_back(jet); + continue; + } - } // jet_iter + for (auto const& l1t_obj : l1ForJets) { + if (reco::deltaR2(jet.eta(), jet.phi(), l1t_obj.eta(), l1t_obj.phi()) < DeltaR2_) { + isMatched = true; + break; + } + } + + if (isMatched) { + result->emplace_back(jet); + continue; + } + } iEvent.put(std::move(result)); } diff --git a/HLTrigger/JetMET/src/HLTJetL1TMatchProducer.cc b/HLTrigger/JetMET/src/HLTJetL1TMatchProducer.cc index 7cc733f87e0e9..4ec006123ee1f 100644 --- a/HLTrigger/JetMET/src/HLTJetL1TMatchProducer.cc +++ b/HLTrigger/JetMET/src/HLTJetL1TMatchProducer.cc @@ -1,32 +1,29 @@ -#include +#include +#include -#include "HLTrigger/JetMET/interface/HLTJetL1TMatchProducer.h" #include "DataFormats/Common/interface/Handle.h" +#include "DataFormats/Math/interface/deltaR.h" #include "FWCore/Framework/interface/ESHandle.h" -#include "DataFormats/Math/interface/deltaPhi.h" - #include "FWCore/MessageLogger/interface/MessageLogger.h" #include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h" #include "FWCore/ParameterSet/interface/ParameterSetDescription.h" #include "HLTrigger/HLTcore/interface/defaultModuleLabel.h" +#include "HLTrigger/JetMET/interface/HLTJetL1TMatchProducer.h" template HLTJetL1TMatchProducer::HLTJetL1TMatchProducer(const edm::ParameterSet& iConfig) { jetsInput_ = iConfig.template getParameter("jetsInput"); L1Jets_ = iConfig.template getParameter("L1Jets"); - DeltaR_ = iConfig.template getParameter("DeltaR"); - typedef std::vector TCollection; - m_theJetToken = consumes(jetsInput_); - m_theL1JetToken = consumes(L1Jets_); - produces(); -} + // minimum delta-R^2 threshold with sign + auto const DeltaR = iConfig.template getParameter("DeltaR"); + DeltaR2_ = DeltaR * std::abs(DeltaR); -template -void HLTJetL1TMatchProducer::beginJob() {} + m_theJetToken = consumes(jetsInput_); + m_theL1JetToken = consumes(L1Jets_); -template -HLTJetL1TMatchProducer::~HLTJetL1TMatchProducer() = default; + produces>(); +} template void HLTJetL1TMatchProducer::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { @@ -39,20 +36,15 @@ void HLTJetL1TMatchProducer::fillDescriptions(edm::ConfigurationDescriptions& template void HLTJetL1TMatchProducer::produce(edm::Event& iEvent, const edm::EventSetup& iSetup) { - typedef std::vector TCollection; - - edm::Handle jets; - iEvent.getByToken(m_theJetToken, jets); - - std::unique_ptr result(new TCollection); + auto const& jets = iEvent.get(m_theJetToken); + auto const l1Jets = iEvent.getHandle(m_theL1JetToken); - edm::Handle l1Jets; - iEvent.getByToken(m_theL1JetToken, l1Jets); bool trigger_bx_only = true; // selection of BX not implemented + auto result = std::make_unique>(); + if (l1Jets.isValid()) { - typename TCollection::const_iterator jet_iter; - for (jet_iter = jets->begin(); jet_iter != jets->end(); ++jet_iter) { + for (auto const& jet : jets) { bool isMatched = false; for (int ibx = l1Jets->getFirstBX(); ibx <= l1Jets->getLastBX(); ++ibx) { if (trigger_bx_only && (ibx != 0)) @@ -60,18 +52,18 @@ void HLTJetL1TMatchProducer::produce(edm::Event& iEvent, const edm::EventSetu for (auto it = l1Jets->begin(ibx); it != l1Jets->end(ibx); it++) { if (it->et() == 0) continue; // if you don't care about L1T candidates with zero ET. - const double deltaeta = jet_iter->eta() - it->eta(); - const double deltaphi = deltaPhi(jet_iter->phi(), it->phi()); - if (sqrt(deltaeta * deltaeta + deltaphi * deltaphi) < DeltaR_) + if (reco::deltaR2(jet.eta(), jet.phi(), it->eta(), it->phi()) < DeltaR2_) { isMatched = true; - //cout << "bx: " << ibx << " et: " << it->et() << " eta: " << it->eta() << " phi: " << it->phi() << "\n"; + break; + } } } - if (isMatched == true) - result->push_back(*jet_iter); - } // jet_iter + if (isMatched) { + result->emplace_back(jet); + } + } } else { - edm::LogWarning("MissingProduct") << "L1Upgrade l1Jets bx collection not found." << std::endl; + edm::LogWarning("MissingProduct") << "L1Upgrade l1Jets bx collection not found."; } iEvent.put(std::move(result)); diff --git a/HLTrigger/JetMET/src/HLTJetSortedVBFFilter.cc b/HLTrigger/JetMET/src/HLTJetSortedVBFFilter.cc index a5d7823406307..21a736b374cb3 100644 --- a/HLTrigger/JetMET/src/HLTJetSortedVBFFilter.cc +++ b/HLTrigger/JetMET/src/HLTJetSortedVBFFilter.cc @@ -2,15 +2,13 @@ * * See header file for documentation * - - * * \author Jacopo Bernardini * */ - -#include +#include #include +#include #include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h" #include "FWCore/ParameterSet/interface/ParameterSetDescription.h" @@ -49,9 +47,6 @@ HLTJetSortedVBFFilter::HLTJetSortedVBFFilter(const edm::ParameterSet& iConfig } } -template -HLTJetSortedVBFFilter::~HLTJetSortedVBFFilter() = default; - template void HLTJetSortedVBFFilter::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { edm::ParameterSetDescription desc; @@ -74,13 +69,12 @@ void HLTJetSortedVBFFilter::fillDescriptions(edm::ConfigurationDescriptions& template float HLTJetSortedVBFFilter::findCSV(const typename std::vector::const_iterator& jet, const reco::JetTagCollection& jetTags) { - float minDr = 0.1; + float minDr2 = 0.01f; float tmpCSV = -20; for (auto jetb = jetTags.begin(); (jetb != jetTags.end()); ++jetb) { - float tmpDr = reco::deltaR(*jet, *(jetb->first)); - - if (tmpDr < minDr) { - minDr = tmpDr; + float tmpDr2 = reco::deltaR2(*jet, *(jetb->first)); + if (tmpDr2 < minDr2) { + minDr2 = tmpDr2; tmpCSV = jetb->second; } } diff --git a/HLTrigger/Muon/plugins/HLTDiMuonGlbTrkFilter.cc b/HLTrigger/Muon/plugins/HLTDiMuonGlbTrkFilter.cc index 49db0a676ecfc..1f5e617432fb0 100644 --- a/HLTrigger/Muon/plugins/HLTDiMuonGlbTrkFilter.cc +++ b/HLTrigger/Muon/plugins/HLTDiMuonGlbTrkFilter.cc @@ -1,3 +1,5 @@ +#include + #include "HLTDiMuonGlbTrkFilter.h" #include "DataFormats/Common/interface/Handle.h" #include "DataFormats/HLTReco/interface/TriggerFilterObjectWithRefs.h" @@ -28,7 +30,6 @@ HLTDiMuonGlbTrkFilter::HLTDiMuonGlbTrkFilter(const edm::ParameterSet& iConfig) m_minTrkHits = iConfig.getParameter("minTrkHits"); m_minMuonHits = iConfig.getParameter("minMuonHits"); m_maxNormalizedChi2 = iConfig.getParameter("maxNormalizedChi2"); - m_minDR = iConfig.getParameter("minDR"); m_allowedTypeMask = iConfig.getParameter("allowedTypeMask"); m_requiredTypeMask = iConfig.getParameter("requiredTypeMask"); m_trkMuonId = muon::SelectionType(iConfig.getParameter("trkMuonId")); @@ -41,6 +42,10 @@ HLTDiMuonGlbTrkFilter::HLTDiMuonGlbTrkFilter(const edm::ParameterSet& iConfig) m_chargeOpt = iConfig.getParameter("ChargeOpt"); m_maxDCAMuMu = iConfig.getParameter("maxDCAMuMu"); m_maxdEtaMuMu = iConfig.getParameter("maxdEtaMuMu"); + + // minimum delta-R^2 threshold with sign + auto const minDR = iConfig.getParameter("minDR"); + m_minDR2 = minDR * std::abs(minDR); } void HLTDiMuonGlbTrkFilter::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { @@ -117,7 +122,7 @@ bool HLTDiMuonGlbTrkFilter::hltFilter(edm::Event& iEvent, const reco::Muon& mu1(muons->at(filteredMuons.at(i))); const reco::Muon& mu2(muons->at(filteredMuons.at(j))); if (std::max(mu1.pt(), mu2.pt()) > std::max(m_minPtMuon1, m_minPtMuon2) && - std::abs(mu2.eta() - mu1.eta()) < m_maxdEtaMuMu && deltaR(mu1, mu2) > m_minDR && + std::abs(mu2.eta() - mu1.eta()) < m_maxdEtaMuMu && reco::deltaR2(mu1, mu2) > m_minDR2 && (mu1.p4() + mu2.p4()).mass() > m_minMass && (mu1.p4() + mu2.p4()).mass() < m_maxMass && std::abs((mu1.p4() + mu2.p4()).Rapidity()) < m_maxYDimuon) { if (m_chargeOpt < 0) { diff --git a/HLTrigger/Muon/plugins/HLTDiMuonGlbTrkFilter.h b/HLTrigger/Muon/plugins/HLTDiMuonGlbTrkFilter.h index f68b58f3aee95..16d11a05ab1d5 100644 --- a/HLTrigger/Muon/plugins/HLTDiMuonGlbTrkFilter.h +++ b/HLTrigger/Muon/plugins/HLTDiMuonGlbTrkFilter.h @@ -1,10 +1,12 @@ -#ifndef HLTDiMuonGlbTrkFilter_h -#define HLTDiMuonGlbTrkFilter_h +#ifndef HLTrigger_Muon_HLTDiMuonGlbTrkFilter_h +#define HLTrigger_Muon_HLTDiMuonGlbTrkFilter_h + // author D.Kovalskyi -#include "HLTrigger/HLTcore/interface/HLTFilter.h" + #include "DataFormats/RecoCandidate/interface/RecoChargedCandidateFwd.h" #include "DataFormats/MuonReco/interface/MuonFwd.h" #include "DataFormats/MuonReco/interface/MuonSelectors.h" +#include "HLTrigger/HLTcore/interface/HLTFilter.h" #include "MagneticField/Engine/interface/MagneticField.h" #include "MagneticField/Records/interface/IdealMagneticFieldRecord.h" @@ -15,8 +17,10 @@ namespace edm { class HLTDiMuonGlbTrkFilter : public HLTFilter { public: HLTDiMuonGlbTrkFilter(const edm::ParameterSet&); - ~HLTDiMuonGlbTrkFilter() override {} + ~HLTDiMuonGlbTrkFilter() override = default; + static void fillDescriptions(edm::ConfigurationDescriptions& descriptions); + bool hltFilter(edm::Event&, const edm::EventSetup&, trigger::TriggerFilterObjectWithRefs& filterproduct) const override; @@ -34,7 +38,7 @@ class HLTDiMuonGlbTrkFilter : public HLTFilter { unsigned int m_allowedTypeMask; unsigned int m_requiredTypeMask; double m_maxNormalizedChi2; - double m_minDR; + double m_minDR2; double m_minPtMuon1; double m_minPtMuon2; double m_maxEtaMuon; @@ -48,4 +52,4 @@ class HLTDiMuonGlbTrkFilter : public HLTFilter { bool m_saveTags; }; -#endif //HLTMuonDimuonFilter_h +#endif diff --git a/HLTrigger/Muon/plugins/HLTMuonTrackSelector.cc b/HLTrigger/Muon/plugins/HLTMuonTrackSelector.cc index e7eebfd5ef18c..260b143843c63 100644 --- a/HLTrigger/Muon/plugins/HLTMuonTrackSelector.cc +++ b/HLTrigger/Muon/plugins/HLTMuonTrackSelector.cc @@ -6,6 +6,7 @@ * Author: Kyeongpil Lee (kplee@cern.ch) * */ +#include #include "HLTMuonTrackSelector.h" @@ -27,8 +28,6 @@ HLTMuonTrackSelector::HLTMuonTrackSelector(const edm::ParameterSet& iConfig) produces("MVAValues"); } -HLTMuonTrackSelector::~HLTMuonTrackSelector() {} - void HLTMuonTrackSelector::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { edm::ParameterSetDescription desc; desc.add("track", edm::InputTag()); @@ -89,7 +88,7 @@ void HLTMuonTrackSelector::produce(edm::StreamID, edm::Event& iEvent, const edm: double trackEta = track.eta(); double trackPhi = track.phi(); - if (deltaR(trackEta, trackPhi, muonEta, muonPhi) < 0.1) { + if (reco::deltaR2(trackEta, trackPhi, muonEta, muonPhi) < 0.01) { double dPt = fabs(trackPt - muonPt); if (dPt < smallestDPt) { diff --git a/HLTrigger/Muon/plugins/HLTMuonTrackSelector.h b/HLTrigger/Muon/plugins/HLTMuonTrackSelector.h index b6089ba2747fe..9621dff9b75e0 100644 --- a/HLTrigger/Muon/plugins/HLTMuonTrackSelector.h +++ b/HLTrigger/Muon/plugins/HLTMuonTrackSelector.h @@ -1,12 +1,12 @@ -#ifndef HLTMuonTrackSelector_h -#define HLTMuonTrackSelector_h +#ifndef HLTrigger_Muon_HLTMuonTrackSelector_h +#define HLTrigger_Muon_HLTMuonTrackSelector_h /* * class HLTMuonTrackSelector * * Select tracks matched to the reco::Muon * -* base on RecoTracker/FinalTrackSelectors/plugins/TrackCollectionFilterCloner.cc +* based on RecoTracker/FinalTrackSelectors/plugins/TrackCollectionFilterCloner.cc * * Author: Kyeongpil Lee (kplee@cern.ch) * @@ -30,7 +30,7 @@ class HLTMuonTrackSelector : public edm::global::EDProducer<> { public: explicit HLTMuonTrackSelector(const edm::ParameterSet &); - ~HLTMuonTrackSelector() override; + ~HLTMuonTrackSelector() override = default; using MVACollection = std::vector; @@ -47,4 +47,4 @@ class HLTMuonTrackSelector : public edm::global::EDProducer<> { const bool flag_copyMVA; }; -#endif //HLTMuonTrackSelector_h +#endif diff --git a/HLTrigger/btau/plugins/HLTmumutkVtxProducer.cc b/HLTrigger/btau/plugins/HLTmumutkVtxProducer.cc index ed46fdb03ab6f..2cfe32743c12d 100644 --- a/HLTrigger/btau/plugins/HLTmumutkVtxProducer.cc +++ b/HLTrigger/btau/plugins/HLTmumutkVtxProducer.cc @@ -22,7 +22,6 @@ using namespace reco; using namespace std; using namespace trigger; -// ---------------------------------------------------------------------- HLTmumutkVtxProducer::HLTmumutkVtxProducer(const edm::ParameterSet& iConfig) : transientTrackRecordToken_(esConsumes(edm::ESInputTag("", "TransientTrackBuilder"))), muCandTag_(iConfig.getParameter("MuCand")), @@ -39,15 +38,13 @@ HLTmumutkVtxProducer::HLTmumutkVtxProducer(const edm::ParameterSet& iConfig) minInvMass_(iConfig.getParameter("MinInvMass")), maxInvMass_(iConfig.getParameter("MaxInvMass")), minD0Significance_(iConfig.getParameter("MinD0Significance")), - overlapDR_(iConfig.getParameter("OverlapDR")), + // minimum delta-R^2 threshold (with sign) for non-overlapping tracks + overlapDR2_(iConfig.getParameter("OverlapDR") * std::abs(iConfig.getParameter("OverlapDR"))), beamSpotTag_(iConfig.getParameter("BeamSpotTag")), beamSpotToken_(consumes(beamSpotTag_)) { produces(); } -// ---------------------------------------------------------------------- -HLTmumutkVtxProducer::~HLTmumutkVtxProducer() = default; - void HLTmumutkVtxProducer::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { edm::ParameterSetDescription desc; desc.add("MuCand", edm::InputTag("hltMuTracks")); @@ -65,7 +62,6 @@ void HLTmumutkVtxProducer::fillDescriptions(edm::ConfigurationDescriptions& desc descriptions.add("HLTmumutkVtxProducer", desc); } -// ---------------------------------------------------------------------- void HLTmumutkVtxProducer::produce(edm::Event& iEvent, const edm::EventSetup& iSetup) { const double MuMass(0.106); const double MuMass2(MuMass * MuMass); @@ -224,9 +220,7 @@ FreeTrajectoryState HLTmumutkVtxProducer::initialFreeState(const reco::Track& tk } bool HLTmumutkVtxProducer::overlap(const TrackRef& trackref1, const TrackRef& trackref2) { - if (deltaR(trackref1->eta(), trackref1->phi(), trackref2->eta(), trackref2->phi()) < overlapDR_) - return true; - return false; + return (reco::deltaR2(trackref1->eta(), trackref1->phi(), trackref2->eta(), trackref2->phi()) < overlapDR2_); } bool HLTmumutkVtxProducer::checkPreviousCand(const TrackRef& trackref, diff --git a/HLTrigger/btau/plugins/HLTmumutkVtxProducer.h b/HLTrigger/btau/plugins/HLTmumutkVtxProducer.h index 84a8890e4035a..bd63dd9543af2 100644 --- a/HLTrigger/btau/plugins/HLTmumutkVtxProducer.h +++ b/HLTrigger/btau/plugins/HLTmumutkVtxProducer.h @@ -1,7 +1,7 @@ -#ifndef HLTmumutkVtxProducer_h -#define HLTmumutkVtxProducer_h +#ifndef HLTrigger_btau_HLTmumutkVtxProducer_h +#define HLTrigger_btau_HLTmumutkVtxProducer_h // -// Package: HLTstaging +// Package: HLTrigger/btau // Class: HLTmumutkVtxProducer // /**\class HLTmumutkVtxProducer @@ -12,8 +12,8 @@ */ -// system include files #include +#include #include "FWCore/Framework/interface/stream/EDProducer.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" @@ -28,7 +28,6 @@ #include "TrackingTools/TransientTrack/interface/TransientTrackBuilder.h" #include "MagneticField/Records/interface/IdealMagneticFieldRecord.h" #include "MagneticField/Engine/interface/MagneticField.h" -#include namespace edm { class ConfigurationDescriptions; @@ -47,8 +46,10 @@ class MagneticField; class HLTmumutkVtxProducer : public edm::stream::EDProducer<> { public: explicit HLTmumutkVtxProducer(const edm::ParameterSet&); - ~HLTmumutkVtxProducer() override; + ~HLTmumutkVtxProducer() override = default; + static void fillDescriptions(edm::ConfigurationDescriptions& descriptions); + void produce(edm::Event&, const edm::EventSetup&) override; private: @@ -74,9 +75,10 @@ class HLTmumutkVtxProducer : public edm::stream::EDProducer<> { const double minInvMass_; const double maxInvMass_; const double minD0Significance_; - const double overlapDR_; + const double overlapDR2_; const edm::InputTag beamSpotTag_; const edm::EDGetTokenT beamSpotToken_; }; + #endif diff --git a/HLTrigger/btau/plugins/HLTmumutktkVtxProducer.cc b/HLTrigger/btau/plugins/HLTmumutktkVtxProducer.cc index 0caf95649a1f9..33e4faeada6e9 100644 --- a/HLTrigger/btau/plugins/HLTmumutktkVtxProducer.cc +++ b/HLTrigger/btau/plugins/HLTmumutktkVtxProducer.cc @@ -23,7 +23,6 @@ using namespace reco; using namespace std; using namespace trigger; -// ---------------------------------------------------------------------- HLTmumutktkVtxProducer::HLTmumutktkVtxProducer(const edm::ParameterSet& iConfig) : transientTrackRecordToken_(esConsumes(edm::ESInputTag("", "TransientTrackBuilder"))), muCandTag_(iConfig.getParameter("MuCand")), @@ -44,15 +43,13 @@ HLTmumutktkVtxProducer::HLTmumutktkVtxProducer(const edm::ParameterSet& iConfig) maxTrkTrkMass_(iConfig.getParameter("MaxTrkTrkMass")), minD0Significance_(iConfig.getParameter("MinD0Significance")), oppositeSign_(iConfig.getParameter("OppositeSign")), - overlapDR_(iConfig.getParameter("OverlapDR")), + // minimum delta-R^2 threshold (with sign) for non-overlapping tracks + overlapDR2_(iConfig.getParameter("OverlapDR") * std::abs(iConfig.getParameter("OverlapDR"))), beamSpotTag_(iConfig.getParameter("BeamSpotTag")), beamSpotToken_(consumes(beamSpotTag_)) { produces(); } -// ---------------------------------------------------------------------- -HLTmumutktkVtxProducer::~HLTmumutktkVtxProducer() = default; - void HLTmumutktkVtxProducer::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { edm::ParameterSetDescription desc; desc.add("MuCand", edm::InputTag("hltMuTracks")); @@ -74,7 +71,6 @@ void HLTmumutktkVtxProducer::fillDescriptions(edm::ConfigurationDescriptions& de descriptions.add("HLTmumutktkVtxProducer", desc); } -// ---------------------------------------------------------------------- void HLTmumutktkVtxProducer::produce(edm::Event& iEvent, const edm::EventSetup& iSetup) { const double MuMass(0.106); const double MuMass2(MuMass * MuMass); @@ -278,9 +274,7 @@ FreeTrajectoryState HLTmumutktkVtxProducer::initialFreeState(const reco::Track& } bool HLTmumutktkVtxProducer::overlap(const TrackRef& trackref1, const TrackRef& trackref2) { - if (deltaR(trackref1->eta(), trackref1->phi(), trackref2->eta(), trackref2->phi()) < overlapDR_) - return true; - return false; + return (reco::deltaR2(trackref1->eta(), trackref1->phi(), trackref2->eta(), trackref2->phi()) < overlapDR2_); } bool HLTmumutktkVtxProducer::checkPreviousCand(const TrackRef& trackref, diff --git a/HLTrigger/btau/plugins/HLTmumutktkVtxProducer.h b/HLTrigger/btau/plugins/HLTmumutktkVtxProducer.h index f0fe3a1dee872..53efcd85a40b0 100644 --- a/HLTrigger/btau/plugins/HLTmumutktkVtxProducer.h +++ b/HLTrigger/btau/plugins/HLTmumutktkVtxProducer.h @@ -1,12 +1,15 @@ -#ifndef HLTmumutktkVtxProducer_h -#define HLTmumutktkVtxProducer_h +#ifndef HLTrigger_btau_HLTmumutktkVtxProducer_h +#define HLTrigger_btau_HLTmumutktkVtxProducer_h // -// Package: HLTstaging +// Package: HLTrigger/btau // Class: HLTmumutktkVtxProducer // /**\class HLTmumutktkVtxProducer */ +#include +#include + #include "FWCore/Framework/interface/stream/EDProducer.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" #include "FWCore/Framework/interface/Event.h" @@ -21,8 +24,6 @@ #include "TrackingTools/TransientTrack/interface/TransientTrackBuilder.h" #include "MagneticField/Records/interface/IdealMagneticFieldRecord.h" #include "MagneticField/Engine/interface/MagneticField.h" -#include -#include namespace edm { class ConfigurationDescriptions; @@ -41,8 +42,10 @@ class MagneticField; class HLTmumutktkVtxProducer : public edm::stream::EDProducer<> { public: explicit HLTmumutktkVtxProducer(const edm::ParameterSet&); - ~HLTmumutktkVtxProducer() override; + ~HLTmumutktkVtxProducer() override = default; + static void fillDescriptions(edm::ConfigurationDescriptions& descriptions); + void produce(edm::Event&, const edm::EventSetup&) override; private: @@ -72,8 +75,9 @@ class HLTmumutktkVtxProducer : public edm::stream::EDProducer<> { const double maxTrkTrkMass_; const double minD0Significance_; const bool oppositeSign_; - const double overlapDR_; + const double overlapDR2_; const edm::InputTag beamSpotTag_; const edm::EDGetTokenT beamSpotToken_; }; + #endif diff --git a/HLTrigger/special/plugins/BuildFile.xml b/HLTrigger/special/plugins/BuildFile.xml index 3ccd205655847..6543d439c0431 100644 --- a/HLTrigger/special/plugins/BuildFile.xml +++ b/HLTrigger/special/plugins/BuildFile.xml @@ -38,6 +38,7 @@ + diff --git a/HLTrigger/special/plugins/HLTEcalResonanceFilter.cc b/HLTrigger/special/plugins/HLTEcalResonanceFilter.cc index cf95b3c96bd53..cd988996f93cd 100644 --- a/HLTrigger/special/plugins/HLTEcalResonanceFilter.cc +++ b/HLTrigger/special/plugins/HLTEcalResonanceFilter.cc @@ -1,7 +1,12 @@ -#include "HLTEcalResonanceFilter.h" +#include + +#include "DataFormats/Math/interface/deltaPhi.h" #include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" #include "FWCore/ParameterSet/interface/ParameterSetDescription.h" -#include "TLorentzVector.h" +#include "HLTEcalResonanceFilter.h" + +#include using namespace std; using namespace edm; @@ -39,7 +44,10 @@ HLTEcalResonanceFilter::HLTEcalResonanceFilter(const edm::ParameterSet &iConfig) } seleIso_ = barrelSelection.getParameter("seleIso"); ptMinForIsolation_ = barrelSelection.getParameter("ptMinForIsolation"); - seleBeltDR_ = barrelSelection.getParameter("seleBeltDR"); + + auto const seleBeltDR = barrelSelection.getParameter("seleBeltDR"); + seleBeltDR2_ = seleBeltDR * std::abs(seleBeltDR); + seleBeltDeta_ = barrelSelection.getParameter("seleBeltDeta"); store5x5RecHitEB_ = barrelSelection.getParameter("store5x5RecHitEB"); @@ -71,7 +79,10 @@ HLTEcalResonanceFilter::HLTEcalResonanceFilter(const edm::ParameterSet &iConfig) seleS4S9GammaEndCap_ = endcapSelection.getParameter("seleS4S9GammaEndCap"); seleS9S25GammaEndCap_ = endcapSelection.getParameter("seleS9S25GammaEndCap"); ptMinForIsolationEndCap_ = endcapSelection.getParameter("ptMinForIsolationEndCap"); - seleBeltDREndCap_ = endcapSelection.getParameter("seleBeltDREndCap"); + + auto const seleBeltDREndCap = endcapSelection.getParameter("seleBeltDREndCap"); + seleBeltDR2EndCap_ = seleBeltDREndCap * std::abs(seleBeltDREndCap); + seleBeltDetaEndCap_ = endcapSelection.getParameter("seleBeltDetaEndCap"); seleIsoEndCap_ = endcapSelection.getParameter("seleIsoEndCap"); @@ -500,7 +511,7 @@ void HLTEcalResonanceFilter::doSelection( double m_maxCut = seleMinvMaxBarrel_; double ptminforIso = ptMinForIsolation_; double isoCut = seleIso_; - double isoBeltdrCut = seleBeltDR_; + double isoBeltdr2Cut = seleBeltDR2_; double isoBeltdetaCut = seleBeltDeta_; double s4s9Cut = seleS4S9Gamma_; double s9s25Cut = seleS9S25Gamma_; @@ -511,7 +522,7 @@ void HLTEcalResonanceFilter::doSelection( m_maxCut = seleMinvMaxEndCap_; ptminforIso = ptMinForIsolationEndCap_; isoCut = seleIsoEndCap_; - isoBeltdrCut = seleBeltDREndCap_; + isoBeltdr2Cut = seleBeltDR2EndCap_; isoBeltdetaCut = seleBeltDetaEndCap_; s4s9Cut = seleS4S9GammaEndCap_; s9s25Cut = seleS9S25GammaEndCap_; @@ -597,9 +608,12 @@ void HLTEcalResonanceFilter::doSelection( for (auto it_bc3 = clusterCollection->begin(); it_bc3 != clusterCollection->end(); it_bc3++) { if (it_bc3->seed() == it_bc->seed() || it_bc3->seed() == it_bc2->seed()) continue; - float drcl = GetDeltaR(eta_pair, it_bc3->eta(), phi_pair, it_bc3->phi()); - float dretacl = fabs(eta_pair - it_bc3->eta()); - if (drcl > isoBeltdrCut || dretacl > isoBeltdetaCut) + float dretacl = std::abs(eta_pair - it_bc3->eta()); + if (dretacl > isoBeltdetaCut) + continue; + float drphicl = reco::deltaPhi(phi_pair, it_bc3->phi()); + float drcl2 = dretacl * dretacl + drphicl * drphicl; + if (drcl2 > isoBeltdr2Cut) continue; float pt3 = it_bc3->energy() * sin(it_bc3->position().theta()); if (pt3 < ptminforIso) @@ -874,21 +888,6 @@ bool HLTEcalResonanceFilter::checkStatusOfEcalRecHit(const EcalChannelStatus &ch return true; } -float HLTEcalResonanceFilter::DeltaPhi(float phi1, float phi2) { - float diff = fabs(phi2 - phi1); - - while (diff > acos(-1)) - diff -= 2 * acos(-1); - while (diff <= -acos(-1)) - diff += 2 * acos(-1); - - return diff; -} - -float HLTEcalResonanceFilter::GetDeltaR(float eta1, float eta2, float phi1, float phi2) { - return sqrt((eta1 - eta2) * (eta1 - eta2) + DeltaPhi(phi1, phi2) * DeltaPhi(phi1, phi2)); -} - void HLTEcalResonanceFilter::makeClusterES( float x, float y, float z, const CaloSubdetectorGeometry *geometry_es, const CaloSubdetectorTopology *topology_es) { ///get assosicated ES clusters of this endcap cluster diff --git a/HLTrigger/special/plugins/HLTEcalResonanceFilter.h b/HLTrigger/special/plugins/HLTEcalResonanceFilter.h index 75214b57e09a8..fea227cca388a 100644 --- a/HLTrigger/special/plugins/HLTEcalResonanceFilter.h +++ b/HLTrigger/special/plugins/HLTEcalResonanceFilter.h @@ -109,9 +109,6 @@ class HLTEcalResonanceFilter : public edm::stream::EDFilter<> { int diff_neta_s(int, int); int diff_nphi_s(int, int); - static float DeltaPhi(float phi1, float phi2); - static float GetDeltaR(float eta1, float eta2, float phi1, float phi2); - edm::ESGetToken const caloTopologyRecordToken_; edm::ESGetToken const ecalChannelStatusRcdToken_; edm::ESGetToken const caloGeometryRecordToken_; @@ -141,7 +138,7 @@ class HLTEcalResonanceFilter : public edm::stream::EDFilter<> { double seleMinvMinBarrel_; double seleS4S9Gamma_; double seleS9S25Gamma_; - double seleBeltDR_; + double seleBeltDR2_; double seleBeltDeta_; double seleIso_; double ptMinForIsolation_; @@ -166,7 +163,7 @@ class HLTEcalResonanceFilter : public edm::stream::EDFilter<> { double seleS4S9GammaEndCap_; double seleS9S25GammaEndCap_; double seleIsoEndCap_; - double seleBeltDREndCap_; + double seleBeltDR2EndCap_; double seleBeltDetaEndCap_; double ptMinForIsolationEndCap_; bool store5x5RecHitEE_; diff --git a/HLTrigger/special/plugins/HLTHcalNoiseFilter.cc b/HLTrigger/special/plugins/HLTHcalNoiseFilter.cc index a0ecf889e0d02..61ce62a60ea68 100644 --- a/HLTrigger/special/plugins/HLTHcalNoiseFilter.cc +++ b/HLTrigger/special/plugins/HLTHcalNoiseFilter.cc @@ -85,8 +85,8 @@ bool HLTHcalNoiseFilter::hltFilter(edm::Event& iEvent, JetContainer.push_back(calojetIter); double maxTowerE = 0.0; for (auto const& kal : *towerHandle) { - double dR = deltaR(calojetIter.eta(), calojetIter.phi(), kal.eta(), kal.phi()); - if ((dR < 0.50) and (kal.p() > maxTowerE)) { + double const dR2 = reco::deltaR2(calojetIter.eta(), calojetIter.phi(), kal.eta(), kal.phi()); + if (dR2 < 0.25 and kal.p() > maxTowerE) { maxTowerE = kal.p(); seedTower = kal; }