diff --git a/RecoTauTag/HLTProducers/interface/CaloTowerCreatorForTauHLT.h b/RecoTauTag/HLTProducers/interface/CaloTowerCreatorForTauHLT.h index 99a3f1ff12f5f..a37cec11232d2 100644 --- a/RecoTauTag/HLTProducers/interface/CaloTowerCreatorForTauHLT.h +++ b/RecoTauTag/HLTProducers/interface/CaloTowerCreatorForTauHLT.h @@ -34,7 +34,7 @@ class CaloTowerCreatorForTauHLT : public edm::global::EDProducer<> { /// constructor from parameter set CaloTowerCreatorForTauHLT(const edm::ParameterSet&); /// destructor - ~CaloTowerCreatorForTauHLT() override; + ~CaloTowerCreatorForTauHLT() override = default; /// static void fillDescriptions(edm::ConfigurationDescriptions& desc); @@ -47,11 +47,9 @@ class CaloTowerCreatorForTauHLT : public edm::global::EDProducer<> { /// label of source collection const edm::EDGetTokenT mtowers_token; /// use only towers in cone mCone around L1 candidate for regional jet reco - const double mCone; + const double mCone, mCone2; /// label of tau trigger type analysis const edm::EDGetTokenT mTauTrigger_token; - /// imitator of L1 seeds - //edm::InputTag ml1seeds; /// ET threshold const double mEtThreshold; /// E threshold diff --git a/RecoTauTag/HLTProducers/interface/CaloTowerFromL1TCreatorForTauHLT.h b/RecoTauTag/HLTProducers/interface/CaloTowerFromL1TCreatorForTauHLT.h index 1cf69475c8ee6..875ac16c83f15 100644 --- a/RecoTauTag/HLTProducers/interface/CaloTowerFromL1TCreatorForTauHLT.h +++ b/RecoTauTag/HLTProducers/interface/CaloTowerFromL1TCreatorForTauHLT.h @@ -33,7 +33,7 @@ class CaloTowerFromL1TCreatorForTauHLT : public edm::global::EDProducer<> { /// constructor from parameter set CaloTowerFromL1TCreatorForTauHLT(const edm::ParameterSet&); /// destructor - ~CaloTowerFromL1TCreatorForTauHLT() override; + ~CaloTowerFromL1TCreatorForTauHLT() override = default; /// static void fillDescriptions(edm::ConfigurationDescriptions& desc); @@ -48,11 +48,9 @@ class CaloTowerFromL1TCreatorForTauHLT : public edm::global::EDProducer<> { /// label of source collection const edm::EDGetTokenT mtowers_token; /// use only towers in cone mCone around L1 candidate for regional jet reco - const double mCone; + const double mCone, mCone2; /// label of tau trigger type analysis const edm::EDGetTokenT mTauTrigger_token; - /// imitator of L1 seeds - //edm::InputTag ml1seeds; /// ET threshold const double mEtThreshold; /// E threshold diff --git a/RecoTauTag/HLTProducers/interface/L1HLTJetsMatching.h b/RecoTauTag/HLTProducers/interface/L1HLTJetsMatching.h index 78090a9763921..b62286bd495a8 100644 --- a/RecoTauTag/HLTProducers/interface/L1HLTJetsMatching.h +++ b/RecoTauTag/HLTProducers/interface/L1HLTJetsMatching.h @@ -6,12 +6,8 @@ #include "FWCore/Framework/interface/global/EDProducer.h" #include "FWCore/Framework/interface/Event.h" +#include "FWCore/Framework/interface/EventSetup.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" -#include "FWCore/Utilities/interface/InputTag.h" -#include "DataFormats/Common/interface/Handle.h" -#include "DataFormats/L1Trigger/interface/L1JetParticle.h" -#include "DataFormats/L1Trigger/interface/L1JetParticleFwd.h" -#include "DataFormats/JetReco/interface/CaloJetCollection.h" #include "DataFormats/HLTReco/interface/TriggerFilterObjectWithRefs.h" #include @@ -20,7 +16,7 @@ class L1HLTJetsMatching : public edm::global::EDProducer<> { public: explicit L1HLTJetsMatching(const edm::ParameterSet&); - ~L1HLTJetsMatching() override; + ~L1HLTJetsMatching() override = default; void produce(edm::StreamID, edm::Event&, const edm::EventSetup&) const override; private: diff --git a/RecoTauTag/HLTProducers/interface/L1HLTTauMatching.h b/RecoTauTag/HLTProducers/interface/L1HLTTauMatching.h index adf37e0ff6b86..91bf42c305484 100644 --- a/RecoTauTag/HLTProducers/interface/L1HLTTauMatching.h +++ b/RecoTauTag/HLTProducers/interface/L1HLTTauMatching.h @@ -5,14 +5,9 @@ #include "FWCore/Framework/interface/Frameworkfwd.h" #include "FWCore/Framework/interface/global/EDProducer.h" #include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h" -#include "FWCore/ParameterSet/interface/ParameterSetDescription.h" #include "FWCore/Framework/interface/Event.h" +#include "FWCore/Framework/interface/EventSetup.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" -#include "FWCore/Utilities/interface/InputTag.h" -#include "DataFormats/Common/interface/Handle.h" -#include "DataFormats/L1Trigger/interface/L1JetParticle.h" -#include "DataFormats/L1Trigger/interface/L1JetParticleFwd.h" -#include "DataFormats/JetReco/interface/CaloJetCollection.h" #include "DataFormats/TauReco/interface/PFTauFwd.h" #include "DataFormats/HLTReco/interface/TriggerFilterObjectWithRefs.h" @@ -21,7 +16,7 @@ class L1HLTTauMatching : public edm::global::EDProducer<> { public: explicit L1HLTTauMatching(const edm::ParameterSet&); - ~L1HLTTauMatching() override; + ~L1HLTTauMatching() override = default; void produce(edm::StreamID, edm::Event&, const edm::EventSetup&) const override; static void fillDescriptions(edm::ConfigurationDescriptions& descriptions); diff --git a/RecoTauTag/HLTProducers/interface/L1THLTTauMatching.h b/RecoTauTag/HLTProducers/interface/L1THLTTauMatching.h index dc6c18e44e187..c36d1e4e5e1d3 100644 --- a/RecoTauTag/HLTProducers/interface/L1THLTTauMatching.h +++ b/RecoTauTag/HLTProducers/interface/L1THLTTauMatching.h @@ -4,14 +4,9 @@ // user include files #include "FWCore/Framework/interface/Frameworkfwd.h" #include "FWCore/Framework/interface/global/EDProducer.h" -#include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h" -#include "FWCore/ParameterSet/interface/ParameterSetDescription.h" #include "FWCore/Framework/interface/Event.h" -#include "FWCore/ParameterSet/interface/ParameterSet.h" -#include "FWCore/Utilities/interface/InputTag.h" -#include "DataFormats/Common/interface/Handle.h" -#include "DataFormats/L1Trigger/interface/Tau.h" -#include "DataFormats/JetReco/interface/CaloJetCollection.h" +#include "FWCore/Framework/interface/EventSetup.h" +#include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h" #include "DataFormats/TauReco/interface/PFTauFwd.h" #include "DataFormats/HLTReco/interface/TriggerFilterObjectWithRefs.h" @@ -20,7 +15,7 @@ class L1THLTTauMatching : public edm::global::EDProducer<> { public: explicit L1THLTTauMatching(const edm::ParameterSet&); - ~L1THLTTauMatching() override; + ~L1THLTTauMatching() override = default; void produce(edm::StreamID, edm::Event&, const edm::EventSetup&) const override; static void fillDescriptions(edm::ConfigurationDescriptions& descriptions); diff --git a/RecoTauTag/HLTProducers/interface/L1TJetsMatching.h b/RecoTauTag/HLTProducers/interface/L1TJetsMatching.h index e9ec408a4c2ed..0a3e4905e24c9 100644 --- a/RecoTauTag/HLTProducers/interface/L1TJetsMatching.h +++ b/RecoTauTag/HLTProducers/interface/L1TJetsMatching.h @@ -52,15 +52,15 @@ template class L1TJetsMatching : public edm::global::EDProducer<> { public: explicit L1TJetsMatching(const edm::ParameterSet&); - ~L1TJetsMatching() override; + ~L1TJetsMatching() override = default; void produce(edm::StreamID, edm::Event&, const edm::EventSetup&) const override; static void fillDescriptions(edm::ConfigurationDescriptions& descriptions); + +private: std::pair, std::vector> categorise( const std::vector& pfMatchedJets, double pt1, double pt2, double pt3, double Mjj) const; std::tuple, std::vector, std::vector> categoriseVBFPlus2CentralJets( const std::vector& pfMatchedJets, double pt1, double pt2, double pt3, double Mjj) const; - -private: const edm::EDGetTokenT> jetSrc_; const edm::EDGetTokenT jetTrigger_; const std::string matchingMode_; @@ -68,7 +68,6 @@ class L1TJetsMatching : public edm::global::EDProducer<> { const double pt2Min_; const double pt3Min_; const double mjjMin_; - const double matchingR_; const double matchingR2_; }; // @@ -80,7 +79,7 @@ std::pair, std::vector> L1TJetsMatching::categorise( std::pair, std::vector> output; unsigned int i1 = 0; unsigned int i2 = 0; - double mjj = 0; + double m2jj = 0; if (pfMatchedJets.size() > 1) { for (unsigned int i = 0; i < pfMatchedJets.size() - 1; i++) { const T& myJet1 = (pfMatchedJets)[i]; @@ -88,10 +87,10 @@ std::pair, std::vector> L1TJetsMatching::categorise( for (unsigned int j = i + 1; j < pfMatchedJets.size(); j++) { const T& myJet2 = (pfMatchedJets)[j]; - const double mjj_test = (myJet1.p4() + myJet2.p4()).M(); + const double m2jj_test = (myJet1.p4() + myJet2.p4()).M2(); - if (mjj_test > mjj) { - mjj = mjj_test; + if (m2jj_test > m2jj) { + m2jj = m2jj_test; i1 = i; i2 = j; } @@ -100,13 +99,14 @@ std::pair, std::vector> L1TJetsMatching::categorise( const T& myJet1 = (pfMatchedJets)[i1]; const T& myJet2 = (pfMatchedJets)[i2]; + const double M2jj = (Mjj >= 0. ? Mjj * Mjj : -1.); - if ((mjj > Mjj) && (myJet1.pt() >= pt1) && (myJet2.pt() > pt2)) { + if ((m2jj > M2jj) && (myJet1.pt() >= pt1) && (myJet2.pt() > pt2)) { output.first.push_back(myJet1); output.first.push_back(myJet2); } - if ((mjj > Mjj) && (myJet1.pt() < pt3) && (myJet1.pt() > pt2) && (myJet2.pt() > pt2)) { + if ((m2jj > M2jj) && (myJet1.pt() < pt3) && (myJet1.pt() > pt2) && (myJet2.pt() > pt2)) { const T& myJetTest = (pfMatchedJets)[0]; if (myJetTest.pt() > pt3) { output.second.push_back(myJet1); @@ -125,7 +125,7 @@ std::tuple, std::vector, std::vector> L1TJetsMatching::c unsigned int i1 = 0; unsigned int i2 = 0; - double mjj = 0; + double m2jj = 0; if (pfMatchedJets.size() > 1) { for (unsigned int i = 0; i < pfMatchedJets.size() - 1; i++) { const T& myJet1 = (pfMatchedJets)[i]; @@ -133,10 +133,10 @@ std::tuple, std::vector, std::vector> L1TJetsMatching::c for (unsigned int j = i + 1; j < pfMatchedJets.size(); j++) { const T& myJet2 = (pfMatchedJets)[j]; - const double mjj_test = (myJet1.p4() + myJet2.p4()).M(); + const double m2jj_test = (myJet1.p4() + myJet2.p4()).M2(); - if (mjj_test > mjj) { - mjj = mjj_test; + if (m2jj_test > m2jj) { + m2jj = m2jj_test; i1 = i; i2 = j; } @@ -145,6 +145,7 @@ std::tuple, std::vector, std::vector> L1TJetsMatching::c const T& myJet1 = (pfMatchedJets)[i1]; const T& myJet2 = (pfMatchedJets)[i2]; + const double M2jj = (Mjj >= 0. ? Mjj * Mjj : -1.); std::vector vec4jets; vec4jets.reserve(4); @@ -153,7 +154,7 @@ std::tuple, std::vector, std::vector> L1TJetsMatching::c std::vector vec6jets; vec6jets.reserve(6); if (pfMatchedJets.size() > 3) { - if ((mjj > Mjj) && (myJet1.pt() >= pt3) && (myJet2.pt() > pt2)) { + if ((m2jj > M2jj) && (myJet1.pt() >= pt3) && (myJet2.pt() > pt2)) { vec4jets.push_back(myJet1); vec4jets.push_back(myJet2); @@ -166,7 +167,7 @@ std::tuple, std::vector, std::vector> L1TJetsMatching::c } } - if ((mjj > Mjj) && (myJet1.pt() < pt1) && (myJet1.pt() < pt3) && (myJet1.pt() > pt2) && + if ((m2jj > M2jj) && (myJet1.pt() < pt1) && (myJet1.pt() < pt3) && (myJet1.pt() > pt2) && (myJet2.pt() > pt2)) { //60, 30, 50, 500 std::vector idx_jets; @@ -212,8 +213,7 @@ L1TJetsMatching::L1TJetsMatching(const edm::ParameterSet& iConfig) pt2Min_(iConfig.getParameter("pt2Min")), pt3Min_(iConfig.getParameter("pt3Min")), mjjMin_(iConfig.getParameter("mjjMin")), - matchingR_(iConfig.getParameter("matchingR")), - matchingR2_(matchingR_ * matchingR_) { + matchingR2_(iConfig.getParameter("matchingR") * iConfig.getParameter("matchingR")) { if (matchingMode_ == "VBF") { // Default produces>("TwoJets"); produces>("ThreeJets"); @@ -226,8 +226,6 @@ L1TJetsMatching::L1TJetsMatching(const edm::ParameterSet& iConfig) << " (valid values are \"VBF\" and \"VBFPlus2CentralJets\")"; } } -template -L1TJetsMatching::~L1TJetsMatching() {} template void L1TJetsMatching::produce(edm::StreamID iSId, edm::Event& iEvent, const edm::EventSetup& iES) const { diff --git a/RecoTauTag/HLTProducers/interface/PFJetsMaxInvMassModule.h b/RecoTauTag/HLTProducers/interface/PFJetsMaxInvMassModule.h index 2bd4282649ff5..435692b80f2e8 100644 --- a/RecoTauTag/HLTProducers/interface/PFJetsMaxInvMassModule.h +++ b/RecoTauTag/HLTProducers/interface/PFJetsMaxInvMassModule.h @@ -5,17 +5,9 @@ #include "FWCore/Framework/interface/Frameworkfwd.h" #include "FWCore/Framework/interface/global/EDProducer.h" #include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h" -#include "FWCore/ParameterSet/interface/ParameterSetDescription.h" #include "FWCore/Framework/interface/Event.h" -#include "FWCore/ParameterSet/interface/ParameterSet.h" -#include "FWCore/Utilities/interface/InputTag.h" -#include "DataFormats/Common/interface/Handle.h" -#include "DataFormats/L1Trigger/interface/Tau.h" -#include "DataFormats/JetReco/interface/CaloJetCollection.h" -#include "DataFormats/TauReco/interface/PFTauFwd.h" -#include "DataFormats/HLTReco/interface/TriggerFilterObjectWithRefs.h" -#include "DataFormats/HLTReco/interface/TriggerObject.h" -#include "DataFormats/HLTReco/interface/TriggerEvent.h" +#include "FWCore/Framework/interface/EventSetup.h" +#include "DataFormats/JetReco/interface/PFJetCollection.h" class PFJetsMaxInvMassModule : public edm::global::EDProducer<> { private: @@ -25,7 +17,7 @@ class PFJetsMaxInvMassModule : public edm::global::EDProducer<> { public: explicit PFJetsMaxInvMassModule(const edm::ParameterSet&); - ~PFJetsMaxInvMassModule() override; + ~PFJetsMaxInvMassModule() override = default; void produce(edm::StreamID, edm::Event&, const edm::EventSetup&) const override; static void fillDescriptions(edm::ConfigurationDescriptions& descriptions); }; diff --git a/RecoTauTag/HLTProducers/src/CaloTowerCreatorForTauHLT.cc b/RecoTauTag/HLTProducers/src/CaloTowerCreatorForTauHLT.cc index c046a84a97930..953b4d6cc4291 100644 --- a/RecoTauTag/HLTProducers/src/CaloTowerCreatorForTauHLT.cc +++ b/RecoTauTag/HLTProducers/src/CaloTowerCreatorForTauHLT.cc @@ -22,6 +22,7 @@ CaloTowerCreatorForTauHLT::CaloTowerCreatorForTauHLT(const ParameterSet& p) : mVerbose(p.getUntrackedParameter("verbose", 0)), mtowers_token(consumes(p.getParameter("towers"))), mCone(p.getParameter("UseTowersInCone")), + mCone2(mCone * mCone), mTauTrigger_token(consumes(p.getParameter("TauTrigger"))), mEtThreshold(p.getParameter("minimumEt")), mEThreshold(p.getParameter("minimumE")), @@ -29,8 +30,6 @@ CaloTowerCreatorForTauHLT::CaloTowerCreatorForTauHLT(const ParameterSet& p) produces(); } -CaloTowerCreatorForTauHLT::~CaloTowerCreatorForTauHLT() {} - void CaloTowerCreatorForTauHLT::produce(StreamID sid, Event& evt, const EventSetup& stp) const { edm::Handle caloTowers; evt.getByToken(mtowers_token, caloTowers); @@ -42,6 +41,11 @@ void CaloTowerCreatorForTauHLT::produce(StreamID sid, Event& evt, const EventSet std::unique_ptr cands(new CaloTowerCollection); cands->reserve(caloTowers->size()); + if (mCone < 0.) { + evt.put(std::move(cands)); + return; + } + int idTau = 0; L1JetParticleCollection::const_iterator myL1Jet = jetsgen->begin(); for (; myL1Jet != jetsgen->end(); myL1Jet++) { @@ -57,9 +61,9 @@ void CaloTowerCreatorForTauHLT::produce(StreamID sid, Event& evt, const EventSet } if (cal->et() >= mEtThreshold && cal->energy() >= mEThreshold) { math::PtEtaPhiELorentzVector p(cal->et(), cal->eta(), cal->phi(), cal->energy()); - double delta = ROOT::Math::VectorUtil::DeltaR((*myL1Jet).p4().Vect(), p); + double delta2 = ROOT::Math::VectorUtil::DeltaR2((*myL1Jet).p4().Vect(), p); - if (delta < mCone) { + if (delta2 < mCone2) { isAccepted = true; cands->push_back(*cal); } diff --git a/RecoTauTag/HLTProducers/src/CaloTowerFromL1TCreatorForTauHLT.cc b/RecoTauTag/HLTProducers/src/CaloTowerFromL1TCreatorForTauHLT.cc index 6cbcbc95c7604..c5c7fe1631a5b 100644 --- a/RecoTauTag/HLTProducers/src/CaloTowerFromL1TCreatorForTauHLT.cc +++ b/RecoTauTag/HLTProducers/src/CaloTowerFromL1TCreatorForTauHLT.cc @@ -22,6 +22,7 @@ CaloTowerFromL1TCreatorForTauHLT::CaloTowerFromL1TCreatorForTauHLT(const Paramet mVerbose(p.getUntrackedParameter("verbose", 0)), mtowers_token(consumes(p.getParameter("towers"))), mCone(p.getParameter("UseTowersInCone")), + mCone2(mCone * mCone), mTauTrigger_token(consumes(p.getParameter("TauTrigger"))), mEtThreshold(p.getParameter("minimumEt")), mEThreshold(p.getParameter("minimumE")), @@ -29,8 +30,6 @@ CaloTowerFromL1TCreatorForTauHLT::CaloTowerFromL1TCreatorForTauHLT(const Paramet produces(); } -CaloTowerFromL1TCreatorForTauHLT::~CaloTowerFromL1TCreatorForTauHLT() {} - void CaloTowerFromL1TCreatorForTauHLT::produce(StreamID sid, Event& evt, const EventSetup& stp) const { edm::Handle caloTowers; evt.getByToken(mtowers_token, caloTowers); @@ -42,6 +41,11 @@ void CaloTowerFromL1TCreatorForTauHLT::produce(StreamID sid, Event& evt, const E std::unique_ptr cands(new CaloTowerCollection); cands->reserve(caloTowers->size()); + if (mCone < 0.) { + evt.put(std::move(cands)); + return; + } + int idTau = 0; if (jetsgen.isValid()) { for (auto myL1Jet = jetsgen->begin(mBX); myL1Jet != jetsgen->end(mBX); myL1Jet++) { @@ -57,8 +61,8 @@ void CaloTowerFromL1TCreatorForTauHLT::produce(StreamID sid, Event& evt, const E } if (cal->et() >= mEtThreshold && cal->energy() >= mEThreshold) { math::PtEtaPhiELorentzVector p(cal->et(), cal->eta(), cal->phi(), cal->energy()); - double delta = ROOT::Math::VectorUtil::DeltaR((*myL1Jet).p4().Vect(), p); - if (delta < mCone) { + double delta2 = ROOT::Math::VectorUtil::DeltaR2((*myL1Jet).p4().Vect(), p); + if (delta2 < mCone2) { isAccepted = true; cands->push_back(*cal); } diff --git a/RecoTauTag/HLTProducers/src/HLTPFDiJetCorrCheckerWithDiTau.cc b/RecoTauTag/HLTProducers/src/HLTPFDiJetCorrCheckerWithDiTau.cc index 0d30f4a7f24b0..277e5b6d56fc0 100644 --- a/RecoTauTag/HLTProducers/src/HLTPFDiJetCorrCheckerWithDiTau.cc +++ b/RecoTauTag/HLTProducers/src/HLTPFDiJetCorrCheckerWithDiTau.cc @@ -15,6 +15,7 @@ The module stores j1, j2 of any (j1, j2, t1, t2) that satisfies the conditions a #include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h" #include "FWCore/ParameterSet/interface/ParameterSetDescription.h" #include "FWCore/Framework/interface/Event.h" +#include "FWCore/Framework/interface/EventSetup.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" #include "FWCore/Utilities/interface/InputTag.h" #include "FWCore/Utilities/interface/Exception.h" @@ -37,7 +38,7 @@ class HLTPFDiJetCorrCheckerWithDiTau : public edm::global::EDProducer<> { const edm::EDGetTokenT tauSrc_; const edm::EDGetTokenT pfJetSrc_; const double extraTauPtCut_; - const double mjjMin_; + const double mjjMin_, m2jjMin_; const double dRmin_, dRmin2_; // pt comparator GreaterByPt pTComparator_; @@ -51,6 +52,7 @@ HLTPFDiJetCorrCheckerWithDiTau::HLTPFDiJetCorrCheckerWithDiTau(const edm::Parame pfJetSrc_(consumes(iConfig.getParameter("pfJetSrc"))), extraTauPtCut_(iConfig.getParameter("extraTauPtCut")), mjjMin_(iConfig.getParameter("mjjMin")), + m2jjMin_(mjjMin_ * mjjMin_), dRmin_(iConfig.getParameter("dRmin")), dRmin2_(dRmin_ * dRmin_) { if (dRmin_ <= 0.) { @@ -77,7 +79,7 @@ void HLTPFDiJetCorrCheckerWithDiTau::produce(edm::StreamID iSId, edm::Event& iEv const reco::PFJet& myPFJet1 = pfJets[iJet1]; const reco::PFJet& myPFJet2 = pfJets[iJet2]; - if ((myPFJet1.p4() + myPFJet2.p4()).M() < mjjMin_) + if (mjjMin_ >= 0. && (myPFJet1.p4() + myPFJet2.p4()).M2() < m2jjMin_) continue; for (unsigned int iTau1 = 0; iTau1 < taus.size(); iTau1++) { diff --git a/RecoTauTag/HLTProducers/src/L1HLTJetsMatching.cc b/RecoTauTag/HLTProducers/src/L1HLTJetsMatching.cc index cff5a8d07b1eb..8e7f3b8a61c80 100644 --- a/RecoTauTag/HLTProducers/src/L1HLTJetsMatching.cc +++ b/RecoTauTag/HLTProducers/src/L1HLTJetsMatching.cc @@ -1,9 +1,12 @@ #include "RecoTauTag/HLTProducers/interface/L1HLTJetsMatching.h" #include "Math/GenVector/VectorUtil.h" +#include "DataFormats/Common/interface/Handle.h" +#include "DataFormats/JetReco/interface/CaloJetCollection.h" #include "DataFormats/L1Trigger/interface/L1JetParticle.h" #include "DataFormats/L1Trigger/interface/L1JetParticleFwd.h" #include "DataFormats/HLTReco/interface/TriggerTypeDefs.h" #include "FWCore/Utilities/interface/EDMException.h" +#include "FWCore/Utilities/interface/InputTag.h" // // class decleration // @@ -20,8 +23,6 @@ L1HLTJetsMatching::L1HLTJetsMatching(const edm::ParameterSet& iConfig) { produces(); } -L1HLTJetsMatching::~L1HLTJetsMatching() {} - void L1HLTJetsMatching::produce(edm::StreamID, edm::Event& iEvent, const edm::EventSetup& iES) const { using namespace edm; using namespace std; @@ -33,8 +34,8 @@ void L1HLTJetsMatching::produce(edm::StreamID, edm::Event& iEvent, const edm::Ev unique_ptr tauL2jets(new CaloJetCollection); - double deltaR = 1.0; - double matchingR = 0.5; + constexpr double matchingR2 = 0.5 * 0.5; + //Getting HLT jets to be matched edm::Handle > tauJets; iEvent.getByToken(jetSrc, tauJets); @@ -56,8 +57,8 @@ void L1HLTJetsMatching::produce(edm::StreamID, edm::Event& iEvent, const edm::Ev for (unsigned int iJet = 0; iJet < tauJets->size(); iJet++) { //Find the relative L2TauJets, to see if it has been reconstructed const Candidate& myJet = (*tauJets)[iJet]; - deltaR = ROOT::Math::VectorUtil::DeltaR(myJet.p4().Vect(), (tauCandRefVec[iL1Tau]->p4()).Vect()); - if (deltaR < matchingR) { + double deltaR2 = ROOT::Math::VectorUtil::DeltaR2(myJet.p4().Vect(), (tauCandRefVec[iL1Tau]->p4()).Vect()); + if (deltaR2 < matchingR2) { // LeafCandidate myLC(myJet); CaloJet myCaloJet(myJet.p4(), a, f); if (myJet.pt() > mEt_Min) { @@ -73,8 +74,8 @@ void L1HLTJetsMatching::produce(edm::StreamID, edm::Event& iEvent, const edm::Ev for (unsigned int iJet = 0; iJet < tauJets->size(); iJet++) { const Candidate& myJet = (*tauJets)[iJet]; //Find the relative L2TauJets, to see if it has been reconstructed - deltaR = ROOT::Math::VectorUtil::DeltaR(myJet.p4().Vect(), (jetCandRefVec[iL1Tau]->p4()).Vect()); - if (deltaR < matchingR) { + double deltaR2 = ROOT::Math::VectorUtil::DeltaR2(myJet.p4().Vect(), (jetCandRefVec[iL1Tau]->p4()).Vect()); + if (deltaR2 < matchingR2) { // LeafCandidate myLC(myJet); CaloJet myCaloJet(myJet.p4(), a, f); if (myJet.pt() > mEt_Min) { diff --git a/RecoTauTag/HLTProducers/src/L1HLTTauMatching.cc b/RecoTauTag/HLTProducers/src/L1HLTTauMatching.cc index 3da2d4d6b3caa..40fd1fdd2d521 100644 --- a/RecoTauTag/HLTProducers/src/L1HLTTauMatching.cc +++ b/RecoTauTag/HLTProducers/src/L1HLTTauMatching.cc @@ -1,9 +1,11 @@ #include "RecoTauTag/HLTProducers/interface/L1HLTTauMatching.h" #include "Math/GenVector/VectorUtil.h" +#include "DataFormats/Common/interface/Handle.h" #include "DataFormats/L1Trigger/interface/L1JetParticle.h" #include "DataFormats/L1Trigger/interface/L1JetParticleFwd.h" #include "DataFormats/HLTReco/interface/TriggerTypeDefs.h" -#include "FWCore/Utilities/interface/EDMException.h" +#include "FWCore/Utilities/interface/InputTag.h" +#include "FWCore/ParameterSet/interface/ParameterSetDescription.h" #include "DataFormats/TauReco/interface/PFTau.h" // @@ -20,7 +22,6 @@ L1HLTTauMatching::L1HLTTauMatching(const edm::ParameterSet& iConfig) mEt_Min(iConfig.getParameter("EtMin")) { produces(); } -L1HLTTauMatching::~L1HLTTauMatching() {} void L1HLTTauMatching::produce(edm::StreamID iSId, edm::Event& iEvent, const edm::EventSetup& iES) const { using namespace edm; @@ -31,14 +32,12 @@ void L1HLTTauMatching::produce(edm::StreamID iSId, edm::Event& iEvent, const edm unique_ptr tauL2jets(new PFTauCollection); - double deltaR = 1.0; - double matchingR = 0.5; + constexpr double matchingR2 = 0.5 * 0.5; + //Getting HLT jets to be matched edm::Handle tauJets; iEvent.getByToken(jetSrc, tauJets); - // std::cout <<"Size of input jet collection "<size()< l1TriggeredTaus; iEvent.getByToken(tauTrigger, l1TriggeredTaus); @@ -53,8 +52,8 @@ void L1HLTTauMatching::produce(edm::StreamID iSId, edm::Event& iEvent, const edm for (unsigned int iJet = 0; iJet < tauJets->size(); iJet++) { //Find the relative L2TauJets, to see if it has been reconstructed const PFTau& myJet = (*tauJets)[iJet]; - deltaR = ROOT::Math::VectorUtil::DeltaR(myJet.p4().Vect(), (tauCandRefVec[iL1Tau]->p4()).Vect()); - if (deltaR < matchingR) { + double deltaR2 = ROOT::Math::VectorUtil::DeltaR2(myJet.p4().Vect(), (tauCandRefVec[iL1Tau]->p4()).Vect()); + if (deltaR2 < matchingR2) { // LeafCandidate myLC(myJet); if (myJet.leadChargedHadrCand().isNonnull()) { a = myJet.leadChargedHadrCand()->vertex(); @@ -73,8 +72,8 @@ void L1HLTTauMatching::produce(edm::StreamID iSId, edm::Event& iEvent, const edm for (unsigned int iJet = 0; iJet < tauJets->size(); iJet++) { const PFTau& myJet = (*tauJets)[iJet]; //Find the relative L2TauJets, to see if it has been reconstructed - deltaR = ROOT::Math::VectorUtil::DeltaR(myJet.p4().Vect(), (jetCandRefVec[iL1Tau]->p4()).Vect()); - if (deltaR < matchingR) { + double deltaR2 = ROOT::Math::VectorUtil::DeltaR2(myJet.p4().Vect(), (jetCandRefVec[iL1Tau]->p4()).Vect()); + if (deltaR2 < matchingR2) { // LeafCandidate myLC(myJet); if (myJet.leadChargedHadrCand().isNonnull()) { a = myJet.leadChargedHadrCand()->vertex(); @@ -90,8 +89,6 @@ void L1HLTTauMatching::produce(edm::StreamID iSId, edm::Event& iEvent, const edm } } - //std::cout <<"Size of L1HLT matched jets "<size()<("KeepOriginalVertex")) { produces(); } -L1THLTTauMatching::~L1THLTTauMatching() {} void L1THLTTauMatching::produce(edm::StreamID iSId, edm::Event& iEvent, const edm::EventSetup& iES) const { unique_ptr tauL2jets(new PFTauCollection); - double deltaR = 1.0; - double matchingR = 0.5; + constexpr double matchingR2 = 0.5 * 0.5; // Getting HLT jets to be matched edm::Handle tauJets; @@ -45,8 +48,8 @@ void L1THLTTauMatching::produce(edm::StreamID iSId, edm::Event& iEvent, const ed for (unsigned int iJet = 0; iJet < tauJets->size(); iJet++) { // Find the relative L2TauJets, to see if it has been reconstructed const PFTau& myJet = (*tauJets)[iJet]; - deltaR = ROOT::Math::VectorUtil::DeltaR(myJet.p4().Vect(), (tauCandRefVec[iL1Tau]->p4()).Vect()); - if (deltaR < matchingR) { + double deltaR2 = ROOT::Math::VectorUtil::DeltaR2(myJet.p4().Vect(), (tauCandRefVec[iL1Tau]->p4()).Vect()); + if (deltaR2 < matchingR2) { if (myJet.leadChargedHadrCand().isNonnull()) { a = myJet.leadChargedHadrCand()->vertex(); } diff --git a/RecoTauTag/HLTProducers/src/L2TauJetsMerger.cc b/RecoTauTag/HLTProducers/src/L2TauJetsMerger.cc index fbc838409ac70..13d9c9773aeff 100644 --- a/RecoTauTag/HLTProducers/src/L2TauJetsMerger.cc +++ b/RecoTauTag/HLTProducers/src/L2TauJetsMerger.cc @@ -58,8 +58,8 @@ void L2TauJetsMerger::produce(edm::StreamID iSId, edm::Event& iEvent, const edm: tauL2jets->push_back(myTmpJets[0]); CaloJetCollection tmp; for (unsigned int i = 1; i < myTmpJets.size(); ++i) { - double DR = ROOT::Math::VectorUtil::DeltaR(myTmpJets[0].p4(), myTmpJets[i].p4()); - if (DR > 0.1) + double DR2 = ROOT::Math::VectorUtil::DeltaR2(myTmpJets[0].p4(), myTmpJets[i].p4()); + if (DR2 > 0.1 * 0.1) tmp.push_back(myTmpJets[i]); } myTmpJets.swap(tmp); diff --git a/RecoTauTag/HLTProducers/src/PFJetsMaxInvMassModule.cc b/RecoTauTag/HLTProducers/src/PFJetsMaxInvMassModule.cc index b7ddf66e92df5..8a2b9f9e909a1 100644 --- a/RecoTauTag/HLTProducers/src/PFJetsMaxInvMassModule.cc +++ b/RecoTauTag/HLTProducers/src/PFJetsMaxInvMassModule.cc @@ -1,8 +1,10 @@ #include "RecoTauTag/HLTProducers/interface/PFJetsMaxInvMassModule.h" #include "Math/GenVector/VectorUtil.h" -#include "DataFormats/HLTReco/interface/TriggerTypeDefs.h" -#include "FWCore/Utilities/interface/EDMException.h" #include "CommonTools/Utils/interface/PtComparator.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "FWCore/ParameterSet/interface/ParameterSetDescription.h" +#include "FWCore/Utilities/interface/InputTag.h" +#include "DataFormats/Common/interface/Handle.h" // // class declaration @@ -13,7 +15,6 @@ PFJetsMaxInvMassModule::PFJetsMaxInvMassModule(const edm::ParameterSet& iConfig) removeMaxInvMassPair_(iConfig.getParameter("removeMaxInvMassPair")) { produces(); } -PFJetsMaxInvMassModule::~PFJetsMaxInvMassModule() {} void PFJetsMaxInvMassModule::produce(edm::StreamID iSId, edm::Event& iEvent, const edm::EventSetup& iES) const { std::unique_ptr addPFJets(new reco::PFJetCollection); @@ -23,14 +24,14 @@ void PFJetsMaxInvMassModule::produce(edm::StreamID iSId, edm::Event& iEvent, con unsigned iCan = 0; unsigned jCan = 0; - double mjj_max = 0; + double m2jj_max = 0; if (jets->size() > 1) { for (unsigned i = 0; i < jets->size(); i++) { for (unsigned j = i + 1; j < jets->size(); j++) { - double test = ((*jets)[i].p4() + (*jets)[j].p4()).M(); - if (test > mjj_max) { - mjj_max = test; + double test = ((*jets)[i].p4() + (*jets)[j].p4()).M2(); + if (test > m2jj_max) { + m2jj_max = test; iCan = i; jCan = j; }