Jpp test-rotations-old
the software that should make you happy
Loading...
Searching...
No Matches
examples/JDataQuality/qaqc.sh
Go to the documentation of this file.
1#!/usr/bin/env zsh
2#
3# \author mdejong
4#
5version=1.0
6script=${0##*/}
7
8if [ -z $JPP_DIR ]; then
9 echo "Variable JPP_DIR undefined."
10 exit
11fi
12
13source $JPP_DIR/setenv.sh $JPP_DIR >& /dev/null
14
15set_variable: DEBUG QAQC_DEBUG 0
16set_variable: WORKDIR QAQC_WORKDIR ${TMPDIR:-/tmp}/.$$
17
18typeset -a PARAMETERS
19
20PARAMETERS=(
21 detector run
22 in-usync out-usync
23 event_duration)
24
25
26if do_usage $*; then
27 usage \
28 "$script (input file)+ <QA/QC file>" \
29 "\nAuxiliary script to produce the following QA/QC data:" \
30 "\n$PARAMETERS[*]"
31fi
32
33if (( $# < 2 )); then
34 fatal "Wrong number of arguments."
35fi
36
37set_array INPUT_FILES $argv[1,-2]
38set_variable QAQC_FILE $argv[-1]
39
40
41mkdir -p $WORKDIR
42
43set_variable DETECTOR ${WORKDIR}/detector.detx
44
45JCookie.sh
46CHECK_EXIT_CODE
47
48if [[ ! -s $QAQC_FILE ]]; then
49 echo $PARAMETERS[*] > $QAQC_FILE
50fi
51
52for INPUT_FILE in ${INPUT_FILES[*]}; do
53
54 # determine values
55
56 JPrintDAQHeader -f ${INPUT_FILE} -d 0 | read -A DAQ_HEADER
57
58 if (( $? != 0 )); then
59 continue
60 fi
61
62 set_variable DETECTOR_ID ${DAQ_HEADER[1]}
63 set_variable RUN ${DAQ_HEADER[2]}
64
65 JDetectorDB -D ${DETECTOR_ID} -r ${RUN} -o ${DETECTOR} # install detector file as-is for JTriggerReprocessor
66 CHECK_EXIT_CODE
67
68 set_variable OUTPUT_FILE ${WORKDIR}/KM3NeT_${(l:8::0::0:)DETECTOR_ID}_${(l:8::0::0:)RUN}_trigger.root
69
70 JTriggerProcessor \
71 -a ${DETECTOR} \
72 -f ${INPUT_FILE} \
73 -C JDAQTimesliceSN \
74 -@ "trigger3DMuon.enabled = 1" \
75 -@ "trigger3DMuon.numberOfHits = 3" \
76 -@ "trigger3DMuon.numberOfModules = 3" \
77 -@ "trigger3DMuon.gridAngle_deg = 10" \
78 -@ "trigger3DMuon.TMaxExtra_ns = 500.0e3" \
79 -@ "TMaxEvent_ns = 500.0e3" \
80 -@ "TMaxLocal_ns = 20.0" \
81 -@ "L2.numberOfHits = 4" \
82 -@ "L2.TMaxLocal_ns = 20.0" \
83 -@ "L2.ctMin = 0.0" \
84 -o ${OUTPUT_FILE} \
85 -d ${DEBUG}
86
87 { $JPP_DIR/examples/JDataQuality/JSquid \
88 -a ${DETECTOR} \
89 -f ${OUTPUT_FILE} \
90 -o /dev/null \
91 -d ${DEBUG} \
92 -Q 3 3>&1 1>&4 | read -A SQUID } 4>&1
93
94 { $JPP_DIR/examples/JDataQuality/JMermaid \
95 -a ${DETECTOR} \
96 -f ${INPUT_FILE} \
97 -o /dev/null \
98 -d ${DEBUG} \
99 -Q 3 3>&1 1>&4 | read -A MERMAID } 4>&1
100
101 # print values
102
103 printf " %8d" ${DAQ_HEADER[1,2]} >> $QAQC_FILE
104 printf " %4d" ${SQUID[1,2]} >> $QAQC_FILE
105 printf " %8d" ${MERMAID[*]} >> $QAQC_FILE
106 printf "\n" >> $QAQC_FILE
107done
108
109rm -rf $WORKDIR