Belle II Software  release-08-01-10
offlineanalysis.py
1 # @cond
2 import uproot
3 import matplotlib.pyplot as plt
4 
5 output_file = {"Mbc": snakemake.output.mbc_plot, "deltaE": snakemake.output.deltaE_plot}
6 BBdata = snakemake.input.data_BB
7 QQdata = snakemake.input.data_QQ
8 
9 treeName = 'BtoPiDtoKPiPi'
10 some_variables = ["Mbc", "deltaE"]
11 BBtuple = uproot.open(f"{BBdata}:{treeName}")
12 QQtuple = uproot.open(f"{QQdata}:{treeName}")
13 
14 for 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