Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2026-05-23 08:12:15

0001 #!/bin/bash
0002 # ─────────────────────────────────────────────────────────────────────────────
0003 #  run_draw.sh  —  runs drawClosure.C
0004 #
0005 #  Usage:  ./run_draw.sh <DIR> <MODE>
0006 #    DIR  — output directory
0007 #    MODE — kFull | kHalf | kData
0008 #
0009 #  Must be run after run_wEEC_unfolding.sh.
0010 #  For closure modes the merged response file is passed so drawClosure can
0011 #  load truth-tower wEEC histograms for the closure reference.
0012 #  Creates DIR/Plots/ if it does not exist.
0013 # ─────────────────────────────────────────────────────────────────────────────
0014 
0015 export USER="$(id -u -n)"
0016 export LOGNAME=${USER}
0017 export HOME=/sphenix/u/${LOGNAME}/macros/detectors/sPHENIX/
0018 export MYINSTALL=/sphenix/user/bkimelman/sPHENIX/install/
0019 
0020 source /opt/sphenix/core/bin/sphenix_setup.sh -n
0021 source /opt/sphenix/core/bin/setup_local.sh $MYINSTALL
0022 
0023 #DIR=/sphenix/tg/tg01/jets/bkimelman/VandyDSTs_wEEC_3D_unfolding_kinematics_Apr28_2026/
0024 DIR=/sphenix/tg/tg01/jets/bkimelman/VandyDSTs_wEEC_3D_unfolding_kinematics_Apr29_2026/
0025 MODE=$1
0026 
0027 if [ -z "$DIR" ] || [ -z "$MODE" ]; then
0028     echo "Usage: $0 <DIR> <MODE>"
0029     exit 1
0030 fi
0031 
0032 case $MODE in
0033     kFull) LABEL="fullClosure" ;;
0034     kHalf) LABEL="halfClosure" ;;
0035     kData) LABEL="dataClosure" ;;
0036     *)
0037         echo "Unknown mode: $MODE  (expected kFull, kHalf, or kData)"
0038         exit 1 ;;
0039 esac
0040 
0041 mkdir -p "${DIR}/Plots"
0042 
0043 if [ "$MODE" = "kData" ]; then
0044     # kData: no truth reference needed, pass null for respFile
0045     RESP_FILE="${DIR}/response-all-${LABEL}.root"
0046     echo "Running drawClosure: mode=${MODE}, dir=${DIR}, resp=${RESP_FILE}"
0047     root -b -q "draw_misses_fakes.C(\"${DIR}\",\"${RESP_FILE}\",Mode::${MODE})"
0048     root -b -q "drawClosure.C(\"${DIR}\",\"${RESP_FILE}\",Mode::${MODE})"
0049 else
0050     RESP_FILE="${DIR}/response-all-${LABEL}.root"
0051     if [ "$MODE" = "kFull" ]; then
0052         root -b -q "draw_3DClosure.C(\"${DIR}\")"
0053         root -b -q "drawResponse.C(\"${DIR}\",\"${RESP_FILE}\",Mode::${MODE},7,2,2,5)"
0054     fi
0055     root -b -q "draw_misses_fakes.C(\"${DIR}\",\"${RESP_FILE}\",Mode::${MODE})"
0056     echo "Running drawClosure: mode=${MODE}, dir=${DIR}, resp=${RESP_FILE}"
0057     root -b -q "drawClosure.C(\"${DIR}\",\"${RESP_FILE}\",Mode::${MODE})"
0058 fi
0059 
0060 echo "Done. Plots written to ${DIR}/Plots/"