#!/bin/bash # # argument 1: run identification number # argument 2: number of events # argument 3: momentum (GeV/c) # argument 4: dec file # # export PANDAROOTHOME=$HOME/pandaroot source $PANDAROOTHOME/build/config.sh > logfile export LD_LIBRARY_PATH=$LD_LIBRARY_PATH export PATH=$HOME/bin:$PATH svn info $VMCWORKDIR >> logfile 2>&1 # revline=`cat logfile | grep "Revision" ` revnumber=`echo $revline | awk '{print $2}'` # # Copy ROOT scripts to local path # cp $PANDAROOTHOME/scrut14/macro/johan/DECAY.DEC . cp $PANDAROOTHOME/scrut14/macro/johan/$4 . # cp $PANDAROOTHOME/scrut14/macro/johan/simfast.C . cp $PANDAROOTHOME/scrut14/macro/johan/ana_lambdac_task.C . # # Run the scripts # mkdir data root -l -b -q "simfast.C(\"data/lambdac_rev${revnumber}_$3_$4\",\"$4\",$3,$2)" >> logfile 2>&1 root -l -b -q "ana_lambdac_task.C(\"data/lambdac_rev${revnumber}_$3_$4\",0,$3)" >> logfile 2>&1 # # Validate the output and return the appropiate value # for ofile in "logfile" "simfast.C" "ana_lambdac_task.C" ; do [ -f $ofile ] || error="$error $ofile doesn't exist,"; done for message in "Segmentation violation" "Segmentation fault" "Abort" "Bus error" "Floating point exception" "root: command not found" "cp: cannot stat" "Error opening Input file" ; do grep -i "$message" logfile && error="$error and $message" done # # Success # if [ -z "$error" ] ; then # # Remove files you dont want to keep # rm -f *.C rm -f *.sh rm -f *.dec rm -f *.dat rm -f DECAY.DEC rm logfile exit 0 fi # # Failure # cat logfile echo " Validation failed with $error" exit -1