Skip to content

Commit 324d735

Browse files
committed
let inputs be a glob
1 parent 3abfcd3 commit 324d735

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

bin/run-clara

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ export JAVA_OPTS="${JAVA_OPTS} -XX:+IgnoreUnrecognizedVMOptions"
66
usage="Usage: run-clara [-i IN] [-o OUT] [-c CLARA] [-t #] [-n #] YAML"
77
info='\nOptions:\n
88
YAML - path to CLARA YAML steering file\n
9-
-i input HIPO file or directory of *.hipo files (default=.)\n
9+
-i input HIPO file, directory of *.hipo files, or glob of HIPO files (default=.)\n
1010
-o output directory (default=.)\n
1111
-p output prefix (default=rec_)\n
1212
-c CLARA installation (default=$CLARA_HOME)\n
@@ -84,7 +84,8 @@ shift $((OPTIND-1))
8484
[ -z ${CLARA_HOME+x} ] && error "-c must be specified or \$CLARA_HOME set"
8585
[ -d $CLARA_HOME ] || error "Invalid CLARA_HOME: $CLARA_HOME"
8686
[ $threads -eq 0 ] && threads=`grep -c ^processor /proc/cpuinfo`
87-
test -e $input && test -r $input || error "Invalid inputs -i: $input"
87+
! test -r $input && echo "WARNING: Interpreting -i as a glob: $input"
88+
! test -r $input && ! compgen -G $input && error "Invalid glob -i: $input"
8889

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

9697
# Normalize all paths:
97-
input=$(abspath $input)
9898
output=$(abspath $output)
9999
yaml=$(abspath $yaml)
100+
test -r $input && input=$(abspath $input)
100101
export CLARA_HOME=$(abspath $CLARA_HOME)
101102
export CLAS12DIR=$CLARA_HOME/plugins/clas12
102103

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

0 commit comments

Comments
 (0)