Jpp master_rocky-44-g75b7c4f75
the software that should make you happy
Loading...
Searching...
No Matches
examples/JDB/JAHRSMonitor.sh
Go to the documentation of this file.
1#!/bin/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 2
17set_variable WORKDIR `pwd`
18set_variable DIR $JPP_DIR/examples/JDB/
19set_variable: FORMAT GRAPHICS_FORMAT gif
20set_variable+ BATCH GRAPHICS_BATCH -B
21
22if do_usage $*; then
23 usage "$script <detector file> <run>"
24fi
25
26if (( $# != 2 )); then
27 fatal "Wrong number of parameters."
28fi
29
30set_variable DETECTOR $argv[1]
31set_variable RUN $argv[2]
32
33eval `JPrintDetector -a $DETECTOR -O IDENTIFIER`
34eval `JPrintDetector -a $DETECTOR -O SUMMARY`
35
36set_variable AHRS_CALIBRATION_FILE $WORKDIR/ahrs_calibration.txt
37set_variable INPUT_FILE $WORKDIR/KM3NeT_${(l:8::0::0:)DETECTOR_ID}_${(l:8::0::0:)RUN}_ahrs.root
38
39if [[ ! -f $INPUT_FILE ]]; then
40
41 echo -n "Writing $INPUT_FILE... "
42
43 JConvertDB \
44 -q "ahrs" \
45 -@ "detid = $DETECTOR_ID" \
46 -@ "minrun = $RUN" \
47 -@ "maxrun = $RUN" \
48 -o $INPUT_FILE \
49 -d $DEBUG --
50
51 echo "OK"
52fi
53
54if [[ ! -f $AHRS_CALIBRATION_FILE ]]; then
55
56 JAHRSCalibration \
57 -D $DETECTOR_ID \
58 -o $AHRS_CALIBRATION_FILE \
59 -d $DEBUG
60fi
61
62$DIR/JAHRSMonitor \
63 -f $INPUT_FILE \
64 -o $WORKDIR/ahrs_old.root
65
66$DIR/JAHRSMonitor \
67 -f $INPUT_FILE \
68 -A $AHRS_CALIBRATION_FILE \
69 -o $WORKDIR/ahrs_new.root
70
71kill_child_processes_at_exit
72
73attach getModule -a $DETECTOR
74
75typeset -Z 4 STRING
76typeset -Z 2 FLOOR
77
78typeset -A X_LABEL
79
80X_LABEL[A]="A"
81X_LABEL[B]="H"
82
83for key value in "${(@kv)X_LABEL}"; do
84
85 for STRING in $STRINGS[*]; do
86
87 echo -n "Creating $key graphics for string $STRING.."
88
89 set_variable FIRST_FLOOR 1
90
91 for (( FLOOR = $FIRST_FLOOR; $FLOOR <= $LAST_FLOOR; FLOOR += 1 )); do
92
93 sput $STRING $FLOOR
94 sget MODULE
95
96 JPlot1D \
97 -f "$WORKDIR/ahrs_old.root:${MODULE}.${key}" \
98 -f "$WORKDIR/ahrs_new.root:${MODULE}.${key}" \
99 -> "${value}" \
100 -\^ "number of events [a.u.]" \
101 -s 110110 \
102 -T "(${STRING},${FLOOR})" \
103 -o ${TMPDIR:-/tmp}/${key}_${STRING}_${FLOOR}.$FORMAT $BATCH
104 done
105
106 montage \
107 -tile 6x3 \
108 -geometry +0+0 \
109 ${TMPDIR:-/tmp}/${key}_${STRING}_*.$FORMAT \
110 $WORKDIR/${key}_${STRING}.$FORMAT >& /dev/null
111
112 echo " -> $WORKDIR/${key}_${STRING}.$FORMAT"
113
114 done
115done
116
117detach