Jpp test-rotations-old
the software that should make you happy
Loading...
Searching...
No Matches
JGizmo/JHistogram1D.sh
Go to the documentation of this file.
1#!/usr/bin/env zsh
2#
3# \author mdejong
4#
5version=1.0
6script=${0##*/}
7
8# ------------------------------------------------------------------------------------------
9#
10# Utility script to test JHistogram1D, JFit and JPlot1D.
11#
12# ------------------------------------------------------------------------------------------
13
14
15if [ -z $JPP_DIR ]; then
16 echo "Variable JPP_DIR undefined."
17 exit
18fi
19
20
21source $JPP_DIR/setenv.sh $JPP_DIR
22
23
24set_variable DEBUG 2
25set_variable WORKDIR ${TMPDIR:-/tmp}/
26
27if do_usage $*; then
28 usage "$script [working directory]"
29fi
30
31case $# in
32 1) set_variable WORKDIR $1;;
33esac
34
35
36if (( 1 )); then
37
38 set_variable FORMULA "[0] * exp(-0.5 * (x-[1])*(x-[1]) / ([2]*[2]))"
39
40 $JPP_DIR/examples/JGizmo/JHistogram1D \
41 -o $WORKDIR/histogram.root \
42 -F "$FORMULA" \
43 -@ "p0 = 1.0; p1 = 0.0; p2 = 2.0" \
44 -x "100 -10 +10" \
45 -n 10000
46
47 JPrintMaximum1D -f $WORKDIR/histogram.root:h0
48
49 JFit \
50 -f $WORKDIR/histogram.root:h0 \
51 -o $WORKDIR/fit.root \
52 -F "$FORMULA" \
53 -@ "p0 = GetMaximum" \
54 -@ "p1 = GetMean" \
55 -@ "p2 = GetRMS" \
56 -d $DEBUG
57
58 echo -n "chi2/NDF: "
59 JPrintFit \
60 -f $WORKDIR/fit.root:h0 \
61 -F "GetChisquare/GetNDF"
62
63 JPlot1D \
64 -f $WORKDIR/fit.root:h0
65
66fi
67
68
69if (( 1 )); then
70
71 set_variable FORMULA "[0] * pow(10,[1]*x)"
72
73 $JPP_DIR/examples/JGizmo/JHistogram1D \
74 -o $WORKDIR/histogram.root \
75 -F "$FORMULA" \
76 -@ "p0 = 1.0; p1 = -2" \
77 -x "100 0 7" \
78 -n 10000000
79
80
81 JFit \
82 -f $WORKDIR/histogram.root:h0 \
83 -o $WORKDIR/fit.root \
84 -F "$FORMULA" \
85 -@ "p0 = GetMaximum" \
86 -@ "p1 = -2" \
87 -d3
88
89 echo -n "chi2/NDF: "
90 JPrintFit \
91 -f $WORKDIR/fit.root:h0 \
92 -F "GetChisquare/GetNDF"
93
94 JPlot1D \
95 -f $WORKDIR/fit.root:h0 \
96 -y "1e-1 1e8" \
97 -XXY \
98 -G XY
99
100fi