From abcdc1f8bfea98d3987fa88390e0e40e8f9f89e9 Mon Sep 17 00:00:00 2001
From: Wouter Deconinck <wdconinc@gmail.com>
Date: Thu, 30 Jun 2022 14:31:58 -0500
Subject: [PATCH] Skip draw clusters for ecce if not imaging

---
 benchmarks/imaging_ecal/run_emcal_barrel.sh   | 27 ++++++++++---------
 .../imaging_ecal/run_emcal_barrel_pion_rej.sh | 27 ++++++++++---------
 2 files changed, 30 insertions(+), 24 deletions(-)

diff --git a/benchmarks/imaging_ecal/run_emcal_barrel.sh b/benchmarks/imaging_ecal/run_emcal_barrel.sh
index b5126af0..c89bc7f4 100644
--- a/benchmarks/imaging_ecal/run_emcal_barrel.sh
+++ b/benchmarks/imaging_ecal/run_emcal_barrel.sh
@@ -127,18 +127,21 @@ for iev in "${ADDR[@]}"; do
         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
+    if [[ ${JUGGLER_DETECTOR} =~ athena
+       || ${JUGGLER_DETECTOR} =~ ecce && ${JUGGLER_DETECTOR_CONFIG} =~ imaging ]] ; then
+      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
     fi
 done
 
diff --git a/benchmarks/imaging_ecal/run_emcal_barrel_pion_rej.sh b/benchmarks/imaging_ecal/run_emcal_barrel_pion_rej.sh
index d2c22c3f..a4a9c7dc 100755
--- a/benchmarks/imaging_ecal/run_emcal_barrel_pion_rej.sh
+++ b/benchmarks/imaging_ecal/run_emcal_barrel_pion_rej.sh
@@ -128,18 +128,21 @@ for iev in "${ADDR[@]}"; do
         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
+    if [[ ${JUGGLER_DETECTOR} =~ athena
+       || ${JUGGLER_DETECTOR} =~ ecce && ${JUGGLER_DETECTOR_CONFIG} =~ imaging ]] ; then
+      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
     fi
 done
 
-- 
GitLab