Jpp  19.1.0
the software that should make you happy
software/JAcoustics/JToA.sh
Go to the documentation of this file.
1 #!/bin/zsh
2 script=${0##*/}
3 
4 if [ -z $JPP_DIR ]; then
5  echo "Variable JPP_DIR undefined."
6  exit
7 fi
8 
9 source $JPP_DIR/setenv.sh $JPP_DIR >& /dev/null
10 
11 set_variable: DEBUG ACOUSTICS_DEBUG 2
12 set_variable: WORKDIR ACOUSTICS_WORKDIR ./
13 set_variable: QUALITY_FACTOR ACOUSTICS_QUALITYFACTOR 2.0e3
14 
15 if do_usage $*; then
16  usage "$script <detector identifier> (run[-run])+"\
17  "\nAuxiliary script to download acoustic data from database."
18 fi
19 
20 if (( $# > 1 )); then
21  set_variable DETID $argv[1]
22  set_array RUNS $argv[2,-1]
23 else
24  fatal "Wrong number of arguments."
25 fi
26 
27 JCookie.sh
28 
29 
30 let "NUMBER_OF_ERRORS = 0"
31 
32 expand_array RUNS
33 
34 set_variable DETECTOR_ID `getDetector -D $DETID -O int`
35 
36 BUFFER=(`JRuns -D $DETECTOR_ID -F RUN`)
37 
38 for RUN in ${RUNS:*BUFFER}; do
39 
40  set_variable OUTPUT_FILE $WORKDIR/KM3NeT_${(l:8::0::0:)DETECTOR_ID}_${(l:8::0::0:)RUN}_toa.root
41 
42  if [[ ! -f $OUTPUT_FILE ]]; then
43 
44  JToA \
45  -@ "detid = `getDetector -D $DETID -O string`" \
46  -@ "minrun = $RUN" \
47  -@ "maxrun = $RUN" \
48  -@ "QUALITYFACTOR >= $QUALITY_FACTOR" \
49  -o $OUTPUT_FILE \
50  -d $DEBUG --!
51 
52  if (( $? != 0 )); then
53  let "NUMBER_OF_ERRORS = $NUMBER_OF_ERRORS + 1"
54  fi
55  fi
56 done
57 
58 if (( $NUMBER_OF_ERRORS != 0 )); then
59  error "Number of errors $NUMBER_OF_ERRORS"
60 fi