Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
detector_benchmarks
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
EIC
benchmarks
detector_benchmarks
Commits
316c8918
Unverified
Commit
316c8918
authored
2 months ago
by
Dmitry Kalinkin
Committed by
GitHub
2 months ago
Browse files
Options
Downloads
Patches
Plain Diff
zdc_lambda: run even more code conditionally (#142)
parent
c88b5542
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
benchmarks/zdc_lambda/analysis/lambda_plots.py
+197
-195
197 additions, 195 deletions
benchmarks/zdc_lambda/analysis/lambda_plots.py
with
197 additions
and
195 deletions
benchmarks/zdc_lambda/analysis/lambda_plots.py
+
197
−
195
View file @
316c8918
...
@@ -60,216 +60,218 @@ for p in momenta:
...
@@ -60,216 +60,218 @@ for p in momenta:
if
"
ReconstructedFarForwardZDCLambdas.momentum.x
"
not
in
arrays_sim
[
momenta
[
0
]].
fields
:
if
"
ReconstructedFarForwardZDCLambdas.momentum.x
"
not
in
arrays_sim
[
momenta
[
0
]].
fields
:
print
(
"
ReconstructedFarForwardZDCLambdas collection is not available (needs EICrecon 1.23)
"
)
print
(
"
ReconstructedFarForwardZDCLambdas collection is not available (needs EICrecon 1.23)
"
)
else
:
import
sys
theta_recon
=
{}
sys
.
exit
(
0
)
E_recon
=
{}
zvtx_recon
=
{}
theta_recon
=
{}
mass_recon
=
{}
E_recon
=
{}
print
(
arrays_sim
[
p
].
fields
)
zvtx_recon
=
{}
for
p
in
momenta
:
mass_recon
=
{}
print
(
arrays_sim
[
p
].
fields
)
px
,
py
,
pz
,
m
=
(
arrays_sim
[
p
][
f
"
ReconstructedFarForwardZDCLambdas.
{
a
}
"
]
for
a
in
"
momentum.x momentum.y momentum.z mass
"
.
split
())
for
p
in
momenta
:
theta_recon
[
p
]
=
np
.
arctan2
(
np
.
hypot
(
px
*
np
.
cos
(
tilt
)
-
pz
*
np
.
sin
(
tilt
),
py
),
pz
*
np
.
cos
(
tilt
)
+
px
*
np
.
sin
(
tilt
))
E_recon
[
p
]
=
np
.
sqrt
(
px
**
2
+
py
**
2
+
pz
**
2
+
m
**
2
)
px
,
py
,
pz
,
m
=
(
arrays_sim
[
p
][
f
"
ReconstructedFarForwardZDCLambdas.
{
a
}
"
]
for
a
in
"
momentum.x momentum.y momentum.z mass
"
.
split
())
zvtx_recon
[
p
]
=
arrays_sim
[
p
][
f
"
ReconstructedFarForwardZDCLambdas.referencePoint.z
"
]
*
np
.
cos
(
tilt
)
+
arrays_sim
[
p
][
f
"
ReconstructedFarForwardZDCLambdas.referencePoint.x
"
]
*
np
.
sin
(
tilt
)
theta_recon
[
p
]
=
np
.
arctan2
(
np
.
hypot
(
px
*
np
.
cos
(
tilt
)
-
pz
*
np
.
sin
(
tilt
),
py
),
pz
*
np
.
cos
(
tilt
)
+
px
*
np
.
sin
(
tilt
))
mass_recon
[
p
]
=
m
E_recon
[
p
]
=
np
.
sqrt
(
px
**
2
+
py
**
2
+
pz
**
2
+
m
**
2
)
zvtx_recon
[
p
]
=
arrays_sim
[
p
][
f
"
ReconstructedFarForwardZDCLambdas.referencePoint.z
"
]
*
np
.
cos
(
tilt
)
+
arrays_sim
[
p
][
f
"
ReconstructedFarForwardZDCLambdas.referencePoint.x
"
]
*
np
.
sin
(
tilt
)
#theta plots
mass_recon
[
p
]
=
m
fig
,
axs
=
plt
.
subplots
(
1
,
3
,
figsize
=
(
24
,
8
))
plt
.
sca
(
axs
[
0
])
#theta plots
plt
.
title
(
f
"
$E_{{
\\
Lambda}}=100-275$ GeV
"
)
fig
,
axs
=
plt
.
subplots
(
1
,
3
,
figsize
=
(
24
,
8
))
x
=
[]
plt
.
sca
(
axs
[
0
])
y
=
[]
plt
.
title
(
f
"
$E_{{
\\
Lambda}}=100-275$ GeV
"
)
import
awkward
as
ak
x
=
[]
for
p
in
momenta
:
y
=
[]
x
+=
list
(
ak
.
flatten
(
theta_truth
[
p
]
+
0
*
theta_recon
[
p
])
*
1000
)
import
awkward
as
ak
y
+=
list
(
ak
.
flatten
(
theta_recon
[
p
]
*
1000
))
for
p
in
momenta
:
plt
.
scatter
(
x
,
y
)
x
+=
list
(
ak
.
flatten
(
theta_truth
[
p
]
+
0
*
theta_recon
[
p
])
*
1000
)
plt
.
xlabel
(
"
$
\\
theta^{*
\\
rm truth}_{
\\
Lambda}$ [mrad]
"
)
y
+=
list
(
ak
.
flatten
(
theta_recon
[
p
]
*
1000
))
plt
.
ylabel
(
"
$
\\
theta^{*
\\
rm recon}_{
\\
Lambda}$ [mrad]
"
)
plt
.
scatter
(
x
,
y
)
plt
.
xlim
(
0
,
3.2
)
plt
.
xlabel
(
"
$
\\
theta^{*
\\
rm truth}_{
\\
Lambda}$ [mrad]
"
)
plt
.
ylim
(
0
,
3.2
)
plt
.
ylabel
(
"
$
\\
theta^{*
\\
rm recon}_{
\\
Lambda}$ [mrad]
"
)
plt
.
xlim
(
0
,
3.2
)
plt
.
sca
(
axs
[
1
])
plt
.
ylim
(
0
,
3.2
)
plt
.
title
(
f
"
$E_{{
\\
Lambda}}=100-275$ GeV
"
)
y
,
x
,
_
=
plt
.
hist
(
y
-
np
.
array
(
x
),
bins
=
50
,
range
=
(
-
1
,
1
))
plt
.
sca
(
axs
[
1
])
plt
.
title
(
f
"
$E_{{
\\
Lambda}}=100-275$ GeV
"
)
y
,
x
,
_
=
plt
.
hist
(
y
-
np
.
array
(
x
),
bins
=
50
,
range
=
(
-
1
,
1
))
bc
=
(
x
[
1
:]
+
x
[:
-
1
])
/
2
from
scipy.optimize
import
curve_fit
slc
=
abs
(
bc
)
<
0.3
fnc
=
gauss
p0
=
[
100
,
0
,
0.05
]
coeff
,
var_matrix
=
curve_fit
(
fnc
,
bc
[
slc
],
y
[
slc
],
p0
=
p0
,
sigma
=
np
.
sqrt
(
y
[
slc
])
+
(
y
[
slc
]
==
0
),
maxfev
=
10000
)
x
=
np
.
linspace
(
-
1
,
1
)
plt
.
plot
(
x
,
gauss
(
x
,
*
coeff
),
color
=
'
tab:orange
'
)
plt
.
xlabel
(
"
$
\\
theta^{*
\\
rm recon}_{
\\
Lambda}-
\\
theta^{*
\\
rm truth}_{
\\
Lambda}$ [mrad]
"
)
plt
.
ylabel
(
"
events
"
)
plt
.
sca
(
axs
[
2
])
sigmas
=
[]
dsigmas
=
[]
xvals
=
[]
for
p
in
momenta
:
y
,
x
=
np
.
histogram
(
ak
.
flatten
(
theta_recon
[
p
]
-
theta_truth
[
p
])
*
1000
,
bins
=
100
,
range
=
(
-
1
,
1
))
bc
=
(
x
[
1
:]
+
x
[:
-
1
])
/
2
bc
=
(
x
[
1
:]
+
x
[:
-
1
])
/
2
from
scipy.optimize
import
curve_fit
from
scipy.optimize
import
curve_fit
slc
=
abs
(
bc
)
<
0.3
slc
=
abs
(
bc
)
<
0.3
fnc
=
gauss
fnc
=
gauss
p0
=
[
100
,
0
,
0.05
]
p0
=
(
100
,
0
,
0.06
)
coeff
,
var_matrix
=
curve_fit
(
fnc
,
bc
[
slc
],
y
[
slc
],
p0
=
p0
,
sigma
=
np
.
sqrt
(
y
[
slc
])
+
(
y
[
slc
]
==
0
)
sigma
=
np
.
sqrt
(
y
[
slc
])
+
(
y
[
slc
]
==
0
),
maxfev
=
10000
)
try
:
x
=
np
.
linspace
(
-
1
,
1
)
coeff
,
var_matrix
=
curve_fit
(
fnc
,
list
(
bc
[
slc
]),
list
(
y
[
slc
]),
p0
=
p0
,
sigma
=
list
(
sigma
),
maxfev
=
10000
)
plt
.
plot
(
x
,
gauss
(
x
,
*
coeff
),
color
=
'
tab:orange
'
)
sigmas
.
append
(
coeff
[
2
])
plt
.
xlabel
(
"
$
\\
theta^{*
\\
rm recon}_{
\\
Lambda}-
\\
theta^{*
\\
rm truth}_{
\\
Lambda}$ [mrad]
"
)
dsigmas
.
append
(
np
.
sqrt
(
var_matrix
[
2
][
2
]))
plt
.
ylabel
(
"
events
"
)
xvals
.
append
(
p
)
except
:
plt
.
sca
(
axs
[
2
])
print
(
"
fit failed
"
)
sigmas
=
[]
plt
.
ylim
(
0
,
0.3
)
dsigmas
=
[]
xvals
=
[]
plt
.
errorbar
(
xvals
,
sigmas
,
dsigmas
,
ls
=
''
,
marker
=
'
o
'
,
color
=
'
k
'
)
for
p
in
momenta
:
x
=
np
.
linspace
(
100
,
275
,
100
)
y
,
x
=
np
.
histogram
(
ak
.
flatten
(
theta_recon
[
p
]
-
theta_truth
[
p
])
*
1000
,
bins
=
100
,
range
=
(
-
1
,
1
))
plt
.
plot
(
x
,
3
/
np
.
sqrt
(
x
),
color
=
'
tab:orange
'
)
bc
=
(
x
[
1
:]
+
x
[:
-
1
])
/
2
plt
.
text
(
170
,
.
23
,
"
YR requirement:
\n
3 mrad/$
\\
sqrt{E}$
"
)
plt
.
xlabel
(
"
$E_{
\\
Lambda}$ [GeV]
"
)
from
scipy.optimize
import
curve_fit
plt
.
ylabel
(
"
$
\\
sigma[
\\
theta^*_{
\\
Lambda}]$ [mrad]
"
)
slc
=
abs
(
bc
)
<
0.3
plt
.
tight_layout
()
fnc
=
gauss
plt
.
savefig
(
outdir
+
"
thetastar_recon.pdf
"
)
p0
=
(
100
,
0
,
0.06
)
#plt.show()
sigma
=
np
.
sqrt
(
y
[
slc
])
+
(
y
[
slc
]
==
0
)
try
:
#vtx z
coeff
,
var_matrix
=
curve_fit
(
fnc
,
list
(
bc
[
slc
]),
list
(
y
[
slc
]),
p0
=
p0
,
sigma
=
list
(
sigma
),
maxfev
=
10000
)
fig
,
axs
=
plt
.
subplots
(
1
,
3
,
figsize
=
(
24
,
8
))
sigmas
.
append
(
coeff
[
2
])
plt
.
sca
(
axs
[
0
])
dsigmas
.
append
(
np
.
sqrt
(
var_matrix
[
2
][
2
]))
plt
.
title
(
f
"
$E_{{
\\
Lambda}}=100-275$ GeV
"
)
xvals
.
append
(
p
)
x
=
[]
except
:
y
=
[]
print
(
"
fit failed
"
)
for
p
in
momenta
:
plt
.
ylim
(
0
,
0.3
)
x
+=
list
(
ak
.
flatten
(
arrays_sim
[
p
][
'
MCParticles.vertex.z
'
][:,
3
]
+
0
*
zvtx_recon
[
p
])
/
1000
)
y
+=
list
(
ak
.
flatten
(
zvtx_recon
[
p
])
/
1000
)
plt
.
errorbar
(
xvals
,
sigmas
,
dsigmas
,
ls
=
''
,
marker
=
'
o
'
,
color
=
'
k
'
)
plt
.
scatter
(
x
,
y
)
x
=
np
.
linspace
(
100
,
275
,
100
)
#print(x,y)
plt
.
plot
(
x
,
3
/
np
.
sqrt
(
x
),
color
=
'
tab:orange
'
)
plt
.
xlabel
(
"
$z^{
\\
rm truth}_{
\\
rm vtx}$ [m]
"
)
plt
.
text
(
170
,
.
23
,
"
YR requirement:
\n
3 mrad/$
\\
sqrt{E}$
"
)
plt
.
ylabel
(
"
$z^{
\\
rm recon}_{
\\
rm vtx}$ [m]
"
)
plt
.
xlabel
(
"
$E_{
\\
Lambda}$ [GeV]
"
)
plt
.
xlim
(
0
,
40
)
plt
.
ylabel
(
"
$
\\
sigma[
\\
theta^*_{
\\
Lambda}]$ [mrad]
"
)
plt
.
ylim
(
0
,
40
)
plt
.
tight_layout
()
plt
.
savefig
(
outdir
+
"
thetastar_recon.pdf
"
)
plt
.
sca
(
axs
[
1
])
#plt.show()
plt
.
title
(
f
"
$E_{{
\\
Lambda}}=100-275$ GeV
"
)
y
,
x
,
_
=
plt
.
hist
(
y
-
np
.
array
(
x
),
bins
=
50
,
range
=
(
-
10
,
10
))
#vtx z
bc
=
(
x
[
1
:]
+
x
[:
-
1
])
/
2
fig
,
axs
=
plt
.
subplots
(
1
,
3
,
figsize
=
(
24
,
8
))
plt
.
sca
(
axs
[
0
])
from
scipy.optimize
import
curve_fit
plt
.
title
(
f
"
$E_{{
\\
Lambda}}=100-275$ GeV
"
)
slc
=
abs
(
bc
)
<
5
x
=
[]
fnc
=
gauss
y
=
[]
p0
=
[
100
,
0
,
1
]
for
p
in
momenta
:
coeff
,
var_matrix
=
curve_fit
(
fnc
,
bc
[
slc
],
y
[
slc
],
p0
=
p0
,
x
+=
list
(
ak
.
flatten
(
arrays_sim
[
p
][
'
MCParticles.vertex.z
'
][:,
3
]
+
0
*
zvtx_recon
[
p
])
/
1000
)
sigma
=
np
.
sqrt
(
y
[
slc
])
+
(
y
[
slc
]
==
0
),
maxfev
=
10000
)
y
+=
list
(
ak
.
flatten
(
zvtx_recon
[
p
])
/
1000
)
x
=
np
.
linspace
(
-
5
,
5
)
plt
.
scatter
(
x
,
y
)
plt
.
plot
(
x
,
gauss
(
x
,
*
coeff
),
color
=
'
tab:orange
'
)
#print(x,y)
print
(
coeff
[
2
],
np
.
sqrt
(
var_matrix
[
2
][
2
]))
plt
.
xlabel
(
"
$z^{
\\
rm truth}_{
\\
rm vtx}$ [m]
"
)
plt
.
xlabel
(
"
$z^{*
\\
rm recon}_{
\\
rm vtx}-z^{*
\\
rm truth}_{
\\
rm vtx}$ [m]
"
)
plt
.
ylabel
(
"
$z^{
\\
rm recon}_{
\\
rm vtx}$ [m]
"
)
plt
.
ylabel
(
"
events
"
)
plt
.
xlim
(
0
,
40
)
plt
.
ylim
(
0
,
40
)
plt
.
sca
(
axs
[
2
])
sigmas
=
[]
plt
.
sca
(
axs
[
1
])
dsigmas
=
[]
plt
.
title
(
f
"
$E_{{
\\
Lambda}}=100-275$ GeV
"
)
xvals
=
[]
y
,
x
,
_
=
plt
.
hist
(
y
-
np
.
array
(
x
),
bins
=
50
,
range
=
(
-
10
,
10
))
for
p
in
momenta
:
a
=
ak
.
flatten
((
zvtx_recon
[
p
]
-
arrays_sim
[
p
][
'
MCParticles.vertex.z
'
][:,
3
])
/
1000
)
y
,
x
=
np
.
histogram
(
a
,
bins
=
100
,
range
=
(
-
10
,
10
))
bc
=
(
x
[
1
:]
+
x
[:
-
1
])
/
2
bc
=
(
x
[
1
:]
+
x
[:
-
1
])
/
2
from
scipy.optimize
import
curve_fit
from
scipy.optimize
import
curve_fit
slc
=
abs
(
bc
)
<
5
slc
=
abs
(
bc
)
<
5
fnc
=
gauss
fnc
=
gauss
p0
=
[
100
,
0
,
1
]
p0
=
(
100
,
0
,
1
)
coeff
,
var_matrix
=
curve_fit
(
fnc
,
bc
[
slc
],
y
[
slc
],
p0
=
p0
,
#print(bc[slc],y[slc])
sigma
=
np
.
sqrt
(
y
[
slc
])
+
(
y
[
slc
]
==
0
),
maxfev
=
10000
)
sigma
=
np
.
sqrt
(
y
[
slc
])
+
(
y
[
slc
]
==
0
)
x
=
np
.
linspace
(
-
5
,
5
)
try
:
plt
.
plot
(
x
,
gauss
(
x
,
*
coeff
),
color
=
'
tab:orange
'
)
coeff
,
var_matrix
=
curve_fit
(
fnc
,
list
(
bc
[
slc
]),
list
(
y
[
slc
]),
p0
=
p0
,
sigma
=
list
(
sigma
),
maxfev
=
10000
)
print
(
coeff
[
2
],
np
.
sqrt
(
var_matrix
[
2
][
2
]))
sigmas
.
append
(
coeff
[
2
])
plt
.
xlabel
(
"
$z^{*
\\
rm recon}_{
\\
rm vtx}-z^{*
\\
rm truth}_{
\\
rm vtx}$ [m]
"
)
dsigmas
.
append
(
np
.
sqrt
(
var_matrix
[
2
][
2
]))
plt
.
ylabel
(
"
events
"
)
xvals
.
append
(
p
)
except
:
plt
.
sca
(
axs
[
2
])
print
(
"
fit failed
"
)
sigmas
=
[]
plt
.
ylim
(
0
,
2
)
dsigmas
=
[]
xvals
=
[]
plt
.
errorbar
(
xvals
,
sigmas
,
dsigmas
,
ls
=
''
,
marker
=
'
o
'
,
color
=
'
k
'
)
for
p
in
momenta
:
x
=
np
.
linspace
(
100
,
275
,
100
)
avg
=
np
.
sum
(
sigmas
/
np
.
array
(
dsigmas
)
**
2
)
/
np
.
sum
(
1
/
np
.
array
(
dsigmas
)
**
2
)
a
=
ak
.
flatten
((
zvtx_recon
[
p
]
-
arrays_sim
[
p
][
'
MCParticles.vertex.z
'
][:,
3
])
/
1000
)
plt
.
axhline
(
avg
,
color
=
'
tab:orange
'
)
y
,
x
=
np
.
histogram
(
a
,
bins
=
100
,
range
=
(
-
10
,
10
))
plt
.
text
(
150
,
1.25
,
f
"
$
\\
sigma
\\
approx$
{
avg
:
.
1
f
}
m
"
)
bc
=
(
x
[
1
:]
+
x
[:
-
1
])
/
2
plt
.
xlabel
(
"
$E_{
\\
Lambda}$ [GeV]
"
)
from
scipy.optimize
import
curve_fit
plt
.
ylabel
(
"
$
\\
sigma[z_{
\\
rm vtx}]$ [m]
"
)
slc
=
abs
(
bc
)
<
5
plt
.
tight_layout
()
fnc
=
gauss
plt
.
savefig
(
outdir
+
"
zvtx_recon.pdf
"
)
p0
=
(
100
,
0
,
1
)
#plt.show()
#print(bc[slc],y[slc])
sigma
=
np
.
sqrt
(
y
[
slc
])
+
(
y
[
slc
]
==
0
)
p
=
100
try
:
fig
,
axs
=
plt
.
subplots
(
1
,
2
,
figsize
=
(
16
,
8
))
coeff
,
var_matrix
=
curve_fit
(
fnc
,
list
(
bc
[
slc
]),
list
(
y
[
slc
]),
p0
=
p0
,
sigma
=
list
(
sigma
),
maxfev
=
10000
)
plt
.
sca
(
axs
[
0
])
sigmas
.
append
(
coeff
[
2
])
lambda_mass
=
1.115683
dsigmas
.
append
(
np
.
sqrt
(
var_matrix
[
2
][
2
]))
vals
=
[]
xvals
.
append
(
p
)
for
p
in
momenta
:
except
:
vals
+=
list
(
ak
.
flatten
(
mass_recon
[
p
]))
print
(
"
fit failed
"
)
plt
.
ylim
(
0
,
2
)
y
,
x
,
_
=
plt
.
hist
(
vals
,
bins
=
100
,
range
=
(
1.0
,
1.25
))
bc
=
(
x
[
1
:]
+
x
[:
-
1
])
/
2
plt
.
errorbar
(
xvals
,
sigmas
,
dsigmas
,
ls
=
''
,
marker
=
'
o
'
,
color
=
'
k
'
)
plt
.
axvline
(
lambda_mass
,
ls
=
'
--
'
,
color
=
'
tab:green
'
,
lw
=
3
)
x
=
np
.
linspace
(
100
,
275
,
100
)
plt
.
text
(
lambda_mass
+
.
01
,
np
.
max
(
y
)
*
1.05
,
"
PDG mass
"
,
color
=
'
tab:green
'
)
plt
.
xlabel
(
"
$m_{
\\
Lambda}^{
\\
rm recon}$ [GeV]
"
)
avg
=
np
.
sum
(
sigmas
/
np
.
array
(
dsigmas
)
**
2
)
/
np
.
sum
(
1
/
np
.
array
(
dsigmas
)
**
2
)
plt
.
ylim
(
0
,
np
.
max
(
y
)
*
1.2
)
plt
.
axhline
(
avg
,
color
=
'
tab:orange
'
)
plt
.
xlim
(
1.0
,
1.25
)
plt
.
text
(
150
,
1.25
,
f
"
$
\\
sigma
\\
approx$
{
avg
:
.
1
f
}
m
"
)
from
scipy.optimize
import
curve_fit
plt
.
xlabel
(
"
$E_{
\\
Lambda}$ [GeV]
"
)
slc
=
abs
(
bc
-
lambda_mass
)
<
0.05
plt
.
ylabel
(
"
$
\\
sigma[z_{
\\
rm vtx}]$ [m]
"
)
fnc
=
gauss
plt
.
tight_layout
()
p0
=
[
100
,
lambda_mass
,
0.04
]
plt
.
savefig
(
outdir
+
"
zvtx_recon.pdf
"
)
coeff
,
var_matrix
=
curve_fit
(
fnc
,
bc
[
slc
],
y
[
slc
],
p0
=
p0
,
#plt.show()
sigma
=
np
.
sqrt
(
y
[
slc
])
+
(
y
[
slc
]
==
0
),
maxfev
=
10000
)
x
=
np
.
linspace
(
0.8
,
1.3
,
200
)
p
=
100
plt
.
plot
(
x
,
gauss
(
x
,
*
coeff
),
color
=
'
tab:orange
'
)
fig
,
axs
=
plt
.
subplots
(
1
,
2
,
figsize
=
(
16
,
8
))
print
(
coeff
[
2
],
np
.
sqrt
(
var_matrix
[
2
][
2
]))
plt
.
sca
(
axs
[
0
])
plt
.
xlabel
(
"
$m^{
\\
rm recon}_{
\\
Lambda}$ [GeV]
"
)
lambda_mass
=
1.115683
plt
.
ylabel
(
"
events
"
)
vals
=
[]
plt
.
title
(
f
"
$E_{{
\\
Lambda}}=100-275$ GeV
"
)
for
p
in
momenta
:
vals
+=
list
(
ak
.
flatten
(
mass_recon
[
p
]))
plt
.
sca
(
axs
[
1
])
xvals
=
[]
y
,
x
,
_
=
plt
.
hist
(
vals
,
bins
=
100
,
range
=
(
1.0
,
1.25
))
sigmas
=
[]
dsigmas
=
[]
for
p
in
momenta
:
y
,
x
=
np
.
histogram
(
ak
.
flatten
(
mass_recon
[
p
]),
bins
=
100
,
range
=
(
0.6
,
1.4
))
bc
=
(
x
[
1
:]
+
x
[:
-
1
])
/
2
bc
=
(
x
[
1
:]
+
x
[:
-
1
])
/
2
plt
.
axvline
(
lambda_mass
,
ls
=
'
--
'
,
color
=
'
tab:green
'
,
lw
=
3
)
plt
.
text
(
lambda_mass
+
.
01
,
np
.
max
(
y
)
*
1.05
,
"
PDG mass
"
,
color
=
'
tab:green
'
)
plt
.
xlabel
(
"
$m_{
\\
Lambda}^{
\\
rm recon}$ [GeV]
"
)
plt
.
ylim
(
0
,
np
.
max
(
y
)
*
1.2
)
plt
.
xlim
(
1.0
,
1.25
)
from
scipy.optimize
import
curve_fit
from
scipy.optimize
import
curve_fit
slc
=
abs
(
bc
-
lambda_mass
)
<
0.05
slc
=
abs
(
bc
-
lambda_mass
)
<
0.05
fnc
=
gauss
fnc
=
gauss
p0
=
[
100
,
lambda_mass
,
0.04
]
p0
=
[
100
,
lambda_mass
,
0.05
]
coeff
,
var_matrix
=
curve_fit
(
fnc
,
bc
[
slc
],
y
[
slc
],
p0
=
p0
,
try
:
sigma
=
np
.
sqrt
(
y
[
slc
])
+
(
y
[
slc
]
==
0
),
maxfev
=
10000
)
coeff
,
var_matrix
=
curve_fit
(
fnc
,
list
(
bc
[
slc
]),
list
(
y
[
slc
]),
p0
=
p0
,
x
=
np
.
linspace
(
0.8
,
1.3
,
200
)
sigma
=
list
(
np
.
sqrt
(
y
[
slc
])
+
(
y
[
slc
]
==
0
)),
maxfev
=
10000
)
plt
.
plot
(
x
,
gauss
(
x
,
*
coeff
),
color
=
'
tab:orange
'
)
x
=
np
.
linspace
(
0.8
,
1.3
,
200
)
print
(
coeff
[
2
],
np
.
sqrt
(
var_matrix
[
2
][
2
]))
sigmas
.
append
(
coeff
[
2
])
plt
.
xlabel
(
"
$m^{
\\
rm recon}_{
\\
Lambda}$ [GeV]
"
)
dsigmas
.
append
(
np
.
sqrt
(
var_matrix
[
2
][
2
]))
plt
.
ylabel
(
"
events
"
)
xvals
.
append
(
p
)
plt
.
title
(
f
"
$E_{{
\\
Lambda}}=100-275$ GeV
"
)
except
:
print
(
"
fit failed
"
)
plt
.
sca
(
axs
[
1
])
xvals
=
[]
plt
.
errorbar
(
xvals
,
sigmas
,
dsigmas
,
ls
=
''
,
marker
=
'
o
'
,
color
=
'
k
'
)
sigmas
=
[]
avg
=
np
.
sum
(
sigmas
/
np
.
array
(
dsigmas
)
**
2
)
/
np
.
sum
(
1
/
np
.
array
(
dsigmas
)
**
2
)
dsigmas
=
[]
plt
.
axhline
(
avg
,
color
=
'
tab:orange
'
)
for
p
in
momenta
:
plt
.
text
(
150
,
0.01
,
f
"
$
\\
sigma
\\
approx$
{
avg
*
1000
:
.
0
f
}
MeV
"
)
y
,
x
=
np
.
histogram
(
ak
.
flatten
(
mass_recon
[
p
]),
bins
=
100
,
range
=
(
0.6
,
1.4
))
plt
.
xlabel
(
"
$E_{
\\
Lambda}$ [GeV]
"
)
bc
=
(
x
[
1
:]
+
x
[:
-
1
])
/
2
plt
.
ylabel
(
"
$
\\
sigma[m_{
\\
Lambda}]$ [GeV]
"
)
plt
.
ylim
(
0
,
0.02
)
from
scipy.optimize
import
curve_fit
plt
.
tight_layout
()
slc
=
abs
(
bc
-
lambda_mass
)
<
0.05
plt
.
savefig
(
outdir
+
"
lambda_mass_rec.pdf
"
)
fnc
=
gauss
p0
=
[
100
,
lambda_mass
,
0.05
]
try
:
coeff
,
var_matrix
=
curve_fit
(
fnc
,
list
(
bc
[
slc
]),
list
(
y
[
slc
]),
p0
=
p0
,
sigma
=
list
(
np
.
sqrt
(
y
[
slc
])
+
(
y
[
slc
]
==
0
)),
maxfev
=
10000
)
x
=
np
.
linspace
(
0.8
,
1.3
,
200
)
sigmas
.
append
(
coeff
[
2
])
dsigmas
.
append
(
np
.
sqrt
(
var_matrix
[
2
][
2
]))
xvals
.
append
(
p
)
except
:
print
(
"
fit failed
"
)
plt
.
errorbar
(
xvals
,
sigmas
,
dsigmas
,
ls
=
''
,
marker
=
'
o
'
,
color
=
'
k
'
)
avg
=
np
.
sum
(
sigmas
/
np
.
array
(
dsigmas
)
**
2
)
/
np
.
sum
(
1
/
np
.
array
(
dsigmas
)
**
2
)
plt
.
axhline
(
avg
,
color
=
'
tab:orange
'
)
plt
.
text
(
150
,
0.01
,
f
"
$
\\
sigma
\\
approx$
{
avg
*
1000
:
.
0
f
}
MeV
"
)
plt
.
xlabel
(
"
$E_{
\\
Lambda}$ [GeV]
"
)
plt
.
ylabel
(
"
$
\\
sigma[m_{
\\
Lambda}]$ [GeV]
"
)
plt
.
ylim
(
0
,
0.02
)
plt
.
tight_layout
()
plt
.
savefig
(
outdir
+
"
lambda_mass_rec.pdf
"
)
#now for the CM stuff:
#now for the CM stuff:
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment