#!/bin/bash if [ $# = 0 ]; then echo "Usage: hd_root.bash [ [...]]" echo " where is 0..99999 the number of the line in scans.rawdata" echo " containing the name of the evio input file to process." exit 1 fi echo Running on `hostname` nthreads=1 nevents=10000000000 rawdata="scans.rawdata" xrootd="root://nod29.phys.uconn.edu" archive="/Gluex/beamline/raster-2-2020" ftpserver="nod28.phys.uconn.edu" source setup.sh while [ $# -gt 0 ]; do seqno=`expr $1 + 0`; shift lineno=`expr $seqno + 1` rline=`head -n $lineno $rawdata | tail -n 1` ibeam=`echo $rline | awk '{print $1}'` fsize=`echo $rline | awk '{print $2}'` fpath=`echo $rline | awk '{print $3}'` infile=$xrootd/$fpath hd_root -PPRINT_PLUGIN_PATHS=1 \ -PPLUGINS=PStagstudy \ -PTHREAD_TIMEOUT_FIRST_EVENT=300 \ -PTHREAD_TIMEOUT=300 \ -PNTHREADS=$nthreads \ -PEVENTS_TO_KEEP=$nevents \ -PJANA:BATCH_MODE=1 \ $infile retcode=$? if [[ $retcode = 0 ]]; then outfile="PStagstudy_$seqno.root" mv hd_root.root $outfile while true; do uberftp $ftpserver "cd $archive; put $outfile" && break sleep 300 done rm $outfile else echo "Error processing input file $infile" echo "Cannot continue." exit $retcode fi done