Skip to content

Commit 1772f69

Browse files
committed
add convenience script
1 parent 80af5aa commit 1772f69

File tree

1 file changed

+63
-0
lines changed

1 file changed

+63
-0
lines changed

run-clara

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
#!/bin/bash
2+
3+
#ulimit -u 49152
4+
set -e
5+
6+
export CLAS12DIR=${CLARA_HOME}/plugins/clas12
7+
export PATH=${PATH}:$CLAS12DIR/bin
8+
unset CLARA_MONITOR_FE
9+
10+
inputdir=.
11+
outputdir=.
12+
threads=2
13+
usage="asdf"
14+
info="qwer"
15+
16+
while [[ $# -gt 0 ]]; do
17+
case $1 in
18+
-h) echo -e "\n$usage" && echo -e "\n$info" && exit 1 ;;
19+
-i) inputdir="$2" && shift && shift ;;
20+
-o) outputdir="$2" && shift && shift ;;
21+
-t) threads="$2" && shift && shift ;;
22+
-n) nevents="$2" && shift && shift ;;
23+
-y) yaml="$2" && shift && shift ;;
24+
-*|--*) echo -e "$usage\n\nUnknown option: $1" && exit 1 ;;
25+
*) args+=("$1") && shift ;;
26+
esac
27+
done
28+
29+
function error() {
30+
echo -e "\n$usage\n\nERROR: $@"
31+
exit 1
32+
}
33+
34+
clara_home="$args"
35+
[ "${#args[@]}" -lt 1 ] && error "Missing PATH argument"
36+
[ "${#args[@]}" -gt 1 ] && error "Extra PATH arguments: ${args[@]:1}"
37+
[ ! -e "$clara_home" ] && error "Missing installation PATH: $clara_home"
38+
[ -z ${yaml+x} ] && error "-y YAML must be specified."
39+
[ -r $yaml ] || error "YAML file does not exist."
40+
[ -d $inputdir ] || error "Input dir does not exist."
41+
42+
[ $threads -eq 0 ] && threads=`grep -c ^processor /proc/cpuinfo`
43+
44+
export CLARA_USER_DATA=$(mktemp -d $outputdir/run-clara.tmp.XXXXXX)
45+
cd $CLARA_USER_DATA
46+
mkdir -p $CLARA_USER_DATA/log
47+
mkdir -p $CLARA_USER_DATA/config
48+
mkdir -p $CLARA_USER_DATA/data/output
49+
50+
find $inputdir -maxdepth 1 -type f -name '*.hipo' | sed 's;^\./;;' | sort > filelist.txt
51+
[ $(stat -L -c%s filelist.txt) -gt 0 ] || error "Found no input files"
52+
53+
$CLARA_HOME/lib/clara/run-clara \
54+
-i $inputdir \
55+
-o $CLARA_USER_DATA \
56+
-z rec_ \
57+
-x $CLARA_USER_DATA/log \
58+
-t $threads \
59+
$nevents \
60+
-s recon \
61+
$yaml \
62+
./filelist.txt
63+

0 commit comments

Comments
 (0)