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