Jpp master_rocky-44-g75b7c4f75
the software that should make you happy
Loading...
Searching...
No Matches
JShowerPostfit.sh
Go to the documentation of this file.
1#!/bin/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 energyprefit 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 N
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 1
63 pointsimplex 1
64 positionfit 1
65 energyprefit 1
66 directionprefit 1
67 completefit 1)
68
69# Fit application identifier
70
71typeset -A ENUMERATION
72
73ENUMERATION=(
74 prefit 101
75 pointsimplex 106
76 positionfit 102
77 energyprefit 105
78 directionprefit 107
79 completefit 103)
80
81# user interaction
82
83for APP in $APPLICATIONS[*]; do
84
85 set_variable OUTPUT_FILE $WORKDIR/jshowerpostfit\[${APP}\].root
86
87 if [[ -f $OUTPUT_FILE ]]; then
88 rm -i $OUTPUT_FILE
89 fi
90done
91
92
93# processing
94
95for APP in $APPLICATIONS[*]; do
96
97 set_variable OUTPUT_FILE $WORKDIR/jshowerpostfit\[${APP}\].root
98
99 if [[ ! -f $OUTPUT_FILE ]]; then
100
101 JShowerPostfit \
102 -f "${INPUT_FILES[*]}" \
103 -o $OUTPUT_FILE \
104 -n ${NUMBER_OF_EVENTS} \
105 -N ${NUMBER_OF_FIT[${APP}]} \
106 -A ${ENUMERATION[${APP}]} \
107 -O ${OPTION} \
108 ${${MUONS:+-I}:--w} \
109 -d ${DEBUG} --!
110 fi
111done
112
113
114if (( 1 )); then
115
116 JPlot1D \
117 -f $WORKDIR/jshowerpostfit\[completefit\].root:ha \
118 -> "angle wrt selected fermion [deg]" \
119 -\^ "number of events [a.u.]" \
120 -s "111111" \
121 -o $WORKDIR/angle.$FORMAT $BATCH
122
123fi
124
125
126if (( 1 )); then
127
128 QUANTILES="0.33 0.5 0.66"
129
130 for APP in prefit pointsimplex positionfit energyprefit directionprefit completefit; do
131
132 JQuantiles2D \
133 -f $WORKDIR/jshowerpostfit\[${APP}\].root:h2 \
134 -Q "$QUANTILES" \
135 -o $WORKDIR/jshowerquantiles\[${APP}\].root
136 done
137
138fi
139
140
141if (( 1 )); then
142
143 if [[ $OPTION =~ "LOG" ]]; then
144 set_variable LOGX -XX
145 set_variable LOGY -YY
146 fi
147
148 JPlot2D \
149 -f $WORKDIR/jshowerpostfit\[completefit\].root:ee \
150 -O COLZ -p $PALETTE \
151 $LOGX $LOGY -Z -T "" \
152 -> "E_{true} [GeV]" \
153 -< "E_{fit} [GeV]" \
154 -o $WORKDIR/jshoweree.$FORMAT $BATCH
155
156fi
157
158