Example #1
0
# for the background only hypothesis and lets it float freely for the signal+background hypothesis.
# See cls_limits documentation for more options.
# plot_exp, plot_obs = cls_limits(model, what=limit_type, signal_processes = [['Higgs_125']], debug_cls = True, debug = True)
# 
# # as for the bayesian limits: write the result to a text file
# plot_exp.write_txt('cls_limits_expected.txt')
# if not limit_type == 'expected':
#     plot_obs.write_txt('cls_limits_observed.txt')

# 3. compatibility tests:
# make a chi2 test by comparing the chi2 value distribution *after* fitting as obtained from background-only toys with
# a fit performed on data. The "signal_process_group" parameter is usually a list
# of the processes to consider together as the signal (which will be all scaled by beta_signal simultaneously).
# Here, we only include background and just use some arbitrary signal process, set the input beta_signal to zero ("toys:0.0")
# and also fix beta_signal to 0.0 during the fit ("fix:0.0").
p = chi2_test(model, signal_process_group = ['Higgs_125'], input = "toys:0.0", signal_prior = "fix:0.0")
print 'p-value from background-only chi2 test: ', p

# if one wants to include some signal in the comparison, one should make toys accordingly with signal, e.g.,
# with beta_signgl = 0.1 ("toys:0.1"). The signal_prior has a default of "flat" so this will now fit
# also the signal yield for each toy (and data) before computing chi2:
p = chi2_test(model, signal_process_group = ['Higgs_125'], input = "toys:0.12")
print 'p-value from chi2 test, including 0.12pb Higgs at m=125GeV: ', p

# model_summary, bayesian_limits, and cls_limits also write their results to the 'report' object
# which we can ask to write its results as html page to a certain directory. Use an existing, empty
# directory and point your web browser to it.

config.report.write_html('htmlout')

# After running theta-auto, you probably want to delete the 'analysis' directory which
Example #2
0
# Here, we stay with the default which fixes beta_signal=0
# for the background only hypothesis and lets it float freely for the signal+background hypothesis.
# See cls_limits documentation for more options.
plot_exp, plot_obs = cls_limits(model, signal_processes = [['zp1000'], ['zp2000'], ['zp3000']])

# as for the bayesian limits: write the result to a text file
plot_exp.write_txt('cls_limits_expected.txt')
plot_obs.write_txt('cls_limits_observed.txt')

# 3. compatibility tests:
# make a chi2 test by comparing the chi2 value distribution *after* fitting as obtained from background-only toys with
# a fit performed on data. The "signal_process_group" parameter is usually a list
# of the processes to consider together as the signal (which will be all scaled by beta_signal simultaneously).
# Here, we only include background and just use some arbitrary signal process, set the input beta_signal to zero ("toys:0.0")
# and also fix beta_signal to 0.0 during the fit ("fix:0.0").
p = chi2_test(model, signal_process_group = ['zp1000'], input = "toys:0.0", signal_prior = "fix:0.0")
print 'p-value from background-only chi2 test: ', p

# if one wants to include some signal in the comparison, one should make toys accordingly with signal, e.g.,
# with beta_signgl = 0.1 ("toys:0.1"). The signal_prior has a default of "flat" so this will now fit
# also the signal yield for each toy (and data) before computing chi2:
p = chi2_test(model, signal_process_group = ['zp1000'], input = "toys:0.1")
print 'p-value from chi2 test, including 0.1pb zprime at m=1TeV: ', p

# model_summary, bayesian_limits, and cls_limits also write their results to the 'report' object
# which we can ask to write its results as html page to a certain directory. Use an existing, empty
# directory and point your web browser to it.

config.report.write_html('htmlout')

# After running theta-auto, you probably want to delete the 'analysis' directory which