-
Notifications
You must be signed in to change notification settings - Fork 2
/
do_fits_multiple
executable file
·71 lines (54 loc) · 1.1 KB
/
do_fits_multiple
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#!/bin/bash
make "do_fits" || exit 1
n_threads="8"
#----------------------------------------------------------------------------------------------------
function ProcessOne()
{
local buffer="$1"
for d in $buffer
do
#echo " $d"
./do_fits "$d" &> "$d/do_fits.log"
res="$?"
if [ $res -eq 0 ]
then
continue
fi
case $res in
1)
echo "WARNING: some plots missing in $d"
;;
*)
echo "ERROR: run problem in $d"
;;
esac
done
}
#----------------------------------------------------------------------------------------------------
echo "* building directory list"
# collect data
idx=0
input=()
while [ -n "$1" ]
do
echo " - $1"
for dir in `find $1 -type d`
do
if [ -f "$dir/output_tracks.root" ]
then
input[$idx]="${input[$idx]} $dir"
idx=$(( (idx+1) % n_threads ))
#else
#echo "ERROR: no output.root in $dir"
fi
done
shift
done
echo "* running fits"
# run in parallel
for (( idx=0; idx<n_threads; idx++))
do
ProcessOne "${input[$idx]}" &
done
wait
echo "* done"