From 22933fd7e2efaece48acb57a03ba7185ff36eb0b Mon Sep 17 00:00:00 2001 From: Andrea Date: Sun, 19 Mar 2023 17:16:16 +0100 Subject: [PATCH] Replace M() with M2() in HLTProducers --- .../interface/PFJetsMaxInvMassModule.h | 14 +++----------- .../src/HLTPFDiJetCorrCheckerWithDiTau.cc | 7 ++++--- .../HLTProducers/src/PFJetsMaxInvMassModule.cc | 15 ++++++++------- 3 files changed, 15 insertions(+), 21 deletions(-) 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/HLTPFDiJetCorrCheckerWithDiTau.cc b/RecoTauTag/HLTProducers/src/HLTPFDiJetCorrCheckerWithDiTau.cc index 0d30f4a7f24b0..5da223bfad6f4 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 m2jjMin_; const double dRmin_, dRmin2_; // pt comparator GreaterByPt pTComparator_; @@ -50,7 +51,7 @@ HLTPFDiJetCorrCheckerWithDiTau::HLTPFDiJetCorrCheckerWithDiTau(const edm::Parame : tauSrc_(consumes(iConfig.getParameter("tauSrc"))), pfJetSrc_(consumes(iConfig.getParameter("pfJetSrc"))), extraTauPtCut_(iConfig.getParameter("extraTauPtCut")), - mjjMin_(iConfig.getParameter("mjjMin")), + m2jjMin_(iConfig.getParameter("mjjMin") * iConfig.getParameter("mjjMin")), dRmin_(iConfig.getParameter("dRmin")), dRmin2_(dRmin_ * dRmin_) { if (dRmin_ <= 0.) { @@ -77,7 +78,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 ((myPFJet1.p4() + myPFJet2.p4()).M2() < m2jjMin_) continue; for (unsigned int iTau1 = 0; iTau1 < taus.size(); iTau1++) { 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; }