File indexing completed on 2026-08-13 08:26:05
0001
0002
0003
0004
0005
0006 function print_the_help {
0007 echo "USAGE: ${0} [--sim-only] "
0008 echo "OPTIONS: "
0009 echo " --sim-only Only run up to the simulation "
0010 echo " --analysis Only run the analysis scripts "
0011 exit
0012 }
0013
0014 ANALYSIS_ONLY=
0015 SIM_ONLY=
0016 POSITIONAL=()
0017
0018 while [[ $
0019 do
0020 key="$1"
0021
0022 case $key in
0023 -h|--help)
0024 shift
0025 print_the_help
0026 ;;
0027 --sim-only)
0028 shift
0029 SIM_ONLY=1
0030 ;;
0031 --analysis)
0032 shift
0033 ANALYSIS_ONLY=1
0034 ;;
0035 *)
0036
0037 echo "unknown option $1"
0038 print_the_help
0039 shift
0040 ;;
0041 esac
0042 done
0043 set -- "${POSITIONAL[@]}"
0044
0045
0046
0047
0048
0049
0050
0051
0052
0053 if [[ ! -n "${JUGGLER_N_EVENTS}" ]] ; then
0054 export JUGGLER_N_EVENTS=100
0055 fi
0056
0057 export JUGGLER_FILE_NAME_TAG="track_hits"
0058 export JUGGLER_GEN_FILE="${LOCAL_DATA_PATH}/${JUGGLER_FILE_NAME_TAG}.hepmc"
0059
0060 export JUGGLER_SIM_FILE="${LOCAL_DATA_PATH}/sim_${JUGGLER_FILE_NAME_TAG}.edm4hep.root"
0061
0062 echo "JUGGLER_N_EVENTS = ${JUGGLER_N_EVENTS}"
0063 echo "DETECTOR = ${DETECTOR}"
0064
0065
0066 if [ -z "${ANALYSIS_ONLY}" ] ; then
0067
0068 echo "Generating Events"
0069
0070 root -b -q "benchmarks/tracking_detectors/scripts/gen_track_hits.cxx(${JUGGLER_N_EVENTS}, \"${JUGGLER_FILE_NAME_TAG}.hepmc\")"
0071 if [[ "$?" -ne "0" ]] ; then
0072 echo "ERROR running script"
0073 exit 1
0074 fi
0075
0076 echo "Running geant4 simulation"
0077
0078 npsim --runType batch \
0079 --part.minimalKineticEnergy 1000*GeV \
0080 --filter.tracker edep0 \
0081 -v WARNING \
0082 --numberOfEvents ${JUGGLER_N_EVENTS} \
0083 --compactFile ${DETECTOR_PATH}/${DETECTOR_CONFIG}.xml \
0084 --inputFiles ${JUGGLER_FILE_NAME_TAG}.hepmc \
0085 --outputFile ${JUGGLER_SIM_FILE}
0086 if [[ "$?" -ne "0" ]] ; then
0087 echo "ERROR running script"
0088 exit 1
0089 fi
0090
0091 fi
0092
0093
0094 if [ -z "${SIM_ONLY}" ] ; then
0095
0096 echo "Running analysis scripts"
0097
0098 mkdir -p results/tracking_detectors
0099 rootls -t ${JUGGLER_SIM_FILE}
0100 root -b -q "benchmarks/tracking_detectors/analysis/sim_track_hits.cxx+(\"${JUGGLER_SIM_FILE}\")"
0101 if [[ "$?" -ne "0" ]] ; then
0102 echo "ERROR running root script"
0103 exit 1
0104 fi
0105
0106 fi
0107
0108 root_filesize=$(stat --format=%s "${JUGGLER_SIM_FILE}")
0109 if [[ "${JUGGLER_N_EVENTS}" -lt "500" ]] ; then
0110
0111 if [[ "${root_filesize}" -lt "10000000" ]] ; then
0112 cp ${JUGGLER_SIM_FILE} results/.
0113 fi
0114 fi