Belle II Software  release-05-01-25
vertex_plots.py
1 import matplotlib.pyplot as plt
2 from root_pandas import read_root
3 
4 plt.style.use("belle2")
5 df = read_root("Bd2JpsiKS.root")
6 
7 m_bins = 50 # number of bins for the histograms of both plots
8 
9 # Z position
10 
11 fig, ax = plt.subplots(figsize=(8, 6))
12 m_range = [-0.1, 0.1]
13 ax.set_xlim(left=-0.1, right=0.15)
14 ax.hist(df["Jpsi_dz"], bins=m_bins, range=m_range, label=r"$J/\psi$ vertex")
15 ax.hist(
16  df["Jpsi_mcDecayVertexZ"],
17  histtype="step",
18  lw=2,
19  color="black",
20  linestyle="--",
21  bins=m_bins,
22  range=m_range,
23  label=r"$J/\psi$ vertex(MC)",
24 )
25 ax.set_xlabel("dz[cm]")
26 ax.set_ylabel("Events")
27 ax.legend()
28 fig.savefig("vertex_jpsi_dz.svg")
29 
30 # P-value
31 
32 fig, ax = plt.subplots(figsize=(8, 6))
33 m_range = [0, 1]
34 ax.set_xlim(left=-0.05, right=1.05)
35 ax.hist(
36  df["Jpsi_chiProb"],
37  bins=m_bins,
38  range=m_range,
39  label=r"$J/\psi$ vertex",
40 )
41 ax.set_yscale("log") # set a logarithmic scale in the y-axis
42 ax.set_xlabel("p-value")
43 ax.set_ylabel("Events")
44 ax.legend()
45 fig.savefig("vertex_pValue.svg")