#!/bin/tcsh
setenv TODAYS_DATE `date +%F`
setenv BUILD_DIR /group/halld/Software/builds/nightly/$TODAYS_DATE
setenv SCRIPTS /group/halld/Software/scripts
setenv BMS_OSNAME `$SCRIPTS/build_scripts/osrelease.pl`
setenv RUN_DIR /u/scratch/$USER/b1pi/$TODAYS_DATE/$BMS_OSNAME

# Setup environment based on sim-recon build we're using 
source ${BUILD_DIR}/sim-recon/setenv.csh

# do the build
mkdir -pv $RUN_DIR
cd $RUN_DIR
cp -v $SCRIPTS/b1pi_macros/* .
./mkevents.sh
setenv PLOTDIR /group/halld/www/halldweb1/html/b1pi/$TODAYS_DATE/$BMS_OSNAME
mkdir -p $PLOTDIR
cp -v *.pdf *.gif *.html $PLOTDIR
cp -v ../../../b1pi*.log $PLOTDIR/../
exit
