Jpp  18.2.1-ARCA-DF-PATCH
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 
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 
37 
38 if do_usage $*; then
39  usage "$script <input file> [option [primary [working directory]]]"\
40  "\nWhere option can be N, E, LINE, LOGE."\
41  "\nNote 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;&
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 PRIMARY ${argv[-2]}
53  set_variable WORKDIR ${argv[-1]}
54 esac
55 
56 # Number of prefits as a function of application (0 = all)
57 
58 typeset -A NUMBER_OF_FIT
59 
60 NUMBER_OF_FIT=( \
61  prefit 0 \
62  simplex 0 \
63  gandalf 1 \
64  energy 1 \
65  start 1)
66 
67 
68 # Fit application identifier
69 
70 typeset -A ENUMERATION
71 
72 ENUMERATION=( \
73  prefit 1 \
74  simplex 2 \
75  gandalf 3 \
76  energy 4 \
77  start 5)
78 
79 case $OPTION in
80  E) set_variable LABEL "E [GeV]";
84  set_variable E_E "log10(E_{fit}/E_{#mu})";;
85  LINE) set_variable LABEL "E [GeV]";
89  set_variable E_E "E_{fit} - E_{#mu} [GeV]";;
90  LOGE) set_variable LABEL "E [GeV]";
91  set_variable LOG -XX;
92  set_variable LOGX -XX;
93  set_variable LOGY -YY;
94  set_variable E_E "log10(E_{fit}/E_{#mu})";;
95  N) set_variable LABEL "number of modules";
97  set_variable LOGX -XX;
98  set_variable LOGY -YY;
99  set_variable E_E "log10(E_{fit}/E_{#mu})";;
100  *) fatal "Invalid option $OPTION"
101 esac
102 
103 
104 # user interaction
105 
106 for APP in $APPLICATIONS[*]; do
107 
108  set_variable OUTPUT_FILE ${WORKDIR}/postfit\[${APP}\].root
109 
110  if [[ -f $OUTPUT_FILE ]]; then
111  rm -i $OUTPUT_FILE
112  fi
113 done
114 
115 
116 # processing
117 
118 for APP in $APPLICATIONS[*]; do
119 
120  set_variable OUTPUT_FILE $WORKDIR/postfit\[${APP}\].root
121 
122  if [[ ! -f $OUTPUT_FILE ]]; then
123 
124  JMuonPostfit \
125  -f"${INPUT_FILES[*]}" \
126  -o ${OUTPUT_FILE} \
127  -n ${NUMBER_OF_EVENTS} \
128  -N ${NUMBER_OF_FIT[${APP}]} \
129  -A ${ENUMERATION[${APP}]} \
130  -O ${OPTION} \
131  -p ${PRIMARY} \
132  -d ${DEBUG} --!
133  fi
134 done
135 
136 if (( 1 )); then
137 
138  JPlot1D \
139  -f $WORKDIR/postfit\[prefit\].root:hx \
140  -f $WORKDIR/postfit\[simplex\].root:hx \
141  -f $WORKDIR/postfit\[gandalf\].root:hx \
142  -\> "angle [deg]" \
143  -\^ "number of events [a.u.]" \
144  -XX \
145  -L TR -T "" \
146  -o $WORKDIR/angle.$FORMAT $BATCH
147 fi
148 
149 if (( 1 )); then
150 
151  QUANTILES="0.33 0.5 0.66"
152 
153  for APP in prefit simplex gandalf; do
154 
155  JQuantiles2D \
156  -f $WORKDIR/postfit\[${APP}\].root:h2 \
157  -Q "$QUANTILES" \
158  -o $WORKDIR/quantiles\[${APP}\].root
159  done
160 
161  JPlot1D \
162  -f $WORKDIR/quantiles\[prefit\].root:h21 \
163  -f $WORKDIR/quantiles\[simplex\].root:h21 \
164  -f $WORKDIR/quantiles\[gandalf\].root:h21 \
165  -\> "$LABEL" $LOG \
166  -\^ "resolution (reco muon) [deg]" \
167  -y "1e-2 1e2" \
168  -Y \
169  -L TR -T "" \
170  -o $WORKDIR/resolution.$FORMAT $BATCH
171 fi
172 
173 if (( 1 )); then
174 
175  JPlot1D \
176  -f $WORKDIR/postfit\[energy\].root:E_0 \
177  -f $WORKDIR/postfit\[energy\].root:E_1 \
178  -f $WORKDIR/postfit\[energy\].root:E_2 \
179  -\^ "number of events [a.u.]" \
180  -\> "E_{#mu} [GeV]" $LOGX \
181  -T "" \
182  -o $WORKDIR/energy.$FORMAT $BATCH
183 fi
184 
185 if (( 1 )); then
186 
187  JConvertToPDF2D \
188  -f $WORKDIR/postfit\[energy\].root:ExE \
189  -O NY \
190  -o $WORKDIR/pdf.root
191 
192  JPlot2D \
193  -f $WORKDIR/pdf.root:ExE \
194  -O COLZ -p $PALETTE \
195  -\> "E_{#mu} [GeV]" $LOGX \
196  -\< "E_{fit} [GeV]" $LOGY \
197  -Z \
198  -T "" \
199  -o $WORKDIR/ee.$FORMAT $BATCH
200 fi
201 
202 if (( 1 )); then
203 
204  JFit \
205  -f $WORKDIR/postfit\[energy\].root:E_E \
206  -o $WORKDIR/fit.root \
207  -F "[0]*exp(-0.5*(x-[1])*(x-[1])/([2]*[2]))" \
208  -@ "p0 = 0.8*GetMaximum" \
209  -@ "p1 = GetMean" \
210  -@ "p2 = GetRMS"
211 
212  JPlot1D \
213  -f $WORKDIR/fit.root:E_E \
214  -\> "$E_E" \
215  -T "" -o $WORKDIR/er.$FORMAT $BATCH
216 fi
217 
218 if (( 1 )); then
219 
220  JPlot2D \
221  -f $WORKDIR/postfit\[energy\].root:Va \
222  -O COLZ -p $PALETTE \
223  -\> "R^{2} [m^{2}]" \
224  -\< "z [m]" \
225  -N "X 505" \
226  -Z -T "" -o $WORKDIR/ha.$FORMAT $BATCH
227 fi
228 
229 
230 if (( 1 )); then
231 
232  JPlot2D \
233  -f $WORKDIR/postfit\[energy\].root:Vb \
234  -O COLZ -p $PALETTE \
235  -\> "R^{2} [m^{2}]" \
236  -\< "z [m]" \
237  -N "X 505" \
238  -Z -T "" -o $WORKDIR/hb.$FORMAT $BATCH
239 fi
240 
241 if (( 1 )); then
242 
243  JPlot1D \
244  -f $WORKDIR/postfit\[start\].root:hz0 \
245  -f $WORKDIR/postfit\[start\].root:hz1 \
246  -\> "#Deltaz [m]" \
247  -\^ "number of events [a.u.]" \
248  -L TR -T "" \
249  -o $WORKDIR/z.$FORMAT $BATCH
250 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 >< detector_file >< output_file(.root)> fi set_variable NUMBER_OF_TIMESLICES set_variable NUMBER_OF_SUMMARYSLICES set_variable NUMBER_OF_EVENTS set_variable ALL_PLOTS case set_variable NUMBER_OF_EVENTS
Definition: JRunAnalyzer.sh:18
then usage $script< input file >[option[primary[working directory]]] nWhere option can be E
Definition: JMuonPostfit.sh:40
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:83
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
Definition: datalogs.sh:31
&set_variable PRIMARY
Definition: JMuonPostfit.sh:46
then fatal Wrong number of arguments fi JConvertDetectorFormat a o
set_variable LOG
Definition: JMuonPostfit.sh:86
const int n
Definition: JPolint.hh:786
do set_variable APP
then rm
Definition: sftpput.zsh:30
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:87
* 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:81
&set_variable OUTPUT_FILE
then usage $script< input file >[option[primary[working directory]]] nWhere option can be LINE
Definition: JMuonPostfit.sh:40
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:40
fi set_variable FILENAME $WORKDIR
Definition: datalogs.sh:34
then JMuonMCEvt f $INPUT_FILE o $INTERMEDIATE_FILE d
Definition: JMuonPath.sh:47
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 echo
Definition: JQAQC.sh:90
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:88