3# \author mdejong, bofearraigh
7# ------------------------------------------------------------------------------------------
9# Utility script to plot fit results of track reconstruction chain for Monte Carlo data.
11# ------------------------------------------------------------------------------------------
14if [ -z $JPP_DIR ]; then
15 echo "Variable JPP_DIR undefined."
20source $JPP_DIR/setenv.sh $JPP_DIR
23# list of applications in the processing chain
25APPLICATIONS=(prefit simplex gandalf energy start)
27set_variable: DEBUG RECONSTRUCTION_DEBUG 2
28set_variable: WORKDIR RECONSTRUCTION_WORKDIR ./
29set_variable: NUMBER_OF_EVENTS RECONSTRUCTION_NUMBER_OF_EVENTS $((2**31))
30set_variable: OPTION RECONSTRUCTION_OPTION LOGN
31set_variable: PRIMARY RECONSTRUCTION_PRIMARY muon
32set_variable+ EXECUTOR RECONSTRUCTION_BACKGROUND nohup
33set_variable+ BACKGROUND RECONSTRUCTION_BACKGROUND >\& \$APP.log \&
35set_variable: PALETTE GRAPHICS_PALETTE 57
36set_variable: FORMAT GRAPHICS_FORMAT gif
37set_variable+ BATCH GRAPHICS_BATCH -B
40 usage "$script (input file)+"\
41 "\nThe option can be LINE, LOGE, LINN or LOGN and the primary muon or neutrino,"\
42 "\nwhere E refers to the energy of the primary and N refers to the number of optical modules with a triggered hit."
46 fatal "Wrong number of arguments"
49set_array INPUT_FILES ${argv[*]}
51# Number of prefits as a function of application (0 = all)
53typeset -A NUMBER_OF_FIT
55NUMBER_OF_FIT=(prefit 0
61# Fit application identifier
72 LINE) set_variable LABEL "E [GeV]";
76 set_variable E_E "E_{fit} - E_{#mu} [GeV]";;
77 LOGE) set_variable LABEL "E [GeV]";
79 set_variable LOGX -XX;
80 set_variable LOGY -YY;
81 set_variable E_E "log10(E_{fit}/E_{#mu})";;
82 LINN) set_variable LABEL "number of modules";
84 set_variable LOGX -XX;
85 set_variable LOGY -YY;
86 set_variable E_E "log10(E_{fit}/E_{#mu})";;
87 LOGN) set_variable LABEL "number of modules";
88 set_variable LOG -XXX;
89 set_variable LOGX -XX;
90 set_variable LOGY -YY;
91 set_variable E_E "log10(E_{fit}/E_{#mu})";;
92 *) fatal "Invalid option $OPTION"
98for APP in $APPLICATIONS[*]; do
100 set_variable OUTPUT_FILE ${WORKDIR}/postfit\[${APP}\].root
102 if [[ -f $OUTPUT_FILE ]]; then
110for APP in $APPLICATIONS[*]; do
112 set_variable OUTPUT_FILE $WORKDIR/postfit\[${APP}\].root
114 if [[ ! -f $OUTPUT_FILE ]]; then
118 -f\"${INPUT_FILES[*]}\" \
119 -o\"${OUTPUT_FILE}\" \
120 -n ${NUMBER_OF_EVENTS} \
121 -N ${NUMBER_OF_FIT[${APP}]} \
122 -A ${ENUMERATION[${APP}]} \
125 -d ${DEBUG} --! $BACKGROUND
134 -f $WORKDIR/postfit\[prefit\].root:hx \
135 -f $WORKDIR/postfit\[simplex\].root:hx \
136 -f $WORKDIR/postfit\[gandalf\].root:hx \
138 -\^ "number of events [a.u.]" \
141 -o $WORKDIR/angle.$FORMAT $BATCH
146 QUANTILES="0.33 0.5 0.66"
148 for APP in prefit simplex gandalf; do
151 -f $WORKDIR/postfit\[${APP}\].root:h2 \
153 -o $WORKDIR/quantiles\[${APP}\].root
157 -f $WORKDIR/quantiles\[prefit\].root:h21 \
158 -f $WORKDIR/quantiles\[simplex\].root:h21 \
159 -f $WORKDIR/quantiles\[gandalf\].root:h21 \
161 -\^ "resolution [deg]" \
167 -o $WORKDIR/resolution.$FORMAT $BATCH
170 -f $WORKDIR/quantiles\[gandalf\].root:h20 \
171 -f $WORKDIR/quantiles\[gandalf\].root:h21 \
172 -f $WORKDIR/quantiles\[gandalf\].root:h22 \
174 -\^ "resolution [deg]" \
180 -o $WORKDIR/gandalf.$FORMAT $BATCH
186 -f $WORKDIR/postfit\[energy\].root:E_0 \
187 -f $WORKDIR/postfit\[energy\].root:E_1 \
188 -f $WORKDIR/postfit\[energy\].root:E_2 \
189 -\^ "number of events [a.u.]" \
190 -> "E_{#mu} [GeV]" $LOGX \
192 -o $WORKDIR/energy.$FORMAT $BATCH
198 -f $WORKDIR/postfit\[energy\].root:ExE \
203 -f $WORKDIR/pdf.root:ExE \
204 -O COLZ -p $PALETTE \
205 -> "E_{#mu} [GeV]" $LOGX \
206 -< "E_{fit} [GeV]" $LOGY \
209 -o $WORKDIR/ee.$FORMAT $BATCH
211 rm -f $WORKDIR/pdf.root
217 -f $WORKDIR/postfit\[energy\].root:E_E \
218 -o $WORKDIR/fit.root \
219 -F "[0]*exp(-0.5*(x-[1])*(x-[1])/([2]*[2]))" \
220 -@ "p0 = 0.8*GetMaximum" \
225 -f $WORKDIR/fit.root:E_E \
227 -T "" -o $WORKDIR/er.$FORMAT $BATCH
229 rm -f $WORKDIR/fit.root
235 -f $WORKDIR/postfit\[energy\].root:Va \
236 -O COLZ -p $PALETTE \
240 -Z -T "" -o $WORKDIR/ha.$FORMAT $BATCH
247 -f $WORKDIR/postfit\[energy\].root:Vb \
248 -O COLZ -p $PALETTE \
252 -Z -T "" -o $WORKDIR/hb.$FORMAT $BATCH
258 -f $WORKDIR/postfit\[energy\].root:hz0 \
259 -f $WORKDIR/postfit\[energy\].root:hz1 \
261 -\^ "number of events [a.u.]" \
263 -o $WORKDIR/z.$FORMAT $BATCH