Jpp test-rotations-old-533-g2bdbdb559
the software that should make you happy
Loading...
Searching...
No Matches
JDataQuality.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 gif
14set_variable+ BATCH GRAPHICS_BATCH -B
15
16if do_usage $*; then
17 usage "$script <detector identifier> <run range> <QA/QC file>"\
18 "\nExample script to produce data quality plots."\
19 "\nWhen a detector identifier and run range are specified, data are downloaded from the database"\
20 "\nand subsequently stored in the given QA/QC file, unless this file already exists."
21fi
22
23if (( $# != 3 )); then
24 fatal "Wrong number of arguments."
25fi
26
27set_variable DETECTOR_ID $argv[1]
28set_variable RANGE $argv[2]
29set_variable QUALITY_TXT $argv[3]
30
31set_variable FILEPREFIX ${${QUALITY_TXT%%.*}##.*/}
32set_variable QUALITY_ROOT ${QUALITY_TXT%%.*}.root
33
34JDataQuality \
35 -D "$DETECTOR_ID" \
36 -R "${RANGE%%-*} ${RANGE##*-}" \
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 -Q "Acoustics / livetime_s; 0.0 100.0" \
48 -Q "AHRS / livetime_s; 0.0 100.0" \
49 -V "(JDAQEvent - JTriggerReprocessor) * 1.0 / (JDAQEvent + 1.0e-10); -5.0e-3 +5.0e-3" \
50 -V "out_sync; 0 0" \
51 -V "out_usync; 0 0" \
52 -o $QUALITY_ROOT \
53 -d $DEBUG --!
54
55CHECK_EXIT_CODE
56
57
58JPlot1D \
59 -f ${QUALITY_ROOT}:h0 \
60 -> "quality" \
61 -\^ "number of runs" \
62 -T "" \
63 -o $WORKDIR/${FILEPREFIX}_quality.${FORMAT} $BATCH
64
65JPlot1D \
66 -f ${QUALITY_ROOT}:h1 \
67 -\^ "number of runs" \
68 -T "" \
69 -o $WORKDIR/${FILEPREFIX}_selection.${FORMAT} $BATCH
70
71JPlot1D \
72 -w 1200x600 \
73 -f ${QUALITY_ROOT}:VETO \
74 -> "run number" \
75 -O P \
76 -N "X 505" \
77 -T "VETO" \
78 -L BL \
79 -o $WORKDIR/${FILEPREFIX}_veto.${FORMAT} $BATCH
80
81typeset -A BUFFER
82
83BUFFER=(
84 \^livetime_s\$ livetime
85 UTC UTC-livetime
86 \^JDAQEvent\.\*livetime_s event-rate
87 \^\‍(JDAQEvent\.\*JTriggerReprocessor\‍) event-count
88 HRV HRV
89 \^DAQ\$ DAQ
90 WR WR
91 FIFO FIFO
92 MEAN_Rate_Hz PMT-rate-mean
93 RMS_Rate_Hz PMT-rate-rms
94 \^out_sync\$ out_sync
95 \^out_usync\$ out_usync
96 Acoustics acoustics
97 AHRS AHRS)
98
99for KEY VALUE in ${(@kv)BUFFER}; do
100
101 JPlot1D \
102 -w 1200x600 \
103 -f ${QUALITY_ROOT}:${KEY} \
104 -> "run number" \
105 -O P \
106 -N "X 505" \
107 -T "?" \
108 -o $WORKDIR/${FILEPREFIX}_${VALUE}.${FORMAT} $BATCH
109done