Skip to content

Commit 2f22902

Browse files
committed
cleanup
1 parent 1bff495 commit 2f22902

File tree

2 files changed

+73
-62
lines changed

2 files changed

+73
-62
lines changed

bin/run-clara

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
#!/bin/bash
2+
3+
usage="Usage: run-clara -y yamlfile [-i dirorfile] [-o dir] [-t threads] [-n nevents] [-c CLARA_HOME]"
4+
5+
function error() {
6+
echo -e "\n$usage\n\nERROR: $@" && exit 1
7+
}
8+
9+
function abspath() {
10+
[ -d $1 ] && echo $(cd $1 && pwd) && return 0
11+
[ -f $1 ] && echo $(cd $(dirname $1) && pwd)/$1 && return 0
12+
return 1
13+
}
14+
15+
ulimit -u 49152 >& /dev/null
16+
set -e
17+
18+
# Check user options:
19+
input=.
20+
output=.
21+
threads=2
22+
while getopts i:o:y:t:n:c:h opt
23+
do
24+
case $opt in
25+
i) input=$OPTARG ;;
26+
o) output=$OPTARG ;;
27+
y) yaml=$OPTARG ;;
28+
t) threads=$OPTARG ;;
29+
n) nevents="-e $OPTARG" ;;
30+
c) CLARA_HOME=$OPTARG ;;
31+
h) echo $usage && exit 0 ;;
32+
?) error "Unknown option: $1" ;;
33+
esac
34+
done
35+
[ -z ${CLARA_HOME+x} ] && error "CLARA_HOME must be specified."
36+
[ -d $CLARA_HOME ] || error "CLARA_HOME is missing: $CLARA_HOME"
37+
[ -z ${yaml+x} ] && error "-y YAML must be specified."
38+
[ -r $yaml ] || error "YAML file does not exist."
39+
[ $threads -eq 0 ] && threads=`grep -c ^processor /proc/cpuinfo`
40+
41+
# Normalize all user paths:
42+
export CLARA_HOME=$(abspath $CLARA_HOME)
43+
input=$(abspath $input)
44+
output=$(abspath $output)
45+
yaml=$(abspath $yaml)
46+
47+
# Set the environment variables and directories required by CLARA:
48+
unset CLARA_MONITOR_FE
49+
export CLARA_USER_DATA=$(mktemp -d $output/run-clara.tmp.XXXXXX)
50+
cd $CLARA_USER_DATA
51+
mkdir -p $CLARA_USER_DATA/log
52+
mkdir -p $CLARA_USER_DATA/config
53+
mkdir -p $CLARA_USER_DATA/data/output
54+
55+
# Generate the required file containing a file list for CLARA:
56+
# (Note, that file list must contain relative paths, not absolute.)
57+
test -e $input || eror "Invalid inputs: $input"
58+
test -d $input && find $input -maxdepth 1 -type f -name '*.hipo' -exec basename {} \; > filelist.txt
59+
test -f $input && echo $(basename $input) > filelist.txt
60+
[ $(cat filelist.txt | wc -l) -gt 0 ] || error "Found no input files."
61+
62+
# Finally, run CLARA:
63+
$CLARA_HOME/lib/clara/run-clara \
64+
-i $input \
65+
-o $CLARA_USER_DATA \
66+
-z rec_ \
67+
-x $CLARA_USER_DATA/log \
68+
-t $threads \
69+
$nevents \
70+
-s recon \
71+
$yaml \
72+
./filelist.txt
73+

run-clara

Lines changed: 0 additions & 62 deletions
This file was deleted.

0 commit comments

Comments
 (0)