#!/bin/sh usage() { echo "usage: `basename $0` -f [ARG] [-i [ARG]] [-q [ARG]] -p pass" } # # This script will strip an run,event into a specified subdirectory # It writes and submits a job to do this to the short batch queue #Rick St. Denis # simplified by P.Murat help() { usage cat <<\EOF -D Debug -f File name for input file and batch job file. -h help -o optimization -p pass -q flavour of cdfsoft2 to use (KCC_4_0 is the default) -v Public Release for offline. (can also be a public patch) process10K -f ar01c33.phys001 -v 3.18.0a -p c will process the file from the default directory where files are kept. The 3.18.0a patch should have been declared public. The patch must still be specified with the -p qualifier as must the pass on the data. EOF exit 1 } # # Some routines to call before exiting in case of errors # # There must be a short sleep so the error can be read. gaspanddie() { echo "I (`basename $0`) will sleep so you see this and then die" echo "Kill me with control C if you wish or wait 100 s" sleep 100 exit 1 } # # Some routines to call before exiting in case of errors # # There must be a short sleep so the error can be read. # # This bit of line noise will define a unique temporary directory to # hold the output scratch files. The $$ is the process number and hence # makes the directory unique TMP=/tmp/calibfind.$$ # More line noise ensures that if an interrupt (ie. ^C) is detected, # it is trapped and the temporary directory is deleted. trap "rm $TMP* 2>/dev/null" 0 # Get the options (options with a : after them take an argument) notgotfile="true" wdir= $PWF # export RDATA="/cdf/scratch/cdfopr/10Kevents" offlineversion=`cat .base_release` pass="" notgotproductiondir="true" notgotpass="true" notgotversion="true" flavour=KCC_4_0 opt=default # echo ... we are here ... while getopts :hr:o:q:p:l:f:v: OPT; do case $OPT in v) # debug on export DEBUG_SCRIPT="yes" ;; f) # File export RFILE=${OPTARG} notgotfile="false" ;; h) # help help ;; o) # optimization opt=${OPTARG} ;; p) # Pass pass=${OPTARG} notgotpass="false" ;; q) # flavour for cdfsoft flavour=$OPTARG notgotpass="false" ;; esac done export ROUT="$wdir" export RLOG="$wdir" # # c. Testing from a release # requires a setup cdfsoft. This will work with the cdfpatch setup. # source ~cdfsoft/cdf2.shrc setup cdfsoft2 $offlineversion srt_setup -a SRT_CXX=$flavour SRT_QUAL=$opt if [ .`echo $flavour | grep GCC_3_2_1` != "." ] ; then setup root v3_05_04d -q GCC_3_2_1 setup diskcache_i -q GCC_3_2_1 fi base_dir=$PWD exefile=$base_dir/bin/$BFARCH/ProductionExe ifile=`echo $RFILE | awk -F / '{print $NF}'` JOB_OUTPUT_DIR=$base_dir/pass$pass/$ifile if [ ! -e $JOB_OUTPUT_DIR ]; then mkdir -p $JOB_OUTPUT_DIR fi # echo exe_file = $exe_file # echo JOB_OUTPUT_DIR = $JOB_OUTPUT_DIR ofile=$JOB_OUTPUT_DIR/$ifile.out logfile=$JOB_OUTPUT_DIR/$ifile.log tclfile=Production/ProductionExe.tcl cd $JOB_OUTPUT_DIR rm * ln -s $base_dir/Production Production echo "########################################################" > $logfile echo "$exefile $tclfile -i $RFILE -o $ofile 1>$logfile 2>&1" >> $logfile echo "########################################################" >> $logfile if [ .$DEBUG_SCRIPT != "." ] ; then echo $exefile $tclfile -i $RFILE -o $ofile fi if [ .`printenv | grep NEVENTS` == "." ] ; then unset NEVENTS ; export NEVENTS; fi #----------------------------------------------------------------------- # NEVENTS looks like N[:d] #----------------------------------------------------------------------- echo NEVENTS=$NEVENTS >> $logfile debug=`echo $NEVENTS | awk -F : '{print $2}'` export NEVENTS=`echo $NEVENTS | awk -F : '{print $1}'` if [ .$debug == ".d" ] ; then echo $exefile $tclfile -i $RFILE -o $ofile export EXEFILE=$exefile export TCLFILE=$tclfile emacs -bg lightskyblue & else $exefile $tclfile -i $RFILE -o $ofile 1>>$logfile 2>>$logfile & fi