8source $JPP_DIR/setenv.sh $JPP_DIR >& /dev/null
11set_variable: NUISANCE ASTRONOMY_NUISANCE fixed fixed
12set_variable: SNR ASTRONOMY_SNR 0.2
13set_variable: M_SIZE ASTRONOMY_M_SIZE 10000
14set_variable: FORMAT GRAPHICS_FORMAT gif
15set_variable+ BATCH GRAPHICS_BATCH -B
18 usage "$script <config file name> <number of tests> <probability>"\
19 "\nThe histograms correspond to \"<file name>:<histogram name>\"."
23 fatal "Wrong number of arguments."
26set_variable CONFIG $argv[1]
27let "NUMBER_OF_TESTS = $argv[2]"
28let "PROBABILITY = $argv[3]"
30if (( $PROBABILITY <= 0.0 || $PROBABILITY >= 1.0 )); then
31 fatal "Invalid probability $PROBABILITY"
34if (( $NUMBER_OF_TESTS * $PROBABILITY <= 1.0 )); then
35 warning "Insufficient number of tests $NUMBER_OF_TESTS given probability $PROBABILITY."
40# H0 pseudo experiments
42let "N = 0" # zero signal
46echo -n "Running H0 pseudo experiments... "
48$JPP_DIR/examples/JAstronomy/JGen2 \
49 -o benchmark\[$H0\].root \
58 -d $DEBUG >& benchmark.$H0.log
63awk '/Minimal likelihood ratio:/ { print $(NF - 1) }' benchmark.$H0.log | read LIKELIHOOD_RATIO
65printf "Minimal likelihood ratio: %9.5f\n" $LIKELIHOOD_RATIO
68# H1 pseudo experiments
70let "NUMBER_OF_TESTS = 100000"
73$JPP_DIR/examples/JAstronomy/JGen2 \
78 -Q $LIKELIHOOD_RATIO \
83 -d $DEBUG >& benchmark.log
85awk '/Signal strength:/ { print $NF }' benchmark.log | read X
87printf "%1.1f" $X | read H1
89$JPP_DIR/examples/JAstronomy/JGen2 \
90 -o benchmark\[$H1\].root \
98 -d $DEBUG >& benchmark.log
100printf "signal: %9.5f\n" $X
110 typeset -A HYPOTHESES
112 HYPOTHESES[H0]=$PROBABILITY
113 HYPOTHESES[H1]=$QUANTILE
115 for KEY VALUE in ${(kv)HYPOTHESES}; do
118 -f benchmark\[${(P)KEY}\].root:hl \
119 -x "$LIKELIHOOD_RATIO 1.0e99" \
122 JPrintResult -f benchmark\[${(P)KEY}\].root:hl -F GetSumOfWeights | read Y0
123 JPrintResult -f zoom.root:hl -F GetSumOfWeights | read Y1
125 printf "Hypothesis %s - check probability: %10.3e == %10.3e\n" $KEY $VALUE $(($Y1 / $Y0))
134let "X1 = $LIKELIHOOD_RATIO"
135let "X2 = $LIKELIHOOD_RATIO"
137let "Y2 = $(JPrintResult -f benchmark\[$N\].root:hl -F GetMaximum)"
139JLine -p "$X1 $Y1 $X2 $Y2" -@ "style = 2" -o line.root
142 -f benchmark\[$H0\].root:hl \
143 -f benchmark\[$H1\].root:hl \
146 -> "likelihood ratio" \
147 -\^ "number of experiments" \
151 -o discovery.$FORMAT $BATCH