Commit 86539b24 authored by Benjamin Fischer's avatar Benjamin Fischer
Browse files

tth: join low+high electron reco SF

see bbww_dl@b84d2ef2
ref common#81
parent 7f486b1d
......@@ -24,8 +24,7 @@ btagWeight_lfstats2=CMS_btag_lfstats2_2016
btagWeight_subjet=CMS_btag_subjet_2016
electron_id_loose_01=CMS_eff_e_id_loose01_2016
electron_id_loose_02=CMS_eff_e_id_loose02_2016
electron_reco_high=CMS_eff_e_reco_high_2016
electron_reco_low=CMS_eff_e_reco_low_2016
electron_reco=CMS_eff_e_reco_2016
electron_tth_loose=CMS_eff_e_id_tth_2016
fake_electrons_barrel=CMS_bbwwsl_FakeRate_e_barrel_2016
fake_electrons_nom=CMS_bbwwsl_FakeRate_e_norm_2016
......@@ -54,4 +53,4 @@ m_top_unc_ggHH=m_top_unc_HH
nc_nom_e=CMS_bbwwsl_FakeRate_e_nc_nom_2016
nc_nom_mu=CMS_bbwwsl_FakeRate_m_nc_nom_2016
nc_res_e=CMS_bbwwsl_FakeRate_e_nc_res_2016
nc_res_mu=CMS_bbwwsl_FakeRate_m_nc_res_2016
\ No newline at end of file
nc_res_mu=CMS_bbwwsl_FakeRate_m_nc_res_2016
......@@ -24,8 +24,7 @@ btagWeight_lfstats2=CMS_btag_lfstats2_2017
btagWeight_subjet=CMS_btag_subjet_2017
electron_id_loose_01=CMS_eff_e_id_loose01_2017
electron_id_loose_02=CMS_eff_e_id_loose02_2017
electron_reco_high=CMS_eff_e_reco_high_2017
electron_reco_low=CMS_eff_e_reco_low_2017
electron_reco=CMS_eff_e_reco_2017
electron_tth_loose=CMS_eff_e_id_tth_2017
fake_electrons_barrel=CMS_bbwwsl_FakeRate_e_barrel_2017
fake_electrons_nom=CMS_bbwwsl_FakeRate_e_norm_2017
......@@ -54,4 +53,4 @@ m_top_unc_ggHH=m_top_unc_HH
nc_nom_e=CMS_bbwwsl_FakeRate_e_nc_nom_2017
nc_nom_mu=CMS_bbwwsl_FakeRate_m_nc_nom_2017
nc_res_e=CMS_bbwwsl_FakeRate_e_nc_res_2017
nc_res_mu=CMS_bbwwsl_FakeRate_m_nc_res_2017
\ No newline at end of file
nc_res_mu=CMS_bbwwsl_FakeRate_m_nc_res_2017
......@@ -24,8 +24,6 @@ btagWeight_lfstats2=CMS_btag_lfstats2_2018
btagWeight_subjet=CMS_btag_subjet_2018
electron_id_loose_01=CMS_eff_e_id_loose01_2018
electron_id_loose_02=CMS_eff_e_id_loose02_2018
electron_reco_high=CMS_eff_e_reco_high_2018
electron_reco_low=CMS_eff_e_reco_low_2018
electron_reco=CMS_eff_e_reco_2018
electron_tth_loose=CMS_eff_e_id_tth_2018
fake_electrons_barrel=CMS_bbwwsl_FakeRate_e_barrel_2018
......@@ -55,4 +53,4 @@ m_top_unc_ggHH=m_top_unc_HH
nc_nom_e=CMS_bbwwsl_FakeRate_e_nc_nom_2018
nc_nom_mu=CMS_bbwwsl_FakeRate_m_nc_nom_2018
nc_res_e=CMS_bbwwsl_FakeRate_e_nc_res_2018
nc_res_mu=CMS_bbwwsl_FakeRate_m_nc_res_2018
\ No newline at end of file
nc_res_mu=CMS_bbwwsl_FakeRate_m_nc_res_2018
......@@ -5,6 +5,9 @@ import itertools
import awkward
import numpy as np
from functools import reduce
from operator import mul
import coffea.processor as processor
from coffea.nanoaod.methods.leptons import LeptonCommon
from coffea.nanoaod.methods.jets import Jet
......@@ -451,49 +454,41 @@ class Base(common.Base):
# lepton sf
e_corr = self.corrections["electron"]
mu_corr = self.corrections["muon"]
if self.year in ("2016", "2017"):
mask = (abs(lep.pdgId) == 11) & lep.gen_matched & (lep.pt < 20)
prefix = "electron_Tallinn_reco_low_EGamma_SF2D"
weights.add(
"electron_reco_low",
e_corr[f"{prefix}"](lep.eta, lep.pt)[mask].prod(),
weightUp=np.where(
mask.any(),
e_corr[f"{prefix}_error"](lep.eta, lep.pt)[mask].prod(),
0,
),
weightDown=None,
shift=True,
)
mask = (abs(lep.pdgId) == 11) & lep.gen_matched & (lep.pt > 20)
prefix = "electron_Tallinn_reco_high_EGamma_SF2D"
weights.add(
"electron_reco_high",
e_corr[f"{prefix}"](lep.eta, lep.pt)[mask].prod(),
weightUp=np.where(
mask.any(),
e_corr[f"{prefix}_error"](lep.eta, lep.pt)[mask].prod(),
0,
),
weightDown=None,
shift=True,
)
else:
mask = (abs(lep.pdgId) == 11) & lep.gen_matched
prefix = "electron_Tallinn_reco_EGamma_SF2D"
weights.add(
"electron_reco",
e_corr[f"{prefix}"](lep.eta, lep.pt)[mask].prod(),
weightUp=np.where(
mask.any(),
e_corr[f"{prefix}_error"](lep.eta, lep.pt)[mask].prod(),
0,
mask = (abs(lep.pdgId) == 11) & lep.gen_matched
prefix2mask = (
{
"electron_Tallinn_reco_low_EGamma_SF2D": mask & (lep.pt < 20),
"electron_Tallinn_reco_high_EGamma_SF2D": mask & (lep.pt > 20),
}
if self.year in ("2016", "2017")
else {
"electron_Tallinn_reco_EGamma_SF2D": mask,
}
)
weights.add(
"electron_reco",
reduce(
mul,
[
e_corr[f"{prefix}"](lep.eta, lep.pt)[mask].prod()
for prefix, mask in prefix2mask.items()
],
),
weightUp=np.where(
mask.any(),
reduce(
mul,
[
e_corr[f"{prefix}_error"](lep.eta, lep.pt)[mask].prod()
for prefix, mask in prefix2mask.items()
],
),
weightDown=None,
shift=True,
)
0,
),
weightDown=None,
shift=True,
)
mask = (abs(lep.pdgId) == 11) & lep.gen_matched
prefix = "electron_Tallinn_id_loose_01_EGamma_SF2D"
weights.add(
"electron_id_loose_01",
......@@ -1061,8 +1056,7 @@ class SyncSelection(sync.Sync, Exporter):
el = [
"weight_trigger_electron_sf",
"weight_trigger_muon_sf",
"weight_electron_reco_low",
"weight_electron_reco_high",
"weight_electron_reco",
"weight_muon_idiso_loose",
"weight_electron_id_loose_01",
"weight_electron_id_loose_02",
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment