Jpp 19.3.0-rc.1
the software that should make you happy
Loading...
Searching...
No Matches
JAHRS.sh
Go to the documentation of this file.
1#!/usr/bin/env zsh
2#
3#
4# \author mdejong
5#
6version=1.0
7script=${0##*/}
8
9if [ -z $JPP_DIR ]; then
10 echo "Variable JPP_DIR undefined."
11 exit
12fi
13
14source $JPP_DIR/setenv.sh $JPP_DIR
15
16set_variable: DEBUG COMPASS_DEBUG 2
17set_variable: WORKDIR COMPASS_WORKDIR ./
18
19if do_usage $*; then
20 usage "$script <detector identifier> (run[-run])+"\
21 "\nAuxiliary script to download AHRS data from database."
22fi
23
24if (( $# > 1 )); then
25 set_variable DETECTOR_ID $argv[1]
26 set_array RUNS $argv[2,-1]
27else
28 fatal "Wrong number of arguments."
29fi
30
31JCookie.sh
32
33let "NUMBER_OF_ERRORS = 0"
34
35expand_array RUNS
36
37BUFFER=(`JRuns -D $DETECTOR_ID -F RUN`)
38
39for RUN in ${RUNS:*BUFFER}; do
40
41 set_variable AHRS_FILE $WORKDIR/KM3NeT_${(l:8::0::0:)DETECTOR_ID}_${(l:8::0::0:)RUN}_ahrs.root
42
43 if [[ ! -f $AHRS_FILE ]]; then
44
45 echo -n "Writing $AHRS_FILE... "
46
47 JConvertDB \
48 -q "ahrs" \
49 -@ "detid = $DETECTOR_ID" \
50 -@ "minrun = $RUN" \
51 -@ "maxrun = $RUN" \
52 -o $AHRS_FILE \
53 -d $DEBUG --
54
55 if (( $? == 0 )); then
56 echo "OK"
57 else
58 echo "no data"
59 let "NUMBER_OF_ERRORS = $NUMBER_OF_ERRORS + 1"
60 fi
61 fi
62done
63
64if (( $NUMBER_OF_ERRORS != 0 )); then
65 error "Number of errors $NUMBER_OF_ERRORS"
66fi