#!/bin/bash function usage() { echo "Usage: ./kstudyrec3.bash [-o ] " echo " where is the index of the subset" echo " of events to reculate in this job. The output" echo " is written to kstudyrec3_.root where" echo " is added to if it is given." exit 1 } nthreads=1 nevents=10000000 sims=/home/www/docs/halld/kstudy-4-2020/sims plugins=danarest,monitoring_hists source setup.sh offset=0 process=none while [ $# -gt 0 ]; do if echo $1 | grep -q -- '-'; then if [ "$1" = "-o" ]; then offset=$2 shift; shift else usage fi else process=$1 break fi done if [ "$process" = "none" ]; then usage else process=`expr $process + $offset` fi function exit_with_error() { rm -f kstudysim3_${process}_smeared.hddm hd_root.root echo "Quitting after error, code=$1" exit $1 } echo Running process $process on `hostname -s` #valgrind --suppressions=valgrind.supp --vgdb-error=0 \ mcsmear -PTHREAD_TIMEOUT_FIRST_EVENT=3000 \ -PTHREAD_TIMEOUT=3000 \ -PNTHREADS=$nthreads \ -PEVENTS_TO_KEEP=$nevents \ -PJANA:BATCH_MODE=1 \ -PEVENT_SOURCE_TYPE=DEventSourceHDDMGenerator \ $sims/kstudysim3_${process}.hddm || exit_with_error $? hd_root -PPLUGINS=$plugins \ -PTHREAD_TIMEOUT_FIRST_EVENT=300 \ -PTHREAD_TIMEOUT=300 \ -PNTHREADS=$nthreads \ -PEVENTS_TO_KEEP=$nevents \ -PJANA:BATCH_MODE=1 \ -PEVENT_SOURCE_TYPE=DEventSourceHDDMGenerator \ kstudysim3_${process}_smeared.hddm || exit_with_error $? if true; then rm kstudysim3_${process}_smeared.hddm [ -f hd_root.root ] && mv hd_root.root kstudyrec3_$process.root [ -f dana_rest.hddm ] && mv dana_rest.hddm kstudyrec3_$process.hddm fi