Skip to content
Snippets Groups Projects
Commit a122604b authored by Chao Peng's avatar Chao Peng
Browse files

standardize env var for DETECTOR_PATH

parent 97d30e8c
No related branches found
No related tags found
1 merge request!116standardize env var for DETECTOR_PATH
Showing with 38 additions and 22 deletions
...@@ -59,8 +59,6 @@ do ...@@ -59,8 +59,6 @@ do
done done
set -- "${POSITIONAL[@]}" # restore positional parameters set -- "${POSITIONAL[@]}" # restore positional parameters
export JUGGLER_COMPACT_PATH=${DETECTOR_PATH}/${JUGGLER_DETECTOR}.xml
if [[ ! -n "${JUGGLER_N_EVENTS}" ]] ; then if [[ ! -n "${JUGGLER_N_EVENTS}" ]] ; then
export JUGGLER_N_EVENTS=1000 export JUGGLER_N_EVENTS=1000
fi fi
...@@ -73,6 +71,11 @@ if [[ ! -n "${FULL_CAL_PMAX}" ]] ; then ...@@ -73,6 +71,11 @@ if [[ ! -n "${FULL_CAL_PMAX}" ]] ; then
export FULL_CAL_PMIN=10.0 export FULL_CAL_PMIN=10.0
fi 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_FILE_NAME_TAG="${nametag}"
export JUGGLER_GEN_FILE="gen_${JUGGLER_FILE_NAME_TAG}.hepmc" export JUGGLER_GEN_FILE="gen_${JUGGLER_FILE_NAME_TAG}.hepmc"
...@@ -81,7 +84,8 @@ export JUGGLER_DIGI_FILE="digi_${JUGGLER_FILE_NAME_TAG}.root" ...@@ -81,7 +84,8 @@ export JUGGLER_DIGI_FILE="digi_${JUGGLER_FILE_NAME_TAG}.root"
export JUGGLER_REC_FILE="rec_${JUGGLER_FILE_NAME_TAG}.root" export JUGGLER_REC_FILE="rec_${JUGGLER_FILE_NAME_TAG}.root"
echo "JUGGLER_N_EVENTS = ${JUGGLER_N_EVENTS}" 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 # Generate the input events
python benchmarks/imaging_ecal/scripts/gen_particles.py ${JUGGLER_GEN_FILE} -n ${JUGGLER_N_EVENTS}\ python benchmarks/imaging_ecal/scripts/gen_particles.py ${JUGGLER_GEN_FILE} -n ${JUGGLER_N_EVENTS}\
...@@ -100,7 +104,7 @@ npsim --runType batch \ ...@@ -100,7 +104,7 @@ npsim --runType batch \
-v WARNING \ -v WARNING \
--part.minimalKineticEnergy "1*TeV" \ --part.minimalKineticEnergy "1*TeV" \
--numberOfEvents ${JUGGLER_N_EVENTS} \ --numberOfEvents ${JUGGLER_N_EVENTS} \
--compactFile ${JUGGLER_COMPACT_PATH} \ --compactFile ${compact_path} \
--inputFiles ${JUGGLER_GEN_FILE} \ --inputFiles ${JUGGLER_GEN_FILE} \
--outputFile ${JUGGLER_SIM_FILE} --outputFile ${JUGGLER_SIM_FILE}
......
...@@ -11,7 +11,7 @@ from Configurables import ApplicationMgr, EICDataSvc, PodioInput, PodioOutput, G ...@@ -11,7 +11,7 @@ from Configurables import ApplicationMgr, EICDataSvc, PodioInput, PodioOutput, G
from GaudiKernel.SystemOfUnits import MeV, GeV, mm, cm, mrad from GaudiKernel.SystemOfUnits import MeV, GeV, mm, cm, mrad
detector_name = str(os.environ.get("JUGGLER_DETECTOR", "athena")) 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) compact_path = os.path.join(detector_path, detector_name)
# get sampling fractions from system environment variable, 1.0 by default # get sampling fractions from system environment variable, 1.0 by default
......
...@@ -10,7 +10,7 @@ from Configurables import ApplicationMgr, EICDataSvc, PodioInput, PodioOutput, G ...@@ -10,7 +10,7 @@ from Configurables import ApplicationMgr, EICDataSvc, PodioInput, PodioOutput, G
from GaudiKernel.SystemOfUnits import MeV, GeV, mm, cm, mrad from GaudiKernel.SystemOfUnits import MeV, GeV, mm, cm, mrad
detector_name = str(os.environ.get("JUGGLER_DETECTOR", "athena")) 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) compact_path = os.path.join(detector_path, detector_name)
# input and output # input and output
......
...@@ -11,7 +11,9 @@ print_env.sh ...@@ -11,7 +11,9 @@ print_env.sh
## You can ready options/env.sh for more in-depth explanations of the variables ## You can ready options/env.sh for more in-depth explanations of the variables
## and how they can be controlled. ## and how they can be controlled.
source options/env.sh source options/env.sh
if [[ ! -n "${JUGGLER_DETECTOR_PATH}" ]] ; then
export JUGGLER_DETECTOR_PATH=${DETECTOR_PATH} export JUGGLER_DETECTOR_PATH=${DETECTOR_PATH}
fi
if [[ ! -n "${JUGGLER_N_EVENTS}" ]] ; then if [[ ! -n "${JUGGLER_N_EVENTS}" ]] ; then
export JUGGLER_N_EVENTS=100 export JUGGLER_N_EVENTS=100
...@@ -55,7 +57,7 @@ npsim --runType batch \ ...@@ -55,7 +57,7 @@ npsim --runType batch \
--part.minimalKineticEnergy 1000*GeV \ --part.minimalKineticEnergy 1000*GeV \
-v WARNING \ -v WARNING \
--numberOfEvents ${JUGGLER_N_EVENTS} \ --numberOfEvents ${JUGGLER_N_EVENTS} \
--compactFile ${DETECTOR_PATH}/${JUGGLER_DETECTOR}.xml \ --compactFile ${JUGGLER_DETECTOR_PATH}/${JUGGLER_DETECTOR}.xml \
--inputFiles ${JUGGLER_FILE_NAME_TAG}.hepmc \ --inputFiles ${JUGGLER_FILE_NAME_TAG}.hepmc \
--outputFile ${JUGGLER_SIM_FILE} --outputFile ${JUGGLER_SIM_FILE}
# Need to figure out how to pass file name to juggler from the commandline # Need to figure out how to pass file name to juggler from the commandline
......
...@@ -16,6 +16,10 @@ if [[ ! -n "${JUGGLER_N_EVENTS}" ]] ; then ...@@ -16,6 +16,10 @@ if [[ ! -n "${JUGGLER_N_EVENTS}" ]] ; then
export JUGGLER_N_EVENTS=100 export JUGGLER_N_EVENTS=100
fi fi
if [[ ! -n "${JUGGLER_DETECTOR_PATH}" ]] ; then
export JUGGLER_DETECTOR_PATH=${DETECTOR_PATH}
fi
# File names # File names
export JUGGLER_FILE_NAME_TAG="emcal_uniform_pi0s" export JUGGLER_FILE_NAME_TAG="emcal_uniform_pi0s"
export JUGGLER_GEN_FILE="${JUGGLER_FILE_NAME_TAG}.hepmc" export JUGGLER_GEN_FILE="${JUGGLER_FILE_NAME_TAG}.hepmc"
...@@ -49,7 +53,7 @@ npsim --runType batch \ ...@@ -49,7 +53,7 @@ npsim --runType batch \
--part.minimalKineticEnergy 1000*GeV \ --part.minimalKineticEnergy 1000*GeV \
-v WARNING \ -v WARNING \
--numberOfEvents ${JUGGLER_N_EVENTS} \ --numberOfEvents ${JUGGLER_N_EVENTS} \
--compactFile ${DETECTOR_PATH}/${JUGGLER_DETECTOR}.xml \ --compactFile ${JUGGLER_DETECTOR_PATH}/${JUGGLER_DETECTOR}.xml \
--inputFiles ${JUGGLER_FILE_NAME_TAG}.hepmc \ --inputFiles ${JUGGLER_FILE_NAME_TAG}.hepmc \
--outputFile ${JUGGLER_SIM_FILE} --outputFile ${JUGGLER_SIM_FILE}
if [[ "$?" -ne "0" ]] ; then if [[ "$?" -ne "0" ]] ; then
......
...@@ -11,7 +11,9 @@ print_env.sh ...@@ -11,7 +11,9 @@ print_env.sh
## You can ready options/env.sh for more in-depth explanations of the variables ## You can ready options/env.sh for more in-depth explanations of the variables
## and how they can be controlled. ## and how they can be controlled.
source options/env.sh source options/env.sh
if [[ ! -n "${JUGGLER_DETECTOR_PATH}" ]] ; then
export JUGGLER_DETECTOR_PATH=${DETECTOR_PATH} export JUGGLER_DETECTOR_PATH=${DETECTOR_PATH}
fi
if [[ ! -n "${JUGGLER_N_EVENTS}" ]] ; then if [[ ! -n "${JUGGLER_N_EVENTS}" ]] ; then
export JUGGLER_N_EVENTS=100 export JUGGLER_N_EVENTS=100
...@@ -48,7 +50,7 @@ npsim --runType batch \ ...@@ -48,7 +50,7 @@ npsim --runType batch \
-v WARNING \ -v WARNING \
--part.minimalKineticEnergy 1*GeV \ --part.minimalKineticEnergy 1*GeV \
--numberOfEvents ${JUGGLER_N_EVENTS} \ --numberOfEvents ${JUGGLER_N_EVENTS} \
--compactFile ${DETECTOR_PATH}/${JUGGLER_DETECTOR}.xml \ --compactFile ${JUGGLER_DETECTOR_PATH}/${JUGGLER_DETECTOR}.xml \
--inputFiles ${JUGGLER_FILE_NAME_TAG}.hepmc \ --inputFiles ${JUGGLER_FILE_NAME_TAG}.hepmc \
--outputFile ${JUGGLER_SIM_FILE} --outputFile ${JUGGLER_SIM_FILE}
# Need to figure out how to pass file name to juggler from the commandline # Need to figure out how to pass file name to juggler from the commandline
......
...@@ -10,8 +10,8 @@ if "JUGGLER_DETECTOR" in os.environ : ...@@ -10,8 +10,8 @@ if "JUGGLER_DETECTOR" in os.environ :
detector_name = str(os.environ["JUGGLER_DETECTOR"]) detector_name = str(os.environ["JUGGLER_DETECTOR"])
detector_path = "topside" detector_path = "topside"
if "DETECTOR_PATH" in os.environ : if "JUGGLER_DETECTOR_PATH" in os.environ :
detector_path = str(os.environ["DETECTOR_PATH"]) detector_path = str(os.environ["JUGGLER_DETECTOR_PATH"])
# todo add checks # todo add checks
input_sim_file = "jug_input.root" input_sim_file = "jug_input.root"
......
...@@ -11,7 +11,9 @@ print_env.sh ...@@ -11,7 +11,9 @@ print_env.sh
## You can ready options/env.sh for more in-depth explanations of the variables ## You can ready options/env.sh for more in-depth explanations of the variables
## and how they can be controlled. ## and how they can be controlled.
source options/env.sh source options/env.sh
if [[ ! -n "${JUGGLER_DETECTOR_PATH}" ]] ; then
export JUGGLER_DETECTOR_PATH=${DETECTOR_PATH} export JUGGLER_DETECTOR_PATH=${DETECTOR_PATH}
fi
if [[ ! -n "${JUGGLER_N_EVENTS}" ]] ; then if [[ ! -n "${JUGGLER_N_EVENTS}" ]] ; then
export JUGGLER_N_EVENTS=1000 export JUGGLER_N_EVENTS=1000
...@@ -56,7 +58,7 @@ npsim --runType batch \ ...@@ -56,7 +58,7 @@ npsim --runType batch \
-v WARNING \ -v WARNING \
--part.minimalKineticEnergy 0.5*GeV \ --part.minimalKineticEnergy 0.5*GeV \
--numberOfEvents ${JUGGLER_N_EVENTS} \ --numberOfEvents ${JUGGLER_N_EVENTS} \
--compactFile ${DETECTOR_PATH}/${JUGGLER_DETECTOR}.xml \ --compactFile ${JUGGLER_DETECTOR_PATH}/${JUGGLER_DETECTOR}.xml \
--inputFiles ${JUGGLER_FILE_NAME_TAG}.hepmc \ --inputFiles ${JUGGLER_FILE_NAME_TAG}.hepmc \
--outputFile ${JUGGLER_SIM_FILE} --outputFile ${JUGGLER_SIM_FILE}
......
...@@ -11,7 +11,9 @@ print_env.sh ...@@ -11,7 +11,9 @@ print_env.sh
## You can ready options/env.sh for more in-depth explanations of the variables ## You can ready options/env.sh for more in-depth explanations of the variables
## and how they can be controlled. ## and how they can be controlled.
source options/env.sh source options/env.sh
if [[ ! -n "${JUGGLER_DETECTOR_PATH}" ]] ; then
export JUGGLER_DETECTOR_PATH=${DETECTOR_PATH} export JUGGLER_DETECTOR_PATH=${DETECTOR_PATH}
fi
if [[ ! -n "${JUGGLER_N_EVENTS}" ]] ; then if [[ ! -n "${JUGGLER_N_EVENTS}" ]] ; then
export JUGGLER_N_EVENTS=1000 export JUGGLER_N_EVENTS=1000
...@@ -56,7 +58,7 @@ npsim --runType batch \ ...@@ -56,7 +58,7 @@ npsim --runType batch \
-v WARNING \ -v WARNING \
--part.minimalKineticEnergy 0.5*GeV \ --part.minimalKineticEnergy 0.5*GeV \
--numberOfEvents ${JUGGLER_N_EVENTS} \ --numberOfEvents ${JUGGLER_N_EVENTS} \
--compactFile ${DETECTOR_PATH}/${JUGGLER_DETECTOR}.xml \ --compactFile ${JUGGLER_DETECTOR_PATH}/${JUGGLER_DETECTOR}.xml \
--inputFiles ${JUGGLER_FILE_NAME_TAG}.hepmc \ --inputFiles ${JUGGLER_FILE_NAME_TAG}.hepmc \
--outputFile ${JUGGLER_SIM_FILE} --outputFile ${JUGGLER_SIM_FILE}
......
...@@ -11,7 +11,7 @@ import subprocess ...@@ -11,7 +11,7 @@ import subprocess
import argparse 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', ''))) '{}.xml'.format(os.environ.get('JUGGLER_DETECTOR', '')))
parser = argparse.ArgumentParser() parser = argparse.ArgumentParser()
parser.add_argument('-n', '--numberOfEvents', dest='nev', type=int, default=100, help='Number of events to process.') parser.add_argument('-n', '--numberOfEvents', dest='nev', type=int, default=100, help='Number of events to process.')
......
...@@ -9,8 +9,8 @@ if "JUGGLER_DETECTOR" in os.environ : ...@@ -9,8 +9,8 @@ if "JUGGLER_DETECTOR" in os.environ :
detector_name = str(os.environ["JUGGLER_DETECTOR"]) detector_name = str(os.environ["JUGGLER_DETECTOR"])
detector_path = "" detector_path = ""
if "DETECTOR_PATH" in os.environ : if "JUGGLER_DETECTOR_PATH" in os.environ :
detector_path = str(os.environ["DETECTOR_PATH"]) detector_path = str(os.environ["JUGGLER_DETECTOR_PATH"])
# todo add checks # todo add checks
input_sim_file = str(os.environ["JUGGLER_SIM_FILE"]) input_sim_file = str(os.environ["JUGGLER_SIM_FILE"])
......
...@@ -14,8 +14,8 @@ output_rec_file = str(os.environ["JUGGLER_REC_FILE"]) ...@@ -14,8 +14,8 @@ output_rec_file = str(os.environ["JUGGLER_REC_FILE"])
n_events = str(os.environ["JUGGLER_N_EVENTS"]) n_events = str(os.environ["JUGGLER_N_EVENTS"])
detector_path = detector_name detector_path = detector_name
if "DETECTOR_PATH" in os.environ : if "JUGGLER_DETECTOR_PATH" in os.environ :
detector_path = str(os.environ["DETECTOR_PATH"]) detector_path = str(os.environ["JUGGLER_DETECTOR_PATH"])
geo_service = GeoSvc("GeoSvc", geo_service = GeoSvc("GeoSvc",
detectors=["{}/{}.xml".format(detector_path, detector_name)]) detectors=["{}/{}.xml".format(detector_path, detector_name)])
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment