Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2026-04-07 08:15:43

0001 #!/usr/bin/env bash
0002 export USER="$(id -u -n)"
0003 export LOGNAME=${USER}
0004 export HOME=/sphenix/u/${LOGNAME}
0005 
0006 source /opt/sphenix/core/bin/sphenix_setup.sh -n new
0007 
0008 f4a_macro=${1}
0009 input=${2}
0010 output=${3}
0011 output_tree=${4}
0012 nEvents=${5}
0013 dbtag=${6}
0014 submitDir=${7}
0015 
0016 # extract runnumber from file name
0017 file=$(basename "$input")
0018 IFS='-' read -r p1 p2 p3 <<< "$file"
0019 run=$(echo "$p2" | sed 's/^0*//') # Remove leading zeros using sed
0020 if [[ -z "$run" || ! "$run" =~ ^[0-9]+$ ]]; then
0021     echo "Failed to parse run number from input: $input" >&2
0022     exit 1
0023 fi
0024 
0025 if [[ -n "$_CONDOR_SCRATCH_DIR" && -d "$_CONDOR_SCRATCH_DIR" ]]
0026 then
0027     cd "$_CONDOR_SCRATCH_DIR" || { echo "Failed to cd to $_CONDOR_SCRATCH_DIR" >&2; exit 1; }
0028     getinputfiles.pl --filelist "$input"
0029     ls -lah
0030     ls DST*.root > test.list
0031 else
0032     echo "condor scratch NOT set" >&2
0033     exit 1
0034 fi
0035 
0036 # print the environment - needed for debugging
0037 printenv
0038 
0039 mkdir -p "$run/hist" "$run/tree"
0040 
0041 root -b -l -q "$f4a_macro($nEvents, \"test.list\", \"$run/hist/$output\", \"$run/tree/$output_tree\", \"$dbtag\")"
0042 
0043 echo "All Done and Transferring Files Back"
0044 cp -rv "$run" "$submitDir"
0045 
0046 echo "Finished"