Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-10-08 08:36:03

0001 #!/usr/bin/env bash
0002 # Source this from bash inside eic-shell, from any directory.
0003 # It mirrors the BNL storage defaults used by the host tcsh setup and exposes
0004 # the checked-out yall-run source directly to the EIC Python. No container-side
0005 # pip install is required.
0006 
0007 _lfhcal_workspace=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")/../../../.." && pwd -P) || return 1
0008 
0009 export LFHCAL_HOME="$_lfhcal_workspace"
0010 export LFHCAL_REPO="$LFHCAL_HOME/epic-lfhcal-tbana"
0011 export YALL_RUN_REPO="$LFHCAL_HOME/yall-run"
0012 export EIC_SHELL="$LFHCAL_HOME/eic-shell"
0013 
0014 # If env.tcsh was sourced before entering eic-shell, these values are normally
0015 # inherited. Otherwise use the same BNL defaults directly.
0016 # LFHCAL_DATA is the directory directly containing Run*.h2g.
0017 export LFHCAL_DATA="${LFHCAL_DATA:-/gpfs01/star/pwg/pnord/eic/2026TBdata/raw}"
0018 export LFHCAL_WORK="${LFHCAL_WORK:-/gpfs01/star/scratch/$(id -un)/lfhcal}"
0019 export LFHCAL_EXAMPLE="lfhcal-simple"
0020 export LFHCAL_EXAMPLE_WORK="$LFHCAL_WORK/$LFHCAL_EXAMPLE"
0021 
0022 _yall_src="$YALL_RUN_REPO/src"
0023 if [[ ! -r "$_yall_src/yall_run/cli.py" ]]; then
0024     echo "yall-run checkout is not readable inside eic-shell: $YALL_RUN_REPO" >&2
0025     unset _lfhcal_workspace _yall_src
0026     return 1
0027 fi
0028 export PYTHONPATH="$_yall_src${PYTHONPATH:+:$PYTHONPATH}"
0029 
0030 # The EIC Python disables the user site and treats /opt/local as an isolated
0031 # prefix, so `pip install --user` is not usable here. Run directly from the
0032 # checkout instead. This also means a git pull immediately updates local-mode
0033 # Yall without a second install step.
0034 yall-run() {
0035     python3 -m yall_run.cli "$@"
0036 }
0037 
0038 mkdir -p "$LFHCAL_WORK/campaigns" "$LFHCAL_EXAMPLE_WORK" || {
0039     echo "Cannot create LFHCal work directories under $LFHCAL_WORK" >&2
0040     unset _lfhcal_workspace _yall_src
0041     return 1
0042 }
0043 
0044 if [[ ! -r "$LFHCAL_DATA" ]]; then
0045     echo "WARNING: shared raw data are not readable: $LFHCAL_DATA" >&2
0046 fi
0047 
0048 if ! yall-run --version >/dev/null 2>&1; then
0049     echo "yall-run checkout is not runnable with the EIC Python." >&2
0050     echo "Check $YALL_RUN_REPO and the eic-shell Python environment." >&2
0051     unset _lfhcal_workspace _yall_src
0052     return 1
0053 fi
0054 
0055 printf 'LFHCAL_DATA=%s\n' "$LFHCAL_DATA"
0056 printf 'LFHCAL_WORK=%s\n' "$LFHCAL_WORK"
0057 printf 'Example work=%s\n' "$LFHCAL_EXAMPLE_WORK"
0058 printf 'yall-run=%s\n' "$(yall-run --version)"
0059 
0060 unset _lfhcal_workspace _yall_src