Jpp  18.0.0
the software that should make you happy
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
JQAQC.sh
Go to the documentation of this file.
1 #!/bin/zsh
2 #
3 # \author mdejong
4 #
5 script=${0##*/}
6 version=1.0
8 
9 if [ -z $JPP_DIR ]; then
10  echo "Variable JPP_DIR undefined."
11  exit
12 fi
13 
14 source $JPP_DIR/setenv.sh $JPP_DIR >& /dev/null
15 
16 # Auxiliary script to produce QA/QC data.
17 #
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].
20 #
21 # Note that if the list of values is extended, the include file JRunQuality.hh should accordingly be updated.
22 
23 set_variable: DEBUG QAQC_DEBUG 0
24 set_variable: WORKDIR QAQC_WORKDIR ${TMPDIR:-/tmp}/.$$
25 
27  trigger3DMuon.enabled
28  trigger3DShower.enabled
29  triggerMXShower.enabled
30  triggerNB.enabled
31  writeL0.prescale
32  writeL1.prescale
33  writeL2.prescale
34  writeSN.prescale)
35 
36 TRIGGERS=(`JPrintTriggerBits`)
37 
38 DAQ=(
39  JDAQTimeslice
40  JDAQTimesliceL0
41  JDAQTimesliceL1
42  JDAQTimesliceL2
44  JDAQSummaryslice
45  JDAQEvent)
46 
47 typeset -a PARAMETERS
48 
49 PARAMETERS=(
50  GIT JPP UUID
51  detector run livetime_s UTCMin_s UTCMax_s
52  ${TRIGGER_PARAMETERS[*]}
53  ${DAQ[*]}
54  JTriggerReprocessor
55  ${TRIGGERS[*]}
56  in_sync out_sync DAQ WR HRV FIFO
58  Acoustics AHRS
59  in_usync out_usync
60  event_duration)
61 
62 if do_usage $*; then
63  usage \
64  "$script (input file)+ <QA/QC file>" \
65  "\nAuxiliary script to produce the following QA/QC data:\n" \
66  ${PARAMETERS//\.*} \
67  "\nSee also: $JPP_PAGES/ Search \"JRunQuality\""
68 fi
69 
70 if (( $# < 2 )); then
71  fatal "Wrong number of arguments."
72 fi
73 
74 set_array INPUT_FILES $argv[1,-2]
75 set_variable QAQC_FILE $argv[-1]
76 
77 
78 mkdir -p $WORKDIR
79 
81 set_variable ACOUSTICS_WORKDIR ${WORKDIR}
82 set_variable COMPASS_DEBUG ${DEBUG}
83 set_variable COMPASS_WORKDIR ${WORKDIR}
85 
86 JCookie.sh
87 CHECK_EXIT_CODE
88 
89 if [[ ! -s $QAQC_FILE ]]; then
90  echo ${PARAMETERS//\.*/} > $QAQC_FILE
91 fi
92 
93 for INPUT_FILE in ${INPUT_FILES[*]}; do
94 
95  # determine values
96 
97  JPrintMeta -v |& awk '/version/ { print $2 }' | read GIT_VERSION
98  CHECK_EXIT_CODE
99 
100  JPrintMeta -f ${INPUT_FILE} -k GIT | read DAQ_VERSION
101 
102  echo ${(s/./)DAQ_VERSION} | read DAQ_MAJOR DAQ_MINOR DAQ_PATCH
103 
104  if [[ -z $DAQ_VERSION ]]; then
105  JPrintMeta -f ${INPUT_FILE} -k SVN | read DAQ_VERSION
106  fi
107 
108  getUUID -f ${INPUT_FILE} -d 0 | read UUID
109  CHECK_EXIT_CODE
110 
111  JPrintDAQHeader -f ${INPUT_FILE} -d 0 | read -A DAQ_HEADER
112  CHECK_EXIT_CODE
113 
114  set_variable DETECTOR_ID ${DAQ_HEADER[1]}
115  set_variable RUN ${DAQ_HEADER[2]}
116 
117  JDetectorDB -D ${DETECTOR_ID} -r ${RUN} -o ${DETECTOR} -d ${DEBUG} # install detector file as-is for JTriggerReprocessor
118  CHECK_EXIT_CODE
119 
120  if [[ "$DAQ_MAJOR" != [0-9][0-9]* ]] || (( $DAQ_MAJOR <= 12 )); then # Jpp-version dependence
121  JEditDetector \
122  -a ${DETECTOR} \
123  -P "-1 -1 set UDP_COUNTER_DISABLE" \
124  -P "-1 -1 set UDP_TRAILER_DISABLE" \
125  -o ${DETECTOR} \
126  -d ${DEBUG}
127  fi
128 
129  JAHRSCalibration.sh ${DETECTOR_ID} # install AHRS calibration file
130  CHECK_EXIT_CODE
131 
132  getLivetime -f ${INPUT_FILE} -d 0 | read -A LIVETIME_S
133  CHECK_EXIT_CODE
134 
135  getUTC -f ${INPUT_FILE} -d 0 | read -A UTC_S
136  CHECK_EXIT_CODE
137 
138  {{ JTriggerMonitor -f ${INPUT_FILE} -d ${DEBUG} -Q 3 3>&1 1>&4 } | read -A TRIGGER_MONITOR } 4>&1
139  CHECK_EXIT_CODE
140 
141  set_variable OUTPUT_FILE ${WORKDIR}/KM3NeT_${(l:8::0::0:)DETECTOR_ID}_${(l:8::0::0:)RUN}_reprocessor.root
142 
143  JTriggerReprocessor \
144  -a ${DETECTOR} \
145  -f ${INPUT_FILE} \
146  -o ${OUTPUT_FILE} \
147  -U \
148  -C -\.\* \
149  -d ${DEBUG}
150  CHECK_EXIT_CODE
151 
152  JPrintTree -f ${OUTPUT_FILE} |& awk '/JDAQEvent/ { print $3 }' | read TRIGGER_REPROCESSOR
153 
154  {{ JTurbot \
155  -f ${INPUT_FILE} \
156  -a ${DETECTOR} \
157  -o /dev/null \
158  -d ${DEBUG} \
159  -Q 3 3>&1 1>&4 } | read -A TURBOT } 4>&1
160  CHECK_EXIT_CODE
161 
162  {{ JSummaryMonitor -f ${INPUT_FILE} -d ${DEBUG} -Q 3 3>&1 1>&4 } | read -A SUMMARY_MONITOR } 4>&1
163  CHECK_EXIT_CODE
164 
165  JDetectorDB -a ${DETECTOR} -o ${DETECTOR} -WW -d ${DEBUG} # update detector file with base modules
166 
167  JAcousticsEventBuilder.sh ${DETECTOR} ${RUN}
168 
169  if (( $? == 0 )); then
170 
171  set_variable OUTPUT_FILE $WORKDIR/KM3NeT_${(l:8::0::0:)DETECTOR_ID}_${(l:8::0::0:)RUN}_event.root
172 
173  JPrintTree -f ${OUTPUT_FILE} |& awk '/JACOUSTICS::JEvent/ { print $3 }' | read -A NUMBER_OF_ACOUSTICS_EVENTS
174  else
175  NUMBER_OF_ACOUSTICS_EVENTS=(0)
176  fi
177 
178  JAHRS.sh ${DETECTOR_ID} ${RUN}
179 
180  if (( $? == 0 )); then
181 
182  set_variable OUTPUT_FILE ${WORKDIR}/KM3NeT_${(l:8::0::0:)DETECTOR_ID}_${(l:8::0::0:)RUN}_ahrs.root
183 
184  {{ JAHRSMonitor \
185  -a ${DETECTOR} \
186  -f ${OUTPUT_FILE} \
187  -c ${WORKDIR}/ahrs_calibration.txt \
188  -q 0.2 \
189  -d ${DEBUG} \
190  -Q 3 3>&1 1>&4 } | read -A NUMBER_OF_AHRS_EVENTS } 4>&1
191  else
192  NUMBER_OF_AHRS_EVENTS=(0)
193  fi
194 
195  set_variable OUTPUT_FILE ${WORKDIR}/KM3NeT_${(l:8::0::0:)DETECTOR_ID}_${(l:8::0::0:)RUN}_trigger.root
196 
197  JTriggerProcessor \
198  -a ${DETECTOR} \
199  -f ${INPUT_FILE} \
200  -C JDAQTimesliceSN \
201  -@ "trigger3DMuon.enabled = 1" \
202  -@ "trigger3DMuon.numberOfHits = 3" \
203  -@ "trigger3DMuon.numberOfModules = 3" \
204  -@ "trigger3DMuon.gridAngle_deg = 10" \
205  -@ "trigger3DMuon.TMaxExtra_ns = 500.0e3" \
206  -@ "TMaxEvent_ns = 500.0e3" \
207  -@ "TMaxLocal_ns = 20.0" \
208  -@ "L2.numberOfHits = 4" \
209  -@ "L2.TMaxLocal_ns = 20.0" \
210  -@ "L2.ctMin = 0.0" \
211  -o ${OUTPUT_FILE} \
212  -d ${DEBUG}
213  CHECK_EXIT_CODE
214 
215  {{ JSquid \
216  -a ${DETECTOR} \
217  -f ${OUTPUT_FILE} \
218  -o /dev/null \
219  -d ${DEBUG} \
220  -Q 3 3>&1 1>&4 } | read -A SQUID } 4>&1
221 
222  {{ JMermaid \
223  -a ${DETECTOR} \
224  -f ${INPUT_FILE} \
225  -o /dev/null \
226  -d ${DEBUG} \
227  -Q 3 3>&1 1>&4 } | read -A MERMAID } 4>&1
228 
229  # print values
230 
231  printf " %12s" ${GIT_VERSION} >> $QAQC_FILE
232  printf " %12s" ${DAQ_VERSION:-\?} >> $QAQC_FILE
233  printf " %s" ${UUID:-\?} >> $QAQC_FILE
234  printf " %8d" ${DAQ_HEADER[1,2]} >> $QAQC_FILE
235  printf " %9.1f" ${LIVETIME_S[1]} >> $QAQC_FILE
236  printf " %12.1f" ${UTC_S[*]} >> $QAQC_FILE
237 
238  for KEY in ${TRIGGER_PARAMETERS[*]}; do
239 
240  JPrintTriggerParameters -f ${INPUT_FILE} -k $KEY -d 0 | read VALUE
241 
242  printf " %4d" ${VALUE:-0} >> $QAQC_FILE
243  done
244 
245  for KEY in ${DAQ[*]}; do
246 
247  JPrintTree -f ${INPUT_FILE} |& eval awk \'/${KEY}/ \{ print \$3 \}\' | read VALUE
248 
249  printf " %8d" ${VALUE:-0} >> $QAQC_FILE
250  done
251 
252  printf " %8d" ${TRIGGER_REPROCESSOR:-0} >> $QAQC_FILE
253  printf " %8d" ${TRIGGER_MONITOR[*]} >> $QAQC_FILE
254  printf " %4d" ${TURBOT[1,2]} >> $QAQC_FILE
255  printf " %7.5f" ${SUMMARY_MONITOR[1,4]} >> $QAQC_FILE
256  printf " %8.1f" ${SUMMARY_MONITOR[5]} >> $QAQC_FILE
257  printf " %7.0f" ${SUMMARY_MONITOR[6,7]} >> $QAQC_FILE
258  printf " %4d" ${NUMBER_OF_ACOUSTICS_EVENTS[1]} >> $QAQC_FILE
259  printf " %8.3f" ${NUMBER_OF_AHRS_EVENTS[1]} >> $QAQC_FILE
260  printf " %4d" ${SQUID[1,2]} >> $QAQC_FILE
261  printf " %8d" ${MERMAID[1]} >> $QAQC_FILE
262  printf "\n" >> $QAQC_FILE
263 done
264 
265 rm -rf $WORKDIR
then usage $script< detector identifier >< startdate\"YYYY-MM-DDHH:MM:SS\"><finaldate\"YYYY-MM-DDHH:MM:SS\"><QA/QCfile> fi case set_variable QAQC_TXT $argv[4]
Definition: JDataMonitor.sh:24
then fatal No hydrophone data file $HYDROPHONE_TXT fi sort gr k
Q(UTCMax_s-UTCMin_s)-livetime_s
V out_sync
Definition: JDataQuality.sh:67
std::istream & read(std::istream &in, JTestSummary &summary, const char delimiter= ' ')
Read test summary.
*fatal Wrong number of arguments esac check_input_file $INPUT_FILE for TIMESLICE in JDAQTimeslice JDAQTimesliceL0 JDAQTimesliceL1 JDAQTimesliceL2 JDAQTimesliceSN
then usage $script[< detector identifier >< run range >]< QA/QCfile > nExample script to produce data quality plots nWhen a detector identifier and run range are data are downloaded from the database nand subsequently stored in the given QA QC file
Definition: JDataQuality.sh:19
*fatal Wrong number of arguments esac TRIGGER_PARAMETERS
version
Definition: JEditTuneHV.sh:5
set_variable QAQC_FILE
Q MEAN_Rate_Hz
Definition: JDataQuality.sh:62
then fatal Wrong number of arguments fi set_variable DETECTOR $argv[1] set_variable INPUT_FILE $argv[2] eval JPrintDetector a $DETECTOR O SUMMARY JPrintDAQHeader f $INPUT_FILE read A DAQ_HEADER set_variable DETECTOR_ID
Definition: JSquid.sh:28
o $QUALITY_ROOT d $DEBUG!CHECK_EXIT_CODE JPlot1D f
Definition: JDataQuality.sh:76
then usage $script(input file)+< QA/QC file >" "\nAuxiliary script to produce the following QA/QC data then fatal Wrong number of arguments fi set_array INPUT_FILES $argv[1,-2] set_variable QAQC_FILE $argv[-1] mkdir p $WORKDIR set_variable ACOUSTICS_DEBUG
Definition: JQAQC.sh:80
usr share Modules init zsh export TMPDIR
exit
Definition: JPizza.sh:36
data_type r[M+1]
Definition: JPolint.hh:779
is
Definition: JDAQCHSM.chsm:167
then fatal Wrong number of arguments fi JConvertDetectorFormat a o
Q JDAQEvent livetime_s
Definition: JDataQuality.sh:57
static const double C
Physics constants.
do JPrintDAQHeader f $INPUT_FILE d read DETECTOR_ID RUN FRAME_INDEX TIMESLICE_START set_variable OUTPUT_FILE $WORKDIR KM3NeT_
then echo Variable JPP_DIR undefined exit fi source $JPP_DIR setenv sh $JPP_DIR &dev null set_variable
Definition: JAcoustics.sh:21
do set_variable STRING_TXT awk
then JCalibrateToT a
Definition: JTuneHV.sh:116
then rm i $OUTPUT_FILE fi let RUN
Q DAQ
Definition: JDataQuality.sh:59
then echo Variable JPP_DIR undefined exit fi source $JPP_DIR setenv sh $JPP_DIR &dev null set_variable DEBUG set_variable WORKDIR
Definition: JLegolas.sh:20
* usage
&set_variable OUTPUT_FILE
set_variable INPUT_FILE
do sput $STRING $FLOOR sget MODULE INPUT_FILES
Definition: JCanberra.sh:77
Q RMS_Rate_Hz
Definition: JDataQuality.sh:63
$WORKDIR ev_configure_dqsimulator txt echo process $DQ_SIMULATOR $i $SOURCE_HOST[$index] csh c(setenv ROOTSYS $ROOTSYS &&source $JPP_DIR/setenv.csh $JPP_DIR &&($DQ_SIMULATOR\-u\$NAME\$\-H\$SERVER\$\-M\$LOGGER\$\-d $DEBUG</dev/null > &/dev/null &))'
then JMuonMCEvt f $INPUT_FILE o $INTERMEDIATE_FILE d
Definition: JMuonPath.sh:47
Q FIFO
Definition: JDataQuality.sh:61
double getLivetime(const std::string &file_name)
Get data taking live time.
then display $WORKDIR
Definition: plot-Domino.sh:128
then eval ls $DIR $ID $TYPE _
Definition: getArchive.sh:104
set_variable DETECTOR
do set_variable DETECTOR_TXT $WORKDIR detector
data_type v[N+1][M+1]
Definition: JPolint.hh:777
then echo
Definition: JQAQC.sh:90
static JNullStream null
Null I/O stream.
Definition: JNullStream.hh:51
then fatal Wrong number of arguments fi set_variable DETECTOR $argv[1] set_variable INPUT_FILE $argv[2] eval JPrintDetector a $DETECTOR O IDENTIFIER eval JPrintDetector a $DETECTOR O SUMMARY JAcoustics sh $DETECTOR_ID source JAcousticsToolkit sh CHECK_EXIT_CODE typeset A EMITTERS get_tripods $WORKDIR tripod txt EMITTERS get_transmitters $WORKDIR transmitter txt EMITTERS for EMITTER in
Definition: JCanberra.sh:46
source $JPP_DIR setenv csh $JPP_DIR &dev null eval JShellParser o a A
script
Definition: JAcoustics.sh:2
do echo Generating $dir eval D
Definition: JDrawLED.sh:53
Q HRV
Definition: JDataQuality.sh:58
V out_usync
Definition: JDataQuality.sh:68
static const JPBS_t AHRS(3, 4, 3, 4)
PBS of compass
then $DIR JPlotNPE PDG P
Definition: JPlotNPE-PDG.sh:62
esac done
Definition: JAddHDE.sh:21
Auxiliary data structure for data quality.
Definition: JRunQuality.hh:34
#define DEBUG(A)
Message macros.
Definition: JMessage.hh:62
Q WR
Definition: JDataQuality.sh:60