Jpp  19.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 
24 
25 set_variable: DEBUG QAQC_DEBUG 0
26 set_variable: VERSION QAQC_VERSION D_1.0.0
27 set_variable: WORKDIR QAQC_WORKDIR ${TMPDIR:-/tmp}/.$$
28 
30  trigger3DMuon.enabled
31  trigger3DShower.enabled
32  triggerMXShower.enabled
33  triggerNB.enabled
34  writeL0.prescale
35  writeL1.prescale
36  writeL2.prescale
37  writeSN.prescale)
38 
39 TRIGGERS=(`JPrintTriggerBits`)
40 
41 DAQ=(
42  JDAQTimeslice
43  JDAQTimesliceL0
44  JDAQTimesliceL1
45  JDAQTimesliceL2
47  JDAQSummaryslice
48  JDAQEvent)
49 
50 typeset -a PARAMETERS
51 
52 PARAMETERS=(
53  GIT JPP nb_of_meta UUID
54  detector run livetime_s UTCMin_s UTCMax_s
55  ${TRIGGER_PARAMETERS[*]}
56  ${DAQ[*]}
57  JTriggerReprocessor
58  ${TRIGGERS[*]}
59  in_sync out_sync DAQ WR HRV FIFO
61  hrv_fifo_failures duplic_timeslices
62  Acoustics AHRS
63  in_usync out_usync
64  event_duration)
65 
66 if do_usage $*; then
67  usage \
68  "$script (input file)+ <QA/QC file>" \
69  "\nAuxiliary script to produce the following QA/QC data:\n" \
70  ${PARAMETERS//\.*} \
71  "\nSee also: $JPP_PAGES/ Search \"JRunQuality\""
72 fi
73 
74 if (( $# < 2 )); then
75  fatal "Wrong number of arguments."
76 fi
77 
78 set_array INPUT_FILES ${argv[1,-2]:a}
79 set_variable QAQC_FILE ${argv[-1]:a}
80 
81 mkdir -p ${WORKDIR}
82 pushd ${WORKDIR}
83 
84 set_variable ACOUSTICS_DEBUG ${DEBUG}
85 set_variable COMPASS_DEBUG ${DEBUG}
86 set_variable DETECTOR detector.detx # detector used during data taking
87 
88 JCookie.sh
89 CHECK_EXIT_CODE
90 
91 if [[ ! -s $QAQC_FILE ]]; then
92  echo ${PARAMETERS//\.*/} > $QAQC_FILE
93 fi
94 
95 for INPUT_FILE in ${INPUT_FILES[*]}; do
96 
97  # determine values
98 
99  JPrintMeta -v |& awk '/version/ { print $2 }' | read GIT_VERSION
100  CHECK_EXIT_CODE
101 
102  JPrintMeta -f ${INPUT_FILE} -k GIT | tr '\n' ' ' | read -A DAQ_VERSION
103 
104  echo ${(s/./)DAQ_VERSION} | read DAQ_MAJOR DAQ_MINOR DAQ_PATCH
105 
106  if [[ -z $DAQ_VERSION ]]; then
107  JPrintMeta -f ${INPUT_FILE} -k SVN | read DAQ_VERSION
108  fi
109 
110  getUUID -f ${INPUT_FILE} -d 0 | read UUID
111  CHECK_EXIT_CODE
112 
113  JPrintDAQHeader -f ${INPUT_FILE} -d 0 | read -A DAQ_HEADER
114  CHECK_EXIT_CODE
115 
116  set_variable DETECTOR_ID ${DAQ_HEADER[1]}
117  set_variable RUN ${DAQ_HEADER[2]}
118 
119  JDetectorDB -D ${DETECTOR_ID} -r ${RUN} -o ${DETECTOR} -d ${DEBUG} # install detector file as-is for a.o. JTriggerReprocessor
120  CHECK_EXIT_CODE
121 
122  if [[ "$DAQ_MAJOR" != [0-9][0-9]* ]] || (( $DAQ_MAJOR <= 12 )); then # Jpp-version dependence
123  JEditDetector \
124  -a ${DETECTOR} \
125  -P "-1 -1 set UDP_COUNTER_DISABLE" \
126  -P "-1 -1 set UDP_TRAILER_DISABLE" \
127  -o ${DETECTOR} \
128  -d ${DEBUG}
129  fi
130 
131  JAHRSCalibration.sh ${DETECTOR_ID} # install AHRS calibration file
132  CHECK_EXIT_CODE
133 
134  getLivetime -f ${INPUT_FILE} -d 0 | read -A LIVETIME_S
135  CHECK_EXIT_CODE
136 
137  getUTC -f ${INPUT_FILE} -d 0 | read -A UTC_S
138  CHECK_EXIT_CODE
139 
140  {{ JTriggerMonitor -f ${INPUT_FILE} -d ${DEBUG} -Q 3 3>&1 1>&4 } | read -A TRIGGER_MONITOR } 4>&1
141  CHECK_EXIT_CODE
142 
143  set_variable OUTPUT_FILE KM3NeT_${(l:8::0::0:)DETECTOR_ID}_${(l:8::0::0:)RUN}_reprocessor.root
144 
145  JTriggerReprocessor \
146  -a ${DETECTOR} \
147  -f ${INPUT_FILE} \
148  -o ${OUTPUT_FILE} \
149  -U \
150  -C -\.\* \
151  -d ${DEBUG}
152  CHECK_EXIT_CODE
153 
154  JPrintTree -f ${OUTPUT_FILE} -@ "type = JDAQEvent" -k number_of_entries | read TRIGGER_REPROCESSOR
155 
156  {{ JTurbot \
157  -f ${INPUT_FILE} \
158  -a ${DETECTOR} \
159  -o /dev/null \
160  -d ${DEBUG} \
161  -Q 3 3>&1 1>&4 } | read -A TURBOT } 4>&1
162  CHECK_EXIT_CODE
163 
164  {{ JSummaryMonitor -f ${INPUT_FILE} -t 50000 -d ${DEBUG} -Q 3 3>&1 1>&4 } | read -A SUMMARY_MONITOR } 4>&1
165  CHECK_EXIT_CODE
166 
167  JAcousticsTriggerProcessor.sh ${DETECTOR} ${RUN}
168 
169  if (( $? == 0 )); then
170 
171  set_variable OUTPUT_FILE KM3NeT_${(l:8::0::0:)DETECTOR_ID}_${(l:8::0::0:)RUN}_event.root
172 
173  JPrintTree -f ${OUTPUT_FILE} -@ "type = JACOUSTICS::JEvent" -k number_of_entries | 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 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 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 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[1]:-\?} >> $QAQC_FILE
233  printf " %1d" ${#DAQ_VERSION} >> $QAQC_FILE
234  printf " %s" ${UUID:-\?} >> $QAQC_FILE
235  printf " %8d" ${DAQ_HEADER[1,2]} >> $QAQC_FILE
236  printf " %9.1f" ${LIVETIME_S[1]} >> $QAQC_FILE
237  printf " %12.1f" ${UTC_S[*]} >> $QAQC_FILE
238 
239  for KEY in ${TRIGGER_PARAMETERS[*]}; do
240 
241  JPrintTriggerParameters -f ${INPUT_FILE} -k $KEY -d 0 | read VALUE
242 
243  printf " %4d" ${VALUE:-0} >> $QAQC_FILE
244  done
245 
246  for KEY in ${DAQ[*]}; do
247 
248  JPrintTree -f ${INPUT_FILE} -@ "type = $KEY" -k number_of_entries | read VALUE
249 
250  printf " %8d" ${VALUE:-0} >> $QAQC_FILE
251  done
252 
253  printf " %8d" ${TRIGGER_REPROCESSOR:-0} >> $QAQC_FILE
254  printf " %8d" ${TRIGGER_MONITOR[*]} >> $QAQC_FILE
255  printf " %4d" ${TURBOT[1,2]} >> $QAQC_FILE
256  printf " %7.5f" ${SUMMARY_MONITOR[1,4]} >> $QAQC_FILE
257  printf " %8.1f" ${SUMMARY_MONITOR[5]} >> $QAQC_FILE
258  printf " %7.0f" ${SUMMARY_MONITOR[6,7]} >> $QAQC_FILE
259  printf " %8d" ${SUMMARY_MONITOR[8]} >> $QAQC_FILE
260  printf " %8d" ${SUMMARY_MONITOR[9]} >> $QAQC_FILE
261  printf " %4d" ${NUMBER_OF_ACOUSTICS_EVENTS[1]} >> $QAQC_FILE
262  printf " %8.3f" ${NUMBER_OF_AHRS_EVENTS[1]} >> $QAQC_FILE
263  printf " %4d" ${SQUID[1,2]} >> $QAQC_FILE
264  printf " %8d" ${MERMAID[1]} >> $QAQC_FILE
265  printf "\n" >> $QAQC_FILE
266 done
267 
268 popd
269 
270 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
exit
Definition: JPizza.sh:36
data_type r[M+1]
Definition: JPolint.hh:868
is
Definition: JDAQCHSM.chsm:167
then
Definition: datalogs.sh:34
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 rm
Definition: sftpput.zsh:30
then JCalibrateToT a
Definition: JTuneHV.sh:107
then echo Variable JPP_DIR undefined exit fi source $JPP_DIR setenv sh $JPP_DIR if do_usage *then usage $script[(input file)+] fi set_variable DEBUG set_variable WORKDIR TMPDIR
&set_variable VERSION
Definition: getLs.sh:21
then rm i $OUTPUT_FILE fi let RUN
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
do set_variable STRING_TXT awk
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
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: JMuonStart.sh:47
then usage $script[energy[distance[z of PMT]]] fi case set_variable z
Definition: JDrawPDF.sh:45
Q FIFO
Definition: JDataQuality.sh:61
do set_variable INPUT_FILE $WORKDIR KM3NeT_
double getLivetime(const std::string &file_name)
Get data taking live time.
then fatal The output file must have the wildcard in the e g root fi 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 JHobbit a $DETECTOR f
do sput $STRING $FLOOR sget MODULE INPUT_FILES
then eval ls $DIR $ID $TYPE _
Definition: getArchive.sh:108
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:92
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