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
03850ad4
Unverified
Commit
03850ad4
authored
1 year ago
by
Dmitry Kalinkin
Committed by
GitHub
1 year ago
Browse files
Options
Downloads
Patches
Plain Diff
ecal_gaps: add profile to the plots (
#19
)
parent
16fd651e
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
benchmarks/ecal_gaps/ecal_gaps.org
+50
-21
50 additions, 21 deletions
benchmarks/ecal_gaps/ecal_gaps.org
with
50 additions
and
21 deletions
benchmarks/ecal_gaps/ecal_gaps.org
+
50
−
21
View file @
03850ad4
...
@@ -65,6 +65,9 @@ def filter_name(name):
...
@@ -65,6 +65,9 @@ def filter_name(name):
import functools
import functools
axis_eta = bh.axis.Regular(200, -4, 4)
axis_eta_coarse = bh.axis.Regular(100, -4, 4)
@functools.cache
@functools.cache
def get_events(particle="e-", energy="20GeV", num_files=1):
def get_events(particle="e-", energy="20GeV", num_files=1):
events = uproot.dask(
events = uproot.dask(
...
@@ -81,8 +84,6 @@ def get_events(particle="e-", energy="20GeV", num_files=1):
...
@@ -81,8 +84,6 @@ def get_events(particle="e-", energy="20GeV", num_files=1):
eta = -np.log(np.tan(theta / 2))
eta = -np.log(np.tan(theta / 2))
p = np.hypot(pt, events["MCParticles.momentum.z"][:,0])
p = np.hypot(pt, events["MCParticles.momentum.z"][:,0])
axis_eta = bh.axis.Regular(200, -4, 4)
hist_norm = dh.factory(
hist_norm = dh.factory(
eta,
eta,
axes=(
axes=(
...
@@ -103,27 +104,38 @@ def get_events(particle="e-", energy="20GeV", num_files=1):
...
@@ -103,27 +104,38 @@ def get_events(particle="e-", energy="20GeV", num_files=1):
events["eta_thrown"] = eta
events["eta_thrown"] = eta
events["weights"] = weights
events["weights"] = weights
return events
, axis_eta
return events
#+end_src
#+end_src
#+begin_src jupyter-python
#+begin_src jupyter-python
particle = "e-"
particle = "e-"
for energy in ["500MeV", "5GeV", "20GeV"]:
for energy in ["500MeV", "5GeV", "20GeV"]:
events
, axis_eta
= get_events(particle=particle, energy=energy)
events = get_events(particle=particle, energy=energy)
for calo_name in ["EcalEndcapN", "EcalBarrelScFi", "EcalBarrelImaging", "EcalEndcapP"]:
for calo_name in ["EcalEndcapN", "EcalBarrelScFi", "EcalBarrelImaging", "EcalEndcapP"]:
cond = ak.sum(events[f"{calo_name}RecHits.energy"], axis=1) > 10e-3 # GeV
cond = ak.sum(events[f"{calo_name}RecHits.energy"], axis=1) > 10e-3 # GeV
hist = dh.factory(
hist, profile = client.gather(client.compute([
events["eta_thrown"][cond],
dh.factory(
(ak.sum(events[f"{calo_name}RecHits.energy"], axis=1) / events["p_thrown"])[cond],
events["eta_thrown"][cond],
axes=(
(ak.sum(events[f"{calo_name}RecHits.energy"], axis=1) / events["p_thrown"])[cond],
axis_eta,
axes=(
bh.axis.Regular(100, 0.1, 1.1),
axis_eta,
bh.axis.Regular(100, 0.1, 1.1),
),
weights=events["weights"][cond],
),
dh.factory(
events["eta_thrown"][cond],
sample=(ak.sum(events[f"{calo_name}RecHits.energy"], axis=1) / events["p_thrown"])[cond],
storage=bh.storage.WeightedMean(),
axes=(
axis_eta_coarse,
),
weights=events["weights"][cond],
),
),
weights=events["weights"][cond],
]))
).compute()
cmap = plt.get_cmap(name="rainbow", lut=None).copy()
cmap = plt.get_cmap(name="rainbow", lut=None).copy()
cmap.set_under("none")
cmap.set_under("none")
...
@@ -138,6 +150,9 @@ for energy in ["500MeV", "5GeV", "20GeV"]:
...
@@ -138,6 +150,9 @@ for energy in ["500MeV", "5GeV", "20GeV"]:
),
),
)
)
plt.colorbar()
plt.colorbar()
std = np.sqrt(profile.variances())
cond = profile.values() > std
plt.errorbar(profile.axes[0].centers[cond], profile.values()[cond], yerr=std[cond], marker=".", markersize=2, color="black", ls="none", lw=0.6, capsize=1.)
plt.xlabel(r"$\eta_{thrown}$", loc="right")
plt.xlabel(r"$\eta_{thrown}$", loc="right")
plt.ylabel(r"$\sum E_{\mathrm{dep.}} / p_{\mathrm{thrown}}$", loc="top")
plt.ylabel(r"$\sum E_{\mathrm{dep.}} / p_{\mathrm{thrown}}$", loc="top")
plt.title(f"{energy} {particle} in {calo_name}")
plt.title(f"{energy} {particle} in {calo_name}")
...
@@ -151,7 +166,7 @@ for energy in ["500MeV", "5GeV", "20GeV"]:
...
@@ -151,7 +166,7 @@ for energy in ["500MeV", "5GeV", "20GeV"]:
particle = "e-"
particle = "e-"
for energy in ["500MeV", "5GeV", "20GeV"]:
for energy in ["500MeV", "5GeV", "20GeV"]:
events
, axis_eta
= get_events(particle=particle, energy=energy)
events = get_events(particle=particle, energy=energy)
calos = ["EcalEndcapN", "EcalBarrelScFi", "EcalEndcapP"]
calos = ["EcalEndcapN", "EcalBarrelScFi", "EcalEndcapP"]
total_energy = sum([
total_energy = sum([
...
@@ -159,15 +174,26 @@ for energy in ["500MeV", "5GeV", "20GeV"]:
...
@@ -159,15 +174,26 @@ for energy in ["500MeV", "5GeV", "20GeV"]:
for calo_name in calos
for calo_name in calos
])
])
hist = dh.factory(
hist, profile = client.gather(client.compute([
events["eta_thrown"],
dh.factory(
total_energy / events["p_thrown"],
events["eta_thrown"],
axes=(
total_energy / events["p_thrown"],
axis_eta,
axes=(
bh.axis.Regular(100, 0.0, 1.1),
axis_eta,
bh.axis.Regular(100, 0.1, 1.1),
),
weights=events["weights"],
),
),
weights=events["weights"],
dh.factory(
).compute()
events["eta_thrown"],
sample=total_energy / events["p_thrown"],
storage=bh.storage.WeightedMean(),
axes=(
axis_eta_coarse,
),
weights=events["weights"],
),
]))
cmap = plt.get_cmap(name="rainbow", lut=None).copy()
cmap = plt.get_cmap(name="rainbow", lut=None).copy()
cmap.set_under("none")
cmap.set_under("none")
...
@@ -182,6 +208,9 @@ for energy in ["500MeV", "5GeV", "20GeV"]:
...
@@ -182,6 +208,9 @@ for energy in ["500MeV", "5GeV", "20GeV"]:
),
),
)
)
plt.colorbar()
plt.colorbar()
std = np.sqrt(profile.variances())
cond = profile.values() > std
plt.errorbar(profile.axes[0].centers[cond], profile.values()[cond], yerr=std[cond], marker=".", markersize=2, color="black", ls="none", lw=0.6, capsize=1.)
plt.xlabel(r"$\eta_{thrown}$", loc="right")
plt.xlabel(r"$\eta_{thrown}$", loc="right")
plt.ylabel(r"$\sum E_{\mathrm{dep.}} / p_{\mathrm{thrown}}$", loc="top")
plt.ylabel(r"$\sum E_{\mathrm{dep.}} / p_{\mathrm{thrown}}$", loc="top")
plt.title(f"{energy} {particle}\n" + "+".join(calos))
plt.title(f"{energy} {particle}\n" + "+".join(calos))
...
...
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