from nnfwtbn import Variable, Process, Cut, hist, McStack
from nnfwtbn.toydata import generate, proposal, mcmc_step, vbfh_pdf, mcmc, ztt_pdf
from pylorentz import Momentum4
import numpy as np
import pandas as pd
import seaborn as sns
# shuffle=False allows plotting the MC walk
%time df = generate(10000, vbfh_frac=0.5, shuffle=False)
CPU times: user 40.9 s, sys: 79.3 ms, total: 41 s Wall time: 41.3 s
import matplotlib.pyplot as plt
idx = df.fpid == 1
fig, ax = plt.subplots(2, 1, sharex=True)
ax[0].set_title("VBFH")
ax[0].plot(np.arange(sum(idx)), df.jet_1_pt[idx], label="Jet 1")
ax[0].plot(np.arange(sum(idx)), df.jet_2_pt[idx], label="Jet 2")
ax[0].set_ylabel(r"$p_{\mathrm{T}}$")
ax[0].legend()
ax[1].set_title(r"$Z\rightarrow\tau\tau$")
ax[1].plot(np.arange(sum(~idx)), df.jet_1_pt[~idx], label="Jet 1")
ax[1].plot(np.arange(sum(~idx)), df.jet_2_pt[~idx], label="Jet 2")
ax[1].set_ylabel(r"$p_{\mathrm{T}}$")
ax[1].legend()
fig.tight_layout()
None
fig, ax = plt.subplots(2, 1, sharex=True)
ax[0].set_title("VBFH")
ax[0].plot(np.arange(sum(idx)), df.jet_1_eta[idx].abs(), label="Jet 1")
ax[0].plot(np.arange(sum(idx)), df.jet_2_eta[idx].abs(), label="Jet 2")
ax[0].set_ylabel(r"$|\eta_j|$")
ax[0].legend()
ax[1].set_title(r"$Z\rightarrow\tau\tau$")
ax[1].plot(np.arange(sum(~idx)), df.jet_1_eta[~idx].abs(), label="Jet 1")
ax[1].plot(np.arange(sum(~idx)), df.jet_2_eta[~idx].abs(), label="Jet 2")
ax[1].set_ylabel(r"$|\eta_j|$")
ax[1].legend()
fig.tight_layout()
None
fig, ax = plt.subplots(1, 1)
ax.plot(np.arange(sum(idx)), df.higgs_m[idx], label="VBFH")
ax.plot(np.arange(sum(~idx)), df.higgs_m[~idx], label=r"$Z\rightarrow\tau\tau$")
ax.set_ylabel(r"$m^H$")
ax.legend()
fig.tight_layout()
None
p_vbfh = Process("VBFH", range=(1, 1))
p_ztt = Process(r"$Z\rightarrow\tau\tau$", range=(0, 0))
s_all = McStack(p_vbfh, p_ztt)
jet_1_eta = Variable(r"$\eta^{j_1}$", "jet_1_eta")
hist(df, jet_1_eta, bins=20, range=(-6, 6), stacks=[s_all], weight="weight")
None
jet_2_eta = Variable(r"$\eta^{j_2}$", "jet_2_eta")
hist(df, jet_2_eta, bins=20, range=(-6, 6), stacks=[s_all], weight="weight")
None
delta_eta_jets = Variable(r"$|\Delta\eta{jj}|$", lambda d: d.jet_1_eta.abs())
hist(df, delta_eta_jets, bins=22, range=(-1, 10), stacks=[s_all], weight="weight")
None
jet_1_pt = Variable(r"$p_{\mathrm{T}}^{j_1}$", "jet_1_pt")
jet_2_pt = Variable(r"$p_{\mathrm{T}}^{j_2}$", "jet_2_pt")
hist(df, jet_1_pt, bins=50, range=(0, 1000), stacks=[s_all], weight="weight")
hist(df, jet_2_pt, bins=25, range=(0, 250), stacks=[s_all], weight="weight")
None
v_higgs_m = Variable(r"$m^H$", "higgs_m")
hist(df, v_higgs_m, bins=20, range=(0, 200), stacks=[s_all], weight="weight")
None
v_weight = Variable(r"$w$", "weight")
hist(df, v_weight, bins=20, range=(0, 2), stacks=[s_all],
weight=lambda d: d.weight * 1 + 0)
None
v_mjj = Variable(r"$m^{jj}$", "m_jj")
hist(df, v_mjj, bins=51, range=(-40, 2000), stacks=[s_all], weight="weight")
hist(df, v_mjj, bins=51, range=(-40, 2000), stacks=[s_all], weight="weight")
None
v_lep_pt = Variable(r"$p^{\ell}_{\mathrm{T}}$", "lep_pt")
hist(df, v_lep_pt, bins=30, range=(-10, 290), stacks=[s_all], weight="weight")
None
v_lep_eta = Variable(r"$|\eta^{\ell}|$", "lep_eta")
hist(df, v_lep_eta, bins=30, range=(-5, 5), stacks=[s_all], weight="weight")
None
v_tau_pt = Variable(r"$p^{\tau}_{\mathrm{T}}$", "tau_pt")
hist(df, v_tau_pt, bins=30, range=(-10, 290), stacks=[s_all], weight="weight")
None
v_tau_eta = Variable(r"$|\eta^{\tau}|$", "tau_eta")
hist(df, v_tau_eta, bins=30, range=(-5, 5), stacks=[s_all], weight="weight")
None
v_met_pt = Variable(r"$E^{\mathrm{miss}}_{\mathrm{T}}$", "met_pt")
hist(df, v_met_pt, bins=30, range=(-10, 290), stacks=[s_all], weight="weight")
None
v_lep_cent = Variable(r"$\eta^{\ell}$", "tau_centrality")
hist(df, v_lep_cent, bins=22, range=(-0.05, 1.05), stacks=[s_all], weight="weight")
None
v_tau_cent = Variable(r"$\eta^{\tau}$", "tau_centrality")
hist(df, v_tau_cent, bins=22, range=(-0.05, 1.05), stacks=[s_all], weight="weight")
None