-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
541 additions
and
203 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,259 @@ | ||
{ | ||
"cells": [ | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"import matplotlib as mpl\n", | ||
"import matplotlib.pyplot as plt\n", | ||
"import matplotlib.ticker as mticker\n", | ||
"import mplhep as hep\n", | ||
"\n", | ||
"plt.style.use(hep.style.CMS)\n", | ||
"hep.style.use(\"CMS\")\n", | ||
"formatter = mticker.ScalarFormatter(useMathText=True)\n", | ||
"formatter.set_powerlimits((-3, 3))" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"import matplotlib.pyplot as plt\n", | ||
"import matplotlib.patches as patches\n", | ||
"import mplhep as hep\n", | ||
"\n", | ||
"# Apply the CMS style\n", | ||
"plt.style.use(hep.style.CMS)\n", | ||
"\n", | ||
"# Define the observed and expected data for the first set (from the first PDF)\n", | ||
"observed_value_1 = 142\n", | ||
"expected_median_1 = 69\n", | ||
"expected_68_low_1, expected_68_high_1 = 50, 80 # 68% confidence interval\n", | ||
"expected_95_low_1, expected_95_high_1 = 40, 100 # 95% confidence interval\n", | ||
"\n", | ||
"# Define the observed and expected data for the second set (from the second PDF)\n", | ||
"observed_value_2 = 1.1\n", | ||
"expected_median_2 = 0.9\n", | ||
"expected_68_low_2, expected_68_high_2 = 0.7, 1.1 # 68% confidence interval\n", | ||
"expected_95_low_2, expected_95_high_2 = 0.5, 1.3 # 95% confidence interval\n", | ||
"\n", | ||
"# Create the figure with custom dimensions\n", | ||
"fig, ax = plt.subplots(figsize=(10, 6)) # Adjust the dimensions as needed\n", | ||
"\n", | ||
"# Plot for the first set\n", | ||
"# Add rectangles for the confidence intervals\n", | ||
"rect_95_1 = patches.Rectangle(\n", | ||
" (expected_95_low_1, 0.7),\n", | ||
" expected_95_high_1 - expected_95_low_1,\n", | ||
" 0.2,\n", | ||
" linewidth=0,\n", | ||
" edgecolor=\"none\",\n", | ||
" facecolor=\"yellow\",\n", | ||
" alpha=0.5,\n", | ||
")\n", | ||
"ax.add_patch(rect_95_1)\n", | ||
"rect_68_1 = patches.Rectangle(\n", | ||
" (expected_68_low_1, 0.7),\n", | ||
" expected_68_high_1 - expected_68_low_1,\n", | ||
" 0.2,\n", | ||
" linewidth=0,\n", | ||
" edgecolor=\"none\",\n", | ||
" facecolor=\"green\",\n", | ||
" alpha=0.5,\n", | ||
")\n", | ||
"ax.add_patch(rect_68_1)\n", | ||
"ax.plot([expected_median_1, expected_median_1], [0.7, 0.9], \"k--\")\n", | ||
"ax.plot([observed_value_1, observed_value_1], [0.7, 0.9], \"k-\", linewidth=2)\n", | ||
"\n", | ||
"# Plot for the second set\n", | ||
"# Add rectangles for the confidence intervals\n", | ||
"rect_95_2 = patches.Rectangle(\n", | ||
" (expected_95_low_2, 0.4),\n", | ||
" expected_95_high_2 - expected_95_low_2,\n", | ||
" 0.2,\n", | ||
" linewidth=0,\n", | ||
" edgecolor=\"none\",\n", | ||
" facecolor=\"yellow\",\n", | ||
" alpha=0.5,\n", | ||
")\n", | ||
"ax.add_patch(rect_95_2)\n", | ||
"rect_68_2 = patches.Rectangle(\n", | ||
" (expected_68_low_2, 0.4),\n", | ||
" expected_68_high_2 - expected_68_low_2,\n", | ||
" 0.2,\n", | ||
" linewidth=0,\n", | ||
" edgecolor=\"none\",\n", | ||
" facecolor=\"green\",\n", | ||
" alpha=0.5,\n", | ||
")\n", | ||
"ax.add_patch(rect_68_2)\n", | ||
"ax.plot([expected_median_2, expected_median_2], [0.4, 0.6], \"k--\")\n", | ||
"ax.plot([observed_value_2, observed_value_2], [0.4, 0.6], \"k-\", linewidth=2)\n", | ||
"\n", | ||
"# Set the x and y axis labels\n", | ||
"ax.set_xlabel(r\"95% CL limit on $\\sigma(pp \\rightarrow HH) / \\sigma$\")\n", | ||
"ax.set_yticks([0.8, 0.5])\n", | ||
"ax.set_yticklabels(\n", | ||
" [\n", | ||
" r\"$\\kappa_{\\lambda} = 1, \\kappa_{t} = 2, \\kappa_{V} = 1$\",\n", | ||
" r\"$\\kappa_{\\lambda} = 1, \\kappa_{t} = 1, \\kappa_{V} = 0$\",\n", | ||
" ]\n", | ||
")\n", | ||
"\n", | ||
"# Set the title\n", | ||
"ax.set_title(\"CMS Work in Progress\")\n", | ||
"\n", | ||
"# Set x-axis to logarithmic scale\n", | ||
"ax.set_xscale(\"log\")\n", | ||
"\n", | ||
"# Add a legend in the top right without the limit values\n", | ||
"legend_elements = [\n", | ||
" patches.Patch(color=\"green\", alpha=0.5, label=\"68% expected\"),\n", | ||
" patches.Patch(color=\"yellow\", alpha=0.5, label=\"95% expected\"),\n", | ||
" plt.Line2D([0], [0], color=\"k\", linestyle=\"--\", label=\"Median expected\"),\n", | ||
" plt.Line2D([0], [0], color=\"k\", linewidth=2, label=\"Observed\"),\n", | ||
"]\n", | ||
"ax.legend(handles=legend_elements, loc=\"upper right\")\n", | ||
"\n", | ||
"# Set x-axis limits\n", | ||
"ax.set_xlim(0.1, 200)\n", | ||
"\n", | ||
"# Use scientific notation for the x-axis\n", | ||
"ax.xaxis.set_major_formatter(plt.ScalarFormatter(useMathText=True))\n", | ||
"ax.ticklabel_format(style=\"sci\", axis=\"x\", scilimits=(0, 0))\n", | ||
"\n", | ||
"# Show grid\n", | ||
"ax.grid(True, axis=\"x\")\n", | ||
"\n", | ||
"# Apply CMS label with `mplhep`\n", | ||
"hep.cms.label(ax=ax, data=True, lumi=138, com=13)\n", | ||
"\n", | ||
"# Adjust layout\n", | ||
"plt.tight_layout()\n", | ||
"\n", | ||
"# Show the plot\n", | ||
"plt.show()" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"import matplotlib.pyplot as plt\n", | ||
"import matplotlib.patches as patches\n", | ||
"\n", | ||
"# Define the observed and expected data\n", | ||
"observed_value = 142\n", | ||
"expected_median = 69\n", | ||
"expected_68_low, expected_68_high = 50, 80 # 68% confidence interval\n", | ||
"expected_95_low, expected_95_high = 40, 100 # 95% confidence interval\n", | ||
"\n", | ||
"# Create the plot with custom dimensions\n", | ||
"fig, ax = plt.subplots(figsize=(8, 2)) # Adjust the dimensions as needed\n", | ||
"\n", | ||
"# Add rectangles for the confidence intervals\n", | ||
"# 95% confidence interval\n", | ||
"rect_95 = patches.Rectangle(\n", | ||
" (expected_95_low, -0.1),\n", | ||
" expected_95_high - expected_95_low,\n", | ||
" 0.2,\n", | ||
" linewidth=0,\n", | ||
" edgecolor=\"none\",\n", | ||
" facecolor=\"yellow\",\n", | ||
" alpha=0.5,\n", | ||
" label=\"95% expected\",\n", | ||
")\n", | ||
"ax.add_patch(rect_95)\n", | ||
"\n", | ||
"# 68% confidence interval\n", | ||
"rect_68 = patches.Rectangle(\n", | ||
" (expected_68_low, -0.1),\n", | ||
" expected_68_high - expected_68_low,\n", | ||
" 0.2,\n", | ||
" linewidth=0,\n", | ||
" edgecolor=\"none\",\n", | ||
" facecolor=\"green\",\n", | ||
" alpha=0.5,\n", | ||
" label=\"68% expected\",\n", | ||
")\n", | ||
"ax.add_patch(rect_68)\n", | ||
"\n", | ||
"# Plot the expected median line\n", | ||
"ax.plot([expected_median, expected_median], [-0.1, 0.1], \"k--\", label=\"Median expected: 69\")\n", | ||
"\n", | ||
"# Plot the observed value as a solid black line\n", | ||
"ax.plot([observed_value, observed_value], [-0.1, 0.1], \"k-\", linewidth=2, label=\"Observed: 142\")\n", | ||
"\n", | ||
"# Set the x and y axis labels\n", | ||
"ax.set_xlabel(r\"95% CL limit on $\\sigma(pp \\rightarrow HH) / \\sigma$\")\n", | ||
"ax.set_yticks([]) # Remove y-axis ticks\n", | ||
"\n", | ||
"# Set the title\n", | ||
"ax.set_title(\"CMS Work in Progress\")\n", | ||
"\n", | ||
"# Add a legend\n", | ||
"ax.legend()\n", | ||
"\n", | ||
"# Set x-axis limits\n", | ||
"ax.set_xlim(0, 150) # Adjust based on the range of your data\n", | ||
"ax.set_ylim(-0.2, 0.3) # Adjust y-axis to provide space for the kappa values\n", | ||
"\n", | ||
"# Use scientific notation for the x-axis\n", | ||
"ax.xaxis.set_major_formatter(plt.ScalarFormatter(useMathText=True))\n", | ||
"ax.ticklabel_format(style=\"sci\", axis=\"x\", scilimits=(0, 0))\n", | ||
"\n", | ||
"# Add kappa values above the observed limit within the figure box\n", | ||
"kappa_values = r\"$\\kappa_{\\lambda} = 1, \\kappa_{t} = 2, \\kappa_{V} = 1$\"\n", | ||
"plt.text(\n", | ||
" observed_value,\n", | ||
" 0.2,\n", | ||
" kappa_values,\n", | ||
" fontsize=12,\n", | ||
" horizontalalignment=\"center\",\n", | ||
" verticalalignment=\"bottom\",\n", | ||
")\n", | ||
"\n", | ||
"# Show grid\n", | ||
"ax.grid(True, axis=\"x\")\n", | ||
"\n", | ||
"# Show the plot\n", | ||
"plt.show()" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [] | ||
} | ||
], | ||
"metadata": { | ||
"kernelspec": { | ||
"display_name": "python310", | ||
"language": "python", | ||
"name": "python3" | ||
}, | ||
"language_info": { | ||
"codemirror_mode": { | ||
"name": "ipython", | ||
"version": 3 | ||
}, | ||
"file_extension": ".py", | ||
"mimetype": "text/x-python", | ||
"name": "python", | ||
"nbconvert_exporter": "python", | ||
"pygments_lexer": "ipython3", | ||
"version": "3.10.11" | ||
} | ||
}, | ||
"nbformat": 4, | ||
"nbformat_minor": 2 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
\multirow{4}{*}{ggF} & SM ggF \HH & $1.05 \pm 0.24$ & 0.16 & 0.05 & 0.00 & 0.16 \\ | ||
& SM VBF \HH & $1.17 \pm 0.45$ & 0.35 & 0.05 & 0.00 & 0.16 \\ | ||
& VBF \HH ($\kapvv = 0$) & $1.09 \pm 0.18$ & 0.02 & 0.04 & 0.01 & 0.15 \\ | ||
& VBF \HH ($\kapvv = 2$) & $1.10 \pm 0.18$ & 0.02 & 0.05 & 0.01 & 0.15 \\ | ||
\midrule | ||
\multirow{4}{*}{VBF} & SM ggF \HH & $0.95 \pm 0.28$ & 0.26 & 0.08 & 0.01 & 0.12 \\ | ||
& SM VBF \HH & $1.08 \pm 0.46$ & 0.38 & 0.05 & 0.01 & 0.19 \\ | ||
& VBF \HH ($\kapvv = 0$) & $0.93 \pm 0.27$ & 0.16 & 0.06 & 0.02 & 0.23 \\ | ||
& VBF \HH ($\kapvv = 2$) & $0.94 \pm 0.27$ & 0.16 & 0.05 & 0.02 & 0.23 |
Oops, something went wrong.