Belle II Software
release-06-00-14
invariant_mass_plot.py
1
#!/usr/bin/env python3
2
3
10
11
import
matplotlib
as
mpl
12
import
matplotlib.pyplot
as
plt
13
from
root_pandas
import
read_root
14
15
# Only include this line if you're running from ipython an a remote server
16
mpl.use(
"Agg"
)
17
18
plt.style.use(
"belle2"
)
# use the official Belle II plotting style
19
20
# Make sure that the .root file is in the same directory to find it
21
df = read_root(
"Bd2JpsiKS.root"
)
22
23
# Let's only consider signal J/Psi
24
df_signal_only = df.query(
"Jpsi_isSignal == 1"
)
25
26
fig, ax = plt.subplots()
27
28
ax.hist(df_signal_only[
"Jpsi_M_uncorrected"
], label=
"w/o brems corr"
, alpha=0.5)
29
ax.hist(df_signal_only[
"Jpsi_M"
], label=
"with brems corr"
, alpha=0.5)
30
31
ax.set_yscale(
"log"
)
# set a logarithmic scale in the y-axis
32
ax.set_xlabel(
"Invariant mass of the J/Psi"
)
33
ax.set_ylabel(
"Events"
)
34
ax.legend()
# show legend
35
36
plt.savefig(
"brems_corr_invariant_mass.png"
)
online_book
basf2
roe
invariant_mass_plot.py
Generated on Thu Jul 14 2022 08:03:55 for Belle II Software by
1.9.1