File indexing completed on 2025-01-18 10:18:27
0001
0002 source strict-mode.sh
0003
0004 function print_the_help {
0005 echo "USAGE: ${0} [--rec] [--sim] [--analysis] [--all] "
0006 echo " The default options are to run all steps (sim,rec,analysis) "
0007 echo "OPTIONS: "
0008 echo " --data-init download the input event data"
0009 echo " --sim,-s Runs the Geant4 simulation"
0010 echo " --rec,-r Run the juggler reconstruction"
0011 echo " --analysis,-a Run the analysis scripts"
0012 echo " --all (default) Do all steps. Argument is included so usage can convey intent."
0013 exit
0014 }
0015
0016 DO_ALL=1
0017 DATA_INIT=
0018 DO_SIM=
0019 DO_REC=
0020 DO_ANALYSIS=
0021 EBEAM=
0022 PBEAM=
0023 TAG=
0024
0025 POSITIONAL=()
0026 while [[ $
0027 do
0028 key="$1"
0029
0030 case $key in
0031 -h|--help)
0032 shift
0033 print_the_help
0034 ;;
0035 --all)
0036 DO_ALL=2
0037 if [[ ! "${DO_REC}${DO_SIM}${DO_ANALYSIS}" -eq "" ]] ; then
0038 echo "Error: cannot use --all with other arguments." 1>&2
0039 print_the_help
0040 exit 1
0041 fi
0042 shift
0043 ;;
0044 --tag)
0045 shift
0046 TAG=$1
0047 shift
0048 ;;
0049 --pbeam)
0050 shift
0051 PBEAM=$1
0052 shift
0053 ;;
0054 --ebeam)
0055 shift
0056 EBEAM=$1
0057 shift
0058 ;;
0059 -s|--sim)
0060 DO_SIM=1
0061 DO_ALL=
0062 shift
0063 ;;
0064 --data-init)
0065 DATA_INIT=1
0066 DO_ALL=
0067 shift
0068 ;;
0069 -r|--rec)
0070 DO_REC=1
0071 DO_ALL=
0072 shift
0073 ;;
0074 -a|--analysis)
0075 DO_ANALYSIS=1
0076 DO_ALL=
0077 shift
0078 ;;
0079 *)
0080
0081 echo "unknown option $1"
0082 print_the_help
0083 shift
0084 ;;
0085 esac
0086 done
0087 set -- "${POSITIONAL[@]}"
0088
0089
0090 print_env.sh
0091
0092 FILE_NAME_TAG="tcs"
0093 XROOTD_BASEURL="root://dtn-eic.jlab.org//work/eic2/EPIC"
0094 INPUT_FILE="EVGEN/EXCLUSIVE/TCS_ABCONV/${EBEAM}x${PBEAM}/hel_minus/TCS_gen_ab_hiAcc_${EBEAM}x${PBEAM}m_${TAG}.hepmc3.tree.root"
0095
0096 export JUGGLER_MC_FILE="${XROOTD_BASEURL}/${INPUT_FILE}"
0097 export JUGGLER_SIM_FILE="${LOCAL_DATA_PATH}/sim_${FILE_NAME_TAG}.edm4hep.root"
0098 export JUGGLER_REC_FILE="${LOCAL_DATA_PATH}/rec_${FILE_NAME_TAG}.root"
0099
0100 echo "FILE_NAME_TAG = ${FILE_NAME_TAG}"
0101 echo "JUGGLER_N_EVENTS = ${JUGGLER_N_EVENTS}"
0102 echo "DETECTOR = ${DETECTOR}"
0103
0104
0105
0106
0107
0108
0109
0110 if [[ -n "${DO_SIM}" || -n "${DO_ALL}" ]] ; then
0111
0112 ddsim --runType batch \
0113 --part.minimalKineticEnergy 1000*GeV \
0114 --filter.tracker edep0 \
0115 -v ERROR \
0116 --numberOfEvents ${JUGGLER_N_EVENTS} \
0117 --compactFile ${DETECTOR_PATH}/${DETECTOR_CONFIG}.xml \
0118 --inputFiles "${JUGGLER_MC_FILE}" \
0119 --outputFile ${JUGGLER_SIM_FILE}
0120 if [ "$?" -ne "0" ] ; then
0121 echo "ERROR running ddsim"
0122 exit 1
0123 fi
0124 fi
0125
0126
0127 export PBEAM
0128 if [[ -n "${DO_REC}" || -n "${DO_ALL}" ]] ; then
0129 if [ ${RECO} == "eicrecon" ] ; then
0130 eicrecon ${JUGGLER_SIM_FILE} -Ppodio:output_file=${JUGGLER_REC_FILE}
0131 if [[ "$?" -ne "0" ]] ; then
0132 echo "ERROR running eicrecon"
0133 exit 1
0134 fi
0135 fi
0136
0137 if [[ ${RECO} == "juggler" ]] ; then
0138 gaudirun.py options/reconstruction.py || [ $? -eq 4 ]
0139 if [ "$?" -ne "0" ] ; then
0140 echo "ERROR running juggler"
0141 exit 1
0142 fi
0143 fi
0144
0145 root_filesize=$(stat --format=%s "${JUGGLER_REC_FILE}")
0146 if [[ "${JUGGLER_N_EVENTS}" -lt "500" ]] ; then
0147
0148 if [[ "${root_filesize}" -lt "10000000" ]] ; then
0149 cp ${JUGGLER_REC_FILE} results/.
0150 fi
0151 fi
0152 fi
0153
0154
0155 if [[ -n "${DO_ANALYSIS}" || -n "${DO_ALL}" ]] ; then
0156 echo "Running analysis scripts"
0157 rootls -t ${JUGGLER_REC_FILE}
0158
0159
0160 mkdir -p results/tcs
0161
0162
0163 root -b -q "benchmarks/Exclusive-Diffraction-Tagging/tcs/analysis/tcs_tests.cxx+(\"${JUGGLER_REC_FILE}\")"
0164 if [[ "$?" -ne "0" ]] ; then
0165 echo "ERROR running root script"
0166 exit 1
0167 fi
0168 fi
0169
0170
0171