Jpp test-rotations-new
the software that should make you happy
Loading...
Searching...
No Matches
footprint.sh
Go to the documentation of this file.
1#!/usr/bin/env zsh
2script=${0##*/}
3
4if [ -z $JPP_DIR ]; then
5 echo "Variable JPP_DIR undefined."
6 exit
7fi
8
9source $JPP_DIR/setenv.sh $JPP_DIR >& /dev/null
10
11set_variable: DEBUG ACOUSTICS_DEBUG 2
12set_variable: WORKDIR ACOUSTICS_WORKDIR `pwd`
13set_variable+ OVERWRITE ACOUSTICS_OVERWRITE Y
14set_variable FORMULA "[0] * exp(-0.5 * (x-[1])*(x-[1]) / ([2]*[2])) * exp(-0.5 * (y-[3])*(y-[3]) / ([4]*[4]))"
15set_variable: FORMAT GRAPHICS_FORMAT gif
16set_variable+ BATCH GRAPHICS_BATCH -B
17
18if do_usage $*; then
19 usage "$script <detector file> <tripod file> (input file)+"\
20 "\nInput files correspond to the output of JKatoomba[.sh]."\
21 "\nThe environment variable ACOUSTICS_OVERWRITE should be set to overwrite the detector and tripod file."
22fi
23
24if (( $# < 3 )); then
25 fatal "Wrong number of arguments."
26fi
27
28set_variable DETECTOR $argv[1]
29set_variable TRIPOD $argv[2]
30set_array INPUT_FILES $argv[3,-1]
31
32eval `JPrintDetector -a $DETECTOR -O IDENTIFIER`
33eval `JPrintDetector -a $DETECTOR -O CAN`
34
35JAcoustics.sh $DETECTOR_ID
36
37JFootprint \
38 -f${^INPUT_FILES} \
39 -x "500 -20.0 +20.0" \
40 -y "500 -20.0 +20.0" \
41 -Z $CAN_ZMAX_M \
42 -o $WORKDIR/footprint.root \
43 -d $DEBUG
44
45JPlot2D \
46 -f $WORKDIR/footprint.root:% \
47 -> "Tx [mrad]" \
48 -< "Ty [mrad]" \
49 -O COLZ \
50 -N "X 505" \
51 -N "Y 505" \
52 -T "" \
53 -o footprint.$FORMAT $BATCH
54
55JPrintMaximum2D -f $WORKDIR/footprint.root:% | read TITLE X Y
56
57let "XMIN = $X - 2.0"
58let "XMAX = $X + 2.0"
59let "YMIN = $Y - 2.0"
60let "YMAX = $Y + 2.0"
61
62JFit2D \
63 -f $WORKDIR/footprint.root:% \
64 -o $WORKDIR/fit.root \
65 -F "$FORMULA" \
66 -x "$XMIN $XMAX" \
67 -y "$YMIN $YMAX" \
68 -@ "p0 = GetMaximum" \
69 -@ "p1 = $X" \
70 -@ "p2 = 1.0" \
71 -@ "p3 = $Y" \
72 -@ "p4 = 1.0" \
73 -E "p0 = 0.1" \
74 -E "p1 = 0.02" \
75 -E "p2 = 0.02" \
76 -E "p3 = 0.02" \
77 -E "p4 = 0.02" \
78 -O "L" \
79 -d $DEBUG --!
80
81JPlot2D \
82 -f $WORKDIR/fit.root:% \
83 -x "$XMIN $XMAX" \
84 -y "$YMIN $YMAX" \
85 -> "Tx [mrad]" \
86 -< "Ty [mrad]" \
87 -O COLZ \
88 -N "X 505" \
89 -N "Y 505" \
90 -T "" \
91 -o fit.$FORMAT $BATCH
92
93set_array TX `JPrintFit -f $WORKDIR/fit.root:% -@ p1`
94set_array TY `JPrintFit -f $WORKDIR/fit.root:% -@ p3`
95set_variable RESULT `JPrintFit -f $WORKDIR/fit.root:% -F "GetChisquare/GetNDF"`
96
97TX[1]=$(($TX[1]*1.0e-3))
98TY[1]=$(($TY[1]*1.0e-3))
99
100printf "Tx = %9.6f Ty = %9.6f chi2/NDF = %7.3f\n" $TX[1] $TY[1] $RESULT
101
102if [[ "$OVERWRITE" == "Y" ]]; then
103 JFootprint.sh $DETECTOR $TRIPOD $TX[1] $TY[1]
104fi