7doxygen=JDATABASE::JRunQuality
9if [ -z $JPP_DIR ]; then
10 echo "Variable JPP_DIR undefined."
14source $JPP_DIR/setenv.sh $JPP_DIR >& /dev/null
16# Auxiliary script to produce QA/QC data.
18# The output data are uploaded to the database with a tool that is part of the km3pipe package.
19# The locally produced data as well as the uploaded data can be viewed with applications/scripts JDataMonitor[.sh] and JDataQuality[.sh].
21# Note that if the list of values is extended, the include file JRunQuality.hh should accordingly be updated.
24set_variable: DEBUG QAQC_DEBUG 0
25set_variable: VERSION QAQC_VERSION D_1.0.0
26set_variable: WORKDIR QAQC_WORKDIR ${TMPDIR:-/tmp}/.$$
30 trigger3DShower.enabled
31 triggerMXShower.enabled
38TRIGGERS=(`JPrintTriggerBits`)
56 GIT JPP nb_of_meta UUID
57 detector run livetime_s UTCMin_s UTCMax_s
58 ${TRIGGER_PARAMETERS[*]}
62 in_sync out_sync DAQ WR HRV FIFO
63 PMTs MEAN_Rate_Hz RMS_Rate_Hz
64 hrv_fifo_failures duplic_timeslices
72 "$script (input file)+ <QA/QC file>" \
73 "\nAuxiliary script to produce the following QA/QC data:\n" \
75 "\nSee also: $JPP_PAGES/ Search \"JRunQuality\""
79 fatal "Wrong number of arguments."
82set_array INPUT_FILES ${argv[1,-2]}
83set_variable QAQC_FILE ${argv[-1]:a}
85for (( i = 1; $i <= ${#INPUT_FILES}; i += 1 )); do
86 if [[ -f $INPUT_FILES[$i] ]]; then
87 INPUT_FILES[$i]=${INPUT_FILES[$i]:a}
94set_variable ACOUSTICS_DEBUG ${DEBUG}
95set_variable COMPASS_DEBUG ${DEBUG}
96set_variable DETECTOR detector.detx # detector used during data taking
101# Locally install input files.
103if [[ ! -f sound_velocity.txt ]]; then
104 cat>sound_velocity.txt<<EOF
1051539.50 -17e-3 -2000.00
109if [[ ! -s $QAQC_FILE ]]; then
110 flock -n $QAQC_FILE echo ${PARAMETERS//\.*/} > $QAQC_FILE
113for INPUT_FILE in ${INPUT_FILES[*]}; do
115 debug "Processing $INPUT_FILE"
119 JPrintMeta -v |& awk '/version/ { print $2 }' | read GIT_VERSION
121 debug "GIT version $GIT_VERSION"
123 set_array DAQ_VERSION `JPrintMeta -f ${INPUT_FILE} -k GIT`
124 debug "DAQ version $DAQ_VERSION[*]"
126 echo ${(s/./)DAQ_VERSION[1]} | read DAQ_MAJOR DAQ_MINOR DAQ_PATCH
128 if [[ -z $DAQ_VERSION[1] ]]; then
129 JPrintMeta -f ${INPUT_FILE} -k SVN | read DAQ_VERSION
132 getUUID -f ${INPUT_FILE} -d 0 | read UUID
135 set_array DAQ_HEADER `JPrintDAQHeader -f ${INPUT_FILE} -d 0`
136 set_variable DETECTOR_ID ${DAQ_HEADER[1]}
137 set_variable RUN ${DAQ_HEADER[2]}
139 JDetectorDB -D ${DETECTOR_ID} -r ${RUN} -o ${DETECTOR} -WW -d ${DEBUG} # install detector file as-is for a.o. JTriggerReprocessor
142 if [[ "$DAQ_MAJOR" != [0-9][0-9]* ]] || (( $DAQ_MAJOR <= 12 )); then # Jpp-version dependence
145 -P "-1 -1 set UDP_COUNTER_DISABLE" \
146 -P "-1 -1 set UDP_TRAILER_DISABLE" \
151 JAHRSCalibration.sh ${DETECTOR_ID} # install AHRS calibration file
154 set_array LIVETIME_S `getLivetime -f ${INPUT_FILE} -d 0`
155 set_array UTC_S `getUTC -f ${INPUT_FILE} -d 0`
159 for KEY in ${TRIGGER_PARAMETERS[*]}; do
161 VALUE=$(JPrintTriggerParameters -f ${INPUT_FILE} -k $KEY -d 0)
163 TRIGGER_VALUES+=(${VALUE:-0})
168 for KEY in ${DAQ_PARAMETERS[*]}; do
170 VALUE=$(JPrintTree -f ${INPUT_FILE} -@ "type = $KEY" -k number_of_entries)
172 DAQ_VALUES+=(${VALUE:-0})
175 {{ JTriggerMonitor -f ${INPUT_FILE} -d ${DEBUG} -Q 3 3>&1 1>&4 } | read -A TRIGGER_MONITOR } 4>&1
178 set_variable OUTPUT_FILE KM3NeT_${(l:8::0::0:)DETECTOR_ID}_${(l:8::0::0:)RUN}_reprocessor.root
180 JTriggerReprocessor \
189 JPrintTree -f ${OUTPUT_FILE} -@ "type = JDAQEvent" -k number_of_entries | read TRIGGER_REPROCESSOR
196 -Q 3 3>&1 1>&4 } | read -A TURBOT } 4>&1
199 {{ JSummaryMonitor -f ${INPUT_FILE} -t 50000 -d ${DEBUG} -Q 3 3>&1 1>&4 } | read -A SUMMARY_MONITOR } 4>&1
202 JAcousticsTriggerProcessor.sh ${DETECTOR} ${RUN}
204 if (( $? == 0 )); then
206 set_variable OUTPUT_FILE KM3NeT_${(l:8::0::0:)DETECTOR_ID}_${(l:8::0::0:)RUN}_event.root
208 NUMBER_OF_ACOUSTICS_EVENTS=(`JPrintTree -f ${OUTPUT_FILE} -@ "type = JACOUSTICS::JEvent" -k number_of_entries`)
210 NUMBER_OF_ACOUSTICS_EVENTS=(0)
213 JAHRS.sh ${DETECTOR_ID} ${RUN}
215 if (( $? == 0 )); then
217 set_variable OUTPUT_FILE KM3NeT_${(l:8::0::0:)DETECTOR_ID}_${(l:8::0::0:)RUN}_ahrs.root
222 -c ahrs_calibration.txt \
225 -Q 3 3>&1 1>&4 } | read -A AHRS_MONITOR } 4>&1
230 set_variable OUTPUT_FILE KM3NeT_${(l:8::0::0:)DETECTOR_ID}_${(l:8::0::0:)RUN}_trigger.root
236 -@ "trigger3DMuon.enabled = 1" \
237 -@ "trigger3DMuon.numberOfHits = 3" \
238 -@ "trigger3DMuon.numberOfModules = 3" \
239 -@ "trigger3DMuon.gridAngle_deg = 10" \
240 -@ "trigger3DMuon.TMaxExtra_ns = 500.0e3" \
241 -@ "TMaxEvent_ns = 500.0e3" \
242 -@ "TMaxLocal_ns = 20.0" \
243 -@ "L2.numberOfHits = 4" \
244 -@ "L2.TMaxLocal_ns = 20.0" \
245 -@ "L2.ctMin = 0.0" \
255 -Q 3 3>&1 1>&4 } | read -A SQUID } 4>&1
262 -Q 3 3>&1 1>&4 } | read -A MERMAID } 4>&1
268 -Q 3 3>&1 1>&4 } | read -A HV_CHECK } 4>&1
269 if (( $? != 0 )); then
276 print -u 9 -f " %12s" ${GIT_VERSION}; \
277 print -u 9 -f " %12s" ${DAQ_VERSION[1]:-\?}; \
278 print -u 9 -f " %1d" ${#DAQ_VERSION}; \
279 print -u 9 -f " %s" ${UUID:-\?}; \
280 print -u 9 -f " %8d" ${DAQ_HEADER[1,2]}; \
281 print -u 9 -f " %9.1f" ${LIVETIME_S[1]}; \
282 print -u 9 -f " %12.1f" ${UTC_S[1,2]}; \
283 print -u 9 -f " %4d" ${TRIGGER_VALUES[*]}; \
284 print -u 9 -f " %8d" ${DAQ_VALUES[*]}; \
285 print -u 9 -f " %8d" ${TRIGGER_REPROCESSOR:-0}; \
286 print -u 9 -f " %8d" ${TRIGGER_MONITOR[*]}; \
287 print -u 9 -f " %4d" ${TURBOT[1,2]}; \
288 print -u 9 -f " %7.5f" ${SUMMARY_MONITOR[1,4]}; \
289 print -u 9 -f " %8.1f" ${SUMMARY_MONITOR[5]}; \
290 print -u 9 -f " %7.0f" ${SUMMARY_MONITOR[6,7]}; \
291 print -u 9 -f " %8d" ${SUMMARY_MONITOR[8]}; \
292 print -u 9 -f " %8d" ${SUMMARY_MONITOR[9]}; \
293 print -u 9 -f " %4d" ${NUMBER_OF_ACOUSTICS_EVENTS[1]}; \
294 print -u 9 -f " %5d" ${AHRS_MONITOR[1]}; \
295 print -u 9 -f " %8.3f" ${AHRS_MONITOR[2]}; \
296 print -u 9 -f " %4d" ${SQUID[1,2]}; \
297 print -u 9 -f " %8d" ${MERMAID[1]}; \
298 print -u 9 -f " %8d" ${HV_CHECK[1]}; \
299 print -u 9 -f "\n"; ) 9>>$QAQC_FILE