Jpp  16.0.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  if [[ ${DETID} =~ ^-?[0-9]+$ ]]; then
88  set_variable DETOID $( getDetector -D ${DETID} -- )
89  else
90  set_variable DETOID DETID
91  fi
92 
93  JAsciiDB \
94  -q pmt_hv_run_settings \
95  -@ "detoid = ${DETOID}" \
96  -@ "run = ${RUNID}" -- > ${WORKDIR}/HVfile.txt
97 
98  set_array HVTABLE 2 ${WORKDIR}/HVfile.txt
99 
100  else
101 
102  if [[ ! ${DETID} =~ ^-?[0-9]+$ ]]; then
103  set_variable DETID $( getDetector -D ${DETID} -- )
104  fi
105 
106  JAsciiDB \
107  -q vendorhv \
108  -@ "detid = ${DETID}" -- > ${WORKDIR}/HVfile.txt
109 
110  set_array HVTABLE 1 ${WORKDIR}/HVfile.txt
111  fi
112 fi
113 
114 
115 if (( 1 )); then
116 
117  timer_stop
118 
119  JEditTuneHV \
120  -f ${INPUT_FILE} \
121  -o ${OUTPUT_FILE} \
122  ${HVTABLE:+-b "${HVTABLE[*]}"} \
123  ${PMTSET:+-P "${PMTSET[*]}"} \
124  -# "login = ${LOGIN}" \
125  -# "locationID = ${LOCATIONID}" \
126  -# "elapsedTime = ${TIMER}" \
127  -d ${DEBUG} --!
128 fi
129 
set_variable LOCATIONID(getLocationID-L ${LOGIN}) if(($
Definition: JEditTuneHV.sh:80
then JLigier sh continue fi cat
Definition: JDAQDriver.sh:51
o $QUALITY_ROOT d $DEBUG!JPlot1D f
Definition: JDataQuality.sh:66
exit
Definition: JPizza.sh:36
then set_array IDENTIFIERS
Definition: JEditTuneHV.sh:56
JDetectorsHelper & getDetector()
Auxiliary function for helper object initialisation.
Definition: JDBToolkit.hh:365
then echo
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:20
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 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
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 JConvertDetectorFormat a $DETECTOR[1] o
set_variable INPUT_FILE
then set_variable RUNID
Definition: JEditTuneHV.sh:67
&set_variable OUTPUT_FILE
then JMuonMCEvt f $INPUT_FILE o $INTERMEDIATE_FILE d
Definition: JMuonPath.sh:47
then usage $script< input_file >< detector_file > fi set_variable OUTPUT_DIR set_variable SELECTOR JDAQTimesliceL1 set_variable DEBUG case set_variable DEBUG
esac timer_start JCookie sh set_variable COOKIE(cat~/.km3netdb_cookie) set_variable LOGIN $
Definition: JEditTuneHV.sh:78
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
do echo Generating $dir eval D
Definition: JDrawLED.sh:53
version
Definition: JCalibratePMT.sh:7
then $DIR JPlotNPE PDG P
Definition: JPlotNPE-PDG.sh:62