Jpp test-rotations-old
the software that should make you happy
Loading...
Searching...
No Matches
JTunePMTThreshold.sh
Go to the documentation of this file.
1#!/usr/bin/env zsh
2#
3# \author mdejong
4#
5script=${0##*/}
6
7# ------------------------------------------------------------------------------------------
8#
9# Script to run tune PMT thresholds.
10#
11# ------------------------------------------------------------------------------------------
12
13if [ -z $JPP_DIR ]; then
14 echo "Variable JPP_DIR undefined."
15 exit
16fi
17source $JPP_DIR/setenv.sh $JPP_DIR
18
19set_variable: JDAQ_TIMESLICE CALIBRATION_DAQ_TIMESLICE JDAQTimesliceL0
20set_variable: WORKDIR CALIBRATION_WORKDIR ./
21set_variable: TOT_RANGE CALIBRATION_TOT_RANGE "0 8"
22set_variable: FRACTION CALIBRATION_FRACTION 0.5
23set_variable: DEBUG CALIBRATION_DEBUG 2
24
25if do_usage $*; then
26 usage "$script <detector file> (input file)+ <PMT threshold file (JSon format)>"\
27 "\nAuxiliary script to tune PMT thresholds."
28fi
29
30if (( $# < 3 )); then
31 fatal "Wrong number of arguments."
32fi
33
34set_variable DETECTOR $argv[1]
35set_array INPUT_FILES $argv[2,-2]
36set_variable JSON_FILE $argv[-1]
37
38JEditDetector \
39 -a $DETECTOR \
40 -P "-1 -1 set HIGH_RATE_VETO_DISABLE" \
41 -o $WORKDIR/detector.datx \
42 -d 1
43
44set_variable DETECTOR $WORKDIR/detector.datx
45
46OUTPUT_FILES=()
47
48for INPUT_FILE in $INPUT_FILES[*]; do
49
50 JPrintDAQHeader -f $INPUT_FILE -d 0 | read DETECTOR_ID RUN FRAME_INDEX TIMESLICE_START
51
52 set_variable OUTPUT_FILE $WORKDIR/KM3NeT_${(l:8::0::0:)DETECTOR_ID}_${(l:8::0::0:)RUN}_monitor.root
53
54 if [[ ! -f $OUTPUT_FILE ]]; then
55
56 echo Processing $INPUT_FILE
57
58 JCalibrateToT \
59 -a $DETECTOR \
60 -f $INPUT_FILE \
61 -o $OUTPUT_FILE \
62 -C $JDAQ_TIMESLICE \
63 -d $DEBUG
64 fi
65
66 OUTPUT_FILES+=($OUTPUT_FILE)
67
68done
69
70JTunePMTThreshold \
71 -f "$OUTPUT_FILES" \
72 -x "$TOT_RANGE" \
73 -t $FRACTION \
74 -o $JSON_FILE \
75 -d $DEBUG --!