Standard demo of the Feldman-Cousins calculator StandardFeldmanCousinsDemo
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.
The actual heart of the demo is only about 10 lines long.
The FeldmanCousins tools is a classical frequentist calculation based on the Neyman Construction. The test statistic can be generalized for nuisance parameters by using the profile likelihood ratio. But unlike the ProfileLikelihoodCalculator, this tool explicitly builds the sampling distribution of the test statistic via toy Monte Carlo.
Processing /mnt/build/workspace/root-makedoc-v610/rootspi/rdoc/src/v6-10-00-patches/tutorials/roostats/StandardFeldmanCousinsDemo.C...
void StandardFeldmanCousinsDemo(const char* infile = "",
const char* workspaceName = "combined",
const char* modelConfigName = "ModelConfig",
const char* dataName = "obsData"){
const char* filename = "";
if (!strcmp(infile,"")) {
filename = "results/example_combined_GaussExample_model.root";
if (!fileExist) {
#ifdef _WIN32
cout << "HistFactory file cannot be generated on Windows - exit" << endl;
return;
#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;
}
if(!w){
cout <<"workspace not found" << endl;
return;
}
if(!data || !mc){
cout << "data or ModelConfig was not found" <<endl;
return;
}
fc.SetConfidenceLevel(0.95);
fc.UseAdaptiveSampling(true);
fc.SetNBins(10);
fc.CreateConfBelt(true);
fc.FluctuateNumDataEntries(false);
else
cout <<"Not sure what to do about this model" <<endl;
}
cout <<
"\n95% interval on " <<firstPOI->
GetName()<<
" is : ["<<
TH1F* histOfThresholds =
new TH1F(
"histOfThresholds",
"",
histOfThresholds->
Fill(poiVal,arMax);
}
histOfThresholds->
Draw();
}
- Author
- Kyle Cranmer
Definition in file StandardFeldmanCousinsDemo.C.