From 4a0b656dbaa8777b00213f74f7d6e09e1cbe36c7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Brochet?= Date: Wed, 14 Dec 2016 11:37:39 +0100 Subject: [PATCH] Move to cMVAv2 b-tagging discriminant --- interface/HHAnalyzer.h | 14 +++++----- interface/Types.h | 4 +-- plugins/HHAnalyzer.cc | 60 ++++++++++++++++++++++------------------- src/classes_def.xml | 33 ++++++++++++++++------- test/HHConfiguration.py | 11 +++++--- 5 files changed, 72 insertions(+), 50 deletions(-) diff --git a/interface/HHAnalyzer.h b/interface/HHAnalyzer.h index 09b4767..c682e44 100644 --- a/interface/HHAnalyzer.h +++ b/interface/HHAnalyzer.h @@ -82,16 +82,16 @@ class HHAnalyzer: public Framework::Analyzer { std::vector llmet; std::vector jj; std::vector llmetjj; - std::vector llmetjj_csv; + std::vector llmetjj_cmva; // some few custom candidates, for convenience // Januray 2016: preapproval freezing custom candidates - BRANCH(llmetjj_HWWleptons_nobtag_csv, std::vector); - BRANCH(llmetjj_HWWleptons_btagL_csv, std::vector); - BRANCH(llmetjj_HWWleptons_btagM_csv, std::vector); - BRANCH(llmetjj_HWWleptons_btagT_csv, std::vector); + BRANCH(llmetjj_HWWleptons_nobtag_cmva, std::vector); + BRANCH(llmetjj_HWWleptons_btagL_cmva, std::vector); + BRANCH(llmetjj_HWWleptons_btagM_cmva, std::vector); + BRANCH(llmetjj_HWWleptons_btagT_cmva, std::vector); // October 2016: adding some asymmetric btag candidates, for study - BRANCH(llmetjj_HWWleptons_btagLM_csv, std::vector); - BRANCH(llmetjj_HWWleptons_btagMT_csv, std::vector); + BRANCH(llmetjj_HWWleptons_btagLM_cmva, std::vector); + BRANCH(llmetjj_HWWleptons_btagMT_cmva, std::vector); virtual void analyze(const edm::Event&, const edm::EventSetup&, const ProducersManager&, const AnalyzersManager&, const CategoryManager&) override; virtual void registerCategories(CategoryManager& manager, const edm::ParameterSet& config) override; diff --git a/interface/Types.h b/interface/Types.h index 873f72c..56ca81e 100644 --- a/interface/Types.h +++ b/interface/Types.h @@ -120,7 +120,7 @@ namespace HH { bool btag_M; bool btag_T; float CSV; - float JP; + float CMVAv2; bool gen_matched_bParton; bool gen_matched_bHadron; bool gen_matched; @@ -149,7 +149,7 @@ namespace HH { bool btag_TM; bool btag_TT; float sumCSV; - float sumJP; + float sumCMVAv2; float DR_j_j; float DPhi_j_j; float ht_j_j; diff --git a/plugins/HHAnalyzer.cc b/plugins/HHAnalyzer.cc index 2a240f0..161e64b 100644 --- a/plugins/HHAnalyzer.cc +++ b/plugins/HHAnalyzer.cc @@ -385,7 +385,7 @@ void HHAnalyzer::analyze(const edm::Event& event, const edm::EventSetup&, const myjet.id_T = alljets.passTightID[ijet]; myjet.id_TLV = alljets.passTightLeptonVetoID[ijet]; myjet.CSV = alljets.getBTagDiscriminant(ijet, "pfCombinedInclusiveSecondaryVertexV2BJetTags"); - myjet.JP = alljets.getBTagDiscriminant(ijet, "pfJetProbabilityBJetTags"); + myjet.CMVAv2 = alljets.getBTagDiscriminant(ijet, "pfCombinedMVAV2BJetTags"); float mybtag = alljets.getBTagDiscriminant(ijet, m_jet_bDiscrName); myjet.btag_L = mybtag > m_jet_bDiscrCut_loose; myjet.btag_M = mybtag > m_jet_bDiscrCut_medium; @@ -439,7 +439,7 @@ void HHAnalyzer::analyze(const edm::Event& event, const edm::EventSetup&, const myjj.btag_TM = (jets[ijet1].btag_T && jets[ijet2].btag_M) || (jets[ijet2].btag_T && jets[ijet1].btag_M); myjj.btag_TT = jets[ijet1].btag_T && jets[ijet2].btag_T; myjj.sumCSV = jets[ijet1].CSV + jets[ijet2].CSV; - myjj.sumJP = jets[ijet1].JP + jets[ijet2].JP; + myjj.sumCMVAv2 = jets[ijet1].CMVAv2 + jets[ijet2].CMVAv2; myjj.DR_j_j = ROOT::Math::VectorUtil::DeltaR(jets[ijet1].p4, jets[ijet2].p4); myjj.DPhi_j_j = fabs(ROOT::Math::VectorUtil::DeltaPhi(jets[ijet1].p4, jets[ijet2].p4)); myjj.ht_j_j = jets[ijet1].p4.Pt() + jets[ijet2].p4.Pt(); @@ -515,7 +515,7 @@ void HHAnalyzer::analyze(const edm::Event& event, const edm::EventSetup&, const myllmetjj.btag_TM = jj[ijj].btag_TM; myllmetjj.btag_TT = jj[ijj].btag_TT; myllmetjj.sumCSV = jj[ijj].sumCSV; - myllmetjj.sumJP = jj[ijj].sumJP; + myllmetjj.sumCMVAv2 = jj[ijj].sumCMVAv2; myllmetjj.DR_j_j = jj[ijj].DR_j_j; myllmetjj.DPhi_j_j = jj[ijj].DPhi_j_j; myllmetjj.ht_j_j = jj[ijj].ht_j_j; @@ -645,36 +645,40 @@ void HHAnalyzer::analyze(const edm::Event& event, const edm::EventSetup&, const } - // Sort the collections -// llmetjj_ht.clear(); llmetjj_ht = llmetjj; -// llmetjj_pt.clear(); llmetjj_pt = llmetjj; -// llmetjj_mh.clear(); llmetjj_mh = llmetjj; - llmetjj_csv.clear(); llmetjj_csv = llmetjj; -// llmetjj_ptOverM.clear(); llmetjj_ptOverM = llmetjj; -// std::sort(llmetjj_ht.begin(), llmetjj_ht.end(), [&](HH::DileptonMetDijet& a, const HH::DileptonMetDijet& b){return (a.jet1_p4.Pt() + a.jet2_p4.Pt()) > (b.jet1_p4.Pt() + bjet2_p4.Pt());}); -// std::sort(llmetjj_pt.begin(), llmetjj_pt.end(), [&](HH::DileptonMetDijet& a, const HH::DileptonMetDijet& b){return a.jj_p4.Pt() > b.jj_p4.Pt();}); -// std::sort(llmetjj_mh.begin(), llmetjj_mh.end(), [&](HH::DileptonMetDijet& a, const HH::DileptonMetDijet& b){return fabs(a.jj_p4.M() - mh) > fabs(b.jj_p4.M() - mh);}); - std::sort(llmetjj_csv.begin(), llmetjj_csv.end(), [&](HH::DileptonMetDijet& a, const HH::DileptonMetDijet& b){return a.sumCSV > b.sumCSV;}); -// std::sort(llmetjj_ptOverM.begin(), llmetjj_ptOverM.end(), [&](HH::DileptonMetDijet& a, const HH::DileptonMetDijet& b){return (a.jj_p4.Pt() / a.jj_p4.M()) > (b.jj_p4.Pt() / b.jj_p4.M());}); + llmetjj_cmva.clear(); + llmetjj_cmva = llmetjj; + + std::sort(llmetjj_cmva.begin(), llmetjj_cmva.end(), [&](HH::DileptonMetDijet& a, const HH::DileptonMetDijet& b){ return a.sumCMVAv2 > b.sumCMVAv2; }); // Adding some few custom candidates, for convenience - for (auto &myllmetjj_csv: llmetjj_csv) { - if (!myllmetjj_csv.id_HWWHWW) continue; - if (!myllmetjj_csv.iso_HWWHWW) continue; + for (auto &myllmetjj_cmva: llmetjj_cmva) { + + if (!myllmetjj_cmva.id_HWWHWW) + continue; + + if (!myllmetjj_cmva.iso_HWWHWW) + continue; + // jetID::L is enforced while filling the jet collection - llmetjj_HWWleptons_nobtag_csv.push_back(myllmetjj_csv); - if (myllmetjj_csv.btag_LL) - llmetjj_HWWleptons_btagL_csv.push_back(myllmetjj_csv); - if (myllmetjj_csv.btag_MM) - llmetjj_HWWleptons_btagM_csv.push_back(myllmetjj_csv); - if (myllmetjj_csv.btag_TT) - llmetjj_HWWleptons_btagT_csv.push_back(myllmetjj_csv); + + llmetjj_HWWleptons_nobtag_cmva.push_back(myllmetjj_cmva); + + if (myllmetjj_cmva.btag_LL) + llmetjj_HWWleptons_btagL_cmva.push_back(myllmetjj_cmva); + + if (myllmetjj_cmva.btag_MM) + llmetjj_HWWleptons_btagM_cmva.push_back(myllmetjj_cmva); + + if (myllmetjj_cmva.btag_TT) + llmetjj_HWWleptons_btagT_cmva.push_back(myllmetjj_cmva); + // October 2016: asymmetric btag candidates - if (myllmetjj_csv.btag_LM || myllmetjj_csv.btag_ML) - llmetjj_HWWleptons_btagLM_csv.push_back(myllmetjj_csv); - if (myllmetjj_csv.btag_MT || myllmetjj_csv.btag_TM) - llmetjj_HWWleptons_btagMT_csv.push_back(myllmetjj_csv); + if (myllmetjj_cmva.btag_LM || myllmetjj_cmva.btag_ML) + llmetjj_HWWleptons_btagLM_cmva.push_back(myllmetjj_cmva); + + if (myllmetjj_cmva.btag_MT || myllmetjj_cmva.btag_TM) + llmetjj_HWWleptons_btagMT_cmva.push_back(myllmetjj_cmva); } diff --git a/src/classes_def.xml b/src/classes_def.xml index d365c3d..8cc7847 100644 --- a/src/classes_def.xml +++ b/src/classes_def.xml @@ -1,21 +1,36 @@ - - + + + - + + + - + + + - + + + - + + + - + + + - + + + - + + + diff --git a/test/HHConfiguration.py b/test/HHConfiguration.py index e56dc5f..a0f110e 100644 --- a/test/HHConfiguration.py +++ b/test/HHConfiguration.py @@ -56,11 +56,14 @@ electrons_hlt_safe_wp_name = cms.untracked.string("cutBasedElectronHLTPreselection-Summer16-V1"), jetEtaCut = cms.untracked.double(2.4), jetPtCut = cms.untracked.double(20), + # BTAG INFO - discr_name = cms.untracked.string("pfCombinedInclusiveSecondaryVertexV2BJetTags"), - discr_cut_loose = cms.untracked.double(0.460), - discr_cut_medium = cms.untracked.double(0.800), - discr_cut_tight = cms.untracked.double(0.935), + # Working points from https://twiki.cern.ch/twiki/bin/viewauth/CMS/BtagRecommendation80X + discr_name = cms.untracked.string("pfCombinedMVAV2BJetTags"), + discr_cut_loose = cms.untracked.double(-0.715), + discr_cut_medium = cms.untracked.double(0.185), + discr_cut_tight = cms.untracked.double(0.875), + minDR_l_j_Cut = cms.untracked.double(0.3), hltDRCut = cms.untracked.double(0.1), hltDPtCut = cms.untracked.double(0.5), # cut will be DPt/Pt < hltDPtCut