Print

Print


Commit in sim/k2jobScripts on MAIN
fname.sh+23added 1.1
jdf.sh+37added 1.1
jdf_env.sh+78added 1.1
jdf_lcdg4.sh+75added 1.1
jdf_mokka.sh+68added 1.1
jdf_slic.sh+72added 1.1
jdf_tbeam.sh[empty]added 1.1
jdf_template.sh+74added 1.1
make_jobdir.sh+35added 1.1
make_mokka_macro.sh+63added 1.1
run_lcdg4.sh+122added 1.1
run_mokka.sh+87added 1.1
run_slic.sh+8added 1.1
run_tbeam.sh+86added 1.1
setup.sh+3added 1.1
setup_appenv.sh+30added 1.1
setup_jobenv.sh+33added 1.1
submit_currjob.sh+2added 1.1
tail_mokka_log.sh+2added 1.1
tail_slic_log.sh+2added 1.1
+900
20 added files
Adding job scripts from NICADD k2 to sim prj.

sim/k2jobScripts
fname.sh added at 1.1
diff -N fname.sh
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ fname.sh	23 Jul 2005 10:04:00 -0000	1.1
@@ -0,0 +1,23 @@
+#!/bin/sh
+
+# strips directories and extensions and concats with "_" for filenaming
+
+fname=""
+
+for f in `echo $@`
+do
+  # strip dir
+  sf=`basename $f`
+ 
+  # strip ext
+  sf=${sf%.*}
+
+  # append to full name sep by "_"
+  fname=${fname}${sf}_
+done
+
+# strip trailing "_"
+fname=${fname/%_/""}
+
+# write to stdout
+echo $fname

sim/k2jobScripts
jdf.sh added at 1.1
diff -N jdf.sh
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ jdf.sh	23 Jul 2005 10:04:00 -0000	1.1
@@ -0,0 +1,37 @@
+#!/bin/sh
+
+# Single Condor job submission based on env vars.
+# Set these in the environment using jdf_env.sh,
+# then run this script.
+
+# general settings
+echo "Universe = Vanilla"
+echo "should_transfer_files = YES"
+echo "when_to_transfer_output = ON_EXIT"
+
+echo
+
+# shell script to execute: RUNSCRIPT
+echo "Executable = ${RUNSCRIPT}"
+
+echo
+
+# data file names: from DATAPATH and OUTFILE
+echo "Log = ${OUTFILEFULLPATH}.log.\$(Process)"
+echo "output = ${OUTFILEFULLPATH}.out.\$(Process)"
+echo "output = ${OUTFILEFULLPATH}.err.\$(Process)"
+
+echo
+
+# set initial dir: current directory
+echo "Initialdir = \$(PWD)"
+
+echo
+
+# select a machine (if desired)
+# Requirements = Machine == "hius-physics.niu.edu"
+
+# args to the wrapper script: SCRIPTARGS
+echo "Arguments = ${SCRIPTARGS}"
+
+echo "Queue"

sim/k2jobScripts
jdf_env.sh added at 1.1
diff -N jdf_env.sh
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ jdf_env.sh	23 Jul 2005 10:04:00 -0000	1.1
@@ -0,0 +1,78 @@
+#!/bin/sh
+
+function print_usage() 
+{
+  echo ". jdf_env.sh RUNSCRIPT DATAPATH OUTFILE [SCRIPT_ARG1 SCRIPT_ARG2 ...]"
+  echo
+  echo "RUNSCRIPT is script to execute. (REQUIRED)"
+  echo "DATAPATH is path to data area for output, logs, stderr and stdout. (REQUIRED)"
+  echo "OUTFILE is the name of the output file. (REQUIRED)"
+  echo "SCRIPT_ARG[#] are an unlimited number of arguments to the run script. (OPTIONAL)"
+  echo
+  echo "execute with \".\" or \"source\" to export these vars to your current environment."
+}
+
+function print_vars()
+{
+  echo "--Job parms in env--"
+  echo "RUNSCRIPT=$RUNSCRIPT"
+  echo "DATAPATH=$DATAPATH"
+  echo "OUTFILE=$OUTFILE"
+  echo "SCRIPTARGS=$SCRIPTARGS"
+  echo "OUTFILEFULLPATH=$OUTFILEFULLPATH"
+  echo "--------------------"
+}
+
+function export_vars()
+{
+  export RUNSCRIPT
+  export DATAPATH
+  export OUTFILE
+  export SCRIPTARGS
+  export OUTFILEFULLPATH=$DATAPATH/$OUTFILE
+}
+
+function unset_vars()
+{
+  unset RUNSCRIPT
+  unset DATAPATH
+  unset OUTFILE
+  unset SCRIPTARGS
+  unset OUTFILEFULLPATH
+}
+
+# no exit to avoid exiting whole shell
+if [ $# -lt "3" ]; then
+  print_usage
+else 
+
+# loop over args and export to environment
+  currarg=`expr 1`
+  while test "$1" != ""; do
+
+    case $currarg in 
+      1)
+        RUNSCRIPT=$1
+      ;;
+      2)
+        DATAPATH=$1
+      ;;
+      3)
+        OUTFILE=$1
+      ;;
+      4)
+        SCRIPTARGS=$1
+      ;;
+      *)
+        SCRIPTARGS=$SCRIPTARGS" "$1
+      ;;
+    esac
+
+    currarg=`expr $currarg + 1`
+
+    shift
+  done
+
+  export_vars
+  print_vars
+fi

sim/k2jobScripts
jdf_lcdg4.sh added at 1.1
diff -N jdf_lcdg4.sh
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ jdf_lcdg4.sh	23 Jul 2005 10:04:00 -0000	1.1
@@ -0,0 +1,75 @@
+#!/bin/sh
+
+function print_usage()
+{
+  echo "USAGE:"
+  echo
+  echo "./jdf_lcdg4.sh XML STDHEP MACRO"
+  echo
+  echo "XML is the name of the XML input file, relative to \$LCDG4_ROOT/ParFiles."
+  echo "STDHEP is the stdhep input file, relative to \$JOB_INPUT."
+  echo "MACRO is a macro, relative to \$JOB_MACROS."
+  echo "All REQUIRED."
+}
+
+function print_vars()
+{
+  echo "--LCDG4 job parms--"
+  echo "_xml=${_xml}"
+  echo "_xmlpath=${_xmlpath}"
+  echo "_stdhep=${_stdhep}"
+  echo "_macname=${_macname}"
+  echo "_macpath=${_macpath}"
+  echo "_runscript=${_runscript}"
+  echo "_datapath=${_datapath}"
+  echo "_lcdg4path=${_lcdg4path}"
+  echo "-------------------"
+}
+
+if [ $# -lt "3" ]; then
+  print_usage
+  exit 1
+fi
+
+# setup run vars
+
+# xml, stdhep, mac
+_xml="$1"
+_stdhep="$2"
+_macname="$3"
+
+_xmlpath="$LCDG4_ROOT/ParFiles/${_xml}.xml"
+#_xmlpath="${_xml}.xml"
+_stdheppath="$JOB_INPUT/${_stdhep}"
+_macpath="$JOB_MACROS/${_macname}"
+
+# from JOB_X, APP_X env
+_runscript="$LCDG4_RUN"
+_datapath="$JOB_OUTPUT"
+_lcdg4path="$LCDG4_ROOT"
+
+# make output file name
+if [ -z "`which fname.sh`" ]; then
+  echo "Could not find naming script fname.sh in the PATH."
+  exit 1
+fi
+
+_fname=`fname.sh ${_xml} ${_stdhep}`
+
+print_vars
+
+# 1st line = env setup script
+# 2nd "    = env script parms
+# 3rd "    = mokka script parms
+. jdf_env.sh \
+${_runscript} ${_datapath} ${_fname} \
+${_lcdg4path} ${_datapath} ${_xmlpath} ${_stdheppath} ${_macpath}
+#${_xmlpath} ${_stdheppath} ${_macpath}
+
+_jobfile=$JOB_JDF/${_fname}.jdf
+
+if [ -n ${_jobfile} ]; then
+  . jdf.sh > $JOB_JDF/${_fname}.jdf
+else
+  echo "ERROR: ${_jobfile} already exists."
+fi

sim/k2jobScripts
jdf_mokka.sh added at 1.1
diff -N jdf_mokka.sh
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ jdf_mokka.sh	23 Jul 2005 10:04:00 -0000	1.1
@@ -0,0 +1,68 @@
+#!/bin/sh
+
+function print_usage()
+{
+  echo "USAGE:"
+  echo
+  echo "./jdf_mokka.sh MODEL MACRO"
+  echo
+  echo "MODEL is name of Mokka model in models00."
+  echo "MACRO is name of macro, relative to \$JOB_MACROS=$JOB_MACROS."
+  echo "All REQUIRED."
+}
+
+function print_vars()
+{
+  echo "--Mokka job parms--"
+  echo "_model=${_model}"
+  echo "_macname=${_macname}"
+  echo "_macpath=${_macpath}"
+  echo "_runscript=${_runscript}"
+  echo "_datapath=${_datapath}"
+  echo "_mokkapath=${_mokkapath}"
+  echo "_fname=${_fname}" 
+  echo "-------------------"
+}
+
+if [ $# -lt "2" ]; then
+  print_usage
+  exit 1
+fi
+
+# setup run vars
+
+# model and macro
+_model="$1"
+_macname="$2"
+_macpath="$JOB_MACROS/${_macname}"
+
+# from JOB_X, APP_X env
+_runscript="$MOKKA_RUN"
+_datapath="$JOB_OUTPUT"
+_mokkapath="$MOKKA_ROOT"
+
+# make output file name
+if [ -z "`which fname.sh`" ]; then
+  echo "Could not find naming script fname.sh in the PATH."
+  exit 1
+fi
+
+_fname=`fname.sh ${_model} ${_macpath}`
+
+print_vars
+
+# 1st line = env setup script
+# 2nd "    = env script parms
+# 3rd "    = mokka script parms
+. jdf_env.sh \
+${_runscript} ${_datapath} ${_fname} \
+${_mokkapath} ${_datapath} ${_macpath} ${_model} &> /dev/null
+
+_jobfile=$JOB_JDF/${_fname}.jdf
+
+if [ -n ${_jobfile} ]; then
+  . jdf.sh > $JOB_JDF/${_fname}.jdf
+else
+  echo "ERROR: ${_jobfile} already exists."
+fi
+

sim/k2jobScripts
jdf_slic.sh added at 1.1
diff -N jdf_slic.sh
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ jdf_slic.sh	23 Jul 2005 10:04:00 -0000	1.1
@@ -0,0 +1,72 @@
+#!/bin/sh
+
+#
+# Script to generate Condor JDF file for batch submission.
+#
+
+# 3 required args
+if [ -z "$3" ]; then
+  echo "jdf_slic.sh geometry_file stdhep_file nrun"
+  exit 1
+fi
+
+# i) geom file
+export detectorfile="$1"
+
+if [ ! -e "$detectorfile" ]; then
+  echo "ERROR: $detectorfile does not exist."
+  exit 1
+fi
+
+detector=$(basename $detectorfile)
+detector=${detector%.*}
+
+# 2) stdhep file
+export stdhepfile="$2"
+
+if [ ! -e "$stdhepfile" ]; then
+  echo "ERROR: $stdhepfile does not exist."
+  exit 1
+fi 
+
+stdhep=$(basename $stdhepfile)
+stdhep=${stdhep%.*}
+
+# 3) n to run
+export nrun="$3"
+
+nrunchk=$(echo $nrun | grep "^[0-9]*$")
+if [ -z "$nrunchk" ]; then
+  echo "ERROR: $nrun is not a valid number of events to run."
+  exit 1
+fi
+
+# set run script
+export runfile="/k2data/APPS/sim/run_slic.sh"
+
+# set run args
+export runargs="-g $detectorfile -z -i $stdhepfile -O -r $nrun"
+
+# set jobname
+#export jobname="${stdhep}_${nrun}_SLIC_${detector}"
+export jobname="${stdhep}_SLIC_${detector}"
+
+# make a dir for each job
+if [ ! -e "${jobname}" ]; then
+  mkdir ${jobname}
+  echo "created initialdir ${jobname}"
+fi
+
+# output template with above args
+/k2work/jeremy/jobs/bin/jdf_template.sh > ${jobname}/submit.jdf
+
+# dump info to caller
+echo "condor_submit ${jobname}/submit.jdf"
+#echo "detectorfile=$detectorfile"
+#echo "detector=$detector"
+#echo "stdhepfile=$stdhepfile"
+#echo "stdep=$stdhep"
+#echo "nrun=$nrun"
+#echo "jobname=$jobname"
+#echo "runfile=$runfile"
+#echo "runargs=$runargs"

sim/k2jobScripts
jdf_template.sh added at 1.1
diff -N jdf_template.sh
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ jdf_template.sh	23 Jul 2005 10:04:00 -0000	1.1
@@ -0,0 +1,74 @@
+#!/bin/env sh
+
+#
+# Outputs a simple Condor JDF template to cout, that can
+# be used for batch submission on k2 or zoot.
+#
+
+# Users of this script should set the env vars they want in the calling script or env.
+if [ -z "$jobname" ]; then
+  jobname="job"
+fi
+
+if [ -z "$initdir" ]; then
+  initdir="${PWD}/${jobname}"
+fi
+
+if [ -z "$runfile" ]; then
+  runfile="run.sh"
+fi 
+
+if [ -z "$runargs" ]; then
+  runargs=""
+fi
+
+if [ -z "$inputfiles" ]; then
+  inputfile=""
+fi
+
+echo "# Condor JDF file"
+echo
+echo "# job"
+echo "JOBNAME = ${jobname}"
+echo 
+echo "# run in Vanilla universe"
+echo "Universe = Vanilla"
+echo
+echo "# transfer output files back"
+echo "should_transfer_files = YES"
+echo
+echo "# output files moved when job is completed"
+echo "when_to_transfer_output = ON_EXIT"
+echo
+echo "# files to copy to batch area"
+echo "transfer_input_files = ${inputfiles}"
+echo
+echo "# file for stdout e.g. user log file"
+echo "output = \$(JOBNAME).log"
+echo
+echo "# file for stderr e.g. user err mesg"
+echo "error = \$(JOBNAME).err"
+echo 
+echo "# Condor logfile name"
+echo "Log = batch.\$(Process).out"
+echo
+echo "# shell script to execute"
+echo "Executable = ${runfile}"
+echo
+echo "# set script arguments"
+echo "Arguments = ${runargs}"
+echo
+echo "# initial dir"
+echo "InitialDir = ${initdir}"
+
+if [ "${HOSTNAME}" == "k2" ]; then
+  echo
+  echo "# host ranking on k2"
+  cat /k2work/jeremy/jobs/bin/hosts.jdf.inc
+fi
+
+echo
+echo "# queue the job"
+echo Queue
+echo 
+echo "# Submit cmd: condor_submit thisFile.jdf"

sim/k2jobScripts
make_jobdir.sh added at 1.1
diff -N make_jobdir.sh
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ make_jobdir.sh	23 Jul 2005 10:04:00 -0000	1.1
@@ -0,0 +1,35 @@
+#!/bin/sh
+
+_jobroot=$PRJ_JOBS
+
+function print_usage()
+{
+  echo "USAGE:"
+  echo "./make_jobdir jobname [root_area]"
+}
+
+if [ -z "$1" ]; then
+  print_usage
+else
+
+  _jobname="$1"
+
+  if [ -n "$2" ]; then
+    _jobroot="$2" 
+  fi
+
+  _jobpath=${_jobroot}/${_jobname}
+  mkdir ${_jobpath}
+
+  if [ ! -e ${_jobpath} ]; then
+    echo "ERROR: unable to create ${_jobpath}"
+  else
+    (
+      cd ${_jobpath}
+      for d in "jdf" "macros" "input" "output" "work" "log" "targz" "sh"; do
+        echo $d
+        mkdir $d
+      done
+    )
+  fi
+fi

sim/k2jobScripts
make_mokka_macro.sh added at 1.1
diff -N make_mokka_macro.sh
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ make_mokka_macro.sh	23 Jul 2005 10:04:00 -0000	1.1
@@ -0,0 +1,63 @@
+#!/bin/sh
+
+function print_usage()
+{
+  echo "USAGE:"
+  echo
+  echo "./make_mokka_macro.sh INPUTFILE NEVENTS"
+  echo
+  echo "Both REQUIRED."
+}
+
+if [ $# -lt "2" ]; then
+  print_usage
+  exit 1
+fi
+
+inputfile=$1
+nevents=$2
+
+echo "inputfile=$inputfile"
+echo "nevents=$nevents"
+
+# input file exists?
+if [ ! -e $inputfile ]; then
+  echo "WARNING: INPUTFILE appears not to exist!"
+fi
+
+# input file extension okay?
+inputfile_ext=`echo $inputfile | sed "s/.*\.//"`
+if [[ $inputfile_ext != "stdhep" && $inputfile_ext != "HepEvt" ]]; then
+  echo "WARNING: INPUTFILE extension does not appear to be valid."
+fi
+
+# check num events is alpha
+alpha_evt=`echo $nevents | egrep "^[[:digit:]]*$"`
+if [ -z $alpha_evt ]; then
+  echo "WARNING: NEVENTS is not all numeric."
+fi
+
+macname=`basename ${inputfile%.*}.mac`
+
+echo "macname=$macname"
+
+if [ -n ${JOB_MACROS} ]; then
+  macname=${JOB_MACROS}/${macname}
+fi
+
+if [ -e "$macname" ]; then
+  echo "$macname already exists."
+  exit 1
+fi
+
+echo "Writing macro to $macname..."
+
+echo "/event/verbose 0" > $macname
+echo "/run/verbose 0" >> $macname
+echo "/tracking/verbose 0" >> $macname
+echo "/generator/generator $inputfile" >> $macname
+echo "/run/beamOn $nevents" >> $macname
+
+echo "DONE"
+
+exit

sim/k2jobScripts
run_lcdg4.sh added at 1.1
diff -N run_lcdg4.sh
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ run_lcdg4.sh	23 Jul 2005 10:04:01 -0000	1.1
@@ -0,0 +1,122 @@
+#!/bin/sh
+
+# bin example
+# bin/Linux-g++/lcdg4 ParFiles/SDJan03.xml blah.sio SDJan03 inputfile run1.macro blah.slcio
+
+# script example
+# /k2work/jeremy/jobs/bin/run_lcdg4.sh `pwd` /k2work/jeremy/jobs/test/output /k2work/jeremy/lcdg4/head/ParFiles/SDJan03.xml \
+# /k2work/lima/data/stdhep/muons-30gev-perptheta-allphi-2000evts.stdhep /k2work/jeremy/lcdg4/head/run1.macro
+
+function print_usage() {
+  echo "Run LCDG4 Job"
+  echo "Usage: ./run-lcdg4.sh lcdg4path datapath xmlpath stdheppath macpath"
+  echo
+  echo "lcdg4path is root lcdg4 dir."
+  echo "datapath is root data area for output files."
+  echo "xmlpath is the full path to the xml geometry file."
+  echo "stdheppath is the full path to a binary stdhep file."
+  echo "macpath is the full path to a macro."
+  echo "All are REQUIRED."
+  echo
+}
+
+function print_vars() {
+  echo "args: $xmlpath $sio $xmltag $stdheppath $macpath $lcio"
+  echo "lcdg4path=$lcdg4path"
+  echo "datapath=$datapath"
+  echo "xmltag=$xmltag"
+  echo "stdheppath=$stdheppath"
+  echo "macpath=$macpath"
+  echo "ofilebase=$ofilebase"
+  echo "sio=$sio"
+  echo "lcio=$lcio"
+  echo "logfile=$logfile"
+}
+
+# check CL args
+if [ $# -lt "5" ]; then
+  print_usage
+  exit 1
+fi
+
+lcdg4path=$1
+datapath=$2
+#xmltag=$3
+xmlpath=$3
+stdheppath=$4
+macpath=$5
+
+
+#xmlpath="$lcdg4path/ParFiles/$xmltag.xml"
+
+# setup project env
+prjenvscript=/k2dist/bin/prjenv.sh
+
+if [ -e $prjenvscript ]
+then
+  . $prjenvscript
+else
+  echo "ERROR: project env not found: $prjenvscript"
+  exit 1
+fi
+
+# setup lcdg4 env
+setupscript=$lcdg4path/setup.sh
+
+# set G4 working dir
+export G4WORKDIR=$lcdg4path
+
+if [ -e $setupscript ]; then
+  . $setupscript
+else
+  echo "ERROR - setup script does not exist: $setupscript"
+  exit 1
+fi
+
+if [ ! -e $lcdg4path ]; then
+  echo "ERROR - lcdg4path does not exist: $lcdg4path"
+  exit 1
+fi
+
+if [ ! -e $datapath ]; then
+  echo "ERROR - datapath does not exist: $datapath"
+  exit 1
+fi
+
+if [ ! -e $xmlpath ]; then
+  echo "ERROR - xmlpath does not exist: $xmlpath"
+  exit 1
+fi
+
+if [ ! -e $stdheppath ]; then
+  echo "ERROR - stdheppath does not exist: $stdheppath"
+  exit 1
+fi
+
+if [ ! -e $macpath ]; then
+  echo "ERROR - macpath does not exist: $macpath"
+  exit 1
+fi
+
+# get derived parameters
+ofilebase=`fname.sh $xmlpath $stdheppath`
+sio=$datapath/$ofilebase.sio
+lcio=$datapath/$ofilebase.slcio
+logfile=$datapath/$ofilebase.log
+
+xmltag=`basename $xmlpath .xml`
+
+# runline
+#runit="time $lcdg4path/lcdg4 $xmlpath $datafile $xmllab $stdheppath $macpath &> $logfile"
+#echo -e "runline:\n$runit"
+
+print_vars
+
+# This is likely to be wrong unless running in $lcdg4path.
+export PEGS4PATH=$lcdg4path
+
+# runit
+runline="time $lcdg4path/bin/$G4SYSTEM/lcdg4 $xmlpath $sio $xmltag $stdheppath $macpath $lcio"
+echo "runline: $runline"
+#time $lcdg4path/bin/$G4SYSTEM/lcdg4 $xmlpath $sio $xmltag $stdheppath $macpath $lcio &> $logfile
+$runline &> $logfile

sim/k2jobScripts
run_mokka.sh added at 1.1
diff -N run_mokka.sh
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ run_mokka.sh	23 Jul 2005 10:04:01 -0000	1.1
@@ -0,0 +1,87 @@
+#!/bin/sh
+
+function print_usage() {
+  echo "Usage: ./run-mokka.sh mokkapath datapath macpath model"
+  echo "*none optional*"
+}
+
+# not enough CL args
+if [ $# -lt "4" ]; then
+  print_usage
+  exit 1
+fi
+
+# CL args to locals
+mokkapath=$1
+datapath=$2
+macpath=$3
+model=$4
+
+lciofile=`/k2work/jeremy/jobs/bin/fname.sh $model $macpath` 
+datafile=$datapath/$lciofile
+full_lciofile=$datafile.slcio
+logfile=$datapath/$lciofile.log 
+
+# print derived parameters
+echo "mokkapath: $mokkapath"
+echo "macpath: $macpath"
+echo "model: $model"
+echo "lciofile: $full_lciofile"
+echo "logfile: $logfile"
+
+# setup project env
+prjenvscript=/k2dist/bin/prjenv.sh
+
+if [ -e $prjenvscript ]
+then
+  . $prjenvscript &> /dev/null
+else
+  echo "ERROR: project env not found: $prjenvscript"
+  exit 1
+fi
+
+
+# check args
+if [ ! -e $mokkapath ]; then
+  echo "exec path does not exist: $mokkapath"
+  exit 1
+fi
+
+if [ ! -e $macpath ]; then
+  echo "G4 macro path does not exist: $macpath"
+fi
+
+if [ ! -e $datapath ]; then
+  echo "geometry path does not exist: $geompath"
+fi
+
+
+# setup mokka env
+setupscript=$mokkapath/setup.sh
+
+echo "setupscript: $setupscript"
+if [ -e $setupscript ]
+then
+  . $setupscript &> /dev/null
+else
+  echo "ERROR: setup script does not exist: $setupscript"
+  exit 1
+fi
+
+# delete old lcio
+if [ -e $full_lciofile ]; then
+  echo "deleting old LCIO file: $full_lciofile"
+  rm $full_lciofile
+
+  if [ -e $full_lciofile ]; then
+    echo "ERROR: couldn't delete $full_lciofile"
+    exit 1
+  fi
+fi
+
+# run it
+#willrun="$mokkapath/Mokka -M $model -m $macpath -l $datafile &> $logfile"
+#echo "runline: $willrun"
+LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/lib/mysql
+#echo "exit" | time $mokkapath/Mokka -h hius.nicadd.niu.edu -M $model -m $macpath -l $datafile &> $logfile
+echo "exit" | time $mokkapath/bin/Linux-g++/Mokka -h hius.nicadd.niu.edu -M $model -m $macpath -l $datafile &> $logfile

sim/k2jobScripts
run_slic.sh added at 1.1
diff -N run_slic.sh
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ run_slic.sh	23 Jul 2005 10:04:01 -0000	1.1
@@ -0,0 +1,8 @@
+#!/bin/sh
+
+# set some k2-specific environment
+export SLIC_BASE=/k2data/APPS/sim/slic
+export XERCESCROOT=/k2data/APPS/sim/xerces
+
+# exec using bundled run script
+source $SLIC_BASE/scripts/run.sh $@

sim/k2jobScripts
run_tbeam.sh added at 1.1
diff -N run_tbeam.sh
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ run_tbeam.sh	23 Jul 2005 10:04:01 -0000	1.1
@@ -0,0 +1,86 @@
+#!/bin/sh
+
+# usage
+function print_usage() {
+  echo "Usage: ./run-tbeam.sh tbeampath datapath macpath geompath"
+  echo "*none optional*"
+}
+
+# not enough CL args
+if [ $# -lt "4" ]; then
+  print_usage
+  exit 1
+fi
+
+# get CL args to local
+tbeampath=$1
+datapath=$2
+macpath=$3
+geompath=$4
+
+# setup project env
+prjenvscript=/k2dist/bin/prjenv.sh
+
+if [ -e $prjenvscript ]
+then
+  . $prjenvscript
+else
+  echo "ERROR - project env not found: $prjenvscript"
+  exit 1
+fi
+
+# setup tbeam env @ NICADD
+setupscript=$tbeampath/setup.sh
+if [ -e $setupscript ]
+then
+  . $setupscript
+else
+  echo "ERROR - setup script does not exist: $setupscript"
+  exit 1
+fi
+
+# check args
+if [ ! -e $tbeampath ]; then
+  echo "ERROR - tbeam exec path does not exist: $tbeampath"
+  exit 1
+fi
+
+if [ ! -e $macpath ]; then
+  echo "ERROR - G4 macro path does not exist: $macpath"
+  exit 1
+fi
+
+if [ ! -e $geompath ]; then
+  echo "ERROR - geometry path does not exist: $geompath"
+  exit 1
+fi
+
+if [ ! -e $datapath ]; then
+  echo "ERROR - geometry path does not exist: $geompath"
+  exit 1
+fi
+
+# get derived parameters
+ofilebase=`fname.sh $geompath $macpath`
+datafile=$datapath/TBS_$ofilebase.txt
+logfile=$datapath/TBS_$ofilebase.log
+
+# exec line
+runline="$tbeampath/testbeam -p $geompath -m $macpath -o $datafile"
+
+# print job parms
+echo "tbeampath: $tbeampath"
+echo "datapath: $datapath"
+echo "macpath: $macpath"
+echo "geompath: $geompath"
+echo "ofilebase: $ofilebase"
+echo "datafile: $datafile"
+echo "logfile: $logfile"
+echo "runline: $runline"
+echo "started: `date`"
+
+# run it
+$runline &> $logfile
+
+# end mesg
+echo "finished: `date`"

sim/k2jobScripts
setup.sh added at 1.1
diff -N setup.sh
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ setup.sh	23 Jul 2005 10:04:01 -0000	1.1
@@ -0,0 +1,3 @@
+#!/bin/sh
+source setup_appenv.sh
+source setup_jobenv.sh

sim/k2jobScripts
setup_appenv.sh added at 1.1
diff -N setup_appenv.sh
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ setup_appenv.sh	23 Jul 2005 10:04:01 -0000	1.1
@@ -0,0 +1,30 @@
+#!/bin/sh
+
+if [ -z "$JOB_ROOT" ]; then
+  source setup_jobenv.sh
+fi
+
+# app locs
+export MOKKA_ROOT="$PRJ_UWORK/mokka/Mokka/source"
+#export MOKKA_ROOT="$PRJ_UWORK/mokka/tbeam/"
+export LCDG4_ROOT="$PRJ_UWORK/lcdg4/head/"
+export TBEAM_ROOT="$PRJ_UWORK/tbeam/head/"
+export SLIC_ROOT="$PRJ_UWORK/sim/slic/"
+
+# attempt to use G4SYSTEM for bin loc
+if [ -n $G4SYSTEM ]; then
+  BIN_PRE="bin/$G4SYSTEM"
+# not set, default to linux
+else
+  BIN_PRE="bin/Linux-g++"
+fi
+
+export MOKKA_EXEC="$MOKKA_ROOT/$BIN_PRE/Mokka"
+export LCDG4_EXEC="$LCDG4_ROOT/$BIN_PRE/lcdg4"
+export TBEAM_EXEC="$TBEAM_ROOT/$BIN_PRE/tbeam"
+export SLIC_EXEC="$SLIC_ROOT/$BIN_PRE/slic"
+
+export MOKKA_RUN="$JOB_BIN/run_mokka.sh"
+export LCDG4_RUN="$JOB_BIN/run_lcdg4.sh"
+export TBEAM_RUN="$JOB_BIN/run_tbeam.sh"
+export SLIC_RUN="$JOB_BIN/run_slic.sh"

sim/k2jobScripts
setup_jobenv.sh added at 1.1
diff -N setup_jobenv.sh
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ setup_jobenv.sh	23 Jul 2005 10:04:01 -0000	1.1
@@ -0,0 +1,33 @@
+#!/bin/sh
+
+# prj bootstrap
+export JOB_PRJENV="/k2dist/bin/prjenv.sh"
+
+# job locs
+export JOB_ROOT=$PRJ_JOBS
+export JOB_BIN=$JOB_ROOT/bin
+
+_currjob=$JOB_BIN/curr_job
+if [ -e ${_currjob} ]; then
+  export JOB_TAG=`cat ${_currjob}`
+else
+  echo "ERROR: curr_job does not exist!"
+  echo "curr_job=${_currjob}"
+fi
+
+#if [ -z $JOB_TAG ]; then
+#  export JOB_TAG="test"
+#fi
+
+export JOB_CURR=$JOB_ROOT/$JOB_TAG
+
+export JOB_JDF=$JOB_CURR/jdf
+export JOB_LOG=$JOB_CURR/log
+export JOB_OUTPUT=$JOB_CURR/output
+export JOB_INPUT=$JOB_CURR/input
+export JOB_WORK=$JOB_CURR/work
+export JOB_MACROS=$JOB_CURR/macros
+export JOB_TARGZ=$JOB_CURR/targz
+
+# add job bin to path
+export PATH=$JOB_BIN:$PATH

sim/k2jobScripts
submit_currjob.sh added at 1.1
diff -N submit_currjob.sh
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ submit_currjob.sh	23 Jul 2005 10:04:01 -0000	1.1
@@ -0,0 +1,2 @@
+#!/bin/sh
+for j in `ls $JOB_JDF`; do condor_submit $JOB_JDF/$j; done

sim/k2jobScripts
tail_mokka_log.sh added at 1.1
diff -N tail_mokka_log.sh
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ tail_mokka_log.sh	23 Jul 2005 10:04:01 -0000	1.1
@@ -0,0 +1,2 @@
+#!/bin/sh
+tail -f *.log | egrep "(==>|>>>)"

sim/k2jobScripts
tail_slic_log.sh added at 1.1
diff -N tail_slic_log.sh
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ tail_slic_log.sh	23 Jul 2005 10:04:01 -0000	1.1
@@ -0,0 +1,2 @@
+#!/bin/sh
+tail -f *.log | egrep "(==>|>>>)"
CVSspam 0.2.8