From 6553a83213107d0478f03eafc78bb1c12e96286c Mon Sep 17 00:00:00 2001
From: Wouter Deconinck <wdconinc@gmail.com>
Date: Fri, 29 Jul 2022 02:46:21 +0000
Subject: [PATCH] fix: migrate from JUGGLER_DETECTOR to simply DETECTOR

---
 README.md                                          |  2 +-
 .../backgrounds/analysis/synchrotron_sim.cxx       |  6 +++---
 benchmarks/backgrounds/synchrotron.sh              |  6 +++---
 benchmarks/dis/analysis-only.sh                    |  8 ++++----
 benchmarks/dis/dis.sh                              | 14 +++++++-------
 benchmarks/dvcs/dvcs.sh                            |  6 +++---
 benchmarks/dvmp/dvmp.sh                            |  6 +++---
 benchmarks/single/simulate.sh                      |  2 +-
 benchmarks/tcs/tcs.sh                              |  6 +++---
 benchmarks/u_omega/u_omega.sh                      |  6 +++---
 options/reconstruction.ecal.py                     | 12 ++++++------
 options/reconstruction.hcal.py                     | 12 ++++++------
 options/reconstruction.py                          | 12 ++++++------
 options/reconstruction.raw.py                      | 12 ++++++------
 14 files changed, 55 insertions(+), 55 deletions(-)

diff --git a/README.md b/README.md
index 4186a278..28bb40ee 100644
--- a/README.md
+++ b/README.md
@@ -32,7 +32,7 @@ Here we setup to use our local build of the `juggler` library.
 First set some environment variables.
 ```
 export JUGGLER_INSTALL_PREFIX=/usr/local 
-export JUGGLER_DETECTOR=athena   # athena is the default
+export DETECTOR=epic             # athena is the default
 export BEAMLINE_CONFIG=ip6       # ip6 is the default
 ```
 
diff --git a/benchmarks/backgrounds/analysis/synchrotron_sim.cxx b/benchmarks/backgrounds/analysis/synchrotron_sim.cxx
index f469e435..6020cd6f 100644
--- a/benchmarks/backgrounds/analysis/synchrotron_sim.cxx
+++ b/benchmarks/backgrounds/analysis/synchrotron_sim.cxx
@@ -30,9 +30,9 @@ void synchrotron_sim(const char* fname = "sim_synchrotron.edm4hep.root"){
 
   // Detector version
   std::string detector_version("default");
-  const char* juggler_detector_version = gSystem->Getenv("JUGGLER_DETECTOR_VERSION");
-  if (juggler_detector_version) {
-    detector_version = juggler_detector_version;
+  const char* getenv_detector_version = gSystem->Getenv("DETECTOR_VERSION");
+  if (getenv_detector_version) {
+    detector_version = getenv_detector_version;
   }
 
   if (detector_version == "acadia") {
diff --git a/benchmarks/backgrounds/synchrotron.sh b/benchmarks/backgrounds/synchrotron.sh
index 45ff4edd..01c7a862 100644
--- a/benchmarks/backgrounds/synchrotron.sh
+++ b/benchmarks/backgrounds/synchrotron.sh
@@ -79,12 +79,12 @@ export JUGGLER_REC_FILE="${LOCAL_DATA_PATH}/rec_${FILE_NAME_TAG}.root"
 
 echo "FILE_NAME_TAG       = ${FILE_NAME_TAG}"
 echo "JUGGLER_N_EVENTS    = ${JUGGLER_N_EVENTS}"
-echo "JUGGLER_DETECTOR    = ${JUGGLER_DETECTOR}"
+echo "DETECTOR    = ${DETECTOR}"
 
 
 ## To run the reconstruction, we need the following global variables:
 ## - JUGGLER_INSTALL_PREFIX: Install prefix for Juggler (simu/recon)
-## - JUGGLER_DETECTOR:       the detector package we want to use for this benchmark
+## - DETECTOR:       the detector package we want to use for this benchmark
 ## - DETECTOR_PATH:          full path to the detector definitions
 
 ## Step 1. Get the data
@@ -105,7 +105,7 @@ if [[ -n "${DO_SIM}" || -n "${DO_ALL}" ]] ; then
     --filter.tracker edep0 \
     -v ERROR \
     --numberOfEvents ${JUGGLER_N_EVENTS} \
-    --compactFile ${DETECTOR_PATH}/${JUGGLER_DETECTOR_CONFIG}.xml \
+    --compactFile ${DETECTOR_PATH}/${DETECTOR_CONFIG}.xml \
     --inputFiles ${JUGGLER_MC_FILE} \
     --outputFile ${JUGGLER_SIM_FILE}
   if [[ "$?" -ne "0" ]] ; then
diff --git a/benchmarks/dis/analysis-only.sh b/benchmarks/dis/analysis-only.sh
index 1cff2044..8c712a07 100755
--- a/benchmarks/dis/analysis-only.sh
+++ b/benchmarks/dis/analysis-only.sh
@@ -27,7 +27,7 @@ source parse_cmd.sh $@
 
 ## To run the reconstruction, we need the following global variables:
 ## - JUGGLER_INSTALL_PREFIX: Install prefix for Juggler (simu/recon)
-## - JUGGLER_DETECTOR:       the detector package we want to use for this benchmark
+## - DETECTOR:       the detector package we want to use for this benchmark
 ## - DETECTOR_PATH:          full path to the detector definitions
 ##
 
@@ -62,7 +62,7 @@ echo "Running Geant4 simulation"
 #      --filter.tracker edep0 \
 #      -v WARNING \
 #      --numberOfEvents ${JUGGLER_N_EVENTS} \
-#      --compactFile ${DETECTOR_PATH}/${JUGGLER_DETECTOR_CONFIG}.xml \
+#      --compactFile ${DETECTOR_PATH}/${DETECTOR_CONFIG}.xml \
 #      --inputFiles ${GEN_FILE} \
 #      --outputFile ${SIM_FILE}
 #if [ "$?" -ne "0" ] ; then
@@ -79,7 +79,7 @@ echo "Running Geant4 simulation"
 ## - JUGGLER_SIM_FILE:    input detector simulation
 ## - JUGGLER_REC_FILE:    output reconstructed data
 ## - JUGGLER_N_EVENTS:    number of events to process (part of global environment)
-## - JUGGLER_DETECTOR:    detector package (part of global environment)
+## - DETECTOR:    detector package (part of global environment)
 #export JUGGLER_SIM_FILE=${SIM_FILE}
 #export JUGGLER_REC_FILE=${REC_FILE}
 #gaudirun.py options/tracker_reconstruction.py 
@@ -103,7 +103,7 @@ CONFIG="${TMP_PATH}/${PLOT_TAG}.json"
 cat << EOF > ${CONFIG}
 {
   "rec_file": "${REC_FILE}",
-  "detector": "${JUGGLER_DETECTOR}",
+  "detector": "${DETECTOR}",
   "output_prefix": "${RESULTS_PATH}/${PLOT_TAG}",
   "test_tag": "${BEAM_TAG}"
 }
diff --git a/benchmarks/dis/dis.sh b/benchmarks/dis/dis.sh
index 43897bed..4b3fe736 100755
--- a/benchmarks/dis/dis.sh
+++ b/benchmarks/dis/dis.sh
@@ -28,7 +28,7 @@ source ${LOCAL_PREFIX}/bin/parse_cmd.sh $@
 
 ## To run the reconstruction, we need the following global variables:
 ## - JUGGLER_INSTALL_PREFIX: Install prefix for Juggler (simu/recon)
-## - JUGGLER_DETECTOR:       the detector package we want to use for this benchmark
+## - DETECTOR:       the detector package we want to use for this benchmark
 ## - DETECTOR_PATH:          full path to the detector definitions
 ##
 ## defined in common_bench repo
@@ -67,7 +67,7 @@ ddsim --runType batch \
       --filter.tracker edep0 \
       -v INFO \
       --numberOfEvents ${JUGGLER_N_EVENTS} \
-      --compactFile ${DETECTOR_PATH}/${JUGGLER_DETECTOR_CONFIG}.xml \
+      --compactFile ${DETECTOR_PATH}/${DETECTOR_CONFIG}.xml \
       --inputFiles ${GEN_FILE} \
       --outputFile ${SIM_FILE}
 if [ "$?" -ne "0" ] ; then
@@ -85,7 +85,7 @@ echo "Running the digitization and reconstruction"
 ## - JUGGLER_SIM_FILE:    input detector simulation
 ## - JUGGLER_REC_FILE:    output reconstructed data
 ## - JUGGLER_N_EVENTS:    number of events to process (part of global environment)
-## - JUGGLER_DETECTOR:    detector package (part of global environment)
+## - DETECTOR:    detector package (part of global environment)
 export JUGGLER_SIM_FILE=${SIM_FILE}
 export JUGGLER_REC_FILE=${REC_FILE}
 for rec in options/*.py ; do
@@ -107,7 +107,7 @@ CONFIG="${TMP_PATH}/${PLOT_TAG}.json"
 cat << EOF > ${CONFIG}
 {
   "rec_file": "${REC_FILE}",
-  "detector": "${JUGGLER_DETECTOR}",
+  "detector": "${DETECTOR}",
   "output_prefix": "${RESULTS_PATH}/${PLOT_TAG}",
   "ebeam": ${EBEAM},
   "pbeam": ${PBEAM},
@@ -132,7 +132,7 @@ CONFIG="${TMP_PATH}/${PLOT_TAG}.raw.json"
 cat << EOF > ${CONFIG}
 {
   "rec_file": "${REC_FILE/.root/.raw.root}",
-  "detector": "${JUGGLER_DETECTOR}",
+  "detector": "${DETECTOR}",
   "output_prefix": "${RESULTS_PATH}/${PLOT_TAG}",
   "ebeam": ${EBEAM},
   "pbeam": ${PBEAM},
@@ -150,7 +150,7 @@ CONFIG="${TMP_PATH}/${PLOT_TAG}.ecal.json"
 cat << EOF > ${CONFIG}
 {
   "rec_file": "${REC_FILE/.root/.ecal.root}",
-  "detector": "${JUGGLER_DETECTOR}",
+  "detector": "${DETECTOR}",
   "output_prefix": "${RESULTS_PATH}/${PLOT_TAG}",
   "ebeam": ${EBEAM},
   "pbeam": ${PBEAM},
@@ -168,7 +168,7 @@ CONFIG="${TMP_PATH}/${PLOT_TAG}.hcal.json"
 cat << EOF > ${CONFIG}
 {
   "rec_file": "${REC_FILE/.root/.hcal.root}",
-  "detector": "${JUGGLER_DETECTOR}",
+  "detector": "${DETECTOR}",
   "output_prefix": "${RESULTS_PATH}/${PLOT_TAG}",
   "ebeam": ${EBEAM},
   "pbeam": ${PBEAM},
diff --git a/benchmarks/dvcs/dvcs.sh b/benchmarks/dvcs/dvcs.sh
index 73c6c89f..9abe3427 100644
--- a/benchmarks/dvcs/dvcs.sh
+++ b/benchmarks/dvcs/dvcs.sh
@@ -79,12 +79,12 @@ export JUGGLER_REC_FILE="${LOCAL_DATA_PATH}/rec_${FILE_NAME_TAG}.root"
 
 echo "FILE_NAME_TAG       = ${FILE_NAME_TAG}"
 echo "JUGGLER_N_EVENTS    = ${JUGGLER_N_EVENTS}"
-echo "JUGGLER_DETECTOR    = ${JUGGLER_DETECTOR}"
+echo "DETECTOR    = ${DETECTOR}"
 
 
 ## To run the reconstruction, we need the following global variables:
 ## - JUGGLER_INSTALL_PREFIX: Install prefix for Juggler (simu/recon)
-## - JUGGLER_DETECTOR:       the detector package we want to use for this benchmark
+## - DETECTOR:       the detector package we want to use for this benchmark
 ## - DETECTOR_PATH:          full path to the detector definitions
 
 ## Step 1. Get the data
@@ -105,7 +105,7 @@ if [[ -n "${DO_SIM}" || -n "${DO_ALL}" ]] ; then
     --filter.tracker edep0 \
     -v ERROR \
     --numberOfEvents ${JUGGLER_N_EVENTS} \
-    --compactFile ${DETECTOR_PATH}/${JUGGLER_DETECTOR_CONFIG}.xml \
+    --compactFile ${DETECTOR_PATH}/${DETECTOR_CONFIG}.xml \
     --inputFiles "${JUGGLER_MC_FILE}" \
     --outputFile  ${JUGGLER_SIM_FILE}
   if [[ "$?" -ne "0" ]] ; then
diff --git a/benchmarks/dvmp/dvmp.sh b/benchmarks/dvmp/dvmp.sh
index ce165df3..432f194f 100755
--- a/benchmarks/dvmp/dvmp.sh
+++ b/benchmarks/dvmp/dvmp.sh
@@ -65,7 +65,7 @@ ddsim --runType batch \
       --filter.tracker edep0 \
       -v WARNING \
       --numberOfEvents ${JUGGLER_N_EVENTS} \
-      --compactFile ${DETECTOR_PATH}/${JUGGLER_DETECTOR_CONFIG}.xml \
+      --compactFile ${DETECTOR_PATH}/${DETECTOR_CONFIG}.xml \
       --inputFiles ${GEN_FILE} \
       --outputFile ${SIM_FILE}
 if [ "$?" -ne "0" ] ; then
@@ -82,7 +82,7 @@ echo "Running the digitization and reconstruction"
 ## - JUGGLER_SIM_FILE:    input detector simulation
 ## - JUGGLER_REC_FILE:    output reconstructed data
 ## - JUGGLER_N_EVENTS:    number of events to process (part of global environment)
-## - JUGGLER_DETECTOR:    detector package (part of global environment)
+## - DETECTOR:    detector package (part of global environment)
 export JUGGLER_SIM_FILE=${SIM_FILE}
 export JUGGLER_REC_FILE=${REC_FILE}
 for rec in options/*.py ; do
@@ -106,7 +106,7 @@ cat << EOF > ${CONFIG}
   "rec_file": "${REC_FILE}",
   "vm_name": "${LEADING}",
   "decay": "${DECAY}",
-  "detector": "${JUGGLER_DETECTOR_CONFIG}",
+  "detector": "${DETECTOR_CONFIG}",
   "output_prefix": "${RESULTS_PATH}/${PLOT_TAG}",
   "test_tag": "${LEADING}_${DECAY}_${BEAM_TAG}"
 }
diff --git a/benchmarks/single/simulate.sh b/benchmarks/single/simulate.sh
index 6466beca..047e1e97 100644
--- a/benchmarks/single/simulate.sh
+++ b/benchmarks/single/simulate.sh
@@ -11,7 +11,7 @@ ddsim --runType run \
       --numberOfEvents ${JUGGLER_N_EVENTS} \
       --part.minimalKineticEnergy 1*TeV  \
       --filter.tracker edep0 \
-      --compactFile ${DETECTOR_PATH}/${JUGGLER_DETECTOR_CONFIG}.xml \
+      --compactFile ${DETECTOR_PATH}/${DETECTOR_CONFIG}.xml \
       --outputFile  ${JUGGLER_SIM_FILE}
 if [[ "$?" -ne "0" ]] ; then
   echo "ERROR running ddsim"
diff --git a/benchmarks/tcs/tcs.sh b/benchmarks/tcs/tcs.sh
index 63b384c7..e8c64bec 100644
--- a/benchmarks/tcs/tcs.sh
+++ b/benchmarks/tcs/tcs.sh
@@ -100,12 +100,12 @@ export JUGGLER_REC_FILE="${LOCAL_DATA_PATH}/rec_${FILE_NAME_TAG}.root"
 
 echo "FILE_NAME_TAG       = ${FILE_NAME_TAG}"
 echo "JUGGLER_N_EVENTS    = ${JUGGLER_N_EVENTS}"
-echo "JUGGLER_DETECTOR    = ${JUGGLER_DETECTOR}"
+echo "DETECTOR    = ${DETECTOR}"
 
 
 ## To run the reconstruction, we need the following global variables:
 ## - JUGGLER_INSTALL_PREFIX: Install prefix for Juggler (simu/recon)
-## - JUGGLER_DETECTOR:       the detector package we want to use for this benchmark
+## - DETECTOR:       the detector package we want to use for this benchmark
 ## - DETECTOR_PATH:          full path to the detector definitions
 
 ## Step 1. Get the data
@@ -126,7 +126,7 @@ if [[ -n "${DO_SIM}" || -n "${DO_ALL}" ]] ; then
     --filter.tracker edep0 \
     -v ERROR \
     --numberOfEvents ${JUGGLER_N_EVENTS} \
-    --compactFile ${DETECTOR_PATH}/${JUGGLER_DETECTOR_CONFIG}.xml \
+    --compactFile ${DETECTOR_PATH}/${DETECTOR_CONFIG}.xml \
     --inputFiles "${JUGGLER_MC_FILE}" \
     --outputFile  ${JUGGLER_SIM_FILE}
   if [ "$?" -ne "0" ] ; then
diff --git a/benchmarks/u_omega/u_omega.sh b/benchmarks/u_omega/u_omega.sh
index 1052c787..ddd8557a 100644
--- a/benchmarks/u_omega/u_omega.sh
+++ b/benchmarks/u_omega/u_omega.sh
@@ -79,11 +79,11 @@ export JUGGLER_REC_FILE="${LOCAL_DATA_PATH}/rec_${FILE_NAME_TAG}.root"
 
 echo "FILE_NAME_TAG       = ${FILE_NAME_TAG}"
 echo "JUGGLER_N_EVENTS    = ${JUGGLER_N_EVENTS}"
-echo "JUGGLER_DETECTOR    = ${JUGGLER_DETECTOR}"
+echo "DETECTOR    = ${DETECTOR}"
 
 ## To run the reconstruction, we need the following global variables:
 ## - JUGGLER_INSTALL_PREFIX: Install prefix for Juggler (simu/recon)
-## - JUGGLER_DETECTOR:       the detector package we want to use for this benchmark
+## - DETECTOR:       the detector package we want to use for this benchmark
 ## - DETECTOR_PATH:          full path to the detector definitions
 
 ## Step 1. Get the data
@@ -104,7 +104,7 @@ if [[ -n "${DO_SIM}" || -n "${DO_ALL}" ]] ; then
     --filter.tracker edep0 \
     -v ERROR \
     --numberOfEvents ${JUGGLER_N_EVENTS} \
-    --compactFile ${DETECTOR_PATH}/${JUGGLER_DETECTOR_CONFIG}.xml \
+    --compactFile ${DETECTOR_PATH}/${DETECTOR_CONFIG}.xml \
     --inputFiles "${JUGGLER_MC_FILE}" \
     --outputFile  ${JUGGLER_SIM_FILE}
   if [[ "$?" -ne "0" ]] ; then
diff --git a/options/reconstruction.ecal.py b/options/reconstruction.ecal.py
index b10d1aa5..91932ae8 100644
--- a/options/reconstruction.ecal.py
+++ b/options/reconstruction.ecal.py
@@ -7,20 +7,20 @@ from GaudiKernel.SystemOfUnits import eV, MeV, GeV, mm, cm, mrad
 import json
 
 detector_name = "athena"
-if "JUGGLER_DETECTOR" in os.environ:
-    detector_name = str(os.environ["JUGGLER_DETECTOR"])
+if "DETECTOR" in os.environ:
+    detector_name = str(os.environ["DETECTOR"])
 
 detector_config = detector_name
-if "JUGGLER_DETECTOR_CONFIG" in os.environ:
-    detector_config = str(os.environ["JUGGLER_DETECTOR_CONFIG"])
+if "DETECTOR_CONFIG" in os.environ:
+    detector_config = str(os.environ["DETECTOR_CONFIG"])
 
 detector_path = ""
 if "DETECTOR_PATH" in os.environ:
     detector_path = str(os.environ["DETECTOR_PATH"])
 
 detector_version = "default"
-if "JUGGLER_DETECTOR_VERSION" in os.environ:
-    env_version = str(os.environ["JUGGLER_DETECTOR_VERSION"])
+if "DETECTOR_VERSION" in os.environ:
+    env_version = str(os.environ["DETECTOR_VERSION"])
     if "acadia" in env_version:
         detector_version = "acadia"
 
diff --git a/options/reconstruction.hcal.py b/options/reconstruction.hcal.py
index d199849d..0fb20276 100644
--- a/options/reconstruction.hcal.py
+++ b/options/reconstruction.hcal.py
@@ -7,20 +7,20 @@ from GaudiKernel.SystemOfUnits import eV, MeV, GeV, mm, cm, mrad
 import json
 
 detector_name = "athena"
-if "JUGGLER_DETECTOR" in os.environ:
-    detector_name = str(os.environ["JUGGLER_DETECTOR"])
+if "DETECTOR" in os.environ:
+    detector_name = str(os.environ["DETECTOR"])
 
 detector_config = detector_name
-if "JUGGLER_DETECTOR_CONFIG" in os.environ:
-    detector_config = str(os.environ["JUGGLER_DETECTOR_CONFIG"])
+if "DETECTOR_CONFIG" in os.environ:
+    detector_config = str(os.environ["DETECTOR_CONFIG"])
 
 detector_path = ""
 if "DETECTOR_PATH" in os.environ:
     detector_path = str(os.environ["DETECTOR_PATH"])
 
 detector_version = "default"
-if "JUGGLER_DETECTOR_VERSION" in os.environ:
-    env_version = str(os.environ["JUGGLER_DETECTOR_VERSION"])
+if "DETECTOR_VERSION" in os.environ:
+    env_version = str(os.environ["DETECTOR_VERSION"])
     if "acadia" in env_version:
         detector_version = "acadia"
 
diff --git a/options/reconstruction.py b/options/reconstruction.py
index f10674e3..2eb6bcf6 100644
--- a/options/reconstruction.py
+++ b/options/reconstruction.py
@@ -7,20 +7,20 @@ from GaudiKernel.SystemOfUnits import eV, MeV, GeV, mm, cm, mrad
 import json
 
 detector_name = "athena"
-if "JUGGLER_DETECTOR" in os.environ:
-    detector_name = str(os.environ["JUGGLER_DETECTOR"])
+if "DETECTOR" in os.environ:
+    detector_name = str(os.environ["DETECTOR"])
 
 detector_config = detector_name
-if "JUGGLER_DETECTOR_CONFIG" in os.environ:
-    detector_config = str(os.environ["JUGGLER_DETECTOR_CONFIG"])
+if "DETECTOR_CONFIG" in os.environ:
+    detector_config = str(os.environ["DETECTOR_CONFIG"])
 
 detector_path = ""
 if "DETECTOR_PATH" in os.environ:
     detector_path = str(os.environ["DETECTOR_PATH"])
 
 detector_version = "default"
-if "JUGGLER_DETECTOR_VERSION" in os.environ:
-    env_version = str(os.environ["JUGGLER_DETECTOR_VERSION"])
+if "DETECTOR_VERSION" in os.environ:
+    env_version = str(os.environ["DETECTOR_VERSION"])
     if "acadia" in env_version:
         detector_version = "acadia"
 
diff --git a/options/reconstruction.raw.py b/options/reconstruction.raw.py
index b2a31f06..9b40beda 100644
--- a/options/reconstruction.raw.py
+++ b/options/reconstruction.raw.py
@@ -7,20 +7,20 @@ from GaudiKernel.SystemOfUnits import eV, MeV, GeV, mm, cm, mrad
 import json
 
 detector_name = "athena"
-if "JUGGLER_DETECTOR" in os.environ:
-    detector_name = str(os.environ["JUGGLER_DETECTOR"])
+if "DETECTOR" in os.environ:
+    detector_name = str(os.environ["DETECTOR"])
 
 detector_config = detector_name
-if "JUGGLER_DETECTOR_CONFIG" in os.environ:
-    detector_config = str(os.environ["JUGGLER_DETECTOR_CONFIG"])
+if "DETECTOR_CONFIG" in os.environ:
+    detector_config = str(os.environ["DETECTOR_CONFIG"])
 
 detector_path = ""
 if "DETECTOR_PATH" in os.environ:
     detector_path = str(os.environ["DETECTOR_PATH"])
 
 detector_version = "default"
-if "JUGGLER_DETECTOR_VERSION" in os.environ:
-    env_version = str(os.environ["JUGGLER_DETECTOR_VERSION"])
+if "DETECTOR_VERSION" in os.environ:
+    env_version = str(os.environ["DETECTOR_VERSION"])
     if "acadia" in env_version:
         detector_version = "acadia"
 
-- 
GitLab