Belle II Software development
plotting_R2.py
1# Include this only if running in a Jupyter notebook
2# %matplotlib inline
3
4import matplotlib.pyplot as plt
5import uproot
6
7var_list = ['isContinuumEvent', 'R2']
8df = uproot.open("ContinuumSuppression_applied.root:tree").arrays(var_list, library='pd')
9
10fig, ax = plt.subplots()
11
12signal_df = df.query("(isContinuumEvent == 0.0)")
13continuum_df = df.query("(isContinuumEvent == 1.0)")
14
15hist_kwargs = dict(bins=30, range=(0, 1), histtype="step")
16ax.hist(signal_df["R2"], label="Not Continuum", **hist_kwargs)
17ax.hist(continuum_df["R2"], label="Continuum", **hist_kwargs)
18ax.set_xlabel("R2")
19ax.set_ylabel("Total number of candidates")
20ax.legend()
21fig.savefig("R2.pdf")