Jpp  16.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 version=1.0
6 script=${0##*/}
7 
8 if [ -z $JPP_DIR ]; then
9  echo "Variable JPP_DIR undefined."
10  exit
11 fi
12 
13 source $JPP_DIR/setenv.sh $JPP_DIR >& /dev/null
14 
15 # Auxiliary script to produce QA/QC data.
16 #
17 # The output data are uploaded to the database with a tool that is part of the km3pipe package.
18 # The locally produced data as well as the uploaded data can be viewed with application/scripts JDataMonitor[.sh] and JDataQuality[.sh].
19 #
20 # Note that if the list of values is extended, the include file JRunQuality.hh should accordingly be updated.
21 
22 set_variable: DEBUG QAQC_DEBUG 0
23 set_variable: WORKDIR QAQC_WORKDIR ${TMPDIR:-/tmp}/.$$
24 
26  trigger3DMuon.enabled
27  trigger3DShower.enabled
28  triggerMXShower.enabled
29  triggerNB.enabled
30  writeL0.prescale
31  writeL1.prescale
32  writeL2.prescale
33  writeSN.prescale)
34 
35 TRIGGERS=(`JPrintTriggerBits`)
36 
37 DAQ=(
38  JDAQTimeslice
39  JDAQTimesliceL0
40  JDAQTimesliceL1
41  JDAQTimesliceL2
43  JDAQSummaryslice
44  JDAQEvent)
45 
46 typeset -a PARAMETERS
47 
48 PARAMETERS=(
49  GIT JPP UUID
50  detector run livetime_s UTCMin_s UTCMax_s
51  ${TRIGGER_PARAMETERS[*]}
52  ${DAQ[*]}
53  JTriggerReprocessor
54  ${TRIGGERS[*]}
55  in-sync out-sync DAQ WR HRV FIFO
57  Acoustics AHRS)
58 
59 
60 if do_usage $*; then
61  usage \
62  "$script (input file)+ <QA/QC file>" \
63  "\nAuxiliary script to produce the following QA/QC data:" \
64  "\n$PARAMETERS[*]"
65 fi
66 
67 if (( $# < 2 )); then
68  fatal "Wrong number of arguments."
69 fi
70 
71 set_array INPUT_FILES $argv[1,-2]
72 set_variable QAQC_FILE $argv[-1]
73 
74 
75 mkdir -p $WORKDIR
76 
77 set_variable ACOUSTICS_WORKDIR ${WORKDIR}
78 set_variable COMPASS_WORKDIR ${WORKDIR}
80 
81 JCookie.sh
82 CHECK_EXIT_CODE
83 
84 if [[ ! -s $QAQC_FILE ]]; then
85  echo $PARAMETERS[*] > $QAQC_FILE
86 fi
87 
88 for INPUT_FILE in ${INPUT_FILES[*]}; do
89 
90  # determine values
91 
92  JPrintMeta -v |& awk '/version/ { print $2 }' | read GIT_VERSION
93  CHECK_EXIT_CODE
94 
95  JPrintMeta -f ${INPUT_FILE} -k GIT | read DAQ_VERSION
96 
97  echo ${(s/./)DAQ_VERSION} | read DAQ_MAJOR DAQ_MINOR DAQ_PATCH
98 
99  if [[ -z $DAQ_VERSION ]]; then
100  JPrintMeta -f ${INPUT_FILE} -k SVN | read DAQ_VERSION
101  fi
102 
103  getUUID -f ${INPUT_FILE} -d 0 | read UUID
104  CHECK_EXIT_CODE
105 
106  JPrintDAQHeader -f ${INPUT_FILE} -d 0 | read -A DAQ_HEADER
107  CHECK_EXIT_CODE
108 
109  set_variable DETECTOR_ID ${DAQ_HEADER[1]}
110  set_variable RUN ${DAQ_HEADER[2]}
111 
112  JDetectorDB -D ${DETECTOR_ID} -r ${RUN} -o ${DETECTOR} # install detector file as-is for JTriggerReprocessor
113  CHECK_EXIT_CODE
114 
115  if [[ "$DAQ_MAJOR" != [0-9][0-9]* ]] || (( $DAQ_MAJOR <= 12 )); then # Jpp-version dependence
116  JEditDetector \
117  -a ${DETECTOR} \
118  -P "-1 -1 set UDP_COUNTER_DISABLE" \
119  -P "-1 -1 set UDP_TRAILER_DISABLE" \
120  -o ${DETECTOR}
121  fi
122 
123  source JAcoustics.sh $DETECTOR_ID # install acoustics input files
124  CHECK_EXIT_CODE
125 
126  JAHRSCalibration.sh ${DETECTOR_ID} # install AHRS calibration file
127  CHECK_EXIT_CODE
128 
129  getLivetime -f ${INPUT_FILE} -d 0 | read -A LIVETIME_S
130  CHECK_EXIT_CODE
131 
132  getUTC -f ${INPUT_FILE} -d 0 | read -A UTC_S
133  CHECK_EXIT_CODE
134 
135  JTriggerMonitor -f ${INPUT_FILE} -d 0 -Q 3 3>&1 | read -A TRIGGER_MONITOR
136  CHECK_EXIT_CODE
137 
138  set_variable OUTPUT_FILE ${WORKDIR}/KM3NeT_${(l:8::0::0:)DETECTOR_ID}_${(l:8::0::0:)RUN}_trigger.root
139 
140  JTriggerReprocessor \
141  -a ${DETECTOR} \
142  -f ${INPUT_FILE} \
143  -o ${OUTPUT_FILE} \
144  -U \
145  -C -\.\* \
146  -d ${DEBUG}
147  CHECK_EXIT_CODE
148 
149  JPrintTree -f ${OUTPUT_FILE} |& awk '/JDAQEvent/ { print $3 }' | read TRIGGER_REPROCESSOR
150 
151  JTurbot \
152  -f ${INPUT_FILE} \
153  -a ${DETECTOR} \
154  -o /dev/null \
155  -d ${DEBUG} \
156  -Q 3 3>&1 | read -A TURBOT
157  CHECK_EXIT_CODE
158 
159  JSummaryMonitor -f ${INPUT_FILE} -d 0 -Q 3 3>&1 | read -A SUMMARY_MONITOR
160  CHECK_EXIT_CODE
161 
162  JDetectorDB -a ${DETECTOR} -o ${DETECTOR} -WW # update detector file with base modules
163 
164  set_variable ACOUSTICS_DEBUG 1
165 
166  JAcousticsEventBuilder.sh ${DETECTOR} ${RUN}
167 
168  if (( $? == 0 )); then
169 
170  set_variable OUTPUT_FILE $WORKDIR/KM3NeT_${(l:8::0::0:)DETECTOR_ID}_${(l:8::0::0:)RUN}_event.root
171 
172  JPrintResult -f ${OUTPUT_FILE}:'^ACOUSTICS$' -F GetEntries | read -A NUMBER_OF_ACOUSTICS_EVENTS
173  else
174  NUMBER_OF_ACOUSTICS_EVENTS=(0)
175  fi
176 
177  JAHRS.sh ${DETECTOR_ID} ${RUN}
178 
179  if (( $? == 0 )); then
180 
181  set_variable OUTPUT_FILE ${WORKDIR}/KM3NeT_${(l:8::0::0:)DETECTOR_ID}_${(l:8::0::0:)RUN}_ahrs.root
182 
183  JAHRSMonitor \
184  -a ${DETECTOR} \
185  -f ${OUTPUT_FILE} \
186  -c ${WORKDIR}/ahrs_calibration.txt \
187  -q 0.2 \
188  -d ${DEBUG} \
189  -Q 3 3>&1 | read -A NUMBER_OF_AHRS_EVENTS
190  else
191  NUMBER_OF_AHRS_EVENTS=(0)
192  fi
193 
194  # print values
195 
196  printf " %12s" ${GIT_VERSION} >> $QAQC_FILE
197  printf " %12s" ${DAQ_VERSION:-\?} >> $QAQC_FILE
198  printf " %s" ${UUID:-\?} >> $QAQC_FILE
199  printf " %8d" ${DAQ_HEADER[1,2]} >> $QAQC_FILE
200  printf " %9.1f" ${LIVETIME_S[1]} >> $QAQC_FILE
201  printf " %12.1f" ${UTC_S[*]} >> $QAQC_FILE
202 
203  for KEY in ${TRIGGER_PARAMETERS[*]}; do
204 
205  JPrintTriggerParameters -f ${INPUT_FILE} -k $KEY -d 0 | read VALUE
206 
207  printf " %4d" ${VALUE:-0} >> $QAQC_FILE
208  done
209 
210  for KEY in ${DAQ[*]}; do
211 
212  JPrintTree -f ${INPUT_FILE} |& eval awk \'/${KEY}/ \{ print \$3 \}\' | read VALUE
213 
214  printf " %8d" ${VALUE:-0} >> $QAQC_FILE
215  done
216 
217  printf " %8d" ${TRIGGER_REPROCESSOR:-0} >> $QAQC_FILE
218  printf " %8d" ${TRIGGER_MONITOR[*]} >> $QAQC_FILE
219  printf " %2d" ${TURBOT[1,2]} >> $QAQC_FILE
220  printf " %7.5f" ${SUMMARY_MONITOR[1,4]} >> $QAQC_FILE
221  printf " %8.1f" ${SUMMARY_MONITOR[5]} >> $QAQC_FILE
222  printf " %7.0f" ${SUMMARY_MONITOR[6,7]} >> $QAQC_FILE
223  printf " %4d" ${NUMBER_OF_ACOUSTICS_EVENTS[1]} >> $QAQC_FILE
224  printf " %8.3f" ${NUMBER_OF_AHRS_EVENTS[1]} >> $QAQC_FILE
225  printf "\n" >> $QAQC_FILE
226 
227 done
228 
229 rm -rf $WORKDIR
then fatal No hydrophone data file $HYDROPHONE_TXT fi sort gr k
Q(UTCMax_s-UTCMin_s)-livetime_s
*set_variable DETECTOR_ID $argv[1] set_array RUNS $argv[2,-2]
Definition: JDataQuality.sh:24
std::istream & read(std::istream &in, JTestSummary &summary, const char delimiter= ' ')
Read test summary.
then set_variable PMT_FILE set_variable DAQ_FILE set_variable OUTPUT_FILE set_variable DETECTOR else fatal Wrong number of arguments fi set_variable RUNBYRUN file
*fatal Wrong number of arguments esac check_input_file $INPUT_FILE for TIMESLICE in JDAQTimeslice JDAQTimesliceL0 JDAQTimesliceL1 JDAQTimesliceL2 JDAQTimesliceSN
*fatal Wrong number of arguments esac TRIGGER_PARAMETERS
set_variable QAQC_FILE
Q MEAN_Rate_Hz
Definition: JDataQuality.sh:56
o $QUALITY_ROOT d $DEBUG!JPlot1D f
Definition: JDataQuality.sh:66
exit
Definition: JPizza.sh:36
data_type r[M+1]
Definition: JPolint.hh:758
is
Definition: JDAQCHSM.chsm:167
then JCookie sh JDataQuality D $DETECTOR_ID R $RUNS[*] o $QUALITY_TXT d $DEBUG!fi fi JDataQuality f $QUALITY_TXT Q livetime_s
Definition: JDataQuality.sh:49
then echo
static const double C
Physics constants.
then echo Variable JPP_DIR undefined exit fi source $JPP_DIR setenv sh $JPP_DIR &dev null if do_usage *then usage $script< detector identifier > fi case set_variable DETECTOR_ID
Definition: JTDC.sh:11
then echo Variable JPP_DIR undefined exit fi source $JPP_DIR setenv sh $JPP_DIR &dev null set_variable
Definition: JAcoustics.sh:20
do set_variable STRING_TXT awk
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
then rm i $OUTPUT_FILE fi let RUN
set_variable NUMBER_OF_ITERATIONS set_variable EPSILON cat acoustics_fit_parameters txt<< EOF $CONFIGURATION[*]Nmin=3;sigma_s=100.0e-6;stdev=10.0;mestimator=0;fixStrings=0;EOF for STRING in $STRINGS[*];do#fit stretching and(z) position of given string set_variable DETECTOR_TMP ${TMPDIR:-/tmp}/detector_A.datx JEditDetector-a $DETECTOR-o $DETECTOR_TMP-r $STRING JEditDetector-a $DETECTOR-o $DETECTOR-k $STRING for MUL in 0.005 0.001;do DX_M=0.2 for((N=0;$N< $NUMBER_OF_ITERATIONS;++N));do CHI2[3]=$CHI2[1] fitPositionOfString $STRING Z $DX_M fitStretchingOfString $STRING $MUL if(($CHI2[3]-$CHI2[1]< $EPSILON));then break fi done if(($N >=$NUMBER_OF_ITERATIONS));then printf"warning: reached maximum number of iterations %d - converenge %7.3f\n"$N $(($CHI2[3]-$CHI2[1])) fi done JMergeDetector-a $DETECTOR-a $DETECTOR_TMP-o $DETECTOR rm-f $DETECTOR_TMP JConvertDetectorFormat-a $DETECTOR-o $DETECTOR-r-d 0 > &dev null done
Q DAQ
Definition: JDataQuality.sh:53
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
then awk F
* usage
then JConvertDetectorFormat a $DETECTOR[1] o
print
Definition: JConvertDusj.sh:44
set_variable INPUT_FILE
do sput $STRING $FLOOR sget MODULE INPUT_FILES
Definition: JCanberra.sh:73
Q RMS_Rate_Hz
Definition: JDataQuality.sh:57
&set_variable OUTPUT_FILE
then JMuonMCEvt f $INPUT_FILE o $INTERMEDIATE_FILE d
Definition: JMuonPath.sh:47
Q FIFO
Definition: JDataQuality.sh:55
double getLivetime(const std::string &file_name)
Get data taking live time.
then JCalibrateToT a
Definition: JTuneHV.sh:116
then usage $script< input_file >< detector_file > fi set_variable OUTPUT_DIR set_variable SELECTOR JDAQTimesliceL1 set_variable DEBUG case set_variable DEBUG
then display $WORKDIR
Definition: plot-Domino.sh:128
possible values
$WORKDIR ev_configure_domsimulator txt echo process $DOM_SIMULATOR $i $SOURCE_HOST[$index] csh c(setenv ROOTSYS $ROOTSYS &&source $JPP_DIR/setenv.csh $JPP_DIR &&($DOM_SIMULATOR\-u\$NAME\$\-H\$SERVER\$\-M\$LOGGER\$\-d $DEBUG</dev/null > &/dev/null &))'
set_variable DETECTOR
do set_variable INPUT_FILE $WORKDIR KM3NeT_
do set_variable DETECTOR_TXT $WORKDIR detector
data_type v[N+1][M+1]
Definition: JPolint.hh:756
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 source JAcoustics sh $DETECTOR_ID CHECK_EXIT_CODE typeset A TRIPODS get_tripods $WORKDIR tripod txt TRIPODS for EMITTER in
Definition: JCanberra.sh:42
source $JPP_DIR setenv csh $JPP_DIR &dev null eval JShellParser o a A
do echo Generating $dir eval D
Definition: JDrawLED.sh:53
version
Definition: JCalibratePMT.sh:7
esac $JPP_BIN JLogger sh $LOGGER until pgrep JGetMessage</dev/null > dev null
Q HRV
Definition: JDataQuality.sh:52
static const JPBS_t AHRS(3, 4, 3, 4)
PBS of compass
then $DIR JPlotNPE PDG P
Definition: JPlotNPE-PDG.sh:62
Q WR
Definition: JDataQuality.sh:54