From b8b0a9ef08639aa6ed9b05af9cff17a6ec9feb37 Mon Sep 17 00:00:00 2001 From: Andrea Date: Tue, 21 Mar 2023 11:35:52 +0100 Subject: [PATCH] Apply code review comments --- .../interface/CaloTowerCreatorForTauHLT.h | 4 +--- .../interface/CaloTowerFromL1TCreatorForTauHLT.h | 4 +--- .../HLTProducers/interface/L1HLTJetsMatching.h | 8 ++------ .../HLTProducers/interface/L1HLTTauMatching.h | 9 ++------- .../HLTProducers/interface/L1THLTTauMatching.h | 11 +++-------- .../HLTProducers/interface/L1TJetsMatching.h | 4 ++-- .../HLTProducers/src/CaloTowerCreatorForTauHLT.cc | 11 +++++++---- .../src/CaloTowerFromL1TCreatorForTauHLT.cc | 11 +++++++---- .../src/HLTPFDiJetCorrCheckerWithDiTau.cc | 2 +- RecoTauTag/HLTProducers/src/L1HLTJetsMatching.cc | 12 +++++++----- RecoTauTag/HLTProducers/src/L1HLTTauMatching.cc | 15 ++++++--------- RecoTauTag/HLTProducers/src/L1THLTTauMatching.cc | 14 +++++++++----- 12 files changed, 48 insertions(+), 57 deletions(-) diff --git a/RecoTauTag/HLTProducers/interface/CaloTowerCreatorForTauHLT.h b/RecoTauTag/HLTProducers/interface/CaloTowerCreatorForTauHLT.h index cba2120c81810..a37cec11232d2 100644 --- a/RecoTauTag/HLTProducers/interface/CaloTowerCreatorForTauHLT.h +++ b/RecoTauTag/HLTProducers/interface/CaloTowerCreatorForTauHLT.h @@ -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 13bf368390680..875ac16c83f15 100644 --- a/RecoTauTag/HLTProducers/interface/CaloTowerFromL1TCreatorForTauHLT.h +++ b/RecoTauTag/HLTProducers/interface/CaloTowerFromL1TCreatorForTauHLT.h @@ -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 f2373f3ca6196..0a3e4905e24c9 100644 --- a/RecoTauTag/HLTProducers/interface/L1TJetsMatching.h +++ b/RecoTauTag/HLTProducers/interface/L1TJetsMatching.h @@ -99,7 +99,7 @@ std::pair, std::vector> L1TJetsMatching::categorise( const T& myJet1 = (pfMatchedJets)[i1]; const T& myJet2 = (pfMatchedJets)[i2]; - const double M2jj = (Mjj > 0. ? Mjj * Mjj : -1.); + const double M2jj = (Mjj >= 0. ? Mjj * Mjj : -1.); if ((m2jj > M2jj) && (myJet1.pt() >= pt1) && (myJet2.pt() > pt2)) { output.first.push_back(myJet1); @@ -145,7 +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.); + const double M2jj = (Mjj >= 0. ? Mjj * Mjj : -1.); std::vector vec4jets; vec4jets.reserve(4); diff --git a/RecoTauTag/HLTProducers/src/CaloTowerCreatorForTauHLT.cc b/RecoTauTag/HLTProducers/src/CaloTowerCreatorForTauHLT.cc index e6f24c30f3057..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")), @@ -30,9 +31,6 @@ CaloTowerCreatorForTauHLT::CaloTowerCreatorForTauHLT(const ParameterSet& p) } void CaloTowerCreatorForTauHLT::produce(StreamID sid, Event& evt, const EventSetup& stp) const { - if (mCone < 0.) - return; - edm::Handle caloTowers; evt.getByToken(mtowers_token, caloTowers); @@ -43,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++) { @@ -60,7 +63,7 @@ void CaloTowerCreatorForTauHLT::produce(StreamID sid, Event& evt, const EventSet math::PtEtaPhiELorentzVector p(cal->et(), cal->eta(), cal->phi(), cal->energy()); double delta2 = ROOT::Math::VectorUtil::DeltaR2((*myL1Jet).p4().Vect(), p); - if (delta2 < mCone * 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 89053652196f3..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")), @@ -30,9 +31,6 @@ CaloTowerFromL1TCreatorForTauHLT::CaloTowerFromL1TCreatorForTauHLT(const Paramet } void CaloTowerFromL1TCreatorForTauHLT::produce(StreamID sid, Event& evt, const EventSetup& stp) const { - if (mCone < 0.) - return; - edm::Handle caloTowers; evt.getByToken(mtowers_token, caloTowers); @@ -43,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++) { @@ -59,7 +62,7 @@ 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 delta2 = ROOT::Math::VectorUtil::DeltaR2((*myL1Jet).p4().Vect(), p); - if (delta2 < mCone * mCone) { + if (delta2 < mCone2) { isAccepted = true; cands->push_back(*cal); } diff --git a/RecoTauTag/HLTProducers/src/HLTPFDiJetCorrCheckerWithDiTau.cc b/RecoTauTag/HLTProducers/src/HLTPFDiJetCorrCheckerWithDiTau.cc index 856dcf645d8ae..277e5b6d56fc0 100644 --- a/RecoTauTag/HLTProducers/src/HLTPFDiJetCorrCheckerWithDiTau.cc +++ b/RecoTauTag/HLTProducers/src/HLTPFDiJetCorrCheckerWithDiTau.cc @@ -79,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 (mjjMin_ <= 0. || (myPFJet1.p4() + myPFJet2.p4()).M2() < m2jjMin_) + 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 30675cbb712c1..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,7 +34,8 @@ void L1HLTJetsMatching::produce(edm::StreamID, edm::Event& iEvent, const edm::Ev unique_ptr tauL2jets(new CaloJetCollection); - constexpr double matchingR = 0.5 * 0.5; + constexpr double matchingR2 = 0.5 * 0.5; + //Getting HLT jets to be matched edm::Handle > tauJets; iEvent.getByToken(jetSrc, tauJets); @@ -56,7 +58,7 @@ void L1HLTJetsMatching::produce(edm::StreamID, edm::Event& iEvent, const edm::Ev //Find the relative L2TauJets, to see if it has been reconstructed const Candidate& myJet = (*tauJets)[iJet]; double deltaR2 = ROOT::Math::VectorUtil::DeltaR2(myJet.p4().Vect(), (tauCandRefVec[iL1Tau]->p4()).Vect()); - if (deltaR2 < matchingR) { + if (deltaR2 < matchingR2) { // LeafCandidate myLC(myJet); CaloJet myCaloJet(myJet.p4(), a, f); if (myJet.pt() > mEt_Min) { @@ -73,7 +75,7 @@ void L1HLTJetsMatching::produce(edm::StreamID, edm::Event& iEvent, const edm::Ev const Candidate& myJet = (*tauJets)[iJet]; //Find the relative L2TauJets, to see if it has been reconstructed double deltaR2 = ROOT::Math::VectorUtil::DeltaR2(myJet.p4().Vect(), (jetCandRefVec[iL1Tau]->p4()).Vect()); - if (deltaR2 < matchingR) { + 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 43c7246cc4a50..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); - constexpr 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); @@ -54,7 +53,7 @@ void L1HLTTauMatching::produce(edm::StreamID iSId, edm::Event& iEvent, const edm //Find the relative L2TauJets, to see if it has been reconstructed const PFTau& myJet = (*tauJets)[iJet]; double deltaR2 = ROOT::Math::VectorUtil::DeltaR2(myJet.p4().Vect(), (tauCandRefVec[iL1Tau]->p4()).Vect()); - if (deltaR2 < matchingR) { + if (deltaR2 < matchingR2) { // LeafCandidate myLC(myJet); if (myJet.leadChargedHadrCand().isNonnull()) { a = myJet.leadChargedHadrCand()->vertex(); @@ -74,7 +73,7 @@ void L1HLTTauMatching::produce(edm::StreamID iSId, edm::Event& iEvent, const edm const PFTau& myJet = (*tauJets)[iJet]; //Find the relative L2TauJets, to see if it has been reconstructed double deltaR2 = ROOT::Math::VectorUtil::DeltaR2(myJet.p4().Vect(), (jetCandRefVec[iL1Tau]->p4()).Vect()); - if (deltaR2 < matchingR) { + 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); - constexpr double matchingR = 0.5 * 0.5; + constexpr double matchingR2 = 0.5 * 0.5; // Getting HLT jets to be matched edm::Handle tauJets; @@ -45,7 +49,7 @@ void L1THLTTauMatching::produce(edm::StreamID iSId, edm::Event& iEvent, const ed // Find the relative L2TauJets, to see if it has been reconstructed const PFTau& myJet = (*tauJets)[iJet]; double deltaR2 = ROOT::Math::VectorUtil::DeltaR2(myJet.p4().Vect(), (tauCandRefVec[iL1Tau]->p4()).Vect()); - if (deltaR2 < matchingR) { + if (deltaR2 < matchingR2) { if (myJet.leadChargedHadrCand().isNonnull()) { a = myJet.leadChargedHadrCand()->vertex(); }