Jpp test-rotations-old
the software that should make you happy
Loading...
Searching...
No Matches
JShowerPostfit.sh
Go to the documentation of this file.
1#!/usr/bin/env zsh
2#
3# \author adomi
4#
5script=${0##*/}
6
7# ------------------------------------------------------------------------------------------
8#
9# Utility script to plot fit results.
10#
11# ------------------------------------------------------------------------------------------
12
13
14if [ -z $JPP_DIR ]; then
15 echo "Variable JPP_DIR undefined."
16 exit
17fi
18
19
20source $JPP_DIR/setenv.sh $JPP_DIR
21
22
23# list of applications in the processing chain
24
25APPLICATIONS=(prefit pointsimplex positionfit directionprefit completefit)
26
27set_variable: DEBUG RECONSTRUCTION_DEBUG 1
28set_variable: NUMBER_OF_EVENTS RECONSTRUCTION_NUMBER_OF_EVENTS $((2**31))
29
30set_variable: PALETTE GRAPHICS_PALETTE 57
31set_variable: FORMAT GRAPHICS_FORMAT gif
32set_variable+ BATCH GRAPHICS_BATCH -B
33
34set_variable OPTION E
35set_variable MUONS ""
36set_variable WORKDIR ./
37
38if do_usage $*; then
39 usage "$script <input file> [option [muons [working directory]]]\n" \
40 "Where option can be N, E, LINE, LOGE.\n" \
41 "Note that if more than one input file is specified, all other arguments must be provided."
42fi
43
44case $# in
45 4) set_variable WORKDIR $4;&
46 3) set_variable MUONS $3;&
47 2) set_variable OPTION $2;&
48 1) set_array INPUT_FILES $1;;
49 0) fatal "Wrong number of arguments";;
50 *) set_array INPUT_FILES ${argv[1,-4]}
51 set_variable OPTION ${argv[-3]}
52 set_variable MUONS ${argv[-2]}
53 set_variable WORKDIR ${argv[-1]}
54esac
55
56
57# Number of prefits as a function of application (0 = all)
58
59typeset -A NUMBER_OF_FIT
60
61NUMBER_OF_FIT=(
62 prefit 0
63 pointsimplex 100
64 positionfit 1
65 directionprefit 4
66 completefit 1)
67
68# Fit application identifier
69
70typeset -A ENUMERATION
71
72ENUMERATION=(
73 prefit 101
74 pointsimplex 106
75 positionfit 102
76 directionprefit 107
77 completefit 103)
78
79# user interaction
80
81for APP in $APPLICATIONS[*]; do
82
83 set_variable OUTPUT_FILE $WORKDIR/jshowerpostfit\[${APP}\].root
84
85 if [[ -f $OUTPUT_FILE ]]; then
86 rm -i $OUTPUT_FILE
87 fi
88done
89
90
91# processing
92
93for APP in $APPLICATIONS[*]; do
94
95 set_variable OUTPUT_FILE $WORKDIR/jshowerpostfit\[${APP}\].root
96
97 if [[ ! -f $OUTPUT_FILE ]]; then
98
99 JShowerPostfit \
100 -f "${INPUT_FILES[*]}" \
101 -o $OUTPUT_FILE \
102 -n ${NUMBER_OF_EVENTS} \
103 -N ${NUMBER_OF_FIT[${APP}]} \
104 -A ${ENUMERATION[${APP}]} \
105 -O ${OPTION} \
106 ${${MUONS:+-I}:--w} \
107 -d ${DEBUG} --!
108 fi
109done
110
111
112if (( 1 )); then
113
114 JPlot1D \
115 -f $WORKDIR/jshowerpostfit\[prefit\].root:hd \
116 -f $WORKDIR/jshowerpostfit\[pointsimplex\].root:hd \
117 -f $WORKDIR/jshowerpostfit\[positionfit\].root:hd \
118 -> "position wrt selected fermion [m]" \
119 -\^ "number of events [a.u.]" \
120 -L TR -T "" \
121 -o $WORKDIR/position.$FORMAT $BATCH
122
123 JPlot1D \
124 -f $WORKDIR/jshowerpostfit\[directionprefit\].root:ha \
125 -f $WORKDIR/jshowerpostfit\[completefit\].root:ha \
126 -> "angle wrt selected fermion [deg]" \
127 -\^ "number of events [a.u.]" \
128 -L TR -T "" \
129 -o $WORKDIR/angle.$FORMAT $BATCH
130
131
132fi
133
134
135if (( 1 )); then
136
137 QUANTILES="0.33 0.5 0.66"
138
139 for APP in prefit pointsimplex positionfit; do
140 JQuantiles2D \
141 -f $WORKDIR/jshowerpostfit\[${APP}\].root:h3 \
142 -Q "$QUANTILES" \
143 -o $WORKDIR/jshowerquantiles\[${APP}\].root
144 done
145
146 for APP in directionprefit completefit; do
147
148 JQuantiles2D \
149 -f $WORKDIR/jshowerpostfit\[${APP}\].root:h2 \
150 -Q "$QUANTILES" \
151 -o $WORKDIR/jshowerquantiles\[${APP}\].root
152 done
153
154 JPlot1D \
155 -f $WORKDIR/jshowerquantiles\[prefit\].root:h31 \
156 -f $WORKDIR/jshowerquantiles\[pointsimplex\].root:31 \
157 -f $WORKDIR/jshowerquantiles\[positionfit\].root:h31 \
158 -> "E[GeV]" \
159 -\^ "resolution (reco jshower) [deg]" \
160 -y "1 1e2" \
161 -XX \
162 -Y \
163 -L TR -T "" \
164 -o $WORKDIR/resolution_pos.$FORMAT $BATCH
165
166 JPlot1D \
167 -f $WORKDIR/jshowerquantiles\[directionprefit\].root:h21 \
168 -f $WORKDIR/jshowerquantiles\[completefit\].root:h21 \
169 -> "E[GeV]" \
170 -\^ "resolution (reco jshower) [deg]" \
171 -y "1 1e2" \
172 -Y \
173 -XX \
174 -L TR -T "" \
175 -o $WORKDIR/resolution_angle.$FORMAT $BATCH
176fi
177
178
179if (( 1 )); then
180
181 if [[ $OPTION =~ "LOG" ]]; then
182 set_variable LOGX -XX
183 set_variable LOGY -YY
184 fi
185
186 JPlot2D \
187 -f $WORKDIR/jshowerpostfit\[completefit\].root:ee \
188 -O COLZ -p $PALETTE \
189 $LOGX $LOGY -Z -T "" \
190 -> "log E_{true} [GeV]" \
191 -< "log E_{fit} [GeV]" \
192 -o $WORKDIR/jshoweree.$FORMAT $BATCH
193
194fi
195
196