From a122604bdacb8b66f8d87b084e886dee60bb347b Mon Sep 17 00:00:00 2001 From: Chao Peng <cpeng@anl.gov> Date: Thu, 24 Jun 2021 04:51:20 +0000 Subject: [PATCH] standardize env var for DETECTOR_PATH --- benchmarks/clustering/full_cal_clusters.sh | 12 ++++++++---- benchmarks/clustering/options/full_cal_clusters.py | 2 +- benchmarks/clustering/options/full_cal_digi.py | 2 +- benchmarks/ecal/emcal_electrons.sh | 6 ++++-- benchmarks/ecal/emcal_pi0s.sh | 6 +++++- benchmarks/ecal/full_emcal_electrons.sh | 6 ++++-- benchmarks/ecal/options/crystal_calorimeter_reco.py | 4 ++-- benchmarks/ecal/run_emcal_barrel_electrons.sh | 6 ++++-- benchmarks/ecal/run_emcal_barrel_pions.sh | 6 ++++-- benchmarks/imaging_shower_ML/sim_rec_tag.py | 2 +- .../tracking/options/tracker_reconstruction.py | 4 ++-- options/tracker_reconstruction.py | 4 ++-- 12 files changed, 38 insertions(+), 22 deletions(-) diff --git a/benchmarks/clustering/full_cal_clusters.sh b/benchmarks/clustering/full_cal_clusters.sh index 220a6360..71b4db4a 100644 --- a/benchmarks/clustering/full_cal_clusters.sh +++ b/benchmarks/clustering/full_cal_clusters.sh @@ -59,8 +59,6 @@ do done set -- "${POSITIONAL[@]}" # restore positional parameters -export JUGGLER_COMPACT_PATH=${DETECTOR_PATH}/${JUGGLER_DETECTOR}.xml - if [[ ! -n "${JUGGLER_N_EVENTS}" ]] ; then export JUGGLER_N_EVENTS=1000 fi @@ -73,6 +71,11 @@ if [[ ! -n "${FULL_CAL_PMAX}" ]] ; then export FULL_CAL_PMIN=10.0 fi +if [[ ! -n "${JUGGLER_DETECTOR_PATH}" ]] ; then + export JUGGLER_DETECTOR_PATH=${DETECTOR_PATH} +fi + +compact_path=${JUGGLER_DETECTOR_PATH}/${JUGGLER_DETECTOR}.xml export JUGGLER_FILE_NAME_TAG="${nametag}" export JUGGLER_GEN_FILE="gen_${JUGGLER_FILE_NAME_TAG}.hepmc" @@ -81,7 +84,8 @@ export JUGGLER_DIGI_FILE="digi_${JUGGLER_FILE_NAME_TAG}.root" export JUGGLER_REC_FILE="rec_${JUGGLER_FILE_NAME_TAG}.root" echo "JUGGLER_N_EVENTS = ${JUGGLER_N_EVENTS}" -echo "JUGGLER_COMPACT_PATH = ${JUGGLER_COMPACT_PATH}" +echo "JUGGLER_DETECTOR_PATH = ${JUGGLER_DETECTOR_PATH}" +echo "JUGGLER_DETECTOR = ${JUGGLER_DETECTOR}" # Generate the input events python benchmarks/imaging_ecal/scripts/gen_particles.py ${JUGGLER_GEN_FILE} -n ${JUGGLER_N_EVENTS}\ @@ -100,7 +104,7 @@ npsim --runType batch \ -v WARNING \ --part.minimalKineticEnergy "1*TeV" \ --numberOfEvents ${JUGGLER_N_EVENTS} \ - --compactFile ${JUGGLER_COMPACT_PATH} \ + --compactFile ${compact_path} \ --inputFiles ${JUGGLER_GEN_FILE} \ --outputFile ${JUGGLER_SIM_FILE} diff --git a/benchmarks/clustering/options/full_cal_clusters.py b/benchmarks/clustering/options/full_cal_clusters.py index 426e7c2e..0b6b3483 100644 --- a/benchmarks/clustering/options/full_cal_clusters.py +++ b/benchmarks/clustering/options/full_cal_clusters.py @@ -11,7 +11,7 @@ from Configurables import ApplicationMgr, EICDataSvc, PodioInput, PodioOutput, G from GaudiKernel.SystemOfUnits import MeV, GeV, mm, cm, mrad detector_name = str(os.environ.get("JUGGLER_DETECTOR", "athena")) -detector_path = str(os.environ.get("DETECTOR_PATH", ".")) +detector_path = str(os.environ.get("JUGGLER_DETECTOR_PATH", ".")) compact_path = os.path.join(detector_path, detector_name) # get sampling fractions from system environment variable, 1.0 by default diff --git a/benchmarks/clustering/options/full_cal_digi.py b/benchmarks/clustering/options/full_cal_digi.py index b0681023..8850e17c 100644 --- a/benchmarks/clustering/options/full_cal_digi.py +++ b/benchmarks/clustering/options/full_cal_digi.py @@ -10,7 +10,7 @@ from Configurables import ApplicationMgr, EICDataSvc, PodioInput, PodioOutput, G from GaudiKernel.SystemOfUnits import MeV, GeV, mm, cm, mrad detector_name = str(os.environ.get("JUGGLER_DETECTOR", "athena")) -detector_path = str(os.environ.get("DETECTOR_PATH", ".")) +detector_path = str(os.environ.get("JUGGLER_DETECTOR_PATH", ".")) compact_path = os.path.join(detector_path, detector_name) # input and output diff --git a/benchmarks/ecal/emcal_electrons.sh b/benchmarks/ecal/emcal_electrons.sh index de2e3bbc..67e08231 100644 --- a/benchmarks/ecal/emcal_electrons.sh +++ b/benchmarks/ecal/emcal_electrons.sh @@ -11,7 +11,9 @@ print_env.sh ## You can ready options/env.sh for more in-depth explanations of the variables ## and how they can be controlled. source options/env.sh -export JUGGLER_DETECTOR_PATH=${DETECTOR_PATH} +if [[ ! -n "${JUGGLER_DETECTOR_PATH}" ]] ; then + export JUGGLER_DETECTOR_PATH=${DETECTOR_PATH} +fi if [[ ! -n "${JUGGLER_N_EVENTS}" ]] ; then export JUGGLER_N_EVENTS=100 @@ -55,7 +57,7 @@ npsim --runType batch \ --part.minimalKineticEnergy 1000*GeV \ -v WARNING \ --numberOfEvents ${JUGGLER_N_EVENTS} \ - --compactFile ${DETECTOR_PATH}/${JUGGLER_DETECTOR}.xml \ + --compactFile ${JUGGLER_DETECTOR_PATH}/${JUGGLER_DETECTOR}.xml \ --inputFiles ${JUGGLER_FILE_NAME_TAG}.hepmc \ --outputFile ${JUGGLER_SIM_FILE} # Need to figure out how to pass file name to juggler from the commandline diff --git a/benchmarks/ecal/emcal_pi0s.sh b/benchmarks/ecal/emcal_pi0s.sh index bed60cd5..c3895aed 100644 --- a/benchmarks/ecal/emcal_pi0s.sh +++ b/benchmarks/ecal/emcal_pi0s.sh @@ -16,6 +16,10 @@ if [[ ! -n "${JUGGLER_N_EVENTS}" ]] ; then export JUGGLER_N_EVENTS=100 fi +if [[ ! -n "${JUGGLER_DETECTOR_PATH}" ]] ; then + export JUGGLER_DETECTOR_PATH=${DETECTOR_PATH} +fi + # File names export JUGGLER_FILE_NAME_TAG="emcal_uniform_pi0s" export JUGGLER_GEN_FILE="${JUGGLER_FILE_NAME_TAG}.hepmc" @@ -49,7 +53,7 @@ npsim --runType batch \ --part.minimalKineticEnergy 1000*GeV \ -v WARNING \ --numberOfEvents ${JUGGLER_N_EVENTS} \ - --compactFile ${DETECTOR_PATH}/${JUGGLER_DETECTOR}.xml \ + --compactFile ${JUGGLER_DETECTOR_PATH}/${JUGGLER_DETECTOR}.xml \ --inputFiles ${JUGGLER_FILE_NAME_TAG}.hepmc \ --outputFile ${JUGGLER_SIM_FILE} if [[ "$?" -ne "0" ]] ; then diff --git a/benchmarks/ecal/full_emcal_electrons.sh b/benchmarks/ecal/full_emcal_electrons.sh index e30364ab..b634d19e 100644 --- a/benchmarks/ecal/full_emcal_electrons.sh +++ b/benchmarks/ecal/full_emcal_electrons.sh @@ -11,7 +11,9 @@ print_env.sh ## You can ready options/env.sh for more in-depth explanations of the variables ## and how they can be controlled. source options/env.sh -export JUGGLER_DETECTOR_PATH=${DETECTOR_PATH} +if [[ ! -n "${JUGGLER_DETECTOR_PATH}" ]] ; then + export JUGGLER_DETECTOR_PATH=${DETECTOR_PATH} +fi if [[ ! -n "${JUGGLER_N_EVENTS}" ]] ; then export JUGGLER_N_EVENTS=100 @@ -48,7 +50,7 @@ npsim --runType batch \ -v WARNING \ --part.minimalKineticEnergy 1*GeV \ --numberOfEvents ${JUGGLER_N_EVENTS} \ - --compactFile ${DETECTOR_PATH}/${JUGGLER_DETECTOR}.xml \ + --compactFile ${JUGGLER_DETECTOR_PATH}/${JUGGLER_DETECTOR}.xml \ --inputFiles ${JUGGLER_FILE_NAME_TAG}.hepmc \ --outputFile ${JUGGLER_SIM_FILE} # Need to figure out how to pass file name to juggler from the commandline diff --git a/benchmarks/ecal/options/crystal_calorimeter_reco.py b/benchmarks/ecal/options/crystal_calorimeter_reco.py index 706a7fd7..e9adbe71 100644 --- a/benchmarks/ecal/options/crystal_calorimeter_reco.py +++ b/benchmarks/ecal/options/crystal_calorimeter_reco.py @@ -10,8 +10,8 @@ if "JUGGLER_DETECTOR" in os.environ : detector_name = str(os.environ["JUGGLER_DETECTOR"]) detector_path = "topside" -if "DETECTOR_PATH" in os.environ : - detector_path = str(os.environ["DETECTOR_PATH"]) +if "JUGGLER_DETECTOR_PATH" in os.environ : + detector_path = str(os.environ["JUGGLER_DETECTOR_PATH"]) # todo add checks input_sim_file = "jug_input.root" diff --git a/benchmarks/ecal/run_emcal_barrel_electrons.sh b/benchmarks/ecal/run_emcal_barrel_electrons.sh index c4482b21..bd6351d8 100755 --- a/benchmarks/ecal/run_emcal_barrel_electrons.sh +++ b/benchmarks/ecal/run_emcal_barrel_electrons.sh @@ -11,7 +11,9 @@ print_env.sh ## You can ready options/env.sh for more in-depth explanations of the variables ## and how they can be controlled. source options/env.sh -export JUGGLER_DETECTOR_PATH=${DETECTOR_PATH} +if [[ ! -n "${JUGGLER_DETECTOR_PATH}" ]] ; then + export JUGGLER_DETECTOR_PATH=${DETECTOR_PATH} +fi if [[ ! -n "${JUGGLER_N_EVENTS}" ]] ; then export JUGGLER_N_EVENTS=1000 @@ -56,7 +58,7 @@ npsim --runType batch \ -v WARNING \ --part.minimalKineticEnergy 0.5*GeV \ --numberOfEvents ${JUGGLER_N_EVENTS} \ - --compactFile ${DETECTOR_PATH}/${JUGGLER_DETECTOR}.xml \ + --compactFile ${JUGGLER_DETECTOR_PATH}/${JUGGLER_DETECTOR}.xml \ --inputFiles ${JUGGLER_FILE_NAME_TAG}.hepmc \ --outputFile ${JUGGLER_SIM_FILE} diff --git a/benchmarks/ecal/run_emcal_barrel_pions.sh b/benchmarks/ecal/run_emcal_barrel_pions.sh index da409133..b25086a5 100755 --- a/benchmarks/ecal/run_emcal_barrel_pions.sh +++ b/benchmarks/ecal/run_emcal_barrel_pions.sh @@ -11,7 +11,9 @@ print_env.sh ## You can ready options/env.sh for more in-depth explanations of the variables ## and how they can be controlled. source options/env.sh -export JUGGLER_DETECTOR_PATH=${DETECTOR_PATH} +if [[ ! -n "${JUGGLER_DETECTOR_PATH}" ]] ; then + export JUGGLER_DETECTOR_PATH=${DETECTOR_PATH} +fi if [[ ! -n "${JUGGLER_N_EVENTS}" ]] ; then export JUGGLER_N_EVENTS=1000 @@ -56,7 +58,7 @@ npsim --runType batch \ -v WARNING \ --part.minimalKineticEnergy 0.5*GeV \ --numberOfEvents ${JUGGLER_N_EVENTS} \ - --compactFile ${DETECTOR_PATH}/${JUGGLER_DETECTOR}.xml \ + --compactFile ${JUGGLER_DETECTOR_PATH}/${JUGGLER_DETECTOR}.xml \ --inputFiles ${JUGGLER_FILE_NAME_TAG}.hepmc \ --outputFile ${JUGGLER_SIM_FILE} diff --git a/benchmarks/imaging_shower_ML/sim_rec_tag.py b/benchmarks/imaging_shower_ML/sim_rec_tag.py index 1b227979..1f7c4b28 100755 --- a/benchmarks/imaging_shower_ML/sim_rec_tag.py +++ b/benchmarks/imaging_shower_ML/sim_rec_tag.py @@ -11,7 +11,7 @@ import subprocess import argparse -default_compact = os.path.join(os.environ.get('DETECTOR_PATH', ''), +default_compact = os.path.join(os.environ.get('JUGGLER_DETECTOR_PATH', os.environ.get('DETECTOR_PATH', '')), '{}.xml'.format(os.environ.get('JUGGLER_DETECTOR', ''))) parser = argparse.ArgumentParser() parser.add_argument('-n', '--numberOfEvents', dest='nev', type=int, default=100, help='Number of events to process.') diff --git a/benchmarks/tracking/options/tracker_reconstruction.py b/benchmarks/tracking/options/tracker_reconstruction.py index ba2cbf0b..6c27c691 100644 --- a/benchmarks/tracking/options/tracker_reconstruction.py +++ b/benchmarks/tracking/options/tracker_reconstruction.py @@ -9,8 +9,8 @@ if "JUGGLER_DETECTOR" in os.environ : detector_name = str(os.environ["JUGGLER_DETECTOR"]) detector_path = "" -if "DETECTOR_PATH" in os.environ : - detector_path = str(os.environ["DETECTOR_PATH"]) +if "JUGGLER_DETECTOR_PATH" in os.environ : + detector_path = str(os.environ["JUGGLER_DETECTOR_PATH"]) # todo add checks input_sim_file = str(os.environ["JUGGLER_SIM_FILE"]) diff --git a/options/tracker_reconstruction.py b/options/tracker_reconstruction.py index 87130a7c..19ca4255 100644 --- a/options/tracker_reconstruction.py +++ b/options/tracker_reconstruction.py @@ -14,8 +14,8 @@ output_rec_file = str(os.environ["JUGGLER_REC_FILE"]) n_events = str(os.environ["JUGGLER_N_EVENTS"]) detector_path = detector_name -if "DETECTOR_PATH" in os.environ : - detector_path = str(os.environ["DETECTOR_PATH"]) +if "JUGGLER_DETECTOR_PATH" in os.environ : + detector_path = str(os.environ["JUGGLER_DETECTOR_PATH"]) geo_service = GeoSvc("GeoSvc", detectors=["{}/{}.xml".format(detector_path, detector_name)]) -- GitLab