From 52a578a726131f17c31c654ac21011e27bd81598 Mon Sep 17 00:00:00 2001 From: Whitney Armstrong <warmstrong@anl.gov> Date: Fri, 13 Nov 2020 15:46:29 -0600 Subject: [PATCH] Added error checking in bash script modified: emcal_electrons.sh --- ecal/emcal_electrons.sh | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/ecal/emcal_electrons.sh b/ecal/emcal_electrons.sh index cd33ad36..9e387ae0 100644 --- a/ecal/emcal_electrons.sh +++ b/ecal/emcal_electrons.sh @@ -45,7 +45,15 @@ popd # note datasets is now only used to develop datasets. #git clone https://eicweb.phy.anl.gov/EIC/datasets.git datasets root -b -q "ecal/scripts/emcal_electrons.cxx(${JUGGLER_N_EVENTS}, ${E_start}, ${E_end}, \"${JUGGLER_FILE_NAME_TAG}.hepmc\")" +if [[ "$?" -ne "0" ]] ; then + echo "ERROR running script" + exit 1 +fi root -b -q "ecal/scripts/emcal_electrons_reader.cxx(${E_start}, ${E_end}, \"${JUGGLER_FILE_NAME_TAG}.hepmc\")" +if [[ "$?" -ne "0" ]] ; then + echo "ERROR running script" + exit 1 +fi pushd ${JUGGLER_DETECTOR} ls -l @@ -58,18 +66,36 @@ npsim --runType batch \ --inputFiles ../${JUGGLER_FILE_NAME_TAG}.hepmc \ --outputFile ${JUGGLER_SIM_FILE} # Need to figure out how to pass file name to juggler from the commandline +if [[ "$?" -ne "0" ]] ; then + echo "ERROR running npdet" + exit 1 +fi xenv -x ${JUGGLER_INSTALL_PREFIX}/Juggler.xenv gaudirun.py ../ecal/options/crystal_calorimeter_reco.py +if [[ "$?" -ne "0" ]] ; then + echo "ERROR running juggler" + exit 1 +fi ls -l popd pwd mkdir -p results + + #rootls ${JUGGLER_DETECTOR}/${JUGGLER_REC_FILE} root -b -q "ecal/scripts/rec_emcal_electrons_reader.C(${E_start}, ${E_end}, \"${JUGGLER_DETECTOR}/${JUGGLER_REC_FILE}\")" +if [[ "$?" -ne "0" ]] ; then + echo "ERROR running analysis script" + exit 1 +fi #root -b -q "ecal/scripts/makeplot.C(${E_start}, ${E_end}, \"${JUGGLER_DETECTOR}/${JUGGLER_REC_FILE}\", \"results/rec_${JUGGLER_FILE_NAME_TAG}.txt\")" #root -b -q "ecal/scripts/makeplot_input.C(\"${JUGGLER_DETECTOR}/${JUGGLER_SIM_FILE}\", \"results/sim_${JUGGLER_FILE_NAME_TAG}.txt\")" root -b -q "ecal/scripts/crystal_cal_electrons.cxx(\"${JUGGLER_DETECTOR}/${JUGGLER_REC_FILE}\")" +if [[ "$?" -ne "0" ]] ; then + echo "ERROR running analysis script" + exit 1 +fi #paste results/sim_${JUGGLER_FILE_NAME_TAG}.txt results/rec_${JUGGLER_FILE_NAME_TAG}.txt > results/eng_${JUGGLER_FILE_NAME_TAG}.txt #root -b -q "ecal/scripts/read_eng.C(\"results/eng_${JUGGLER_FILE_NAME_TAG}.root\", \"results/eng_${JUGGLER_FILE_NAME_TAG}.txt\")" -- GitLab