Jpp  18.2.1
the software that should make you happy
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
JEditTuneHV.sh
Go to the documentation of this file.
1 #!/bin/zsh
2 #
3 # \author bjung
4 #
5 version=1.0
6 script=${0##*/}
7 
8 # ------------------------------------------------------------------------------------------------
9 #
10 # Utility script for finding PMT supply voltages corresponding to the nominal gain setting.
11 #
12 # ------------------------------------------------------------------------------------------------
13 
14 
15 if [ -z $JPP_DIR ]; then
16  echo "Variable JPP_DIR undefined."
17  exit
18 fi
19 
20 
21 source $JPP_DIR/setenv.sh $JPP_DIR
22 
23 set_variable: DEBUG CALIBRATION_DEBUG 2
24 set_variable: WORKDIR CALIBRATION_WORKDIR ${TMPDIR:-/tmp}
25 
26 set_variable: DETID EDITTUNEHV_DETID -1
27 set_variable: RUNID EDITTUNEHV_RUNID -1
28 set_variable: OUTPUT_FILE EDITTUNEHV_OUTPUT_FILE "HVtuningEdit.json"
29 
30 
31 if do_usage $*; then
32  usage "$script <input file> <output files> [detector identifier] [run number] [PMT set]\n\n" \
33  "Note: The operation performed depends on the input parameters.\n" \
34  " Possible operations are to update according to:\n" \
35  " - the high-voltage settings corresponding to a specific DAQ run\n" \
36  " if both detector ID and run number are specified.\n" \
37  " - the vendor high-voltage settings\n" \
38  " if the detector ID is specified, but the run number is left unspecified.\n" \
39  " - manually specifiable values\n" \
40  " if both detector ID and run number are left unspecified.\n\n" \
41  " A set of PMTs on which the operation should be performed can be optionally\n" \
42  " specified via the command line."
43 fi
44 
45 case $# in
50 
51  set_array IDENTIFIERS ""
52  set_array PMTSET ""
53 
54  for ARGUMENT in ${argv[3,-1]}; do
55  if [[ ${ARGUMENT} =~ ^-?[0-9]+$ ]]; then
56  set_array IDENTIFIERS ${IDENTIFIERS[@]} ${ARGUMENT}
57  else
58  set_array PMTSET ${PMTSET[@]} ${ARGUMENT}
59  fi
60  done
61 
62  if (( ${#IDENTIFIERS} > 0 )); then
64  fi
65 
66  if (( ${#IDENTIFIERS} > 1 )); then
68  fi
69  ;;
70 esac
71 
73 
74 
75 # Retrieve cookie
76 JCookie.sh
77 
78 set_variable COOKIE $(cat ~/.km3netdb_cookie)
79 set_variable LOGIN ${${COOKIE#*_}%%_*}
80 set_variable LOCATIONID $(getLocationID -L ${LOGIN})
81 
82 
83 if (( ${DETID} > 0 )); then
84 
85  if (( ${RUNID} > 0 )); then
86 
87  set_variable DETOID $( getDetector -D ${DETID} -- )
88 
89  JAsciiDB \
90  -q pmt_hv_run_settings \
91  -@ "detoid = ${DETOID}" \
92  -@ "run = ${RUNID}" -- > ${WORKDIR}/HVfile.txt
93 
94  set_array HVTABLE 2 ${WORKDIR}/HVfile.txt
95 
96  else
97 
98  JAsciiDB \
99  -q vendorhv \
100  -@ "detid = ${DETID}" -- > ${WORKDIR}/HVfile.txt
101 
102  set_array HVTABLE 1 ${WORKDIR}/HVfile.txt
103  fi
104 fi
105 
106 
107 if (( 1 )); then
108 
109  timer_stop
110 
111  JEditTuneHV \
112  -f ${INPUT_FILE} \
113  -o ${OUTPUT_FILE} \
114  ${HVTABLE:+-b "${HVTABLE[*]}"} \
115  ${PMTSET:+-P "${PMTSET[*]}"} \
116  -# "login = ${LOGIN}" \
117  -# "locationID = ${LOCATIONID}" \
118  -# "elapsedTime = ${TIMER}" \
119  -d ${DEBUG} --!
120 fi
121 
set_variable LOCATIONID(getLocationID-L ${LOGIN}) if(($
Definition: JEditTuneHV.sh:80
version
Definition: JEditTuneHV.sh:5
then JLigier sh continue fi cat
Definition: JDAQDriver.sh:51
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 set_array IDENTIFIERS
Definition: JEditTuneHV.sh:56
then
Definition: datalogs.sh:31
JDetectorsHelper & getDetector()
Auxiliary function for helper object initialisation.
Definition: JDBToolkit.hh:378
then fatal Wrong number of arguments fi JConvertDetectorFormat a o
then set_variable DETID
Definition: JEditTuneHV.sh:63
then timer_start(JRandomTimesliceWriter-a ${DETECTOR}-o ${PIPE}-n ${NUMBER_OF_SLICES}-P ${PMT_FILE}-d ${DEBUG}-S ${SEED}-B"$BACKGROUND_HZ"-N"$RECYCLING"--!&&for((i=0;$i!=10;++i));do;echo 'EOF' > $PIPE;usleep 100000;done &&rm-f $PIPE)&JTimesliceReprocessor-a $
then echo Variable JPP_DIR undefined exit fi source $JPP_DIR setenv sh $JPP_DIR &dev null set_variable
Definition: JAcoustics.sh:21
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
then set_variable RUNID
Definition: JEditTuneHV.sh:67
then JMuonMCEvt f $INPUT_FILE o $INTERMEDIATE_FILE d
Definition: JMuonPath.sh:47
esac timer_start JCookie sh set_variable COOKIE(cat~/.km3netdb_cookie) set_variable LOGIN $
Definition: JEditTuneHV.sh:78
then eval ls $DIR $ID $TYPE _
Definition: getArchive.sh:104
then echo
Definition: JQAQC.sh:90
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
do echo Generating $dir eval D
Definition: JDrawLED.sh:53
then $DIR JPlotNPE PDG P
Definition: JPlotNPE-PDG.sh:62
esac done
Definition: JAddHDE.sh:21
#define DEBUG(A)
Message macros.
Definition: JMessage.hh:62