def plot_fit_results(fit_results, centre_of_mass, channel, variable, k_value,
                     tau_value, output_folder, output_formats, bin_edges):
    h_mean = Hist(bin_edges, type='D')
    h_sigma = Hist(bin_edges, type='D')
    n_bins = h_mean.nbins()
    assert len(fit_results) == n_bins
    for i, fr in enumerate(fit_results):
        h_mean.SetBinContent(i + 1, fr.mean)
        h_mean.SetBinError(i + 1, fr.meanError)
        h_sigma.SetBinContent(i + 1, fr.sigma)
        h_sigma.SetBinError(i + 1, fr.sigmaError)
    histogram_properties = Histogram_properties()
    name_mpt = 'pull_distribution_mean_and_sigma_{0}_{1}_{2}TeV'
    histogram_properties.name = name_mpt.format(variable, channel,
                                                centre_of_mass)
    histogram_properties.y_axis_title = r'$\mu_{\text{pull}}$ ($\sigma_{\text{pull}}$)'
    histogram_properties.x_axis_title = latex_labels.variables_latex[variable]
    value = get_value_title(k_value, tau_value)
    title = 'pull distribution mean \& sigma for {0}'.format(value)
    histogram_properties.title = title
    histogram_properties.y_limits = [-0.5, 2]
    histogram_properties.xerr = True

    compare_measurements(models={
        'ideal $\mu$': make_line_hist(bin_edges, 0),
        'ideal $\sigma$': make_line_hist(bin_edges, 1)
    },
                         measurements={
                             r'$\mu_{\text{pull}}$': h_mean,
                             r'$\sigma_{\text{pull}}$': h_sigma
                         },
                         show_measurement_errors=True,
                         histogram_properties=histogram_properties,
                         save_folder=output_folder,
                         save_as=output_formats)
예제 #2
0
def plot_bias_in_all_bins(
    biases, mean_bias, centre_of_mass, channel, variable, tau_value, output_folder, output_formats, bin_edges
):
    h_bias = Hist(bin_edges, type="D")
    n_bins = h_bias.nbins()
    assert len(biases) == n_bins
    for i, bias in enumerate(biases):
        h_bias.SetBinContent(i + 1, bias)
    histogram_properties = Histogram_properties()
    name_mpt = "bias_{0}_{1}_{2}TeV"
    histogram_properties.name = name_mpt.format(variable, channel, centre_of_mass)
    histogram_properties.y_axis_title = "Bias"
    histogram_properties.x_axis_title = latex_labels.variables_latex[variable]
    title = "pull distribution mean \& sigma for {0}".format(tau_value)
    histogram_properties.title = title
    histogram_properties.y_limits = [0, 10]
    histogram_properties.xerr = True

    compare_measurements(
        models={"Mean bias": make_line_hist(bin_edges, mean_bias)},
        measurements={"Bias": h_bias},
        show_measurement_errors=True,
        histogram_properties=histogram_properties,
        save_folder=output_folder,
        save_as=output_formats,
    )
예제 #3
0
def plot_fit_results(
    fit_results, centre_of_mass, channel, variable, k_value, tau_value, output_folder, output_formats, bin_edges
):
    h_mean = Hist(bin_edges, type="D")
    h_sigma = Hist(bin_edges, type="D")
    n_bins = h_mean.nbins()
    assert len(fit_results) == n_bins

    mean_abs_pull = 0
    for i, fr in enumerate(fit_results):
        mean_abs_pull += abs(fr.mean)
        h_mean.SetBinContent(i + 1, fr.mean)
        h_mean.SetBinError(i + 1, fr.meanError)
        h_sigma.SetBinContent(i + 1, fr.sigma)
        h_sigma.SetBinError(i + 1, fr.sigmaError)
    mean_abs_pull /= n_bins
    histogram_properties = Histogram_properties()
    name_mpt = "pull_distribution_mean_and_sigma_{0}_{1}_{2}TeV"
    histogram_properties.name = name_mpt.format(variable, channel, centre_of_mass)
    histogram_properties.y_axis_title = r"$\mu_{\text{pull}}$ ($\sigma_{\text{pull}}$)"
    histogram_properties.x_axis_title = latex_labels.variables_latex[variable]
    histogram_properties.legend_location = (0.98, 0.48)
    value = get_value_title(k_value, tau_value)
    title = "pull distribution mean \& sigma for {0}".format(value)
    histogram_properties.title = title
    histogram_properties.y_limits = [-2, 2]
    histogram_properties.xerr = True

    compare_measurements(
        models={
            "mean $|\mu|$": make_line_hist(bin_edges, mean_abs_pull),
            "ideal $\mu$": make_line_hist(bin_edges, 0),
            "ideal $\sigma$": make_line_hist(bin_edges, 1),
        },
        measurements={r"$\mu_{\text{pull}}$": h_mean, r"$\sigma_{\text{pull}}$": h_sigma},
        show_measurement_errors=True,
        histogram_properties=histogram_properties,
        save_folder=output_folder,
        save_as=output_formats,
    )
def plot_fit_results(fit_results, centre_of_mass, channel, variable, k_value,
                     tau_value, output_folder, output_formats, bin_edges):
    h_mean = Hist(bin_edges, type='D')
    h_sigma = Hist(bin_edges, type='D')
    n_bins = h_mean.nbins()
    assert len(fit_results) == n_bins
    for i, fr in enumerate(fit_results):
        h_mean.SetBinContent(i + 1, fr.mean)
        h_mean.SetBinError(i + 1, fr.meanError)
        h_sigma.SetBinContent(i + 1, fr.sigma)
        h_sigma.SetBinError(i + 1, fr.sigmaError)
    histogram_properties = Histogram_properties()
    name_mpt = 'pull_distribution_mean_and_sigma_{0}_{1}_{2}TeV'
    histogram_properties.name = name_mpt.format(
        variable,
        channel,
        centre_of_mass
    )
    histogram_properties.y_axis_title = r'$\mu_{\text{pull}}$ ($\sigma_{\text{pull}}$)'
    histogram_properties.x_axis_title = latex_labels.variables_latex[variable]
    value = get_value_title(k_value, tau_value)
    title = 'pull distribution mean \& sigma for {0}'.format(value)
    histogram_properties.title = title
    histogram_properties.y_limits = [-0.5, 2]
    histogram_properties.xerr = True

    compare_measurements(
        models={
            'ideal $\mu$': make_line_hist(bin_edges, 0),
            'ideal $\sigma$': make_line_hist(bin_edges, 1)
        },
        measurements={
            r'$\mu_{\text{pull}}$': h_mean,
            r'$\sigma_{\text{pull}}$': h_sigma
        },
        show_measurement_errors=True,
        histogram_properties=histogram_properties,
        save_folder=output_folder,
        save_as=output_formats)