-
Notifications
You must be signed in to change notification settings - Fork 393
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update datacards and scripts for tutorial
- Loading branch information
Showing
4 changed files
with
92 additions
and
0 deletions.
There are no files selected for viewing
17 changes: 17 additions & 0 deletions
17
data/tutorials/statistical_routines_tutorial/datacard_lowbackground.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
17 changes: 17 additions & 0 deletions
17
data/tutorials/statistical_routines_tutorial/datacard_obs12.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
17 changes: 17 additions & 0 deletions
17
data/tutorials/statistical_routines_tutorial/datacard_underfluctuation.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
41 changes: 41 additions & 0 deletions
41
data/tutorials/statistical_routines_tutorial/get_quantile.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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}') | ||
|