File indexing completed on 2026-04-25 08:29:08
0001
0002
0003
0004 echo Hostname: `hostname`
0005 echo Working directory: $_CONDOR_SCRATCH_DIR
0006 echo Timestamp at start of script
0007 echo $(date)
0008 echo "Calling script is $0"
0009 echo "This script is ${BASH_SOURCE[0]}"
0010 echo "Full argument list:"
0011 echo $@
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021 ARG_COUNT=17
0022 if [ "$#" -lt $ARG_COUNT ] ; then
0023 echo "Error: Incorrect number of arguments."
0024 echo "Expected $ARG_COUNT [+1], but received $#."
0025 echo "Usage: $0 <buildarg> <dataset> <intriplet> <dsttype> <run> <seg> <daqhost> <inputs>"
0026 echo " <nevents> <outdir> <histdir> <outbase> <neventsper> <dbtag>"
0027 echo " <logbase> <logdir> <condor_rsync> [dbid]"
0028 exit 1
0029 fi
0030
0031
0032 buildarg="$1"; shift
0033 dataset="$1"; shift
0034 intriplet="$1"; shift
0035 dsttype="$1"; shift
0036 run="$1"; shift
0037 seg="$1"; shift
0038 daqhost="$1"; shift
0039 inputs="$1"; shift
0040 nevents="$1"; shift
0041 outdir="$1"; shift
0042 histdir="$1"; shift
0043 outbase="$1"; shift
0044 neventsper="$1"; shift
0045 dbtag="$1"; shift
0046 logbase="$1"; shift
0047 logdir="$1"; shift
0048 condor_rsync="$1"; shift
0049 dbid=${1:--1};shift
0050 export PRODDB_DBID=$dbid
0051
0052
0053 echo "---------------------------------------------"
0054 echo "Processing job with the following parameters:"
0055 echo "---------------------------------------------"
0056 echo "Environment:"
0057 echo "Build argument (buildarg): $buildarg"
0058 echo "---------------------------------------------"
0059 echo "Input sources:"
0060 echo "Dataset: $dataset"
0061 echo "intriplet (db lingo: 'tag'): $intriplet"
0062 echo "Input type (dsttype): $dsttype"
0063 echo "Run number (run): $run"
0064 echo "Segment number (seg): $seg"
0065 echo "DAQ host, leaf (daqhost) $daqhost"
0066 echo "Input mode (inputs): $inputs (all segments or seg0 only, or list in some cases)"
0067 echo "---------------------------------------------"
0068 echo "Macro arguments:"
0069 echo "Number of events to process (nevents): $nevents"
0070 echo "Output directory (outdir): $outdir"
0071 echo "Histogram directory (histdir): $histdir"
0072 echo "Output base name (outbase): $outbase"
0073 echo "Events per output file (neventsper): $neventsper"
0074 echo "DB Tag (dbtag): $dbtag"
0075 echo "---------------------------------------------"
0076
0077 echo "Logs:"
0078 echo "Log base name (logbase): $logbase"
0079 echo "Log directory (logdir): $logdir"
0080 echo "---------------------------------------------"
0081 echo "Files/directories to stage in (condor_rsync):"
0082 echo "$condor_rsync"
0083 echo "---------------------------------------------"
0084 echo "Job database id (dbid): $dbid"
0085 echo "---------------------------------------------"
0086
0087
0088
0089 sighandler()
0090 {
0091 mv ${logbase}.out ${logdir
0092 mv ${logbase}.err ${logdir
0093 }
0094 trap sighandler SIGTERM
0095 trap sighandler SIGSTOP
0096 trap sighandler SIGINT
0097
0098
0099
0100 condor_rsync=`echo $condor_rsync|sed 's/,/ /g'`
0101 cd $_CONDOR_SCRATCH_DIR
0102 echo Copying payload data to `pwd`
0103 for f in ${condor_rsync}; do
0104 cp --verbose -r $f .
0105 done
0106 echo "---------------------------------------------"
0107
0108 export USER="$(id -u -n)"
0109 export LOGNAME=${USER}
0110 export HOME=/sphenix/u/${USER}
0111
0112 OS=$( grep ^PRETTY_NAME /etc/os-release | sed 's/"//g'| cut -f2- -d'=' )
0113 if [[ $OS == "" ]]; then
0114 echo "Unable to determine OS version."
0115 else
0116
0117 if [[ "$_CONDOR_JOB_IWD" =~ "/Users/eickolja" ]]; then
0118 source /Users/eickolja/sphenix/sphenixprod/mac_this_sphenixprod.sh
0119 elif [[ $OS =~ "AlmaLinux" ]]; then
0120 echo "Setting up Production software for ${OS}"
0121 source /opt/sphenix/core/bin/sphenix_setup.sh -n $buildarg
0122 else
0123 echo "Unsupported OS $OS"
0124 exit 1
0125 fi
0126 fi
0127
0128 if [ -e odbc.ini ]; then
0129 echo export ODBCINI=./odbc.ini
0130 export ODBCINI=./odbc.ini
0131 else
0132 echo No odbc.ini file detected. Using system odbc.ini
0133 fi
0134
0135 shopt -s nullglob
0136 jsonfound="$(echo *.json)"
0137 shopt -u nullglob
0138 if [[ -n $jsonfound ]]; then
0139 echo "Found json file(s):"
0140 ls -la *.json
0141 else
0142 echo "No .json files found."
0143 fi
0144 if [ -e sPHENIX_newcdb_test.json ]; then
0145 echo "... setting user provided conditions database config"
0146 export NOPAYLOADCLIENT_CONF=./sPHENIX_newcdb_test.json
0147 fi
0148 echo NOPAYLOADCLIENT_CONF=${NOPAYLOADCLIENT_CONF}
0149
0150 echo "---------------------------------------------"
0151 echo "Offline main "${OFFLINE_MAIN}
0152 echo pwd is `pwd`
0153 echo ls -lha
0154 ls -lha
0155
0156 echo "---------------------------------------------"
0157 return 0 2>/dev/null
0158
0159 echo "Execution of $0 complete "
0160 echo "---------------------------------------------"
0161 exit
0162
0163
0164