|
@@ -3,7 +3,7 @@ import numpy as np
|
|
import matplotlib.pyplot as plt
|
|
import matplotlib.pyplot as plt
|
|
|
|
|
|
from filval.result_set import ResultSet
|
|
from filval.result_set import ResultSet
|
|
-from filval.histogram_utils import hist, hist_add, hist_normalize
|
|
|
|
|
|
+from filval.histogram_utils import hist, hist_add, hist_normalize, hist_scale
|
|
from filval.plotter import (decl_plot, render_plots, hist_plot, hist_plot_stack, Plot, generate_dashboard)
|
|
from filval.plotter import (decl_plot, render_plots, hist_plot, hist_plot_stack, Plot, generate_dashboard)
|
|
|
|
|
|
|
|
|
|
@@ -66,16 +66,11 @@ def plot_yield_stack(rss):
|
|
|
|
|
|
|
|
|
|
@decl_plot
|
|
@decl_plot
|
|
-def plot_lep_multi(rss, use_mc_reweight, dataset):
|
|
|
|
|
|
+def plot_lep_multi(rss, dataset):
|
|
_, (ax_els, ax_mus, ax_taus) = plt.subplots(3, 1)
|
|
_, (ax_els, ax_mus, ax_taus) = plt.subplots(3, 1)
|
|
- if use_mc_reweight:
|
|
|
|
- els = list(map(lambda rs: hist_normalize(hist(rs.nEls_mc)), rss))
|
|
|
|
- mus = list(map(lambda rs: hist_normalize(hist(rs.nMus_mc)), rss))
|
|
|
|
- taus = list(map(lambda rs: hist_normalize(hist(rs.nTaus_mc)), rss))
|
|
|
|
- else:
|
|
|
|
- els = list(map(lambda rs: hist_normalize(hist(rs.nEls)), rss))
|
|
|
|
- mus = list(map(lambda rs: hist_normalize(hist(rs.nMus)), rss))
|
|
|
|
- taus = list(map(lambda rs: hist_normalize(hist(rs.nTaus)), rss))
|
|
|
|
|
|
+ els = list(map(lambda rs: hist_normalize(hist(rs.nEls)), rss))
|
|
|
|
+ mus = list(map(lambda rs: hist_normalize(hist(rs.nMus)), rss))
|
|
|
|
+ taus = list(map(lambda rs: hist_normalize(hist(rs.nTaus)), rss))
|
|
|
|
|
|
def _plot(ax, procs):
|
|
def _plot(ax, procs):
|
|
plt.sca(ax)
|
|
plt.sca(ax)
|
|
@@ -111,7 +106,7 @@ def plot_event_obs(rss, dataset):
|
|
r"""
|
|
r"""
|
|
|
|
|
|
"""
|
|
"""
|
|
- _, ((ax_ht, ax_met), (ax_njet, ax_nbjet)) = plt.subplots(2, 2)
|
|
|
|
|
|
+ _, ((ax_njet, ax_nbjet), (ax_ht, ax_met)) = plt.subplots(2, 2)
|
|
# ft, ttw, ttz, tth = map(lambda rs: hist(rs.SRs), rss)
|
|
# ft, ttw, ttz, tth = map(lambda rs: hist(rs.SRs), rss)
|
|
ft, ttw, ttz, tth = rss
|
|
ft, ttw, ttz, tth = rss
|
|
rs = {'TTTT': ft,
|
|
rs = {'TTTT': ft,
|
|
@@ -121,17 +116,40 @@ def plot_event_obs(rss, dataset):
|
|
|
|
|
|
def _plot(ax, obs):
|
|
def _plot(ax, obs):
|
|
plt.sca(ax)
|
|
plt.sca(ax)
|
|
- h = {'MET': rs.met,
|
|
|
|
- 'HT': rs.ht,
|
|
|
|
- 'NJET': rs.njet,
|
|
|
|
- 'NBJET': rs.nbjet}[obs]
|
|
|
|
|
|
+ h = {'MET': rs.met_in_SR,
|
|
|
|
+ 'HT': rs.ht_in_SR,
|
|
|
|
+ 'NJET': rs.njet_in_SR,
|
|
|
|
+ 'NBJET': rs.nbjet_in_SR}[obs]
|
|
hist_plot(hist(h), stats=False, label=dataset, xlabel=obs)
|
|
hist_plot(hist(h), stats=False, label=dataset, xlabel=obs)
|
|
|
|
|
|
|
|
+ _plot(ax_njet, 'NJET')
|
|
|
|
+ _plot(ax_nbjet, 'NBJET')
|
|
_plot(ax_ht, 'HT')
|
|
_plot(ax_ht, 'HT')
|
|
_plot(ax_met, 'MET')
|
|
_plot(ax_met, 'MET')
|
|
|
|
+
|
|
|
|
+@decl_plot
|
|
|
|
+def plot_event_obs_stack(rss):
|
|
|
|
+ r"""
|
|
|
|
+
|
|
|
|
+ """
|
|
|
|
+ _, ((ax_njet, ax_nbjet), (ax_ht, ax_met)) = plt.subplots(2, 2)
|
|
|
|
+
|
|
|
|
+ def _plot(ax, obs):
|
|
|
|
+ plt.sca(ax)
|
|
|
|
+ attr = {'MET': 'met_in_SR',
|
|
|
|
+ 'HT': 'ht_in_SR',
|
|
|
|
+ 'NJET': 'njet_in_SR',
|
|
|
|
+ 'NBJET': 'nbjet_in_SR'}[obs]
|
|
|
|
+ ft, ttw, ttz, tth = map(lambda rs: hist(getattr(rs, attr)), rss)
|
|
|
|
+ hist_plot_stack([ttw, ttz, tth], labels=["TTW", "TTZ", "TTH"])
|
|
|
|
+ hist_plot(hist_scale(ft, 5), label="TTTT (x5)", color='k')
|
|
|
|
+ plt.xlabel(obs)
|
|
|
|
+
|
|
_plot(ax_njet, 'NJET')
|
|
_plot(ax_njet, 'NJET')
|
|
_plot(ax_nbjet, 'NBJET')
|
|
_plot(ax_nbjet, 'NBJET')
|
|
-
|
|
|
|
|
|
+ plt.legend()
|
|
|
|
+ _plot(ax_ht, 'HT')
|
|
|
|
+ _plot(ax_met, 'MET')
|
|
|
|
|
|
@decl_plot
|
|
@decl_plot
|
|
def plot_tau_purity(rss):
|
|
def plot_tau_purity(rss):
|
|
@@ -177,15 +195,17 @@ if __name__ == '__main__':
|
|
sig_strength_tau = (plot_sig_strength, (rss,), {})
|
|
sig_strength_tau = (plot_sig_strength, (rss,), {})
|
|
sig_strength_notau = (plot_sig_strength, (rss_notau,), {})
|
|
sig_strength_notau = (plot_sig_strength, (rss_notau,), {})
|
|
|
|
|
|
- ft_lep_multi = (plot_lep_multi, (rss, True, 'TTTT'), {})
|
|
|
|
- ttw_lep_multi = (plot_lep_multi, (rss, True, 'TTW'), {})
|
|
|
|
- ttz_lep_multi = (plot_lep_multi, (rss, True, 'TTZ'), {})
|
|
|
|
- tth_lep_multi = (plot_lep_multi, (rss, True, 'TTH'), {})
|
|
|
|
|
|
+ ft_lep_multi = (plot_lep_multi, (rss, 'TTTT'), {})
|
|
|
|
+ ttw_lep_multi = (plot_lep_multi, (rss, 'TTW'), {})
|
|
|
|
+ ttz_lep_multi = (plot_lep_multi, (rss, 'TTZ'), {})
|
|
|
|
+ tth_lep_multi = (plot_lep_multi, (rss, 'TTH'), {})
|
|
|
|
+
|
|
|
|
+ ft_event_obs = (plot_event_obs, (rss_notau, 'TTTT'), {})
|
|
|
|
+ ttw_event_obs = (plot_event_obs, (rss_notau, 'TTW'), {})
|
|
|
|
+ ttz_event_obs = (plot_event_obs, (rss_notau, 'TTZ'), {})
|
|
|
|
+ tth_event_obs = (plot_event_obs, (rss_notau, 'TTH'), {})
|
|
|
|
|
|
- ft_event_obs = (plot_event_obs, (rss, 'TTTT'), {})
|
|
|
|
- ttw_event_obs = (plot_event_obs, (rss, 'TTW'), {})
|
|
|
|
- ttz_event_obs = (plot_event_obs, (rss, 'TTZ'), {})
|
|
|
|
- tth_event_obs = (plot_event_obs, (rss, 'TTH'), {})
|
|
|
|
|
|
+ event_obs_stack = (plot_event_obs_stack, (rss_notau,), {})
|
|
|
|
|
|
tau_purity = (plot_tau_purity, (rss,), {})
|
|
tau_purity = (plot_tau_purity, (rss,), {})
|
|
|
|
|
|
@@ -221,6 +241,8 @@ if __name__ == '__main__':
|
|
'TTZ - Event Observables'),
|
|
'TTZ - Event Observables'),
|
|
Plot([[tth_event_obs]],
|
|
Plot([[tth_event_obs]],
|
|
'TTH - Event Observables'),
|
|
'TTH - Event Observables'),
|
|
|
|
+ Plot([[event_obs_stack]],
|
|
|
|
+ 'Event Observables'),
|
|
Plot([[tau_purity]],
|
|
Plot([[tau_purity]],
|
|
'Tau Purity'),
|
|
'Tau Purity'),
|
|
]
|
|
]
|