StandardFrequentistDiscovery.
This is a standard demo that can be used with any ROOT file prepared in the standard way. You specify:
- name for input ROOT file
- name of workspace inside ROOT file that holds model and data
- name of ModelConfig that specifies details for calculator tools
- name of dataset
With default parameters the macro will attempt to run the standard hist2workspace example and read the ROOT file that it produces.
Processing /builddir/build/BUILD/root-6.10.00/tutorials/roostats/StandardFrequentistDiscovery.C...
[1mRooFit v3.60 -- Developed by Wouter Verkerke and David Kirkby[0m
Copyright (C) 2000-2013 NIKHEF, University of California & Stanford University
All rights reserved, please
read http:
=== Using the following for ModelConfigNull ===
Nuisance
Parameters:
RooArgSet:: = (alpha_syst3,beta_syst2,gamma_stat_channel1_bin_0,gamma_stat_channel1_bin_1)
Global Observables:
RooArgSet:: = (nom_beta_syst2,nom_alpha_syst3,nom_gamma_stat_channel1_bin_0,nom_gamma_stat_channel1_bin_1)
PDF: RooProdPdf::model_channel1[ lumiConstraint * alpha_syst1Constraint * beta_syst2Constraint * alpha_syst3Constraint * gamma_stat_channel1_bin_0_constraint * gamma_stat_channel1_bin_1_constraint * channel1_model(obs_x_channel1) ] = 0.209846
Snapshot:
1) 0x119d9460 RooRealVar:: SigXsecOverSM = 0
L(0 - 3)
"SigXsecOverSM"
=== Using the following for ModelConfig ===
Nuisance
Parameters:
RooArgSet:: = (alpha_syst3,beta_syst2,gamma_stat_channel1_bin_0,gamma_stat_channel1_bin_1)
Global Observables:
RooArgSet:: = (nom_beta_syst2,nom_alpha_syst3,nom_gamma_stat_channel1_bin_0,nom_gamma_stat_channel1_bin_1)
PDF: RooProdPdf::model_channel1[ lumiConstraint * alpha_syst1Constraint * beta_syst2Constraint * alpha_syst3Constraint * gamma_stat_channel1_bin_0_constraint * gamma_stat_channel1_bin_1_constraint * channel1_model(obs_x_channel1) ] = 0.209846
Snapshot:
1) 0x119d9460 RooRealVar:: SigXsecOverSM = 1
L(0 - 3)
"SigXsecOverSM"
Results HypoTestCalculator_result:
-
Null p-value = 0.119 +/- 0.0102391
- Significance = 1.18 +/- 0.0514882 sigma
- Number of Alt toys: 1000
- Number of
Null toys: 1000
- Test statistic evaluated on data: 1.73379
- CL_b: 0.119 +/- 0.0102391
- CL_s+b: 0.582 +/- 0.0155973
- CL_s: 4.89076 +/- 0.440754
total CPU time: 49.47
total real time: 49.5781
(double) 0.119000
#include <vector>
using namespace RooFit;
using namespace RooStats;
double StandardFrequentistDiscovery(
const char* infile = "",
const char* workspaceName = "channel1",
const char* modelConfigNameSB = "ModelConfig",
const char* dataName = "obsData",
int toys = 1000,
double poiValueForBackground = 0.0,
double poiValueForSignal = 1.0
) {
const char* filename = "";
if (!strcmp(infile,"")) {
filename = "results/example_channel1_GammaExample_model.root";
if (!fileExist) {
#ifdef _WIN32
cout << "HistFactory file cannot be generated on Windows - exit" << endl;
return -1;
#endif
cout <<"will run standard hist2workspace example"<<endl;
gROOT->ProcessLine(
".! prepareHistFactory .");
gROOT->ProcessLine(
".! hist2workspace config/example.xml");
cout <<"\n\n---------------------"<<endl;
cout <<"Done creating example input"<<endl;
cout <<"---------------------\n\n"<<endl;
}
}
else
filename = infile;
if(!file ){
cout <<"StandardRooStatsDemoMacro: Input file " << filename << " is not found" << endl;
return -1;
}
if (!w) {
cout << "workspace not found" << endl;
return -1.0;
}
ModelConfig* mc = (ModelConfig*) w->
obj(modelConfigNameSB);
if (!data || !mc) {
cout << "data or ModelConfig was not found" << endl;
return -1.0;
}
firstPOI->
setVal(poiValueForSignal);
ModelConfig *mcNull = mc->
Clone(
"ModelConfigNull");
firstPOI->
setVal(poiValueForBackground);
toymcs.SetNEventsPerToy(1);
} else cout << "Not sure what to do about this model" << endl;
}
freqCalc.SetToys( toys,toys );
cout <<
"total CPU time: " << mn_t->
CpuTime() << endl;
cout <<
"total real time: " << mn_t->
RealTime() << endl;
int nPOI = 1;
c1->
SaveAs(
"standard_discovery_output.pdf");
return pvalue;
}
- Authors
- Sven Kreiss, Kyle Cranmer
Definition in file StandardFrequentistDiscovery.C.