From a616cfcee823a8cf3d00050a16510121a562f958 Mon Sep 17 00:00:00 2001 From: Marino Missiroli Date: Mon, 21 Aug 2023 15:23:22 +0200 Subject: [PATCH] remove plugin template HLTJetTagWithMatching --- ...BTagPFPuppiDeepCSV0p865DoubleEta2p4_cfi.py | 5 +- ...PFPuppiDeepFlavour0p935DoubleEta2p4_cfi.py | 5 +- .../btau/plugins/HLTJetTagWithMatching.cc | 145 ------------------ .../btau/plugins/HLTJetTagWithMatching.h | 52 ------- HLTrigger/btau/plugins/modules.cc | 7 - 5 files changed, 6 insertions(+), 208 deletions(-) delete mode 100644 HLTrigger/btau/plugins/HLTJetTagWithMatching.cc delete mode 100644 HLTrigger/btau/plugins/HLTJetTagWithMatching.h diff --git a/HLTrigger/Configuration/python/HLT_75e33/modules/hltBTagPFPuppiDeepCSV0p865DoubleEta2p4_cfi.py b/HLTrigger/Configuration/python/HLT_75e33/modules/hltBTagPFPuppiDeepCSV0p865DoubleEta2p4_cfi.py index 5b6aaccac8fe6..1f65c755c10d6 100644 --- a/HLTrigger/Configuration/python/HLT_75e33/modules/hltBTagPFPuppiDeepCSV0p865DoubleEta2p4_cfi.py +++ b/HLTrigger/Configuration/python/HLT_75e33/modules/hltBTagPFPuppiDeepCSV0p865DoubleEta2p4_cfi.py @@ -1,12 +1,13 @@ import FWCore.ParameterSet.Config as cms -hltBTagPFPuppiDeepCSV0p865DoubleEta2p4 = cms.EDFilter("HLTPFJetTagWithMatching", +hltBTagPFPuppiDeepCSV0p865DoubleEta2p4 = cms.EDFilter("HLTPFJetTag", JetTags = cms.InputTag("hltDeepCombinedSecondaryVertexBJetTagsPFPuppiModEta2p4","probb"), Jets = cms.InputTag("hltPFPuppiJetForBtagEta2p4"), MaxTag = cms.double(999999.0), MinJets = cms.int32(2), MinTag = cms.double(0.865), TriggerType = cms.int32(86), - deltaR = cms.double(0.1), + MatchJetsByDeltaR = cms.bool(True), + MaxJetDeltaR = cms.double(0.1), saveTags = cms.bool(True) ) diff --git a/HLTrigger/Configuration/python/HLT_75e33/modules/hltBTagPFPuppiDeepFlavour0p935DoubleEta2p4_cfi.py b/HLTrigger/Configuration/python/HLT_75e33/modules/hltBTagPFPuppiDeepFlavour0p935DoubleEta2p4_cfi.py index f15d0b51fdcbb..b2acbd2fd5f75 100644 --- a/HLTrigger/Configuration/python/HLT_75e33/modules/hltBTagPFPuppiDeepFlavour0p935DoubleEta2p4_cfi.py +++ b/HLTrigger/Configuration/python/HLT_75e33/modules/hltBTagPFPuppiDeepFlavour0p935DoubleEta2p4_cfi.py @@ -1,12 +1,13 @@ import FWCore.ParameterSet.Config as cms -hltBTagPFPuppiDeepFlavour0p935DoubleEta2p4 = cms.EDFilter("HLTPFJetTagWithMatching", +hltBTagPFPuppiDeepFlavour0p935DoubleEta2p4 = cms.EDFilter("HLTPFJetTag", JetTags = cms.InputTag("hltPfDeepFlavourJetTagsModEta2p4","probb"), Jets = cms.InputTag("hltPFPuppiJetForBtagEta2p4"), MaxTag = cms.double(999999.0), MinJets = cms.int32(2), MinTag = cms.double(0.935), TriggerType = cms.int32(86), - deltaR = cms.double(0.1), + MatchJetsByDeltaR = cms.bool(True), + MaxJetDeltaR = cms.double(0.1), saveTags = cms.bool(True) ) diff --git a/HLTrigger/btau/plugins/HLTJetTagWithMatching.cc b/HLTrigger/btau/plugins/HLTJetTagWithMatching.cc deleted file mode 100644 index 696625fe60ce7..0000000000000 --- a/HLTrigger/btau/plugins/HLTJetTagWithMatching.cc +++ /dev/null @@ -1,145 +0,0 @@ -/** \class HLTJetTagWithMatching - * - * This class is an HLTFilter (a spcialized EDFilter) implementing - * tagged multi-jet trigger for b and tau. - * It should be run after the normal multi-jet trigger. - * It is like HLTJetTag, but it loop on jets collection instead of jetTag collection. - * - */ - -#include -#include - -#include "FWCore/MessageLogger/interface/MessageLogger.h" -#include "DataFormats/Common/interface/Handle.h" -#include "DataFormats/Common/interface/RefToBase.h" -#include "DataFormats/JetReco/interface/CaloJetCollection.h" -#include "DataFormats/BTauReco/interface/JetTag.h" -#include "DataFormats/HLTReco/interface/TriggerFilterObjectWithRefs.h" -#include "HLTrigger/HLTcore/interface/HLTFilter.h" -#include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h" -#include "FWCore/ParameterSet/interface/ParameterSetDescription.h" -#include "DataFormats/Math/interface/deltaR.h" -#include "HLTrigger/HLTcore/interface/defaultModuleLabel.h" - -#include "HLTJetTagWithMatching.h" - -// -// constructors and destructor -// - -template -HLTJetTagWithMatching::HLTJetTagWithMatching(const edm::ParameterSet& config) - : HLTFilter(config), - m_Jets(config.getParameter("Jets")), - m_JetTags(config.getParameter("JetTags")), - m_MinTag(config.getParameter("MinTag")), - m_MaxTag(config.getParameter("MaxTag")), - m_MinJets(config.getParameter("MinJets")), - m_TriggerType(config.getParameter("TriggerType")), - m_deltaR(config.getParameter("deltaR")) { - m_JetsToken = consumes>(m_Jets), m_JetTagsToken = consumes(m_JetTags), - - edm::LogInfo("") << " (HLTJetTagWithMatching) trigger cuts: " << std::endl - << "\ttype of jets used: " << m_Jets.encode() << std::endl - << "\ttype of tagged jets used: " << m_JetTags.encode() << std::endl - << "\tmin/max tag value: [" << m_MinTag << ".." << m_MaxTag << "]" << std::endl - << "\tmin no. tagged jets: " << m_MinJets << "\tTriggerType: " << m_TriggerType << std::endl; -} - -template -HLTJetTagWithMatching::~HLTJetTagWithMatching() = default; - -template -float HLTJetTagWithMatching::findCSV(const typename std::vector::const_iterator& jet, - const reco::JetTagCollection& jetTags, - float minDr) { - float tmpCSV = -20; - for (auto jetb = jetTags.begin(); (jetb != jetTags.end()); ++jetb) { - float tmpDr = reco::deltaR(*jet, *(jetb->first)); - - if (tmpDr < minDr) { - minDr = tmpDr; - tmpCSV = jetb->second; - } - } - return tmpCSV; -} - -template -void HLTJetTagWithMatching::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { - edm::ParameterSetDescription desc; - makeHLTFilterDescription(desc); - desc.add("Jets", edm::InputTag("hltJetCollection")); - desc.add("JetTags", edm::InputTag("HLTJetTagWithMatchingCollection")); - desc.add("MinTag", 2.0); - desc.add("MaxTag", 999999.0); - desc.add("MinJets", 1); - desc.add("TriggerType", 0); - desc.add("deltaR", 0.1); - descriptions.add(defaultModuleLabel>(), desc); -} - -// -// member functions -// - -// ------------ method called to produce the data ------------ -template -bool HLTJetTagWithMatching::hltFilter(edm::Event& event, - const edm::EventSetup& setup, - trigger::TriggerFilterObjectWithRefs& filterproduct) const { - using namespace std; - using namespace edm; - using namespace reco; - - typedef vector TCollection; - typedef Ref TRef; - - edm::Handle h_Jets; - event.getByToken(m_JetsToken, h_Jets); - if (saveTags()) - filterproduct.addCollectionTag(m_Jets); - - edm::Handle h_JetTags; - event.getByToken(m_JetTagsToken, h_JetTags); - - // check if the product this one depends on is available - auto const& handle = h_JetTags; - auto const& dependent = handle->keyProduct(); - if (not dependent.isNull() and not dependent.hasCache()) { - // only an empty AssociationVector can have a invalid dependent collection - edm::StableProvenance const& dependent_provenance = event.getStableProvenance(dependent.id()); - if (dependent_provenance.branchDescription().dropped()) - // FIXME the error message should be made prettier - throw edm::Exception(edm::errors::ProductNotFound) - << "Product " << handle.provenance()->branchName() << " requires product " - << dependent_provenance.branchName() << ", which has been dropped"; - } - - TRef jetRef; - - // Look at all jets in decreasing order of Et. - int nJet = 0; - int nTag = 0; - for (typename TCollection::const_iterator jet = h_Jets->begin(); jet != h_Jets->end(); ++jet) { - jetRef = TRef(h_Jets, nJet); - LogTrace("") << "Jet " << nJet << " : Et = " << jet->et() - << " , tag value = " << findCSV(jet, *h_JetTags, m_deltaR); - ++nJet; - // Check if jet is tagged. - if ((m_MinTag <= findCSV(jet, *h_JetTags, m_deltaR)) and (findCSV(jet, *h_JetTags, m_deltaR) <= m_MaxTag)) { - ++nTag; - - // Store a reference to the jets which passed tagging cuts - filterproduct.addObject(m_TriggerType, jetRef); - } - } - - // filter decision - bool accept = (nTag >= m_MinJets); - - edm::LogInfo("") << " trigger accept ? = " << accept << " nTag/nJet = " << nTag << "/" << nJet << std::endl; - - return accept; -} diff --git a/HLTrigger/btau/plugins/HLTJetTagWithMatching.h b/HLTrigger/btau/plugins/HLTJetTagWithMatching.h deleted file mode 100644 index 7809f0fd20bc3..0000000000000 --- a/HLTrigger/btau/plugins/HLTJetTagWithMatching.h +++ /dev/null @@ -1,52 +0,0 @@ -#ifndef HLTrigger_btau_HLTJetTagWithMatching_h -#define HLTrigger_btau_HLTJetTagWithMatching_h - -/** \class HLTJetTagWithMatching - * - * This class is an HLTFilter (a spcialized EDFilter) implementing - * tagged multi-jet trigger for b and tau. - * It should be run after the normal multi-jet trigger. - * It is like HLTJetTag, but it loop on jets collection instead of jetTag collection. - * - */ - -#include - -#include "FWCore/Framework/interface/Frameworkfwd.h" -#include "FWCore/Utilities/interface/InputTag.h" -#include "HLTrigger/HLTcore/interface/HLTFilter.h" -#include "DataFormats/BTauReco/interface/JetTag.h" - -namespace edm { - class ConfigurationDescriptions; -} - -// -// class declaration -// - -template -class HLTJetTagWithMatching : public HLTFilter { -public: - explicit HLTJetTagWithMatching(const edm::ParameterSet& config); - ~HLTJetTagWithMatching() override; - static float findCSV(const typename std::vector::const_iterator& jet, - const reco::JetTagCollection& jetTags, - float minDr = 0.1); - static void fillDescriptions(edm::ConfigurationDescriptions& descriptions); - bool hltFilter(edm::Event& event, - const edm::EventSetup& setup, - trigger::TriggerFilterObjectWithRefs& filterproduct) const override; - -private: - edm::InputTag m_Jets; // module label of input JetCollection - edm::EDGetTokenT > m_JetsToken; - edm::InputTag m_JetTags; // module label of input JetTagCollection - edm::EDGetTokenT m_JetTagsToken; - double m_MinTag, m_MaxTag; // tag descriminator cuts applied to each jet - int m_MinJets; // min. number of jets required to be tagged - int m_TriggerType; - double m_deltaR; // deltaR used to match jet with jetTags -}; - -#endif // HLTrigger_btau_HLTJetTagWithMatching_h diff --git a/HLTrigger/btau/plugins/modules.cc b/HLTrigger/btau/plugins/modules.cc index cbf5c94393a18..41766bc2a7696 100644 --- a/HLTrigger/btau/plugins/modules.cc +++ b/HLTrigger/btau/plugins/modules.cc @@ -76,13 +76,6 @@ typedef HLTSumJetTag HLTSumPFJetTag; DEFINE_FWK_MODULE(HLTSumCaloJetTag); DEFINE_FWK_MODULE(HLTSumPFJetTag); -#include "HLTJetTagWithMatching.h" -#include "HLTJetTagWithMatching.cc" -typedef HLTJetTagWithMatching HLTCaloJetTagWithMatching; -typedef HLTJetTagWithMatching HLTPFJetTagWithMatching; -DEFINE_FWK_MODULE(HLTCaloJetTagWithMatching); -DEFINE_FWK_MODULE(HLTPFJetTagWithMatching); - #include "HLTCollectionProducer.h" typedef HLTCollectionProducer HLTCaloJetCollectionProducer; typedef HLTCollectionProducer HLTPFJetCollectionProducer;