Jpp  debug
the software that should make you happy
JShowerPostfit.sh
Go to the documentation of this file.
1 #!/bin/zsh
2 #
3 # \author adomi
4 #
5 script=${0##*/}
6 
7 # ------------------------------------------------------------------------------------------
8 #
9 # Utility script to plot fit results.
10 #
11 # ------------------------------------------------------------------------------------------
12 
13 
14 if [ -z $JPP_DIR ]; then
15  echo "Variable JPP_DIR undefined."
16  exit
17 fi
18 
19 
20 source $JPP_DIR/setenv.sh $JPP_DIR
21 
22 
23 # list of applications in the processing chain
24 
25 APPLICATIONS=(prefit pointsimplex positionfit energyprefit directionprefit completefit)
26 
27 set_variable: DEBUG RECONSTRUCTION_DEBUG 1
28 set_variable: NUMBER_OF_EVENTS RECONSTRUCTION_NUMBER_OF_EVENTS $((2**31))
29 
30 set_variable: PALETTE GRAPHICS_PALETTE 57
31 set_variable: FORMAT GRAPHICS_FORMAT gif
32 set_variable+ BATCH GRAPHICS_BATCH -B
33 
34 set_variable OPTION N
35 set_variable MUONS ""
36 set_variable WORKDIR ./
37 
38 if 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."
42 fi
43 
44 case $# 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]}
54 esac
55 
56 
57 # Number of prefits as a function of application (0 = all)
58 
59 typeset -A NUMBER_OF_FIT
60 
61 NUMBER_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 
71 typeset -A ENUMERATION
72 
73 ENUMERATION=(
74  prefit 101
75  pointsimplex 106
76  positionfit 102
77  energyprefit 105
78  directionprefit 107
79  completefit 103)
80 
81 # user interaction
82 
83 for 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
90 done
91 
92 
93 # processing
94 
95 for 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
111 done
112 
113 
114 if (( 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 
123 fi
124 
125 
126 if (( 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 
138 fi
139 
140 
141 if (( 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 
156 fi
157 
158