Belle II Software
release-08-02-06
Main Page
Modules
Namespaces
Namespace List
Namespace Members
All
_
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
x
z
Functions
_
a
b
c
d
e
f
g
h
i
l
m
n
o
p
r
s
t
u
v
w
x
z
Variables
a
b
c
d
e
f
g
h
i
l
m
n
o
p
q
r
s
t
v
w
x
z
Typedefs
a
b
c
d
e
g
i
k
l
m
n
p
r
s
t
u
v
w
Enumerations
a
b
c
e
f
g
n
p
s
v
z
Enumerator
c
d
f
p
t
u
v
w
Classes
Class List
Class Hierarchy
Class Members
All
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
Functions
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
Variables
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Typedefs
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
Enumerations
a
b
c
d
e
f
g
h
i
l
m
o
p
r
s
t
u
v
Enumerator
a
b
c
d
e
f
g
h
k
l
m
n
o
p
r
s
t
u
v
w
z
Related Functions
b
c
d
g
i
o
r
s
t
Files
File List
File Members
All
Functions
Typedefs
Macros
invariant_mass_plot.py
1
#!/usr/bin/env python3
2
3
10
11
import
matplotlib
as
mpl
12
import
matplotlib.pyplot
as
plt
13
import
uproot
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
# Declare list of variables
21
var_list = [
'Jpsi_isSignal'
,
'Jpsi_M_uncorrected'
,
'Jpsi_M'
]
22
23
# Make sure that the .root file is in the same directory to find it
24
df = uproot.open(
"Bd2JpsiKS.root:tree"
).arrays(var_list, library=
'pd'
)
25
26
# Let's only consider signal J/Psi
27
df_signal_only = df.query(
"Jpsi_isSignal == 1"
)
28
29
fig, ax = plt.subplots()
30
31
ax.hist(df_signal_only[
"Jpsi_M_uncorrected"
], label=
"w/o brems corr"
, alpha=0.5)
32
ax.hist(df_signal_only[
"Jpsi_M"
], label=
"with brems corr"
, alpha=0.5)
33
34
ax.set_yscale(
"log"
)
# set a logarithmic scale in the y-axis
35
ax.set_xlabel(
"Invariant mass of the J/Psi"
)
36
ax.set_ylabel(
"Events"
)
37
ax.legend()
# show legend
38
39
plt.savefig(
"brems_corr_invariant_mass.png"
)
online_book
basf2
roe
invariant_mass_plot.py
Generated on Tue Jan 28 2025 01:55:21 for Belle II Software by
1.9.1