Jpp 19.3.0-rc.2
the software that should make you happy
Loading...
Searching...
No Matches
JOperationsRunMonitor.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 QAQC_DEBUG 2
12set_variable: WORKDIR QAQC_WORKDIR `pwd`
13set_variable: FORMAT GRAPHICS_FORMAT pdf
14set_variable: BATCH GRAPHICS_BATCH -B
15
16if do_usage $*; then
17 usage "$script <qaqc file> <detector identifier> <first run> <last run> [working directory]"
18fi
19
20case $# in
21 5) set_variable WORKDIR $5;&
22 4) set_variable QUALITY_TXT $1;
23 set_variable DETECTOR $2;
24 set_array RUNS $3 $4;;
25 *) fatal "Wrong number of arguments."
26esac
27
28set_variable FILEPREFIX KM3NeT_${(l:8::0::0:)DETECTOR}_${(l:8::0::0:)RUNS[1]}-${(l:8::0::0:)RUNS[2]}
29set_variable QUALITY_ROOT ${QUALITY_TXT/.txt/.root}
30
31echo "Output will appear in directory ${WORKDIR}."
32
33mkdir -p $WORKDIR
34
35# Check the quality of the runs
36JDataQuality \
37 -f $QUALITY_TXT \
38 -Q "livetime_s; 1200 60000" \
39 -Q "(UTCMax_s - UTCMin_s) - livetime_s; -100 +100" \
40 -Q "JDAQEvent / livetime_s; 0.05 50.0" \
41 -Q "HRV; 0.00 0.2" \
42 -Q "DAQ; 0.95 1.05" \
43 -Q "WR; 0.95 1.05" \
44 -Q "FIFO; 0.00 0.01" \
45 -Q "MEAN_Rate_Hz; 4500 15000" \
46 -Q "RMS_Rate_Hz; 200 5000" \
47 -V "(JDAQEvent - JTriggerReprocessor) * 1.0 / (JDAQEvent + 1.0e-10); -5.0e-3 +5.0e-3" \
48 -V "out_sync; 0 0" \
49 -o $QUALITY_ROOT \
50 -d $DEBUG --!
51
52# Create the plots
53JPlot1D \
54 -f ${QUALITY_ROOT}:h0 \
55 -> "quality" \
56 -\^ "number of runs" \
57 -T "" \
58 -o $WORKDIR/${FILEPREFIX}_quality.${FORMAT} $BATCH
59
60JPlot1D \
61 -f ${QUALITY_ROOT}:h1 \
62 -> "selection" \
63 -\^ "number of runs" \
64 -T "" \
65 -o $WORKDIR/${FILEPREFIX}_selection.${FORMAT} $BATCH
66
67JPlot1D \
68 -w 1200x600 \
69 -f ${QUALITY_ROOT}:\^livetime_s \
70 -> "run number" \
71 -O P \
72 -T "?" \
73 -o $WORKDIR/${FILEPREFIX}_livetime.${FORMAT} $BATCH
74
75JPlot1D \
76 -w 1200x600 \
77 -f ${QUALITY_ROOT}:UTC \
78 -> "run number" \
79 -O P \
80 -T "?" \
81 -o $WORKDIR/${FILEPREFIX}_UTC-livetime.${FORMAT} $BATCH
82
83JPlot1D \
84 -w 1200x600 \
85 -f ${QUALITY_ROOT}:JDAQEvent \
86 -> "run number" \
87 -O P \
88 -T "?" \
89 -o $WORKDIR/${FILEPREFIX}_event-rate.${FORMAT} $BATCH
90
91JPlot1D \
92 -w 1200x600 \
93 -f ${QUALITY_ROOT}:HRV \
94 -> "run number" \
95 -O P \
96 -T "?" \
97 -o $WORKDIR/${FILEPREFIX}_HRV.${FORMAT} $BATCH
98
99JPlot1D \
100 -w 1200x600 \
101 -f ${QUALITY_ROOT}:DAQ$ \
102 -> "run number" \
103 -O P \
104 -T "?" \
105 -o $WORKDIR/${FILEPREFIX}_DAQ.${FORMAT} $BATCH
106
107JPlot1D \
108 -w 1200x600 \
109 -f ${QUALITY_ROOT}:WR \
110 -> "run number" \
111 -O P \
112 -T "?" \
113 -o $WORKDIR/${FILEPREFIX}_WR.${FORMAT} $BATCH
114
115JPlot1D \
116 -w 1200x600 \
117 -f ${QUALITY_ROOT}:FIFO \
118 -> "run number" \
119 -O P \
120 -T "?" \
121 -o $WORKDIR/${FILEPREFIX}_FIFO.${FORMAT} $BATCH
122
123JPlot1D \
124 -w 1200x600 \
125 -f ${QUALITY_ROOT}:MEAN_Rate_Hz \
126 -> "run number" \
127 -O P \
128 -T "?" \
129 -o $WORKDIR/${FILEPREFIX}_PMT-rate-mean.${FORMAT} $BATCH
130
131JPlot1D \
132 -w 1200x600 \
133 -f ${QUALITY_ROOT}:RMS_Rate_Hz \
134 -> "run number" \
135 -O P \
136 -T "?" \
137 -o $WORKDIR/${FILEPREFIX}_PMT-rate-rms.${FORMAT} $BATCH
138
139JPlot1D \
140 -w 1200x600 \
141 -f ${QUALITY_ROOT}:\^out_sync\$ \
142 -y "-1 10" \
143 -> "run number" \
144 -O P \
145 -T "?" \
146 -o $WORKDIR/${FILEPREFIX}_out_sync.${FORMAT} $BATCH
147
148JPlot1D \
149 -w 1200x600 \
150 -f ${QUALITY_ROOT}:VETO \
151 -y "0 1.1" \
152 -> "run number" \
153 -O P \
154 -L BL \
155 -T "veto" \
156 -o $WORKDIR/${FILEPREFIX}_veto.${FORMAT} $BATCH
157
158# Check whether ghostscript is installed, and if, combine all plots
159if (( $+commands[gs] )); then
160 convert ${FILEPREFIX}_*.${FORMAT} ${FILEPREFIX}_QAQC.${FORMAT}
161 gs -dNOPAUSE -SDEVICE=pdfwrite -sOUTPUTFILE=${FILEPREFIX}_QAQC.pdf -dBATCH ${FILEPREFIX}_*.${FORMAT}
162 /bin/ls ${FILEPREFIX}_*.${FORMAT} | grep -v ${FILEPREFIX}_QAQC.${FORMAT} | xargs -0 -d '\n' rm
163fi