Jpp 19.3.0-rc.1
the software that should make you happy
Loading...
Searching...
No Matches
JDynamics.sh
Go to the documentation of this file.
1#!/usr/bin/env zsh
2script=${0##*/}
3
4if [ -z $JPP_DIR ]; then
5 echo "Variable JPP_DIR undefined."
6 exit
7fi
8
9source $JPP_DIR/setenv.sh $JPP_DIR >& /dev/null
10
11set_variable: DEBUG DYNAMICS_DEBUG 2
12set_variable: WORKDIR DYNAMICS_WORKDIR ./
13set_variable: PERIOD DYNAMICS_PERIOD 100 # range of runs per output file
14set_variable: MARGIN DYNAMICS_MARGIN 5 # overlap of runs at edges between output files
15set_variable RANGE 1-99999999
16
17if do_usage $*; then
18 usage "$script <archive> <detector identifier|detector file> <version> [run-run]"\
19 "\nAuxiliary script to process dynamical positions and orientations data."\
20 "\nThe static and dynamic data are stored in the archive with the given version."
21fi
22
23case $# in
24 4) set_variable RANGE $argv[4];&
25 3) set_variable VERSION $argv[3];
26 set_variable DETECTOR $argv[2];
27 set_variable ARCHIVE $argv[1];;
28 *) fatal "Wrong number of arguments."
29esac
30
31JCookie.sh
32
33CHECK_EXIT_CODE
34
35if [[ -f $DETECTOR ]]; then
36 eval `JPrintDetector -a $DETECTOR -O IDENTIFIER`
37else
38 set_variable DETECTOR_ID `getDetector -D $DETECTOR -O int`
39 set_variable DETECTOR detector.datx
40fi
41
42if [[ ! -f $DETECTOR ]]; then
43 fatal "Missing file $DETECTOR"\
44 "\nYou may want to execute archive-get-calibration.sh beforehand."
45fi
46
47JAcoustics.sh $DETECTOR_ID
48
49CHECK_EXIT_CODE
50
51archive-put-calibration.sh $ARCHIVE $VERSION ./
52
53CHECK_EXIT_CODE
54
55RUNS=(`JRuns -D $DETECTOR_ID -F RUN -@ "RUN >= ${RANGE%%-*}" -@ "RUN <= ${RANGE##*-}" | sort -g`)
56
57for (( L = 1; $L <= ${#RUNS}; L += $PERIOD )); do
58
59 let "R = $L + $PERIOD - 1"
60
61 if (( $R > ${#RUNS} )); then
62 let "R = ${#RUNS}"
63 fi
64
65 let "LS = $L - $MARGIN"
66 let "RS = $R + $MARGIN"
67
68 if (( $LS < 1 )); then
69 let "LS = 1"
70 fi
71 if (( $RS > ${#RUNS} )); then
72 let "RS = ${#RUNS}"
73 fi
74
75 echo "\n\nProcessing runs $RUNS[$L]-$RUNS[$R]\n"
76
77
78 set_variable TYPE positions
79 set_variable OUTPUT_FILE katoomba_${(l:8::0::0:)DETECTOR_ID}_${(l:8::0::0:)RUNS[$L]}.root
80
81 INPUT_FILES=()
82
83 for (( i = $LS; $i <= $RS; i += 1 )); do
84
85 set_variable INPUT_FILE KM3NeT_${(l:8::0::0:)DETECTOR_ID}_${(l:8::0::0:)RUNS[$i]}_event.root
86
87 if [[ ! -f $INPUT_FILE ]]; then
88 JAcousticsEventBuilder.sh $DETECTOR $RUNS[$i]
89 fi
90
91 if [[ -f $INPUT_FILE ]]; then
92 INPUT_FILES+=($INPUT_FILE)
93 fi
94 done
95
96 if [[ ! -f $OUTPUT_FILE ]]; then
97
98 if (( ${#INPUT_FILES} != 0 )); then
99
100 set_variable ACOUSTICS_STRIP
101
102 JKatoomba.sh $DETECTOR $INPUT_FILES[*] $OUTPUT_FILE
103
104 putFile.sh $OUTPUT_FILE $ARCHIVE $DETECTOR_ID $RUNS[$L] $RUNS[$R] $TYPE $VERSION
105
106 else
107 error "No input files for $OUTPUT_FILE"
108 fi
109 fi
110
111
112 set_variable TYPE orientations
113 set_variable OUTPUT_FILE ballarat_${(l:8::0::0:)DETECTOR_ID}_${(l:8::0::0:)RUNS[$L]}.root
114
115 if [[ ! -f $OUTPUT_FILE ]]; then
116
117 JBallarat.sh $DETECTOR $RUNS[$LS,$RS] $OUTPUT_FILE
118
119 putFile.sh $OUTPUT_FILE $ARCHIVE $DETECTOR_ID $RUNS[$L] $RUNS[$R] $TYPE $VERSION
120 fi
121done
122