diff --git a/data/tutorials/statistical_routines_tutorial/datacard_lowbackground.txt b/data/tutorials/statistical_routines_tutorial/datacard_lowbackground.txt new file mode 100644 index 00000000000..0d7e30c466e --- /dev/null +++ b/data/tutorials/statistical_routines_tutorial/datacard_lowbackground.txt @@ -0,0 +1,17 @@ +imax 1 # number of channels +jmax 1 # number of backgrounds +kmax 3 # number of nuisance parameters +------- +shapes * * FAKE +------ +bin bin1 +observation 0 +----- +bin bin1 bin1 +process ggH WW +process 0 1 +rate 2.3 1 +------- +lumi lnN 1.01 1.01 # luminosity uncertainty +xs_ggH lnN 1.10 - # gg->H cross section + signal efficiency + other minor ones +xs_WW lnN - 1.16 # WW cross section + signal efficiency + other minor ones diff --git a/data/tutorials/statistical_routines_tutorial/datacard_obs12.txt b/data/tutorials/statistical_routines_tutorial/datacard_obs12.txt new file mode 100644 index 00000000000..19f1f030939 --- /dev/null +++ b/data/tutorials/statistical_routines_tutorial/datacard_obs12.txt @@ -0,0 +1,17 @@ +imax 1 # number of channels +jmax 1 # number of backgrounds +kmax 3 # number of nuisance parameters +------- +shapes * * FAKE +------ +bin bin1 +observation 12 +----- +bin bin1 bin1 +process ggH WW +process 0 1 +rate 2.3 5.4 +------- +lumi lnN 1.01 1.01 # luminosity uncertainty +xs_ggH lnN 1.10 - # gg->H cross section + signal efficiency + other minor ones +xs_WW lnN - 1.16 # WW cross section + signal efficiency + other minor ones diff --git a/data/tutorials/statistical_routines_tutorial/datacard_underfluctuation.txt b/data/tutorials/statistical_routines_tutorial/datacard_underfluctuation.txt new file mode 100644 index 00000000000..8e944bd9167 --- /dev/null +++ b/data/tutorials/statistical_routines_tutorial/datacard_underfluctuation.txt @@ -0,0 +1,17 @@ +imax 1 # number of channels +jmax 1 # number of backgrounds +kmax 3 # number of nuisance parameters +------- +shapes * * FAKE +------ +bin bin1 +observation 13 +----- +bin bin1 bin1 +process ggH WW +process 0 1 +rate 2.3 23.4 +------- +lumi lnN 1.01 1.01 # luminosity uncertainty +xs_ggH lnN 1.10 - # gg->H cross section + signal efficiency + other minor ones +xs_WW lnN - 1.16 # WW cross section + signal efficiency + other minor ones diff --git a/data/tutorials/statistical_routines_tutorial/get_quantile.py b/data/tutorials/statistical_routines_tutorial/get_quantile.py new file mode 100644 index 00000000000..3f73f1727db --- /dev/null +++ b/data/tutorials/statistical_routines_tutorial/get_quantile.py @@ -0,0 +1,41 @@ +from ROOT import TFile +import numpy as np +import scipy.stats as st + +from argparse import ArgumentParser + +parser = ArgumentParser() +parser.add_argument('--input', default="higgsCombineTest.MultiDimFit.mH120.123456.root", help='input root file with toy results from MultiDimFit') +parser.add_argument('--q0', action='store_true', help='use the q_0 test statistic rather than the profile likelihood ratio.') +args = parser.parse_args() + +n_sigma = 1 +quantile_val = 2*st.norm().cdf(-n_sigma) #Get the quantile corresponding to the N sigma interval + + + +f = TFile(args.input,"READ") +limit = f.Get("limit") +n_entries = limit.GetEntries() + +m2nll_vals = [] +r_vals = [] +last_toy_num = -1 +for i in range(n_entries): + limit.GetEntry(i) + if limit.quantileExpected < 0: + if args.q0: + r_vals.append(limit.r) + continue + + m2nll_vals.append(2*limit.deltaNLL) + + +test_stat_vals = m2nll_vals +if args.q0: + test_stat_vals = np.where( np.array(r_vals) > 0, test_stat_vals, 0 ) + +test_stat_cutoff = np.quantile( test_stat_vals, 1-quantile_val) +t_stat_name = 'q0' if args.q0 else '-2*deltaNLL' +print(f'This point is rejected at the {n_sigma} sigma level if the test stat {t_stat_name} > {test_stat_cutoff}') +