Jpp test-rotations-new
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
23case $# in
24 0) fatal "Wrong number of arguments.";;
25 3) set_variable DETECTOR_ID $argv[1]
26 set_variable RANGE $argv[2];&
27 1) set_variable QUALITY_TXT $argv[-1];;
28esac
29
30set_variable FILEPREFIX ${${QUALITY_TXT%%.*}##.*/}
31set_variable QUALITY_ROOT ${QUALITY_TXT%%.*}.root
32
33if (( $# == 3 )); then
34
35 if ( ! reuse_file $QUALITY_TXT ); then
36
37 JCookie.sh
38
39 JDataQuality \
40 -D "$DETECTOR_ID" \
41 -R "${RANGE%%-*} ${RANGE##*-}" \
42 -o $QUALITY_TXT \
43 -d $DEBUG --!
44 else
45
46 echo "Note that the specified detector identifer and runs are discarded."
47 fi
48fi
49
50
51JDataQuality \
52 -D "$DETECTOR_ID" \
53 -R "${RANGE%%-*} ${RANGE##*-}" \
54 -f $QUALITY_TXT \
55 -Q "livetime_s; 1200 60000" \
56 -Q "(UTCMax_s - UTCMin_s) - livetime_s; -100 +100" \
57 -Q "JDAQEvent / livetime_s; 0.05 50.0" \
58 -Q "HRV; 0.00 0.2" \
59 -Q "DAQ; 0.95 1.05" \
60 -Q "WR; 0.95 1.05" \
61 -Q "FIFO; 0.00 0.01" \
62 -Q "MEAN_Rate_Hz; 4500 15000" \
63 -Q "RMS_Rate_Hz; 200 5000" \
64 -Q "Acoustics / livetime_s; 0.0 100.0" \
65 -Q "AHRS / livetime_s; 0.0 100.0" \
66 -V "(JDAQEvent - JTriggerReprocessor) * 1.0 / (JDAQEvent + 1.0e-10); -5.0e-3 +5.0e-3" \
67 -V "out_sync; 0 0" \
68 -V "out_usync; 0 0" \
69 -o $QUALITY_ROOT \
70 -d $DEBUG --!
71
72CHECK_EXIT_CODE
73
74
75JPlot1D \
76 -f ${QUALITY_ROOT}:h0 \
77 -> "quality" \
78 -\^ "number of runs" \
79 -T "" \
80 -o $WORKDIR/${FILEPREFIX}_quality.${FORMAT} $BATCH
81
82JPlot1D \
83 -f ${QUALITY_ROOT}:h1 \
84 -\^ "number of runs" \
85 -T "" \
86 -o $WORKDIR/${FILEPREFIX}_selection.${FORMAT} $BATCH
87
88JPlot1D \
89 -w 1200x600 \
90 -f ${QUALITY_ROOT}:VETO \
91 -> "run number" \
92 -O P \
93 -N "X 505" \
94 -T "VETO" \
95 -L BL \
96 -o $WORKDIR/${FILEPREFIX}_veto.${FORMAT} $BATCH
97
98typeset -A BUFFER
99
100BUFFER=(
101 \^livetime_s\$ livetime
102 UTC UTC-livetime
103 \^JDAQEvent\.\*livetime_s event-rate
104 \^\‍(JDAQEvent\.\*JTriggerReprocessor\‍) event-count
105 HRV HRV
106 \^DAQ\$ DAQ
107 WR WR
108 FIFO FIFO
109 MEAN_Rate_Hz PMT-rate-mean
110 RMS_Rate_Hz PMT-rate-rms
111 \^out_sync\$ out_sync
112 \^out_usync\$ out_usync
113 Acoustics acoustics
114 AHRS AHRS)
115
116for KEY VALUE in ${(@kv)BUFFER}; do
117
118 JPlot1D \
119 -w 1200x600 \
120 -f ${QUALITY_ROOT}:${KEY} \
121 -> "run number" \
122 -O P \
123 -N "X 505" \
124 -T "?" \
125 -o $WORKDIR/${FILEPREFIX}_${VALUE}.${FORMAT} $BATCH
126done