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 /tmp/
25 if ( do_usage $* ); then
26 usage "$script [working directory]"
33 set_variable DETECTOR $WORKDIR/detector.detx
34 set_variable BACKGROUND_HZ 5e3 440 50 5 0.5
36 set_variable numberOfSlices 6000
41 set_variable detectorType 1
42 set_variable numberOfLines 1
43 set_variable numberOfFloors 1
47 -@ "detectorType = $detectorType" \
48 -@ "numberOfLines = $numberOfLines" \
49 -@ "numberOfFloors = $numberOfFloors" \
57 debug "Generating random background."
59 if ( ! reuse_file $WORKDIR/timeslice.root ); then
61 JRandomTimesliceWriter \
63 -o $WORKDIR/timeslice.root \
66 -P "pmt= 101 0 QE=$QE" \
67 -P "pmt= 101 1 QE=$QE" \
68 -P "pmt= 101 2 QE=$QE" \
69 -P "pmt= 101 1 QE=$QE" \
70 -P "pmt= 101 3 QE=$QE" \
71 -P "pmt= 101 4 QE=$QE" \
72 -P "pmt= 101 5 QE=$QE" \
73 -P "pmt= 101 6 QE=$QE" \
74 -P "pmt= 101 7 QE=$QE" \
75 -P "pmt= 101 8 QE=$QE" \
76 -P "pmt= 101 9 QE=$QE" \
77 -P "pmt= 101 10 QE=$QE" \
78 -P "pmt= 101 11 QE=$QE" \
79 -P "pmt= 101 12 QE=$QE" \
80 -P "pmt= 101 11 QE=$QE" \
81 -P "pmt= 101 13 QE=$QE" \
82 -P "pmt= 101 14 QE=$QE" \
83 -P "pmt= 101 15 QE=$QE" \
84 -P "pmt= 101 16 QE=$QE" \
85 -P "pmt= 101 17 QE=$QE" \
86 -P "pmt= 101 18 QE=$QE" \
87 -P "pmt= 101 19 QE=$QE" \
88 -P "pmt= 101 20 QE=$QE" \
89 -P "pmt= 101 21 QE=$QE" \
90 -P "pmt= 101 22 QE=$QE" \
91 -P "pmt= 101 21 QE=$QE" \
92 -P "pmt= 101 23 QE=$QE" \
93 -P "pmt= 101 24 QE=$QE" \
94 -P "pmt= 101 25 QE=$QE" \
95 -P "pmt= 101 26 QE=$QE" \
96 -P "pmt= 101 27 QE=$QE" \
97 -P "pmt= 101 28 QE=$QE" \
98 -P "pmt= 101 29 QE=$QE" \
99 -P "pmt= 101 30 QE=$QE" \
107 debug "Processing data."
109 if ( ! reuse_file $WORKDIR/trigger_processor.root ); then
113 -f $WORKDIR/timeslice.root \
114 -o $WORKDIR/trigger_processor.root \
116 -@"TMaxLocal_ns=50" \
125 debug "Monitoring data."
128 -f $WORKDIR/trigger_processor.root \
131 -o $WORKDIR/monitor.root \
134 debug "Merging data."
137 -f $WORKDIR/monitor.root \
138 -o $WORKDIR/merge.root \
141 debug "Fitting data."
142 debug "Detector: $DETECTOR"
146 -f $WORKDIR/merge.root \
147 -o $WORKDIR/fit.root \
155 debug "Plotting results"
158 -f $WORKDIR/monitor.root:\.\*2S \
169 debug "Plotting standard deviations"
172 -f $WORKDIR/fit.root:\.\*2F \
177 -T "standard deviation" \
184 debug "Plotting results for t0"
187 -f $WORKDIR/fit.root:\.\*1t0 \
192 -T "time calibration" \
199 debug "Plotting results for sigma"
202 -f $WORKDIR/fit.root:\.\*1sigma \
207 -T "time resolution" \
215 debug "Plotting results for QE"
218 -f $WORKDIR/fit.root:\.\*1QE \