From 388dff9fcc5d2d6dce254898d1b29c63830dd4a5 Mon Sep 17 00:00:00 2001
From: Sebouh Paul <sebouh.paul@gmail.com>
Date: Mon, 26 Aug 2024 18:31:47 -0400
Subject: [PATCH] Fix bug in neutron_plots.py (#26)

* Update neutron_plots.py

import uproot as ur

* fixed another bug in the neutron_plots.py

* Update config.yml

Make sure the neutron::analyze stage actually runs.
---
 benchmarks/neutron/analysis/neutron_plots.py | 4 ++--
 benchmarks/neutron/config.yml                | 3 ++-
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/benchmarks/neutron/analysis/neutron_plots.py b/benchmarks/neutron/analysis/neutron_plots.py
index a7b919b6..41583b9c 100644
--- a/benchmarks/neutron/analysis/neutron_plots.py
+++ b/benchmarks/neutron/analysis/neutron_plots.py
@@ -1,4 +1,4 @@
-import numpy as np, pandas as pd, matplotlib.pyplot as plt, matplotlib as mpl, awkward as ak, sys
+import numpy as np, pandas as pd, matplotlib.pyplot as plt, matplotlib as mpl, awkward as ak, sys, uproot as ur
 import mplhep as hep
 hep.style.use("CMS")
 
@@ -57,7 +57,7 @@ for array in arrays_sim.values():
     w=E
     
     array['theta_recon']=np.sum(np.arccos(zp/r)*w, axis=-1)/np.sum(w, axis=-1)
-    array['eta_recon']=-np.log(np.tan(['theta_recon']/2))
+    array['eta_recon']=-np.log(np.tan(array['theta_recon']/2))
     
     
     array['E_Hcal']=np.sum(array['HcalEndcapPInsertClusters.energy'], axis=-1)#*20/12.5
diff --git a/benchmarks/neutron/config.yml b/benchmarks/neutron/config.yml
index be42df42..304b8311 100644
--- a/benchmarks/neutron/config.yml
+++ b/benchmarks/neutron/config.yml
@@ -24,7 +24,8 @@ neutron:analyze:
   extends: .phy_benchmark
   needs: ["neutron:simulate"]
   script:
-    - snakemake --cores 1 --touch results/epic_craterlake/neutron 
+    - mkdir -p results/epic_craterlake
+    - python benchmarks/neutron/analysis/neutron_plots.py results/epic_craterlake/neutron
 
 neutron:results:
   stage: collect
-- 
GitLab