Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 12 additions & 7 deletions bin/run-clara
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@ export JAVA_OPTS="${JAVA_OPTS} -XX:+IgnoreUnrecognizedVMOptions"
usage="Usage: run-clara [-i IN] [-o OUT] [-c CLARA] [-t #] [-n #] YAML"
info='\nOptions:\n
YAML - path to CLARA YAML steering file\n
-i input HIPO file or directory of *.hipo files (default=.)\n
-i input HIPO file, directory of *.hipo files, or glob of HIPO files (default=.)\n
-o output directory (default=.)\n
-p output prefix (default=rec_)\n
-c CLARA installation (default=$CLARA_HOME)\n
-t number of threads (default=2)\n
-n number of events (default=-1)\n\n
Expand Down Expand Up @@ -62,11 +63,13 @@ set -e
input=.
output=.
threads=2
while getopts i:o:c:t:n:h opt
prefix=rec_
while getopts i:o:p:c:t:n:h opt
do
case $opt in
i) input=$OPTARG ;;
o) output=$OPTARG ;;
p) prefix=$OPTARG ;;
c) CLARA_HOME=$OPTARG ;;
t) threads=$OPTARG && echo $threads | grep -q -E '^[0-9]+$' || error "-t must be an integer, threads" ;;
n) nevents="-e $OPTARG" && echo $nevents | grep -q -E '^-e [0-9]+$' || error "-n must be an integer, events" ;;
Expand All @@ -81,7 +84,8 @@ shift $((OPTIND-1))
[ -z ${CLARA_HOME+x} ] && error "-c must be specified or \$CLARA_HOME set"
[ -d $CLARA_HOME ] || error "Invalid CLARA_HOME: $CLARA_HOME"
[ $threads -eq 0 ] && threads=`grep -c ^processor /proc/cpuinfo`
test -e $input && test -r $input || error "Invalid inputs -i: $input"
! test -r $input && echo "WARNING: Interpreting -i as a glob: $input"
! test -r $input && ! compgen -G $input && error "Invalid glob -i: $input"

# Create the environment variables and directories required by CLARA:
[ -e $output ] && echo "WARNING: Using existing directory: $output."
Expand All @@ -91,14 +95,15 @@ export CLARA_USER_DATA=$output
unset CLARA_MONITOR_FE

# Normalize all paths:
input=$(abspath $input)
output=$(abspath $output)
yaml=$(abspath $yaml)
test -r $input && input=$(abspath $input)
export CLARA_HOME=$(abspath $CLARA_HOME)
export CLAS12DIR=$CLARA_HOME/plugins/clas12

# Generate the file for CLARA containing a file list (of relative paths, not absolute):
test -d $input && find $input -maxdepth 1 -name '*.hipo' -exec basename {} \; > $CLARA_USER_DATA/filelist.txt
! test -r $input && compgen -G $input > $CLARA_USER_DATA/filelist.txt
test -d $input && find $input -maxdepth 1 -name "*.hipo" -exec basename {} \; > $CLARA_USER_DATA/filelist.txt
test -f $input && echo $(basename $input) > $CLARA_USER_DATA/filelist.txt
[ $(cat $CLARA_USER_DATA/filelist.txt | wc -l) -gt 0 ] || error "Found no input files."

Expand All @@ -117,14 +122,14 @@ then
unset JAVA_OPTS
$CLARA_HOME/bin/clara-orchestrator \
-F -f ${ip}%${port}_java -s recon \
-i $input -o $output -z rec_ \
-i $input -o $output -z $prefix \
-p $threads -t $threads \
$yaml $CLARA_USER_DATA/filelist.txt
else
$CLARA_HOME/lib/clara/run-clara \
-i $input \
-o $CLARA_USER_DATA \
-z rec_ \
-z $prefix \
-x $CLARA_USER_DATA/log \
-t $threads \
$nevents \
Expand Down