Skip to content

Commit

Permalink
Replace M() with M2() in HLTProducers
Browse files Browse the repository at this point in the history
  • Loading branch information
perrotta committed Mar 19, 2023
1 parent 3989479 commit 22933fd
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 21 deletions.
14 changes: 3 additions & 11 deletions RecoTauTag/HLTProducers/interface/PFJetsMaxInvMassModule.h
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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);
};
Expand Down
7 changes: 4 additions & 3 deletions RecoTauTag/HLTProducers/src/HLTPFDiJetCorrCheckerWithDiTau.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -37,7 +38,7 @@ class HLTPFDiJetCorrCheckerWithDiTau : public edm::global::EDProducer<> {
const edm::EDGetTokenT<trigger::TriggerFilterObjectWithRefs> tauSrc_;
const edm::EDGetTokenT<reco::PFJetCollection> pfJetSrc_;
const double extraTauPtCut_;
const double mjjMin_;
const double m2jjMin_;
const double dRmin_, dRmin2_;
// pt comparator
GreaterByPt<reco::PFJet> pTComparator_;
Expand All @@ -50,7 +51,7 @@ HLTPFDiJetCorrCheckerWithDiTau::HLTPFDiJetCorrCheckerWithDiTau(const edm::Parame
: tauSrc_(consumes(iConfig.getParameter<edm::InputTag>("tauSrc"))),
pfJetSrc_(consumes(iConfig.getParameter<edm::InputTag>("pfJetSrc"))),
extraTauPtCut_(iConfig.getParameter<double>("extraTauPtCut")),
mjjMin_(iConfig.getParameter<double>("mjjMin")),
m2jjMin_(iConfig.getParameter<double>("mjjMin") * iConfig.getParameter<double>("mjjMin")),
dRmin_(iConfig.getParameter<double>("dRmin")),
dRmin2_(dRmin_ * dRmin_) {
if (dRmin_ <= 0.) {
Expand All @@ -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++) {
Expand Down
15 changes: 8 additions & 7 deletions RecoTauTag/HLTProducers/src/PFJetsMaxInvMassModule.cc
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -13,7 +15,6 @@ PFJetsMaxInvMassModule::PFJetsMaxInvMassModule(const edm::ParameterSet& iConfig)
removeMaxInvMassPair_(iConfig.getParameter<bool>("removeMaxInvMassPair")) {
produces<reco::PFJetCollection>();
}
PFJetsMaxInvMassModule::~PFJetsMaxInvMassModule() {}

void PFJetsMaxInvMassModule::produce(edm::StreamID iSId, edm::Event& iEvent, const edm::EventSetup& iES) const {
std::unique_ptr<reco::PFJetCollection> addPFJets(new reco::PFJetCollection);
Expand All @@ -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;
}
Expand Down

0 comments on commit 22933fd

Please sign in to comment.