From f5bc57c9e825e50535e515b1e3c84dca4ad39118 Mon Sep 17 00:00:00 2001 From: vukasinmilosevic Date: Thu, 1 Jun 2017 17:29:48 +0200 Subject: [PATCH 1/8] Adding the template module --- .../HLTProducers/interface/L1TJetsMatching.h | 202 ++++++++++++++++++ RecoTauTag/HLTProducers/src/SealModule.cc | 9 + 2 files changed, 211 insertions(+) create mode 100644 RecoTauTag/HLTProducers/interface/L1TJetsMatching.h diff --git a/RecoTauTag/HLTProducers/interface/L1TJetsMatching.h b/RecoTauTag/HLTProducers/interface/L1TJetsMatching.h new file mode 100644 index 0000000000000..63b2fe3e24e44 --- /dev/null +++ b/RecoTauTag/HLTProducers/interface/L1TJetsMatching.h @@ -0,0 +1,202 @@ +// -*- C++ -*- +// +// Package: RecoTauTag/HLTProducers +// Class: L1TJetsMatching +// +/**\class L1TJetsMatching L1TJetsMatching.h + RecoTauTag/HLTProducers/interface/L1TJetsMatching.h + Description: + Matching L1 to PF/Calo Jets. Used for HLT_VBF paths. + *Matches PF/Calo Jets to L1 jets from the dedicated seed + *Adds selection criteria to the leading/subleading jets as well as the maximum dijet mass + *Separates collections of PF/Calo jets into two categories + + +*/ +// +// Original Author: Vukasin Milosevic +// Created: Thu, 01 Jun 2017 17:23:00 GMT +// +// + + + + +#ifndef RecoTauTag_HLTProducers_L1TJetsMatching_h +#define RecoTauTag_HLTProducers_L1TJetsMatching_h + +// 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/JetReco/interface/PFJetCollection.h" +#include "DataFormats/TauReco/interface/PFTauFwd.h" +#include "DataFormats/HLTReco/interface/TriggerFilterObjectWithRefs.h" + +#include "Math/GenVector/VectorUtil.h" +#include "DataFormats/HLTReco/interface/TriggerTypeDefs.h" +#include "FWCore/Utilities/interface/EDMException.h" +#include "DataFormats/JetReco/interface/PFJet.h" + + +#include +#include + +template< typename T> +class L1TJetsMatching: public edm::global::EDProducer<> { + public: + explicit L1TJetsMatching(const edm::ParameterSet&); + ~L1TJetsMatching(); + virtual void produce(edm::StreamID, edm::Event&, const edm::EventSetup&) const override; + static void fillDescriptions(edm::ConfigurationDescriptions& descriptions); + + private: + + const edm::EDGetTokenT> jetSrc_; + const edm::EDGetTokenT jetTrigger_; + const double pt1_Min; + const double pt2_Min; + const double mjj_Min; + + }; + // + // class decleration + // + using namespace reco ; + using namespace std ; + using namespace edm ; + using namespace trigger; + + + template< typename T> + std::pair,std::vector> categorise(const std::vector& pfMatchedJets, double pt1, double pt2, double Mjj) + { + std::pair,std::vector> output; + unsigned int i1 = 0; + unsigned int i2 = 0; + double mjj = 0; + if (pfMatchedJets.size()>1){ + for (unsigned int i = 0; i < pfMatchedJets.size()-1; i++) + for (unsigned int j = i+1; j < pfMatchedJets.size(); j++) + { + const T & myJet1 = (pfMatchedJets)[i]; + const T & myJet2 = (pfMatchedJets)[j]; + + const double mjj_test = (myJet1.p4()+myJet2.p4()).M(); + + if (mjj_test > mjj){ + + mjj =mjj_test; + i1 = i; + i2 = j; + } + } + + const T & myJet1 = (pfMatchedJets)[i1]; + const T & myJet2 = (pfMatchedJets)[i2]; + + if ((mjj > Mjj) && (myJet1.pt() >= pt1) && (myJet2.pt() > pt2) ) + { + + output.first.push_back(myJet1); + output.first.push_back(myJet2); + + } + + if ((mjj > Mjj) && (myJet1.pt() < pt1) && (myJet1.pt() > pt2) && (myJet2.pt() > pt2)) + { + + const T & myJetTest = (pfMatchedJets)[0]; + if (myJetTest.pt()>pt1){ + output.second.push_back(myJet1); + output.second.push_back(myJet2); + output.second.push_back(myJetTest); + + } + } + + } + + return output; + + } + template< typename T> + L1TJetsMatching::L1TJetsMatching(const edm::ParameterSet& iConfig): + jetSrc_ ( consumes> (iConfig.getParameter("JetSrc" ) ) ), + jetTrigger_( consumes(iConfig.getParameter("L1JetTrigger") ) ), + pt1_Min ( iConfig.getParameter("pt1_Min")), + pt2_Min ( iConfig.getParameter("pt2_Min")), + mjj_Min ( iConfig.getParameter("mjj_Min")) + { + produces>("TwoJets"); + produces>("ThreeJets"); + } + template< typename T> + L1TJetsMatching::~L1TJetsMatching(){ } + + template< typename T> + void L1TJetsMatching::produce(edm::StreamID iSId, edm::Event& iEvent, const edm::EventSetup& iES) const + { + + unique_ptr> pfMatchedJets(new std::vector); + std::pair,std::vector> output; + + double deltaR = 1.0; + double matchingR = 0.5; + + // Getting HLT jets to be matched + edm::Handle > pfJets; + iEvent.getByToken( jetSrc_, pfJets ); + + edm::Handle l1TriggeredJets; + iEvent.getByToken(jetTrigger_,l1TriggeredJets); + + //l1t::TauVectorRef jetCandRefVec; + l1t::JetVectorRef jetCandRefVec; + l1TriggeredJets->getObjects( trigger::TriggerL1Jet,jetCandRefVec); + + math::XYZPoint a(0.,0.,0.); + + //std::cout<<"PFsize= "<size()<p4()).Vect()); + if(deltaR < matchingR ) { + pfMatchedJets->push_back(myJet); + break; + } + } + } + + output= categorise(*pfMatchedJets,pt1_Min,pt2_Min, mjj_Min); + unique_ptr> output1(new std::vector(output.first)); + unique_ptr> output2(new std::vector(output.second)); + + iEvent.put(std::move(output1),"TwoJets"); + iEvent.put(std::move(output2),"ThreeJets"); + + } + template< typename T> + void L1TJetsMatching::fillDescriptions(edm::ConfigurationDescriptions& descriptions) + { + edm::ParameterSetDescription desc; + desc.add("L1JetTrigger", edm::InputTag("hltL1DiJetVBF"))->setComment("Name of trigger filter" ); + desc.add("JetSrc" , edm::InputTag("hltAK4PFJetsTightIDCorrected"))->setComment("Input collection of PFJets"); + desc.add ("pt1_Min",95.0)->setComment("Minimal pT1 of PFJets to match"); + desc.add ("pt2_Min",35.0)->setComment("Minimal pT2 of PFJets to match"); + desc.add ("mjj_Min",650.0)->setComment("Minimal mjj of matched PFjets"); + descriptions.setComment("This module produces collection of PFJetss matched to L1 Taus / Jets passing a HLT filter (Only p4 and vertex of returned PFJetss are set)."); + descriptions.add ("L1TJetsMatching",desc); + } + + + +#endif diff --git a/RecoTauTag/HLTProducers/src/SealModule.cc b/RecoTauTag/HLTProducers/src/SealModule.cc index 3273cbb25548a..35eace6e10c33 100644 --- a/RecoTauTag/HLTProducers/src/SealModule.cc +++ b/RecoTauTag/HLTProducers/src/SealModule.cc @@ -20,6 +20,13 @@ #include "HLTPFTauPairLeadTrackDzMatchFilter.h" #include "RecoTauTag/HLTProducers/interface/L2TauPixelIsoTagProducer.h" +#include "DataFormats/JetReco/interface/PFJet.h" +#include "DataFormats/JetReco/interface/CaloJet.h" +#include "RecoTauTag/HLTProducers/interface/L1TJetsMatching.h" + +typedef L1TJetsMatching L1PFTJetsMatching ; +typedef L1TJetsMatching L1CaloTJetsMatching ; + DEFINE_EDM_PLUGIN(TrackingRegionProducerFactory, TauRegionalPixelSeedGenerator, "TauRegionalPixelSeedGenerator"); DEFINE_EDM_PLUGIN(TrackingRegionProducerFactory, TrackingRegionsFromBeamSpotAndL2Tau, "TrackingRegionsFromBeamSpotAndL2Tau"); DEFINE_EDM_PLUGIN(TrackingRegionProducerFactory, CandidateSeededTrackingRegionsProducer, "CandidateSeededTrackingRegionsProducer"); @@ -45,4 +52,6 @@ DEFINE_FWK_MODULE(VertexFromTrackProducer); //DEFINE_FWK_MODULE(L2TauPixelTrackMatch); DEFINE_FWK_MODULE(HLTPFTauPairLeadTrackDzMatchFilter); DEFINE_FWK_MODULE(L2TauPixelIsoTagProducer); +DEFINE_FWK_MODULE(L1CaloTJetsMatching); +DEFINE_FWK_MODULE(L1PFTJetsMatching); From 3409897a722cda59aafea7cca273295bb5da2330 Mon Sep 17 00:00:00 2001 From: vukasinmilosevic Date: Thu, 1 Jun 2017 18:30:43 +0200 Subject: [PATCH 2/8] changes vol.2 --- .../HLTProducers/interface/L1TJetsMatching.h | 15 ++++++++++----- RecoTauTag/HLTProducers/src/SealModule.cc | 8 ++++---- 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/RecoTauTag/HLTProducers/interface/L1TJetsMatching.h b/RecoTauTag/HLTProducers/interface/L1TJetsMatching.h index 63b2fe3e24e44..d7c2844c14ddf 100644 --- a/RecoTauTag/HLTProducers/interface/L1TJetsMatching.h +++ b/RecoTauTag/HLTProducers/interface/L1TJetsMatching.h @@ -43,6 +43,8 @@ #include "FWCore/Utilities/interface/EDMException.h" #include "DataFormats/JetReco/interface/PFJet.h" +#include "HLTrigger/HLTcore/interface/defaultModuleLabel.h" +#include "DataFormats/Math/interface/deltaR.h" #include #include @@ -81,10 +83,12 @@ class L1TJetsMatching: public edm::global::EDProducer<> { unsigned int i2 = 0; double mjj = 0; if (pfMatchedJets.size()>1){ - for (unsigned int i = 0; i < pfMatchedJets.size()-1; i++) + for (unsigned int i = 0; i < pfMatchedJets.size()-1; i++){ + + const T & myJet1 = (pfMatchedJets)[i]; + for (unsigned int j = i+1; j < pfMatchedJets.size(); j++) { - const T & myJet1 = (pfMatchedJets)[i]; const T & myJet2 = (pfMatchedJets)[j]; const double mjj_test = (myJet1.p4()+myJet2.p4()).M(); @@ -96,6 +100,7 @@ class L1TJetsMatching: public edm::global::EDProducer<> { i2 = j; } } + } const T & myJet1 = (pfMatchedJets)[i1]; const T & myJet2 = (pfMatchedJets)[i2]; @@ -164,11 +169,11 @@ class L1TJetsMatching: public edm::global::EDProducer<> { //std::cout<<"PFsize= "<size()<p4()).Vect()); + deltaR = reco::deltaR2(myJet.p4().Vect(), (jetCandRefVec[iL1Jet]->p4()).Vect()); if(deltaR < matchingR ) { pfMatchedJets->push_back(myJet); break; @@ -194,7 +199,7 @@ class L1TJetsMatching: public edm::global::EDProducer<> { desc.add ("pt2_Min",35.0)->setComment("Minimal pT2 of PFJets to match"); desc.add ("mjj_Min",650.0)->setComment("Minimal mjj of matched PFjets"); descriptions.setComment("This module produces collection of PFJetss matched to L1 Taus / Jets passing a HLT filter (Only p4 and vertex of returned PFJetss are set)."); - descriptions.add ("L1TJetsMatching",desc); + descriptions.add(defaultModuleLabel>(), desc); } diff --git a/RecoTauTag/HLTProducers/src/SealModule.cc b/RecoTauTag/HLTProducers/src/SealModule.cc index 35eace6e10c33..6f22e7dc23db7 100644 --- a/RecoTauTag/HLTProducers/src/SealModule.cc +++ b/RecoTauTag/HLTProducers/src/SealModule.cc @@ -24,8 +24,8 @@ #include "DataFormats/JetReco/interface/CaloJet.h" #include "RecoTauTag/HLTProducers/interface/L1TJetsMatching.h" -typedef L1TJetsMatching L1PFTJetsMatching ; -typedef L1TJetsMatching L1CaloTJetsMatching ; +typedef L1TJetsMatching L1TPFJetsMatching ; +typedef L1TJetsMatching L1TCaloJetsMatching ; DEFINE_EDM_PLUGIN(TrackingRegionProducerFactory, TauRegionalPixelSeedGenerator, "TauRegionalPixelSeedGenerator"); DEFINE_EDM_PLUGIN(TrackingRegionProducerFactory, TrackingRegionsFromBeamSpotAndL2Tau, "TrackingRegionsFromBeamSpotAndL2Tau"); @@ -52,6 +52,6 @@ DEFINE_FWK_MODULE(VertexFromTrackProducer); //DEFINE_FWK_MODULE(L2TauPixelTrackMatch); DEFINE_FWK_MODULE(HLTPFTauPairLeadTrackDzMatchFilter); DEFINE_FWK_MODULE(L2TauPixelIsoTagProducer); -DEFINE_FWK_MODULE(L1CaloTJetsMatching); -DEFINE_FWK_MODULE(L1PFTJetsMatching); +DEFINE_FWK_MODULE(L1TCaloJetsMatching); +DEFINE_FWK_MODULE(L1TPFJetsMatching); From 35183ce7b06b31e5b69a71af7a70c4b95e441249 Mon Sep 17 00:00:00 2001 From: vukasinmilosevic Date: Fri, 2 Jun 2017 10:54:41 +0200 Subject: [PATCH 3/8] Squared the matching dR value, changed names from R to R2 --- RecoTauTag/HLTProducers/interface/L1TJetsMatching.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/RecoTauTag/HLTProducers/interface/L1TJetsMatching.h b/RecoTauTag/HLTProducers/interface/L1TJetsMatching.h index d7c2844c14ddf..0ef4915b9576d 100644 --- a/RecoTauTag/HLTProducers/interface/L1TJetsMatching.h +++ b/RecoTauTag/HLTProducers/interface/L1TJetsMatching.h @@ -151,8 +151,8 @@ class L1TJetsMatching: public edm::global::EDProducer<> { unique_ptr> pfMatchedJets(new std::vector); std::pair,std::vector> output; - double deltaR = 1.0; - double matchingR = 0.5; + double deltaR2 = 1.0; + double matchingR2 = 0.25; // Getting HLT jets to be matched edm::Handle > pfJets; @@ -173,8 +173,8 @@ class L1TJetsMatching: public edm::global::EDProducer<> { for(unsigned int iL1Jet = 0; iL1Jet < jetCandRefVec.size(); iL1Jet++){ // Find the relative L2pfJets, to see if it has been reconstructed // if ((iJet<3) && (iL1Jet==0)) std::cout<p4()).Vect()); - if(deltaR < matchingR ) { + deltaR2 = reco::deltaR2(myJet.p4().Vect(), (jetCandRefVec[iL1Jet]->p4()).Vect()); + if(deltaR2 < matchingR2 ) { pfMatchedJets->push_back(myJet); break; } From ab9614e49cc6332506d668cdf45d63ec25fb5fe2 Mon Sep 17 00:00:00 2001 From: vukasinmilosevic Date: Fri, 2 Jun 2017 11:33:12 +0200 Subject: [PATCH 4/8] Added the option of getting the value of matchingR, removed deltaR2 --- RecoTauTag/HLTProducers/interface/L1TJetsMatching.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/RecoTauTag/HLTProducers/interface/L1TJetsMatching.h b/RecoTauTag/HLTProducers/interface/L1TJetsMatching.h index 0ef4915b9576d..fdec8cb67325e 100644 --- a/RecoTauTag/HLTProducers/interface/L1TJetsMatching.h +++ b/RecoTauTag/HLTProducers/interface/L1TJetsMatching.h @@ -64,7 +64,7 @@ class L1TJetsMatching: public edm::global::EDProducer<> { const double pt1_Min; const double pt2_Min; const double mjj_Min; - + const double matchingR; }; // // class decleration @@ -136,7 +136,8 @@ class L1TJetsMatching: public edm::global::EDProducer<> { jetTrigger_( consumes(iConfig.getParameter("L1JetTrigger") ) ), pt1_Min ( iConfig.getParameter("pt1_Min")), pt2_Min ( iConfig.getParameter("pt2_Min")), - mjj_Min ( iConfig.getParameter("mjj_Min")) + mjj_Min ( iConfig.getParameter("mjj_Min")), + matchingR ( iConfig.getParameter("matchingR")) { produces>("TwoJets"); produces>("ThreeJets"); @@ -151,8 +152,7 @@ class L1TJetsMatching: public edm::global::EDProducer<> { unique_ptr> pfMatchedJets(new std::vector); std::pair,std::vector> output; - double deltaR2 = 1.0; - double matchingR2 = 0.25; + double matchingR2 = matchingR*matchingR; // Getting HLT jets to be matched edm::Handle > pfJets; @@ -173,8 +173,7 @@ class L1TJetsMatching: public edm::global::EDProducer<> { for(unsigned int iL1Jet = 0; iL1Jet < jetCandRefVec.size(); iL1Jet++){ // Find the relative L2pfJets, to see if it has been reconstructed // if ((iJet<3) && (iL1Jet==0)) std::cout<p4()).Vect()); - if(deltaR2 < matchingR2 ) { + if(reco::deltaR2(myJet.p4().Vect(), (jetCandRefVec[iL1Jet]->p4()).Vect()) < matchingR2 ) { pfMatchedJets->push_back(myJet); break; } @@ -198,6 +197,7 @@ class L1TJetsMatching: public edm::global::EDProducer<> { desc.add ("pt1_Min",95.0)->setComment("Minimal pT1 of PFJets to match"); desc.add ("pt2_Min",35.0)->setComment("Minimal pT2 of PFJets to match"); desc.add ("mjj_Min",650.0)->setComment("Minimal mjj of matched PFjets"); + desc.add ("matchingR",0.5)->setComment("dR value used for matching"); descriptions.setComment("This module produces collection of PFJetss matched to L1 Taus / Jets passing a HLT filter (Only p4 and vertex of returned PFJetss are set)."); descriptions.add(defaultModuleLabel>(), desc); } From 9b164f14df79f56c319ac16fe786c3e6aa44456b Mon Sep 17 00:00:00 2001 From: vukasinmilosevic Date: Wed, 7 Jun 2017 11:25:19 +0200 Subject: [PATCH 5/8] Changes added. Also added condition (myJet.pt()>pt2Min) in the matching part. --- .../HLTProducers/interface/L1TJetsMatching.h | 31 ++++++++++--------- 1 file changed, 17 insertions(+), 14 deletions(-) diff --git a/RecoTauTag/HLTProducers/interface/L1TJetsMatching.h b/RecoTauTag/HLTProducers/interface/L1TJetsMatching.h index fdec8cb67325e..68e201cb114f4 100644 --- a/RecoTauTag/HLTProducers/interface/L1TJetsMatching.h +++ b/RecoTauTag/HLTProducers/interface/L1TJetsMatching.h @@ -61,10 +61,11 @@ class L1TJetsMatching: public edm::global::EDProducer<> { const edm::EDGetTokenT> jetSrc_; const edm::EDGetTokenT jetTrigger_; - const double pt1_Min; - const double pt2_Min; - const double mjj_Min; - const double matchingR; + const double pt1Min; + const double pt2Min; + const double mjjMin; + const double matchingR; + const double matchingR2; }; // // class decleration @@ -134,13 +135,15 @@ class L1TJetsMatching: public edm::global::EDProducer<> { L1TJetsMatching::L1TJetsMatching(const edm::ParameterSet& iConfig): jetSrc_ ( consumes> (iConfig.getParameter("JetSrc" ) ) ), jetTrigger_( consumes(iConfig.getParameter("L1JetTrigger") ) ), - pt1_Min ( iConfig.getParameter("pt1_Min")), - pt2_Min ( iConfig.getParameter("pt2_Min")), - mjj_Min ( iConfig.getParameter("mjj_Min")), - matchingR ( iConfig.getParameter("matchingR")) + pt1Min ( iConfig.getParameter("pt1Min")), + pt2Min ( iConfig.getParameter("pt2Min")), + mjjMin ( iConfig.getParameter("mjjMin")), + matchingR ( iConfig.getParameter("matchingR")), + matchingR2 ( matchingR*matchingR ) { produces>("TwoJets"); produces>("ThreeJets"); + } template< typename T> L1TJetsMatching::~L1TJetsMatching(){ } @@ -152,7 +155,7 @@ class L1TJetsMatching: public edm::global::EDProducer<> { unique_ptr> pfMatchedJets(new std::vector); std::pair,std::vector> output; - double matchingR2 = matchingR*matchingR; + // Getting HLT jets to be matched edm::Handle > pfJets; @@ -173,14 +176,14 @@ class L1TJetsMatching: public edm::global::EDProducer<> { for(unsigned int iL1Jet = 0; iL1Jet < jetCandRefVec.size(); iL1Jet++){ // Find the relative L2pfJets, to see if it has been reconstructed // if ((iJet<3) && (iL1Jet==0)) std::cout<p4()).Vect()) < matchingR2 ) { + if ((reco::deltaR2(myJet.p4().Vect(), (jetCandRefVec[iL1Jet]->p4()).Vect()) < matchingR2 ) && (myJet.pt()>pt2Min)) { pfMatchedJets->push_back(myJet); break; } } } - output= categorise(*pfMatchedJets,pt1_Min,pt2_Min, mjj_Min); + output= categorise(*pfMatchedJets,pt1Min,pt2Min, mjjMin); unique_ptr> output1(new std::vector(output.first)); unique_ptr> output2(new std::vector(output.second)); @@ -194,9 +197,9 @@ class L1TJetsMatching: public edm::global::EDProducer<> { edm::ParameterSetDescription desc; desc.add("L1JetTrigger", edm::InputTag("hltL1DiJetVBF"))->setComment("Name of trigger filter" ); desc.add("JetSrc" , edm::InputTag("hltAK4PFJetsTightIDCorrected"))->setComment("Input collection of PFJets"); - desc.add ("pt1_Min",95.0)->setComment("Minimal pT1 of PFJets to match"); - desc.add ("pt2_Min",35.0)->setComment("Minimal pT2 of PFJets to match"); - desc.add ("mjj_Min",650.0)->setComment("Minimal mjj of matched PFjets"); + desc.add ("pt1Min",95.0)->setComment("Minimal pT1 of PFJets to match"); + desc.add ("pt2Min",35.0)->setComment("Minimal pT2 of PFJets to match"); + desc.add ("mjjMin",650.0)->setComment("Minimal mjj of matched PFjets"); desc.add ("matchingR",0.5)->setComment("dR value used for matching"); descriptions.setComment("This module produces collection of PFJetss matched to L1 Taus / Jets passing a HLT filter (Only p4 and vertex of returned PFJetss are set)."); descriptions.add(defaultModuleLabel>(), desc); From b14b5d677874ecdafba35e0957d70c060d2557c0 Mon Sep 17 00:00:00 2001 From: vukasinmilosevic Date: Wed, 7 Jun 2017 11:48:29 +0200 Subject: [PATCH 6/8] added changes vol.2 --- .../HLTProducers/interface/L1TJetsMatching.h | 32 +++++++++---------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/RecoTauTag/HLTProducers/interface/L1TJetsMatching.h b/RecoTauTag/HLTProducers/interface/L1TJetsMatching.h index 68e201cb114f4..98a40c6abe0bd 100644 --- a/RecoTauTag/HLTProducers/interface/L1TJetsMatching.h +++ b/RecoTauTag/HLTProducers/interface/L1TJetsMatching.h @@ -61,11 +61,11 @@ class L1TJetsMatching: public edm::global::EDProducer<> { const edm::EDGetTokenT> jetSrc_; const edm::EDGetTokenT jetTrigger_; - const double pt1Min; - const double pt2Min; - const double mjjMin; - const double matchingR; - const double matchingR2; + const double pt1Min_; + const double pt2Min_; + const double mjjMin_; + const double matchingR_; + const double matchingR2_; }; // // class decleration @@ -135,11 +135,11 @@ class L1TJetsMatching: public edm::global::EDProducer<> { L1TJetsMatching::L1TJetsMatching(const edm::ParameterSet& iConfig): jetSrc_ ( consumes> (iConfig.getParameter("JetSrc" ) ) ), jetTrigger_( consumes(iConfig.getParameter("L1JetTrigger") ) ), - pt1Min ( iConfig.getParameter("pt1Min")), - pt2Min ( iConfig.getParameter("pt2Min")), - mjjMin ( iConfig.getParameter("mjjMin")), - matchingR ( iConfig.getParameter("matchingR")), - matchingR2 ( matchingR*matchingR ) + pt1Min_ ( iConfig.getParameter("pt1Min_")), + pt2Min_ ( iConfig.getParameter("pt2Min_")), + mjjMin_ ( iConfig.getParameter("mjjMin_")), + matchingR_ ( iConfig.getParameter("matchingR_")), + matchingR2_ ( matchingR_*matchingR_ ) { produces>("TwoJets"); produces>("ThreeJets"); @@ -176,14 +176,14 @@ class L1TJetsMatching: public edm::global::EDProducer<> { for(unsigned int iL1Jet = 0; iL1Jet < jetCandRefVec.size(); iL1Jet++){ // Find the relative L2pfJets, to see if it has been reconstructed // if ((iJet<3) && (iL1Jet==0)) std::cout<p4()).Vect()) < matchingR2 ) && (myJet.pt()>pt2Min)) { + if ((reco::deltaR2(myJet.p4().Vect(), (jetCandRefVec[iL1Jet]->p4()).Vect()) < matchingR2_ ) && (myJet.pt()>pt2Min_)) { pfMatchedJets->push_back(myJet); break; } } } - output= categorise(*pfMatchedJets,pt1Min,pt2Min, mjjMin); + output= categorise(*pfMatchedJets,pt1Min_,pt2Min_, mjjMin_); unique_ptr> output1(new std::vector(output.first)); unique_ptr> output2(new std::vector(output.second)); @@ -197,10 +197,10 @@ class L1TJetsMatching: public edm::global::EDProducer<> { edm::ParameterSetDescription desc; desc.add("L1JetTrigger", edm::InputTag("hltL1DiJetVBF"))->setComment("Name of trigger filter" ); desc.add("JetSrc" , edm::InputTag("hltAK4PFJetsTightIDCorrected"))->setComment("Input collection of PFJets"); - desc.add ("pt1Min",95.0)->setComment("Minimal pT1 of PFJets to match"); - desc.add ("pt2Min",35.0)->setComment("Minimal pT2 of PFJets to match"); - desc.add ("mjjMin",650.0)->setComment("Minimal mjj of matched PFjets"); - desc.add ("matchingR",0.5)->setComment("dR value used for matching"); + desc.add ("pt1Min_",95.0)->setComment("Minimal pT1 of PFJets to match"); + desc.add ("pt2Min_",35.0)->setComment("Minimal pT2 of PFJets to match"); + desc.add ("mjjMin_",650.0)->setComment("Minimal mjj of matched PFjets"); + desc.add ("matchingR_",0.5)->setComment("dR value used for matching"); descriptions.setComment("This module produces collection of PFJetss matched to L1 Taus / Jets passing a HLT filter (Only p4 and vertex of returned PFJetss are set)."); descriptions.add(defaultModuleLabel>(), desc); } From f78a31c975547d23391f7542338e866ad0378ebe Mon Sep 17 00:00:00 2001 From: vukasinmilosevic Date: Wed, 7 Jun 2017 12:01:12 +0200 Subject: [PATCH 7/8] Changes vol.3 --- .../HLTProducers/interface/L1TJetsMatching.h | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/RecoTauTag/HLTProducers/interface/L1TJetsMatching.h b/RecoTauTag/HLTProducers/interface/L1TJetsMatching.h index 98a40c6abe0bd..6f5922f1712a7 100644 --- a/RecoTauTag/HLTProducers/interface/L1TJetsMatching.h +++ b/RecoTauTag/HLTProducers/interface/L1TJetsMatching.h @@ -135,10 +135,10 @@ class L1TJetsMatching: public edm::global::EDProducer<> { L1TJetsMatching::L1TJetsMatching(const edm::ParameterSet& iConfig): jetSrc_ ( consumes> (iConfig.getParameter("JetSrc" ) ) ), jetTrigger_( consumes(iConfig.getParameter("L1JetTrigger") ) ), - pt1Min_ ( iConfig.getParameter("pt1Min_")), - pt2Min_ ( iConfig.getParameter("pt2Min_")), - mjjMin_ ( iConfig.getParameter("mjjMin_")), - matchingR_ ( iConfig.getParameter("matchingR_")), + pt1Min_ ( iConfig.getParameter("pt1Min")), + pt2Min_ ( iConfig.getParameter("pt2Min")), + mjjMin_ ( iConfig.getParameter("mjjMin")), + matchingR_ ( iConfig.getParameter("matchingR")), matchingR2_ ( matchingR_*matchingR_ ) { produces>("TwoJets"); @@ -197,10 +197,10 @@ class L1TJetsMatching: public edm::global::EDProducer<> { edm::ParameterSetDescription desc; desc.add("L1JetTrigger", edm::InputTag("hltL1DiJetVBF"))->setComment("Name of trigger filter" ); desc.add("JetSrc" , edm::InputTag("hltAK4PFJetsTightIDCorrected"))->setComment("Input collection of PFJets"); - desc.add ("pt1Min_",95.0)->setComment("Minimal pT1 of PFJets to match"); - desc.add ("pt2Min_",35.0)->setComment("Minimal pT2 of PFJets to match"); - desc.add ("mjjMin_",650.0)->setComment("Minimal mjj of matched PFjets"); - desc.add ("matchingR_",0.5)->setComment("dR value used for matching"); + desc.add ("pt1Min",95.0)->setComment("Minimal pT1 of PFJets to match"); + desc.add ("pt2Min",35.0)->setComment("Minimal pT2 of PFJets to match"); + desc.add ("mjjMin",650.0)->setComment("Minimal mjj of matched PFjets"); + desc.add ("matchingR",0.5)->setComment("dR value used for matching"); descriptions.setComment("This module produces collection of PFJetss matched to L1 Taus / Jets passing a HLT filter (Only p4 and vertex of returned PFJetss are set)."); descriptions.add(defaultModuleLabel>(), desc); } From 4112231459b803bc5c04ad085473bf7f8b0f029d Mon Sep 17 00:00:00 2001 From: vukasinmilosevic Date: Thu, 8 Jun 2017 14:13:40 +0200 Subject: [PATCH 8/8] Removing .Vect() --- RecoTauTag/HLTProducers/interface/L1TJetsMatching.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/RecoTauTag/HLTProducers/interface/L1TJetsMatching.h b/RecoTauTag/HLTProducers/interface/L1TJetsMatching.h index 6f5922f1712a7..39b2b753b493e 100644 --- a/RecoTauTag/HLTProducers/interface/L1TJetsMatching.h +++ b/RecoTauTag/HLTProducers/interface/L1TJetsMatching.h @@ -176,7 +176,7 @@ class L1TJetsMatching: public edm::global::EDProducer<> { for(unsigned int iL1Jet = 0; iL1Jet < jetCandRefVec.size(); iL1Jet++){ // Find the relative L2pfJets, to see if it has been reconstructed // if ((iJet<3) && (iL1Jet==0)) std::cout<p4()).Vect()) < matchingR2_ ) && (myJet.pt()>pt2Min_)) { + if ((reco::deltaR2(myJet.p4(), jetCandRefVec[iL1Jet]->p4()) < matchingR2_ ) && (myJet.pt()>pt2Min_)) { pfMatchedJets->push_back(myJet); break; }