#!/bin/bash if [ $# = 0 ]; then echo "Usage: hd_root.bash [-o ] [ [...]]" echo " where is 0..99999 the number of the line in scans.rawdata" echo " containing the name of the evio input file to process, offset" echo " by if given." exit 1 fi echo Running on `hostname` nthreads=4 nevents=100000000 rawdata="scans.rawdata" xrootd="root://nod29.phys.uconn.edu" archive="/Gluex/beamline/accidentals-2-2020" ftpserver="nod28.phys.uconn.edu" source setup.sh offset=0 while [ $# -gt 0 ]; do if [ "$1" = "-o" ]; then offset=$2 shift; shift continue fi seqno=`expr $1 + $offset`; 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 \ -PTAGMHit:CUT_FACTOR=0 \ -PTHREAD_TIMEOUT_FIRST_EVENT=300 \ -PTHREAD_TIMEOUT=300 \ -PNTHREADS=$nthreads \ -PEVENTS_TO_KEEP=$nevents \ -PAUTOACTIVATE=DTAGMHit:Calib \ -PJANA:BATCH_MODE=1 \ $infile retcode=$? if [[ $retcode = 0 ]]; then outfile="PStagstudy2_$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