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
73 "$script (input file)+ <QA/QC file>" \
74 "\nAuxiliary script to produce the following QA/QC data:\n" \
76 "\nSee also: $JPP_PAGES/ Search \"JRunQuality\""
80 fatal "Wrong number of arguments."
83set_array INPUT_FILES ${argv[1,-2]}
84set_variable QAQC_FILE ${argv[-1]:a}
86for (( i = 1; $i <= ${#INPUT_FILES}; i += 1 )); do
87 if [[ -f $INPUT_FILES[$i] ]]; then
88 INPUT_FILES[$i]=${INPUT_FILES[$i]:a}
92set_variable ACOUSTICS_DEBUG ${DEBUG}
93set_variable COMPASS_DEBUG ${DEBUG}
94set_variable DETECTOR detector.detx # detector used during data taking
99if [[ ! -s $QAQC_FILE ]]; then
100 flock -n $QAQC_FILE echo ${PARAMETERS//\.*/} > $QAQC_FILE
103if [[ ! -d $WORKDIR ]]; then
107for INPUT_FILE in ${INPUT_FILES[*]}; do
109 set_variable DIR `mktemp -d $WORKDIR/qaqc.XXXXXX`
114 debug "Processing $INPUT_FILE"
116 # Locally install input files.
118 cat>sound_velocity.txt<<EOF
119 1539.50 -17e-3 -2000.00
124 JPrintMeta -v |& awk '/version/ { print $2 }' | read GIT_VERSION
126 debug "GIT version $GIT_VERSION"
128 set_array DAQ_VERSION `JPrintMeta -f ${INPUT_FILE} -k GIT`
129 debug "DAQ version $DAQ_VERSION[*]"
131 echo ${(s/./)DAQ_VERSION[1]} | read DAQ_MAJOR DAQ_MINOR DAQ_PATCH
133 if [[ -z $DAQ_VERSION[1] ]]; then
134 JPrintMeta -f ${INPUT_FILE} -k SVN | read DAQ_VERSION
137 getUUID -f ${INPUT_FILE} -d 0 | read UUID
140 set_array DAQ_HEADER `JPrintDAQHeader -f ${INPUT_FILE} -d 0`
141 set_variable DETECTOR_ID ${DAQ_HEADER[1]}
142 set_variable RUN ${DAQ_HEADER[2]}
144 JDetectorDB -D ${DETECTOR_ID} -r ${RUN} -o ${DETECTOR} -WW -d ${DEBUG} # install detector file as-is for a.o. JTriggerReprocessor
147 if [[ "$DAQ_MAJOR" != [0-9][0-9]* ]] || (( $DAQ_MAJOR <= 12 )); then # Jpp-version dependence
150 -P "-1 -1 set UDP_COUNTER_DISABLE" \
151 -P "-1 -1 set UDP_TRAILER_DISABLE" \
156 JAHRSCalibration.sh ${DETECTOR_ID} # install AHRS calibration file
159 set_array LIVETIME_S `getLivetime -f ${INPUT_FILE} -d 0`
160 set_array UTC_S `getUTC -f ${INPUT_FILE} -d 0`
164 for KEY in ${TRIGGER_PARAMETERS[*]}; do
166 VALUE=$(JPrintTriggerParameters -f ${INPUT_FILE} -k $KEY -d 0)
168 TRIGGER_VALUES+=(${VALUE:-0})
173 for KEY in ${DAQ_PARAMETERS[*]}; do
175 VALUE=$(JPrintTree -f ${INPUT_FILE} -@ "type = $KEY" -k number_of_entries)
177 DAQ_VALUES+=(${VALUE:-0})
180 {{ JTriggerMonitor -f ${INPUT_FILE} -d ${DEBUG} -Q 3 3>&1 1>&4 } | read -A TRIGGER_MONITOR } 4>&1
183 set_variable OUTPUT_FILE KM3NeT_${(l:8::0::0:)DETECTOR_ID}_${(l:8::0::0:)RUN}_reprocessor.root
185 JTriggerReprocessor \
194 JPrintTree -f ${OUTPUT_FILE} -@ "type = JDAQEvent" -k number_of_entries | read TRIGGER_REPROCESSOR
201 -Q 3 3>&1 1>&4 } | read -A TURBOT } 4>&1
204 set_variable OUTPUT_FILE KM3NeT_${(l:8::0::0:)DETECTOR_ID}_${(l:8::0::0:)RUN}_reprocessor2.root
206 JTriggerReprocessor \
220 -Q 3 3>&1 1>&4 } | read -A COELACANTH } 4>&1
223 {{ JSummaryMonitor -f ${INPUT_FILE} -t 50000 -d ${DEBUG} -Q 3 3>&1 1>&4 } | read -A SUMMARY_MONITOR } 4>&1
226 JAcousticsTriggerProcessor.sh ${DETECTOR} ${RUN}
228 if (( $? == 0 )); then
230 set_variable OUTPUT_FILE KM3NeT_${(l:8::0::0:)DETECTOR_ID}_${(l:8::0::0:)RUN}_event.root
232 NUMBER_OF_ACOUSTICS_EVENTS=(`JPrintTree -f ${OUTPUT_FILE} -@ "type = JACOUSTICS::JEvent" -k number_of_entries`)
234 NUMBER_OF_ACOUSTICS_EVENTS=(0)
237 JAHRS.sh ${DETECTOR_ID} ${RUN}
239 if (( $? == 0 )); then
241 set_variable OUTPUT_FILE KM3NeT_${(l:8::0::0:)DETECTOR_ID}_${(l:8::0::0:)RUN}_ahrs.root
246 -c ahrs_calibration.txt \
249 -Q 3 3>&1 1>&4 } | read -A AHRS_MONITOR } 4>&1
254 set_variable OUTPUT_FILE KM3NeT_${(l:8::0::0:)DETECTOR_ID}_${(l:8::0::0:)RUN}_trigger.root
260 -@ "trigger3DMuon.enabled = 1" \
261 -@ "trigger3DMuon.numberOfHits = 3" \
262 -@ "trigger3DMuon.numberOfModules = 3" \
263 -@ "trigger3DMuon.gridAngle_deg = 10" \
264 -@ "trigger3DMuon.TMaxExtra_ns = 500.0e3" \
265 -@ "TMaxEvent_ns = 500.0e3" \
266 -@ "TMaxLocal_ns = 20.0" \
267 -@ "L2.numberOfHits = 4" \
268 -@ "L2.TMaxLocal_ns = 20.0" \
269 -@ "L2.ctMin = 0.0" \
279 -Q 3 3>&1 1>&4 } | read -A SQUID } 4>&1
286 -Q 3 3>&1 1>&4 } | read -A MERMAID } 4>&1
292 -Q 3 3>&1 1>&4 } | read -A HV_CHECK } 4>&1
293 if (( $? != 0 )); then
300 print -u 9 -f " %12s" ${GIT_VERSION}; \
301 print -u 9 -f " %12s" ${DAQ_VERSION[1]:-\?}; \
302 print -u 9 -f " %1d" ${#DAQ_VERSION}; \
303 print -u 9 -f " %s" ${UUID:-\?}; \
304 print -u 9 -f " %8d" ${DAQ_HEADER[1,2]}; \
305 print -u 9 -f " %9.1f" ${LIVETIME_S[1]}; \
306 print -u 9 -f " %12.1f" ${UTC_S[1,2]}; \
307 print -u 9 -f " %4d" ${TRIGGER_VALUES[*]}; \
308 print -u 9 -f " %8d" ${DAQ_VALUES[*]}; \
309 print -u 9 -f " %8d" ${TRIGGER_REPROCESSOR:-0}; \
310 print -u 9 -f " %8d" ${TRIGGER_MONITOR[*]}; \
311 print -u 9 -f " %4d" ${TURBOT[1,2]}; \
312 print -u 9 -f " %7.5f" ${SUMMARY_MONITOR[1,4]}; \
313 print -u 9 -f " %8.1f" ${SUMMARY_MONITOR[5]}; \
314 print -u 9 -f " %7.0f" ${SUMMARY_MONITOR[6,7]}; \
315 print -u 9 -f " %8d" ${SUMMARY_MONITOR[8]}; \
316 print -u 9 -f " %8d" ${SUMMARY_MONITOR[9]}; \
317 print -u 9 -f " %4d" ${NUMBER_OF_ACOUSTICS_EVENTS[1]}; \
318 print -u 9 -f " %5d" ${AHRS_MONITOR[1]}; \
319 print -u 9 -f " %8.3f" ${AHRS_MONITOR[2]}; \
320 print -u 9 -f " %4d" ${SQUID[1,2]}; \
321 print -u 9 -f " %8d" ${MERMAID[1]}; \
322 print -u 9 -f " %8d" ${HV_CHECK[1]}; \
323 print -u 9 -f " %8d" ${COELACANTH[1]}; \
324 print -u 9 -f "\n"; ) 9>>$QAQC_FILE