9 # ------------------------------------------------------------------------------------------
11 # Utility script to test JCalibrateK40/JFitK40.
13 # ------------------------------------------------------------------------------------------
15 if [ -z $JPP_DIR ]; then
16 echo "Variable JPP_DIR undefined."
20 source $JPP_DIR/setenv.sh $JPP_DIR
23 set_variable WORKDIR ${TMPDIR:-/tmp}/
24 set_variable: FORMAT GRAPHICS_FORMAT gif
25 set_variable+ BATCH GRAPHICS_BATCH -B
28 usage "$script [working directory]"
32 1) set_variable WORKDIR $1;;
35 set_variable DETECTOR $WORKDIR/detector.detx
36 set_variable BACKGROUND_HZ 5e3 440 50 5 0.5
38 set_variable numberOfSlices 6000
43 set_variable detectorType 1
44 set_variable numberOfLines 1
45 set_variable numberOfFloors 1
49 -@ "detectorType = $detectorType" \
50 -@ "numberOfLines = $numberOfLines" \
51 -@ "numberOfFloors = $numberOfFloors" \
59 debug "Generating random background."
61 if ( ! reuse_file $WORKDIR/timeslice.root ); then
63 JRandomTimesliceWriter \
65 -o $WORKDIR/timeslice.root \
68 -P "pmt= 101 0 QE=$QE" \
69 -P "pmt= 101 1 QE=$QE" \
70 -P "pmt= 101 2 QE=$QE" \
71 -P "pmt= 101 1 QE=$QE" \
72 -P "pmt= 101 3 QE=$QE" \
73 -P "pmt= 101 4 QE=$QE" \
74 -P "pmt= 101 5 QE=$QE" \
75 -P "pmt= 101 6 QE=$QE" \
76 -P "pmt= 101 7 QE=$QE" \
77 -P "pmt= 101 8 QE=$QE" \
78 -P "pmt= 101 9 QE=$QE" \
79 -P "pmt= 101 10 QE=$QE" \
80 -P "pmt= 101 11 QE=$QE" \
81 -P "pmt= 101 12 QE=$QE" \
82 -P "pmt= 101 11 QE=$QE" \
83 -P "pmt= 101 13 QE=$QE" \
84 -P "pmt= 101 14 QE=$QE" \
85 -P "pmt= 101 15 QE=$QE" \
86 -P "pmt= 101 16 QE=$QE" \
87 -P "pmt= 101 17 QE=$QE" \
88 -P "pmt= 101 18 QE=$QE" \
89 -P "pmt= 101 19 QE=$QE" \
90 -P "pmt= 101 20 QE=$QE" \
91 -P "pmt= 101 21 QE=$QE" \
92 -P "pmt= 101 22 QE=$QE" \
93 -P "pmt= 101 21 QE=$QE" \
94 -P "pmt= 101 23 QE=$QE" \
95 -P "pmt= 101 24 QE=$QE" \
96 -P "pmt= 101 25 QE=$QE" \
97 -P "pmt= 101 26 QE=$QE" \
98 -P "pmt= 101 27 QE=$QE" \
99 -P "pmt= 101 28 QE=$QE" \
100 -P "pmt= 101 29 QE=$QE" \
101 -P "pmt= 101 30 QE=$QE" \
109 debug "Processing data."
111 if ( ! reuse_file $WORKDIR/trigger_processor.root ); then
115 -f $WORKDIR/timeslice.root \
116 -o $WORKDIR/trigger_processor.root \
118 -@"TMaxLocal_ns=50" \
127 debug "Monitoring data."
130 -f $WORKDIR/trigger_processor.root \
133 -o $WORKDIR/monitor.root \
136 debug "Merging data."
139 -f $WORKDIR/monitor.root \
140 -o $WORKDIR/merge.root \
143 debug "Fitting data."
144 debug "Detector: $DETECTOR"
148 -f $WORKDIR/merge.root \
149 -o $WORKDIR/fit.root \
157 debug "Plotting results"
160 -f $WORKDIR/monitor.root:\.\*2S \
165 -o monitor.$FORMAT $BATCH
171 debug "Plotting standard deviations"
174 -f $WORKDIR/fit.root:\.\*2F \
179 -T "standard deviation" \
180 -o stdev.$FORMAT $BATCH
186 debug "Plotting results for t0"
189 -f $WORKDIR/fit.root:\.\*1t0 \
194 -T "time calibration" \
201 debug "Plotting results for sigma"
204 -f $WORKDIR/fit.root:\.\*1sigma \
209 -T "time resolution" \
210 -o sigma.$FORMAT $BATCH
217 debug "Plotting results for QE"
220 -f $WORKDIR/fit.root:\.\*1QE \