Jpp  18.5.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: VERSION QAQC_VERSION process_B
25 set_variable: WORKDIR QAQC_WORKDIR ${TMPDIR:-/tmp}/.$$
26 
28  trigger3DMuon.enabled
29  trigger3DShower.enabled
30  triggerMXShower.enabled
31  triggerNB.enabled
32 d writeL0.prescale
33  writeL1.prescale
34  writeL2.prescale
35  writeSN.prescale)
36 
37 TRIGGERS=(`JPrintTriggerBits`)
38 
39 DAQ=(
40  JDAQTimeslice
41  JDAQTimesliceL0
42  JDAQTimesliceL1
43  JDAQTimesliceL2
45  JDAQSummaryslice
46  JDAQEvent)
47 
48 typeset -a PARAMETERS
49 
50 PARAMETERS=(
51  GIT JPP UUID
52  detector run livetime_s UTCMin_s UTCMax_s
53  ${TRIGGER_PARAMETERS[*]}
54  ${DAQ[*]}
55  JTriggerReprocessor
56  ${TRIGGERS[*]}
57  in_sync out_sync DAQ WR HRV FIFO
59  Acoustics AHRS
60  in_usync out_usync
61  event_duration)
62 
63 if do_usage $*; then
64  usage \
65  "$script <archive> (input file)+ <QA/QC file>" \
66  "\nThe archive should correspond to the GIT repository \"auxiliary_data/jpp/\"" \
67  "\nAuxiliary script to produce the following QA/QC data:\n" \
68  ${PARAMETERS//\.*} \
69  "\nSee also: $JPP_PAGES/ Search \"JRunQuality\""
70 fi
71 
72 if (( $# < 2 )); then
73  fatal "Wrong number of arguments."
74 fi
75 
77 set_array INPUT_FILES ${argv[2,-2]}
78 set_variable QAQC_FILE ${argv[-1]:a}
79 
80 mkdir -p ${WORKDIR}
81 pushd ${WORKDIR}
82 
83 set_variable ACOUSTICS_DEBUG ${DEBUG}
84 set_variable COMPASS_DEBUG ${DEBUG}
85 set_variable DAQX daq.detx # detector used during data taking
86 set_variable DETECTOR detector.datx # fixed nomenclature
87 
88 JCookie.sh
89 CHECK_EXIT_CODE
90 
91 if [[ ! -d $ARCHIVE ]]; then
92  fatal "No archive $ARCHIVE"
93 fi
94 
95 if [[ ! -s $QAQC_FILE ]]; then
96  echo ${PARAMETERS//\.*/} > $QAQC_FILE
97 fi
98 
99 for INPUT_FILE in ${INPUT_FILES[*]}; do
100 
101  # determine values
102 
103  JPrintMeta -v |& awk '/version/ { print $2 }' | read GIT_VERSION
104  CHECK_EXIT_CODE
105 
106  JPrintMeta -f ${INPUT_FILE} -k GIT | read DAQ_VERSION
107 
108  echo ${(s/./)DAQ_VERSION} | read DAQ_MAJOR DAQ_MINOR DAQ_PATCH
109 
110  if [[ -z $DAQ_VERSION ]]; then
111  JPrintMeta -f ${INPUT_FILE} -k SVN | read DAQ_VERSION
112  fi
113 
114  getUUID -f ${INPUT_FILE} -d 0 | read UUID
115  CHECK_EXIT_CODE
116 
117  JPrintDAQHeader -f ${INPUT_FILE} -d 0 | read -A DAQ_HEADER
118  CHECK_EXIT_CODE
119 
120  set_variable DETECTOR_ID ${DAQ_HEADER[1]}
121  set_variable RUN ${DAQ_HEADER[2]}
122 
123  JDetectorDB -D ${DETECTOR_ID} -r ${RUN} -o ${DAQX} -d ${DEBUG} # install detector file as-is for JTriggerReprocessor
124  CHECK_EXIT_CODE
125 
126  if [[ "$DAQ_MAJOR" != [0-9][0-9]* ]] || (( $DAQ_MAJOR <= 12 )); then # Jpp-version dependence
127  JEditDetector \
128  -a ${DAQX} \
129  -P "-1 -1 set UDP_COUNTER_DISABLE" \
130  -P "-1 -1 set UDP_TRAILER_DISABLE" \
131  -o ${DAQX} \
132  -d ${DEBUG}
133  fi
134 
135  JAHRSCalibration.sh ${DETECTOR_ID} # install AHRS calibration file
136  CHECK_EXIT_CODE
137 
138  getLivetime -f ${INPUT_FILE} -d 0 | read -A LIVETIME_S
139  CHECK_EXIT_CODE
140 
141  getUTC -f ${INPUT_FILE} -d 0 | read -A UTC_S
142  CHECK_EXIT_CODE
143 
144  {{ JTriggerMonitor -f ${INPUT_FILE} -d ${DEBUG} -Q 3 3>&1 1>&4 } | read -A TRIGGER_MONITOR } 4>&1
145  CHECK_EXIT_CODE
146 
147  set_variable OUTPUT_FILE KM3NeT_${(l:8::0::0:)DETECTOR_ID}_${(l:8::0::0:)RUN}_reprocessor.root
148 
149  JTriggerReprocessor \
150  -a ${DAQX} \
151  -f ${INPUT_FILE} \
152  -o ${OUTPUT_FILE} \
153  -U \
154  -C -\.\* \
155  -d ${DEBUG}
156  CHECK_EXIT_CODE
157 
158  JPrintTree -f ${OUTPUT_FILE} |& awk '/JDAQEvent/ { print $3 }' | read TRIGGER_REPROCESSOR
159 
160  {{ JTurbot \
161  -f ${INPUT_FILE} \
162  -a ${DAQX} \
163  -o /dev/null \
164  -d ${DEBUG} \
165  -Q 3 3>&1 1>&4 } | read -A TURBOT } 4>&1
166  CHECK_EXIT_CODE
167 
168  {{ JSummaryMonitor -f ${INPUT_FILE} -d ${DEBUG} -Q 3 3>&1 1>&4 } | read -A SUMMARY_MONITOR } 4>&1
169  CHECK_EXIT_CODE
170 
171  archive-get-calibration.sh ${ARCHIVE} ${DETECTOR_ID} ${VERSION} # detector and auxiliary calibrations
172  CHECK_EXIT_CODE
173 
174  JAcousticsEventBuilder.sh ${DETECTOR} ${RUN}
175 
176  if (( $? == 0 )); then
177 
178  set_variable OUTPUT_FILE KM3NeT_${(l:8::0::0:)DETECTOR_ID}_${(l:8::0::0:)RUN}_event.root
179 
180  JPrintTree -f ${OUTPUT_FILE} |& awk '/JACOUSTICS::JEvent/ { print $3 }' | read -A NUMBER_OF_ACOUSTICS_EVENTS
181  else
182  NUMBER_OF_ACOUSTICS_EVENTS=(0)
183  fi
184 
185  JAHRS.sh ${DETECTOR_ID} ${RUN}
186 
187  if (( $? == 0 )); then
188 
189  set_variable OUTPUT_FILE KM3NeT_${(l:8::0::0:)DETECTOR_ID}_${(l:8::0::0:)RUN}_ahrs.root
190 
191  {{ JAHRSMonitor \
192  -a ${DETECTOR} \
193  -f ${OUTPUT_FILE} \
194  -c ahrs_calibration.txt \
195  -q 0.2 \
196  -d ${DEBUG} \
197  -Q 3 3>&1 1>&4 } | read -A NUMBER_OF_AHRS_EVENTS } 4>&1
198  else
199  NUMBER_OF_AHRS_EVENTS=(0)
200  fi
201 
202  set_variable OUTPUT_FILE KM3NeT_${(l:8::0::0:)DETECTOR_ID}_${(l:8::0::0:)RUN}_trigger.root
203 
204  JTriggerProcessor \
205  -a ${DETECTOR} \
206  -f ${INPUT_FILE} \
207  -C JDAQTimesliceSN \
208  -@ "trigger3DMuon.enabled = 1" \
209  -@ "trigger3DMuon.numberOfHits = 3" \
210  -@ "trigger3DMuon.numberOfModules = 3" \
211  -@ "trigger3DMuon.gridAngle_deg = 10" \
212  -@ "trigger3DMuon.TMaxExtra_ns = 500.0e3" \
213  -@ "TMaxEvent_ns = 500.0e3" \
214  -@ "TMaxLocal_ns = 20.0" \
215  -@ "L2.numberOfHits = 4" \
216  -@ "L2.TMaxLocal_ns = 20.0" \
217  -@ "L2.ctMin = 0.0" \
218  -o ${OUTPUT_FILE} \
219  -d ${DEBUG}
220  CHECK_EXIT_CODE
221 
222  {{ JSquid \
223  -a ${DETECTOR} \
224  -f ${OUTPUT_FILE} \
225  -o /dev/null \
226  -d ${DEBUG} \
227  -Q 3 3>&1 1>&4 } | read -A SQUID } 4>&1
228 
229  {{ JMermaid \
230  -a ${DETECTOR} \
231  -f ${INPUT_FILE} \
232  -o /dev/null \
233  -d ${DEBUG} \
234  -Q 3 3>&1 1>&4 } | read -A MERMAID } 4>&1
235 
236  # print values
237 
238  printf " %12s" ${GIT_VERSION} >> $QAQC_FILE
239  printf " %12s" ${DAQ_VERSION:-\?} >> $QAQC_FILE
240  printf " %s" ${UUID:-\?} >> $QAQC_FILE
241  printf " %8d" ${DAQ_HEADER[1,2]} >> $QAQC_FILE
242  printf " %9.1f" ${LIVETIME_S[1]} >> $QAQC_FILE
243  printf " %12.1f" ${UTC_S[*]} >> $QAQC_FILE
244 
245  for KEY in ${TRIGGER_PARAMETERS[*]}; do
246 
247  JPrintTriggerParameters -f ${INPUT_FILE} -k $KEY -d 0 | read VALUE
248 
249  printf " %4d" ${VALUE:-0} >> $QAQC_FILE
250  done
251 
252  for KEY in ${DAQ[*]}; do
253 
254  JPrintTree -f ${INPUT_FILE} |& eval awk \'/${KEY}/ \{ print \$3 \}\' | read VALUE
255 
256  printf " %8d" ${VALUE:-0} >> $QAQC_FILE
257  done
258 
259  printf " %8d" ${TRIGGER_REPROCESSOR:-0} >> $QAQC_FILE
260  printf " %8d" ${TRIGGER_MONITOR[*]} >> $QAQC_FILE
261  printf " %4d" ${TURBOT[1,2]} >> $QAQC_FILE
262  printf " %7.5f" ${SUMMARY_MONITOR[1,4]} >> $QAQC_FILE
263  printf " %8.1f" ${SUMMARY_MONITOR[5]} >> $QAQC_FILE
264  printf " %7.0f" ${SUMMARY_MONITOR[6,7]} >> $QAQC_FILE
265  printf " %4d" ${NUMBER_OF_ACOUSTICS_EVENTS[1]} >> $QAQC_FILE
266  printf " %8.3f" ${NUMBER_OF_AHRS_EVENTS[1]} >> $QAQC_FILE
267  printf " %4d" ${SQUID[1,2]} >> $QAQC_FILE
268  printf " %8d" ${MERMAID[1]} >> $QAQC_FILE
269  printf "\n" >> $QAQC_FILE
270 done
271 
272 popd
273 
274 rm -rf ${WORKDIR}
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
usr share Modules init zsh export TMPDIR
exit
Definition: JPizza.sh:36
then fatal Wrong number of arguments fi set_variable ARCHIVE $argv[1] set_variable ID $argv[2] set_variable VERSION $argv[3] source JAcousticsToolkit sh RUN
data_type r[M+1]
Definition: JPolint.hh:868
is
Definition: JDAQCHSM.chsm:167
then
Definition: datalogs.sh:31
then fatal Wrong number of arguments fi JConvertDetectorFormat a o
Q JDAQEvent livetime_s
Definition: JDataQuality.sh:57
static const double C
Physics constants.
then fatal Invalid path $argv[1] fi setopt extendedglob typeset Z8 ID function archive()
Definition: getArchive.sh:42
do JPrintDAQHeader f $INPUT_FILE d read DETECTOR_ID RUN FRAME_INDEX TIMESLICE_START set_variable OUTPUT_FILE $WORKDIR KM3NeT_
do set_variable STRING_TXT awk
then JCalibrateToT a
Definition: JTuneHV.sh:113
&set_variable VERSION
Definition: getLs.sh:21
then echo Variable JPP_DIR undefined exit fi source $JPP_DIR setenv sh $JPP_DIR &dev null set_variable
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
then usage $script< archive >(input file)+< QA/QC file >" "\nThe archive should correspond to the GIT repository\"auxiliary_data/jpp/\"""\nAuxiliary script to produce the following QA/QC data then fatal Wrong number of arguments fi set_variable ARCHIVE
Definition: JQAQC.sh:76
&set_variable OUTPUT_FILE
set_variable INPUT_FILE
do sput $STRING $FLOOR sget MODULE INPUT_FILES
Definition: JCanberra.sh:79
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 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:48
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:866
then echo
Definition: JQAQC.sh:96
source $JPP_DIR setenv csh $JPP_DIR &dev null eval JShellParser o a A
do echo Generating $dir eval D
Definition: JDrawLED.sh:53
esac $JPP_BIN JLogger sh $LOGGER until pgrep JGetMessage</dev/null > dev null
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