Belle II Software development
offlineanalysis.py
1# @cond
2import uproot
3import matplotlib.pyplot as plt
4
5output_file = {"Mbc": snakemake.output.mbc_plot, "deltaE": snakemake.output.deltaE_plot}
6BBdata = snakemake.input.data_BB
7QQdata = snakemake.input.data_QQ
8
9treeName = 'BtoPiDtoKPiPi'
10some_variables = ["Mbc", "deltaE"]
11BBtuple = uproot.open(f"{BBdata}:{treeName}")
12QQtuple = uproot.open(f"{QQdata}:{treeName}")
13
14for var in some_variables:
15 plt.hist([QQtuple[var].array(), BBtuple[var].array()], label=["uudd Continuum", "mixed B mesons"], stacked=True)
16 plt.legend(loc='best')
17 plt.xlabel(f"{var} [GeV]")
18 plt.savefig(output_file[var], dpi=100)
19 plt.close()
20# @endcond