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 /mnt/build/workspace/root-makedoc-v608/rootspi/rdoc/src/v6-08-00-patches/tutorials/roostats/StandardFrequentistDiscovery.C...
#include <vector>
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;
}
if (!data || !mc) {
cout << "data or ModelConfig was not found" << endl;
return -1.0;
}
firstPOI->
setVal(poiValueForSignal);
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.