From f968df1e69d1c9fb5021c4487b19c8ee0c7f55cd Mon Sep 17 00:00:00 2001
From: Chao Peng <cpeng@anl.gov>
Date: Wed, 26 May 2021 20:19:40 +0000
Subject: [PATCH] update bash script for barrel benchmark

---
 benchmarks/sampling_ecal/run_emcal_barrel.sh | 40 +++++++++++---------
 1 file changed, 23 insertions(+), 17 deletions(-)

diff --git a/benchmarks/sampling_ecal/run_emcal_barrel.sh b/benchmarks/sampling_ecal/run_emcal_barrel.sh
index f6501902..6e719c9f 100644
--- a/benchmarks/sampling_ecal/run_emcal_barrel.sh
+++ b/benchmarks/sampling_ecal/run_emcal_barrel.sh
@@ -16,7 +16,7 @@ if [[ ! -n  "${CB_EMCAL_NUMEV}" ]] ; then
 fi
 
 if [[ ! -n "${CB_EMCAL_IEV}" ]] ; then
-  export CB_EMCAL_IEV=5
+  export CB_EMCAL_IEV="0, 1, 2, 3, 4"
 fi
 
 if [[ ! -n  "${CB_EMCAL_ENERGY}" ]] ; then
@@ -37,8 +37,8 @@ echo "CB_EMCAL_NUMEV = ${CB_EMCAL_NUMEV}"
 echo "CB_EMCAL_COMPACT_PATH = ${CB_EMCAL_COMPACT_PATH}"
 
 # Generate the input events
-python benchmarks/sampling_ecal/scripts/gen_particles.py ${CB_EMCAL_GEN_FILE} \
-    --angmin 90 --angmax 90 --parray ${CB_EMCAL_ENERGY} --particles="${particle}"
+python benchmarks/sampling_ecal/scripts/gen_particles.py ${CB_EMCAL_GEN_FILE} -n ${CB_EMCAL_NUMEV}\
+    --angmin 60 --angmax 120 --parray ${CB_EMCAL_ENERGY} --particles="${particle}"
 if [[ "$?" -ne "0" ]] ; then
   echo "ERROR running script: generating input events"
   exit 1
@@ -80,20 +80,26 @@ fi
 # check required python modules
 python -m pip install -r benchmarks/sampling_ecal/requirements.txt
 
-# Run analysis script
-python ${CB_EMCAL_SCRIPT_DIR}/draw_cluster_layers.py \
-    ${CB_EMCAL_REC_FILE} -e ${CB_EMCAL_IEV} --topo-size=1.0 --compact=${CB_EMCAL_COMPACT_PATH} -o results/${particle}
-if [[ "$?" -ne "0" ]] ; then
-  echo "ERROR running analysis script: draw_cluster_layers"
-  exit 1
-fi
-
-python ${CB_EMCAL_SCRIPT_DIR}/draw_cluster.py \
-    ${CB_EMCAL_REC_FILE} -e ${CB_EMCAL_IEV} --topo-size=2.0 --compact=${CB_EMCAL_COMPACT_PATH} -o results/${particle}
-if [[ "$?" -ne "0" ]] ; then
-  echo "ERROR running analysis script: draw_cluster"
-  exit 1
-fi
+IFS=',' read -ra ADDR <<< "$CB_EMCAL_IEV"
+for iev in "${ADDR[@]}"; do
+    if [[ $iev -ge "${CB_EMCAL_NUMEV}" ]] ; then
+        continue
+    fi
+
+    python ${CB_EMCAL_SCRIPT_DIR}/draw_cluster_layers.py \
+        ${CB_EMCAL_REC_FILE} -e iev --topo-size=1.0 --compact=${CB_EMCAL_COMPACT_PATH} -o results/${particle}
+    if [[ "$?" -ne "0" ]] ; then
+      echo "ERROR running analysis script: draw_cluster_layers"
+      exit 1
+    fi
+
+    python ${CB_EMCAL_SCRIPT_DIR}/draw_cluster.py \
+        ${CB_EMCAL_REC_FILE} -e iev --topo-size=2.0 --compact=${CB_EMCAL_COMPACT_PATH} -o results/${particle}
+    if [[ "$?" -ne "0" ]] ; then
+      echo "ERROR running analysis script: draw_cluster"
+      exit 1
+    fi
+done
 
 python ${CB_EMCAL_SCRIPT_DIR}/energy_profile.py \
     ${CB_EMCAL_REC_FILE} --type=EM --energy=${CB_EMCAL_ENERGY} -o results/${particle} \
-- 
GitLab