@@ -16,6 +16,7 @@ declare -A REHEAT_METHODS=(
1616
1717# default options
1818dataset=train
19+ coatjava_version=13.3.0 # the first version with rollover correction, used for RG-A Spring 2018 reheating
1920declare -A modes
2021for key in submit; do
2122 modes[$key ]=false
@@ -35,12 +36,14 @@ usage() {
3536 REQUIRED OPTIONS:
3637 -i [INPUT_DIR] input directory of HIPO files; all HIPO files will be reheated
3738 -o [OUTPUT_DIR] output directory
38- -c [COMMAND] which reheating method to use, one of:
39+ -m [METHOD] which reheating method to use, one of:
3940$( for key in " ${! REHEAT_METHODS[@]} " ; do printf " %24s %-11s %-s\n" " " " $key " " ${REHEAT_METHODS[$key]} " ; done)
4041
4142 OPTIONAL OPTIONS:
4243 -d [DATASET] unique name for this dataset
4344 default: $dataset
45+ -c [COATJAVA_VER] coatjava version number
46+ default: $coatjava_version
4447 --submit submit the slurm jobs, rather than just
4548 printing the \` sbatch\` command
4649 " " " >&2
5356# parse options
5457inputDir=" "
5558outputDir=" "
56- cmd =" "
57- while getopts " i:o:c:d :h-:" opt; do
59+ mtd =" "
60+ while getopts " i:o:m:d:c :h-:" opt; do
5861 case $opt in
5962 i) inputDir=$OPTARG ;;
6063 o) outputDir=$OPTARG ;;
61- c )
64+ m )
6265 [ -z " ${REHEAT_METHODS[$OPTARG]-} " ] && printError " unknown command '$OPTARG '" && exit 100
63- cmd =$OPTARG
66+ mtd =$OPTARG
6467 ;;
6568 d) dataset=$OPTARG ;;
69+ c) coatjava_version=$OPTARG ;;
6670 h)
6771 usage
6872 exit 101
8084# check arguments
8185[ -z " $inputDir " ] && printError " missing input directory argument" && exit 100
8286[ -z " $outputDir " ] && printError " missing output directory argument" && exit 100
83- [ -z " $cmd " ] && printError " missing command argument" && exit 100
84-
85- # make sure coatjava environment is loaded
86- [ -z " ${COATJAVA-} " ] && printError " COATJAVA environment variable is not set" && exit 100
87+ [ -z " $mtd " ] && printError " missing method argument" && exit 100
8788
8889# get list of input files
8990[ ! -d $inputDir ] && printError " input directory '$inputDir ' not found" && exit 100
@@ -95,7 +96,7 @@ mkdir -p $outputDir
9596outputDir=$( realpath $outputDir )
9697
9798# start job lists
98- jobName=reheat.$cmd .$dataset
99+ jobName=reheat.$mtd .$dataset
99100slurmDir=./slurm
100101jobList=$slurmDir /job.$jobName .list
101102> $jobList
@@ -115,6 +116,13 @@ for inputFile in ${inputFiles[@]}; do
115116 cat > $jobScript << EOF
116117#!/usr/bin/env bash
117118set -eou pipefail
119+ # load coatjava module
120+ source /usr/share/Modules/init/bash
121+ module purge
122+ module use /scigroup/cvmfs/hallb/clas12/sw/modulefiles
123+ module load clas12
124+ module switch coatjava/$coatjava_version
125+ echo "COATJAVA = $COATJAVA "
118126# set env vars
119127source $TIMELINESRC /libexec/environ.sh
120128# logger info
@@ -123,16 +131,16 @@ echo "OUTPUT FILE: $outputFile"
123131EOF
124132
125133 # add main command to the job script
126- case $cmd in
134+ case $mtd in
127135
128136 rollover)
129137 mkdir -p $outputDir /tmp
130138 tmpFile=$outputDir /tmp/$inputBase .hipo
131139 cat >> $jobScript << EOF
132140echo "TMP FILE: $tmpFile "
133141# fix the clock rollover
134- $( which rebuild-scalers) -l INFO -c X -o $tmpFile $inputFile -- -Xmx1536m
135- $( which postprocess) -l INFO -q 1 -o $outputFile $tmpFile
142+ $COATJAVA /bin/ rebuild-scalers -l INFO -c X -o $tmpFile $inputFile -- -Xmx1536m
143+ $COATJAVA /bin/ postprocess -l INFO -q 1 -o $outputFile $tmpFile
136144rm -v $tmpFile
137145EOF
138146
0 commit comments