Jpp - the software that should make you happy
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
JGizmo/JHistogram1D.sh
Go to the documentation of this file.
1 #!/bin/zsh
2 #
3 # \author mdejong
4 #
5 version=1.0
6 script=${0##*/}
7 
8 # ------------------------------------------------------------------------------------------
9 #
10 # Utility script to test JHistogram1D, JFit and JPlot1D.
11 #
12 # ------------------------------------------------------------------------------------------
13 
14 
15 if [ -z $JPP_DIR ]; then
16  echo "Variable JPP_DIR undefined."
17  exit
18 fi
19 
20 
21 source $JPP_DIR/setenv.sh $JPP_DIR
22 
23 
26 
27 if ( do_usage $* ); then
28  usage "$script [working directory]"
29 fi
30 
31 case $# in
33 esac
34 
35 
36 if (( 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 
48  JFit \
49  -f $WORKDIR/histogram.root:h0 \
50  -o $WORKDIR/fit.root \
51  -F "$FORMULA" \
52  -@ "p0 = GetMaximum" \
53  -@ "p1 = GetMean" \
54  -@ "p2 = GetRMS" \
55  -d $DEBUG
56 
57  echo -n "chi2/NDF: "
58  JPrintFit \
59  -f $WORKDIR/fit.root:h0 \
60  -F "GetChisquare/GetNDF"
61 
62  JPlot1D \
63  -f $WORKDIR/fit.root:h0
64 
65 fi
66 
67 
68 if (( 1 )); then
69 
70  set_variable FORMULA "[0] * pow(10,[1]*x)"
71 
72  $JPP_DIR/examples/JGizmo/JHistogram1D \
73  -o $WORKDIR/histogram.root \
74  -F "$FORMULA" \
75  -@ "p0 = 1.0; p1 = -2" \
76  -x "100 0 7" \
77  -n 10000000
78 
79 
80  JFit \
81  -f $WORKDIR/histogram.root:h0 \
82  -o $WORKDIR/fit.root \
83  -F "$FORMULA" \
84  -@ "p0 = GetMaximum" \
85  -@ "p1 = -2" \
86  -d3
87 
88  echo -n "chi2/NDF: "
89  JPrintFit \
90  -f $WORKDIR/fit.root:h0 \
91  -F "GetChisquare/GetNDF"
92 
93  JPlot1D \
94  -f $WORKDIR/fit.root:h0 \
95  -y "1e-1 1e8" \
96  -XXY \
97  -G XY
98 
99 fi
void set_variable(const std::string &name, const std::string &value)
Set environment variable.
exit
Definition: JPizza.sh:36
then JPizza f
Definition: JPizza.sh:46
then echo
do $DIR JTransitTime o
Definition: JTransitTime.sh:44
then awk F
* usage
then JMuonMCEvt f $INPUT_FILE o $INTERMEDIATE_FILE d
Definition: JMuonPath.sh:45
then echo Launching message logger in new window xterm geometry e JGetMessage H $HOST T $TAG d3
alias put_queue eval echo n
Definition: qlib.csh:19
then display $WORKDIR
Definition: plot-Domino.sh:127
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 source JAcoustics sh $DETECTOR_ID CHECK_EXIT_CODE typeset A TRIPODS get_tripods $WORKDIR tripod txt TRIPODS for EMITTER in
Definition: JCanberra.sh:38
version
Definition: JCalibratePMT.sh:7
then usage $script< detector file >< inputfile > fi case set_variable WORKDIR
Definition: JLegolas.sh:28
#define DEBUG(A)
Message macros.
Definition: JMessage.hh:62