Jpp  master_rocky-40-g5f0272dcd
the software that should make you happy
examples/JDB/JCompass.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 DATABASE_DEBUG 2
12 set_variable: WORKDIR DATABASE_WORKDIR ./
13 set_variable DIR $JPP_DIR/examples/JDB/
14 set_variable TMAX_S 600.0
15 set_variable YMIN 0.00
16 set_variable YMAX 0.01
17 set_variable FLOOR_RANGE 1 1
18 set_variable: FORMAT GRAPHICS_FORMAT gif
19 set_variable+ BATCH GRAPHICS_BATCH -B
20 
21 if do_usage $*; then
22  usage "$script <detector file> (run[-run])+"
23 fi
24 
25 if (( $# > 1 )); then
26  set_variable DETECTOR $argv[1]
27  set_array RUNS $argv[2,-1]
28 else
29  fatal "Wrong number of arguments."
30 fi
31 
32 JCookie.sh
33 
34 eval `JPrintDetector -a $DETECTOR -O IDENTIFIER`
35 
36 typeset -a INPUT_FILES
37 
38 expand_array RUNS
39 
40 for RUN in $RUNS[*]; do
41 
42  set_variable OUTPUT_FILE $WORKDIR/KM3NeT_${(l:8::0::0:)DETECTOR_ID}_${(l:8::0::0:)RUN}_ahrs.root
43 
44  INPUT_FILES+=($OUTPUT_FILE)
45 
46  if [[ ! -f $OUTPUT_FILE ]]; then
47 
48  JConvertDB \
49  -q ahrs \
50  -@ "detid = `getDetector -D $DETECTOR_ID`" \
51  -@ "minrun = $RUN" \
52  -@ "maxrun = $RUN" \
53  -o $OUTPUT_FILE \
54  -d $DEBUG --!
55  fi
56 done
57 
58 if [[ ! -f ahrs_cal_${DETECTOR_ID}.txt ]]; then
59  JAHRSCalibration -D $DETECTOR_ID -o ahrs_cal_${DETECTOR_ID}.txt --!
60 fi
61 
62 $DIR/JCompass \
63  -f "$INPUT_FILES[*]" \
64  -a $DETECTOR \
65  -o $WORKDIR/ahrs.root \
66  -T $TMAX_S \
67  -c ahrs_cal_${DETECTOR_ID}.txt \
68  -R "$FLOOR_RANGE" \
69  -d $DEBUG --!
70 
71 JPlot1D \
72  -w 1200x600 \
73  -f $WORKDIR/ahrs.root:G\.\*\\\.orientation \
74  -\^ "orientation [rad]" \
75  -y "-3.20 +3.20" \
76  -N "X 505" \
77  -t "$TIMESTAMP" \
78  -L BR \
79  -T "" \
80  -o $WORKDIR/orientation.$FORMAT $BATCH
81 
82 JPlot1D \
83  -w 1200x600 \
84  -f $WORKDIR/ahrs.root:G\.\*amplitude \
85  -\^ "amplitude [rad]" \
86  -N "X 505" \
87  -t "$TIMESTAMP" \
88  -L TR \
89  -T "" \
90  -o $WORKDIR/amplitude.$FORMAT $BATCH
91 
92 JPlot1D \
93  -w 1200x600 \
94  -f $WORKDIR/ahrs.root:G\.\*offset \
95  -\^ "offset [rad]" \
96  -N "X 505" \
97  -t "$TIMESTAMP" \
98  -L TR \
99  -T "" \
100  -o $WORKDIR/offset.$FORMAT $BATCH
101 
102 JPlot1D \
103  -w 1200x600 \
104  -f $WORKDIR/ahrs.root:G\.\*xorientation \
105  -\^ "xorientation [rad]" \
106  -N "X 505" \
107  -t "$TIMESTAMP" \
108  -L TR \
109  -T "" \
110  -o $WORKDIR/xorientation.$FORMAT $BATCH