Jpp  18.0.0-rc.2
the software that should make you happy
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
JMuonPostfit.sh
Go to the documentation of this file.
1 #!/bin/zsh
2 #
3 # \author mdejong, bofearraigh
4 #
5 script=${0##*/}
6 
7 # ------------------------------------------------------------------------------------------
8 #
9 # Utility script to plot fit results of track reconstruction chain for Monte Carlo data.
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 simplex gandalf energy start)
26 
30 set_variable: PALETTE GRAPHICS_PALETTE 57
31 set_variable: FORMAT GRAPHICS_FORMAT gif
32 set_variable+ BATCH GRAPHICS_BATCH -B
33 
34 if do_usage $*; then
35  usage "$script <input file> [option [primary [working directory]]]"\
36  "\nWhere option can be N, E, LINE, LOGE."\
37  "\nNote that if more than one input file is specified, all other arguments must be provided."
38 fi
39 
40 case $# in
41  4) set_variable WORKDIR $4;&
44  1) set_array INPUT_FILES $1;;
45  0) fatal "Wrong number of arguments";;
46  *) set_array INPUT_FILES ${argv[1,-4]}
47  set_variable OPTION ${argv[-3]}
48  set_variable PRIMARY ${argv[-2]}
49  set_variable WORKDIR ${argv[-1]}
50 esac
51 
52 # Number of prefits as a function of application (0 = all)
53 
54 typeset -A NUMBER_OF_FIT
55 
56 NUMBER_OF_FIT=( \
57  prefit 0 \
58  simplex 0 \
59  gandalf 1 \
60  energy 1 \
61  start 1)
62 
63 
64 # Fit application identifier
65 
66 typeset -A ENUMERATION
67 
68 ENUMERATION=( \
69  prefit 1 \
70  simplex 2 \
71  gandalf 3 \
72  energy 4 \
73  start 5)
74 
75 case $OPTION in
76  E) set_variable LABEL "E [GeV]";
80  set_variable E_E "log10(E_{fit}/E_{#mu})";;
81  LINE) set_variable LABEL "E [GeV]";
85  set_variable E_E "E_{fit} - E_{#mu} [GeV]";;
86  LOGE) set_variable LABEL "E [GeV]";
87  set_variable LOG -XX;
88  set_variable LOGX -XX;
89  set_variable LOGY -YY;
90  set_variable E_E "log10(E_{fit}/E_{#mu})";;
91  N) set_variable LABEL "number of modules";
93  set_variable LOGX -XX;
94  set_variable LOGY -YY;
95  set_variable E_E "log10(E_{fit}/E_{#mu})";;
96  *) fatal "Invalid option $OPTION"
97 esac
98 
99 
100 # user interaction
101 
102 for APP in $APPLICATIONS[*]; do
103 
104  set_variable OUTPUT_FILE $WORKDIR/postfit\[${APP}\].root
105 
106  if [[ -f $OUTPUT_FILE ]]; then
107  rm -i $OUTPUT_FILE
108  fi
109 done
110 
111 
112 # processing
113 
114 for APP in $APPLICATIONS[*]; do
115 
116  set_variable OUTPUT_FILE $WORKDIR/postfit\[${APP}\].root
117 
118  if [[ ! -f $OUTPUT_FILE ]]; then
119 
120  JMuonPostfit \
121  -f"${INPUT_FILES[*]}" \
122  -o ${OUTPUT_FILE} \
123  -N ${NUMBER_OF_FIT[${APP}]} \
124  -A ${ENUMERATION[${APP}]} \
125  -O ${OPTION} \
126  -p ${PRIMARY} \
127  -d ${DEBUG} --!
128  fi
129 done
130 
131 if (( 1 )); then
132 
133  JPlot1D \
134  -f $WORKDIR/postfit\[prefit\].root:hx \
135  -f $WORKDIR/postfit\[simplex\].root:hx \
136  -f $WORKDIR/postfit\[gandalf\].root:hx \
137  -\> "angle [deg]" \
138  -\^ "number of events [a.u.]" \
139  -XX \
140  -L TR -T "" \
141  -o $WORKDIR/angle.$FORMAT $BATCH
142 fi
143 
144 if (( 1 )); then
145 
146  QUANTILES="0.33 0.5 0.66"
147 
148  for APP in prefit simplex gandalf; do
149 
150  JQuantiles2D \
151  -f $WORKDIR/postfit\[${APP}\].root:h2 \
152  -Q "$QUANTILES" \
153  -o $WORKDIR/quantiles\[${APP}\].root
154  done
155 
156  JPlot1D \
157  -f $WORKDIR/quantiles\[prefit\].root:h21 \
158  -f $WORKDIR/quantiles\[simplex\].root:h21 \
159  -f $WORKDIR/quantiles\[gandalf\].root:h21 \
160  -\> "$LABEL" $LOG \
161  -\^ "resolution (reco muon) [deg]" \
162  -y "1e-2 1e2" \
163  -Y \
164  -L TR -T "" \
165  -o $WORKDIR/resolution.$FORMAT $BATCH
166 fi
167 
168 if (( 1 )); then
169 
170  JPlot1D \
171  -f $WORKDIR/postfit\[energy\].root:E_0 \
172  -f $WORKDIR/postfit\[energy\].root:E_1 \
173  -f $WORKDIR/postfit\[energy\].root:E_2 \
174  -\^ "number of events [a.u.]" \
175  -\> "E_{#mu} [GeV]" $LOGX \
176  -T "" \
177  -o $WORKDIR/energy.$FORMAT $BATCH
178 fi
179 
180 if (( 1 )); then
181 
182  JConvertToPDF2D \
183  -f $WORKDIR/postfit\[energy\].root:ExE \
184  -O NY \
185  -o $WORKDIR/pdf.root
186 
187  JPlot2D \
188  -f $WORKDIR/pdf.root:ExE \
189  -O COLZ -p $PALETTE \
190  -\> "E_{#mu} [GeV]" $LOGX \
191  -\< "E_{fit} [GeV]" $LOGY \
192  -Z \
193  -T "" \
194  -o $WORKDIR/ee.$FORMAT $BATCH
195 fi
196 
197 if (( 1 )); then
198 
199  JFit \
200  -f $WORKDIR/postfit\[energy\].root:E_E \
201  -o $WORKDIR/fit.root \
202  -F "[0]*exp(-0.5*(x-[1])*(x-[1])/([2]*[2]))" \
203  -@ "p0 = 0.8*GetMaximum" \
204  -@ "p1 = GetMean" \
205  -@ "p2 = GetRMS"
206 
207  JPlot1D \
208  -f $WORKDIR/fit.root:E_E \
209  -\> "$E_E" \
210  -T "" -o $WORKDIR/er.$FORMAT $BATCH
211 fi
212 
213 if (( 1 )); then
214 
215  JPlot2D \
216  -f $WORKDIR/postfit\[energy\].root:Va \
217  -O COLZ -p $PALETTE \
218  -\> "R^{2} [m^{2}]" \
219  -\< "z [m]" \
220  -N "X 505" \
221  -Z -T "" -o $WORKDIR/ha.$FORMAT $BATCH
222 fi
223 
224 
225 if (( 1 )); then
226 
227  JPlot2D \
228  -f $WORKDIR/postfit\[energy\].root:Vb \
229  -O COLZ -p $PALETTE \
230  -\> "R^{2} [m^{2}]" \
231  -\< "z [m]" \
232  -N "X 505" \
233  -Z -T "" -o $WORKDIR/hb.$FORMAT $BATCH
234 fi
235 
236 if (( 1 )); then
237 
238  JPlot1D \
239  -f $WORKDIR/postfit\[start\].root:hz0 \
240  -f $WORKDIR/postfit\[start\].root:hz1 \
241  -\> "#Deltaz [m]" \
242  -\^ "number of events [a.u.]" \
243  -L TR -T "" \
244  -o $WORKDIR/z.$FORMAT $BATCH
245 fi
then usage $script< detector >< run >< outputfile > fi case set_variable OPTION
Definition: JTuna.sh:26
Q(UTCMax_s-UTCMin_s)-livetime_s
then usage $script< input file >[option[primary[working directory]]] nWhere option can be E
Definition: JMuonPostfit.sh:36
then wget no check certificate user
TFitResultPtr Fit(TH1D *h)
Definition: JNanobeacon.hh:14
o $QUALITY_ROOT d $DEBUG!CHECK_EXIT_CODE JPlot1D f
Definition: JDataQuality.sh:76
exit
Definition: JPizza.sh:36
set_variable LOGY YY
Definition: JMuonPostfit.sh:79
then fatal Wrong number of arguments fi set_variable STRING $argv[1] set_variable DETECTORXY_TXT $WORKDIR $DETECTORXY_TXT tail read X Y CHI2 RMS printf optimum n $X $Y $CHI2 $RMS awk v Y
then fatal Wrong number of arguments fi JConvertDetectorFormat a o
&set_variable PRIMARY
Definition: JMuonPostfit.sh:42
then echo
set_variable LOG
Definition: JMuonPostfit.sh:82
do set_variable APP
then echo Variable JPP_DIR undefined exit fi source $JPP_DIR setenv sh $JPP_DIR &dev null set_variable
Definition: JAcoustics.sh:21
do set_variable OUTPUT_DIRECTORY $WORKDIR T
then rm i $OUTPUT_FILE fi done for APP in $APPLICATIONS[*]
then echo Variable JPP_DIR undefined exit fi source $JPP_DIR setenv sh $JPP_DIR &dev null set_variable DEBUG set_variable WORKDIR
Definition: JLegolas.sh:20
then awk F
set_variable LOGX
Definition: JMuonPostfit.sh:83
* usage
then fatal The output file must have the wildcard in the e g root fi typeset A PARAMETERS typeset a APPLICATIONS APPLICATIONS
set_variable LOG XX
Definition: JMuonPostfit.sh:77
&set_variable OUTPUT_FILE
then usage $script< input file >[option[primary[working directory]]] nWhere option can be LINE
Definition: JMuonPostfit.sh:36
do sput $STRING $FLOOR sget MODULE INPUT_FILES
Definition: JCanberra.sh:77
then for APP in event gandalf start energy
Definition: JMuonMCEvt.sh:44
then usage $script< input file >[option[primary[working directory]]] nWhere option can be N
Definition: JMuonPostfit.sh:36
then JMuonMCEvt f $INPUT_FILE o $INTERMEDIATE_FILE d
Definition: JMuonPath.sh:47
then display $WORKDIR
Definition: plot-Domino.sh:128
do set_variable MODULE getModule a $WORKDIR detector_a datx L $STRING JEditDetector a $WORKDIR detector_a datx M $MODULE setz o $WORKDIR detector_a datx JEditDetector a $WORKDIR detector_b datx M $MODULE setz o $WORKDIR detector_b datx done echo Output stored at $WORKDIR detector_a datx and $WORKDIR tripod_a txt JDrawDetector2D a $WORKDIR detector_a datx a $WORKDIR detector_b datx L BL o detector $FORMAT $BATCH JDrawDetector2D T $WORKDIR tripod_a txt T $WORKDIR tripod_b txt L BL o tripod $FORMAT $BATCH JCompareDetector a $WORKDIR detector_a datx b $WORKDIR detector_b datx o $WORKDIR abc root &dev null for KEY in X Y Z
then fatal Wrong number of arguments fi set_variable DETECTOR $argv[1] set_variable INPUT_FILE $argv[2] eval JPrintDetector a $DETECTOR O IDENTIFIER eval JPrintDetector a $DETECTOR O SUMMARY JAcoustics sh $DETECTOR_ID source JAcousticsToolkit sh CHECK_EXIT_CODE typeset A EMITTERS get_tripods $WORKDIR tripod txt EMITTERS get_transmitters $WORKDIR transmitter txt EMITTERS for EMITTER in
Definition: JCanberra.sh:46
source $JPP_DIR setenv csh $JPP_DIR &dev null eval JShellParser o a A
script
Definition: JAcoustics.sh:2
*fatal Wrong option $OPTION
esac done
Definition: JAddHDE.sh:21
#define DEBUG(A)
Message macros.
Definition: JMessage.hh:62
set_variable LOGY
Definition: JMuonPostfit.sh:84