72 bool generateBinned =
false;
90 bool generateBinned =
optHT.generateBinned;
124 SimpleLikelihoodRatioTestStat::SetAlwaysReuseNLL(
true);
125 ProfileLikelihoodTestStat::SetAlwaysReuseNLL(
true);
126 RatioOfProfiledLikelihoodsTestStat::SetAlwaysReuseNLL(
true);
142 filename =
"results/example_combined_GaussExample_model.root";
147 cout <<
"will run standard hist2workspace example" << endl;
148 gROOT->ProcessLine(
".! prepareHistFactory .");
149 gROOT->ProcessLine(
".! hist2workspace config/example.xml");
150 cout <<
"\n\n---------------------" << endl;
151 cout <<
"Done creating example input" << endl;
152 cout <<
"---------------------\n\n" << endl;
163 cout <<
"StandardRooStatsDemoMacro: Input file " <<
filename <<
" is not found" << endl;
174 cout <<
"workspace not found" << endl;
188 cout <<
"data or ModelConfig was not found" << endl;
199 std::cout <<
"StandardHypoTestInvDemo"
200 <<
" - Switch off all systematics by setting them constant to their initial values" << std::endl;
211 Info(
"StandardHypoTestInvDemo",
"The background model %s does not exist",
modelBName);
212 Info(
"StandardHypoTestInvDemo",
"Copy it from ModelConfig %s and set POI to zero",
modelSBName);
226 Info(
"StandardHypoTestDemo",
"Model %s has no snapshot - make one using model poi",
modelSBName);
244 if (
bModel->GetNuisanceParameters())
249 if (
sbModel->GetNuisanceParameters())
257 ropl->SetSubtractMLE(
false);
260 profll->SetOneSidedDiscovery(1);
264 slrts->EnableDetailedOutput();
265 profll->EnableDetailedOutput();
266 ropl->EnableDetailedOutput();
273 AsymptoticCalculator::SetPrintLevel(
printLevel);
297 Warning(
"StandardHypoTestDemo",
298 "Only the PL test statistic can be used with AsymptoticCalculator - use by default a two-sided PL");
308 Info(
"StandardHypoTestDemo",
309 "No nuisance pdf given for the HybridCalculator - try to deduce pdf from the model");
316 if (
bModel->GetPriorPdf()) {
318 Info(
"StandardHypoTestDemo",
319 "No nuisance pdf given - try to use %s that is defined as a prior pdf in the B model",
322 Error(
"StandardHypoTestDemo",
"Cannot run Hybrid calculator because no prior on the nuisance parameter is "
323 "specified or can be derived");
328 Info(
"StandardHypoTestDemo",
"Using as nuisance Pdf ... ");
332 (
bModel->GetNuisanceParameters()) ?
bModel->GetNuisanceParameters() :
sbModel->GetNuisanceParameters();
334 if (
np->getSize() == 0) {
335 Warning(
"StandardHypoTestDemo",
336 "Prior nuisance does not depend on nuisance parameters. They will be smeared in their full range");
351 if (
sbModel->GetPdf()->canBeExtended()) {
353 Warning(
"StandardHypoTestDemo",
"Pdf is extended: but number counting flag is set: ignore it ");
357 int nEvents =
data->numEntries();
358 Info(
"StandardHypoTestDemo",
359 "Pdf is not extended: number of events to generate taken from observed data set is %d", nEvents);
360 sampler->SetNEventsPerToy(nEvents);
362 Info(
"StandardHypoTestDemo",
"using a number counting pdf");
367 if (
data->isWeighted() && !generateBinned) {
368 Info(
"StandardHypoTestDemo",
"Data set is weighted, nentries = %d and sum of weights = %8.1f but toy "
369 "generation is unbinned - it would be faster to set generateBinned to true\n",
370 data->numEntries(),
data->sumEntries());
373 sampler->SetGenerateBinned(generateBinned);
391 htr->SetPValueIsRightTail(
true);
392 htr->SetBackgroundAsAlt(
false);
402 plot->SetLogYaxis(
true);
405 std::cout <<
"Asymptotic results " << std::endl;
418 for (
int i = 0; i < 5; ++i) {
422 std::vector<double> values =
altDist->GetSamplingDistribution();
425 for (
int i = 0; i < 5; ++i) {
426 htExp.SetTestStatisticData(
q[i]);
428 std::cout <<
" Expected p -value and significance at " << sig <<
" sigma = " <<
htExp.NullPValue()
429 <<
" significance " <<
htExp.Significance() <<
" sigma " << std::endl;
433 for (
int i = 0; i < 5; ++i) {
436 double pval = AsymptoticCalculator::GetExpectedPValues(
htr->NullPValue(),
htr->AlternatePValue(), -sig,
false);
437 std::cout <<
" Expected p -value and significance at " << sig <<
" sigma = " <<
pval <<
" significance "
447 Info(
"StandardHypoTestDemo",
"Detailed output will be written in output result file");
458 name.Replace(0,
name.Last(
'/') + 1,
"");
463 Info(
"StandardHypoTestDemo",
"HypoTestResult has been written in the file %s",
resultFileName.Data());
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
void Info(const char *location, const char *msgfmt,...)
Use this function for informational messages.
void Error(const char *location, const char *msgfmt,...)
Use this function in case an error occurred.
void Warning(const char *location, const char *msgfmt,...)
Use this function in warning situations.
winID h TVirtualViewer3D TVirtualGLPainter p
winID h TVirtualViewer3D TVirtualGLPainter char TVirtualGLPainter plot
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void data
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char filename
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t np
R__EXTERN TSystem * gSystem
Abstract base class for binned and unbinned datasets.
Abstract interface for all probability density functions.
double getVal(const RooArgSet *normalisationSet=nullptr) const
Evaluate object.
RooArgSet is a container object that can hold multiple RooAbsArg objects.
Variable that can be changed from the outside.
void setVal(double value) override
Set value of variable to 'value'.
Hypothesis Test Calculator based on the asymptotic formulae for the profile likelihood ratio.
Does a frequentist hypothesis test.
Same purpose as HybridCalculatorOriginal, but different implementation.
Common base class for the Hypothesis Test Calculators.
This class provides the plots for the result of a study performed with any of the HypoTestCalculatorG...
HypoTestResult is a base class for results from hypothesis tests.
ModelConfig is a simple class that holds configuration information specifying how a model should be u...
ProfileLikelihoodTestStat is an implementation of the TestStatistic interface that calculates the pro...
Holds configuration options for proof and proof-lite.
TestStatistic that returns the ratio of profiled likelihoods.
This class simply holds a sampling distribution of some test statistic.
TestStatistic class that returns -log(L[null] / L[alt]) where L is the likelihood.
ToyMCSampler is an implementation of the TestStatSampler interface.
Persistable container for RooFit projects.
TObject * Get(const char *namecycle) override
Return pointer to object identified by namecycle.
A ROOT file is an on-disk file, usually with extension .root, that stores objects in a file-system-li...
static TFile * Open(const char *name, Option_t *option="", const char *ftitle="", Int_t compress=ROOT::RCompressionSetting::EDefaults::kUseCompiledDefault, Int_t netopt=0)
Create / open a file.
static TString Format(const char *fmt,...)
Static method which formats a string using a printf style format descriptor and return a TString.
virtual Bool_t AccessPathName(const char *path, EAccessMode mode=kFileExists)
Returns FALSE if one can access a file using the specified access mode.
double normal_cdf(double x, double sigma=1, double x0=0)
Cumulative distribution function of the normal (Gaussian) distribution (lower tail).
double normal_quantile_c(double z, double sigma)
Inverse ( ) of the cumulative distribution function of the upper tail of the normal (Gaussian) distri...
The namespace RooFit contains mostly switches that change the behaviour of functions of PDFs (or othe...
Namespace for the RooStats classes.
bool SetAllConstant(const RooAbsCollection &coll, bool constant=true)
utility function to set all variable constant in a collection (from G.
RooAbsPdf * MakeNuisancePdf(RooAbsPdf &pdf, const RooArgSet &observables, const char *name)
extract constraint terms from pdf
void Quantiles(Int_t n, Int_t nprob, Double_t *x, Double_t *quantiles, Double_t *prob, Bool_t isSorted=kTRUE, Int_t *index=nullptr, Int_t type=7)
Computes sample quantiles, corresponding to the given probabilities.