74struct HypoTestInvOptions {
76 bool plotHypoTestResult =
true;
77 bool writeResult =
true;
80 bool useVectorStore =
true;
81 bool generateBinned =
false;
82 bool noSystematics =
false;
84 double nToysRatio = 2;
86 bool useProof =
false;
88 bool enableDetailedOutput =
92 int nToyToRebuild = 100;
93 int rebuildParamValues = 0;
105 bool reuseAltToys =
false;
106 double confLevel = 0.95;
108 std::string minimizerType =
110 std::string massValue =
"";
113 bool useNLLOffset =
false;
116HypoTestInvOptions optHTInv;
122class HypoTestInvTool {
126 ~HypoTestInvTool(){};
129 const char *dataName,
int type,
int testStatType,
bool useCLs,
int npoints,
130 double poimin,
double poimax,
int ntoys,
bool useNumberCounting =
false,
131 const char *nuisPriorName = 0);
134 const char *fileNameBase = 0);
136 void SetParameter(
const char *
name,
const char *value);
137 void SetParameter(
const char *
name,
bool value);
138 void SetParameter(
const char *
name,
int value);
139 void SetParameter(
const char *
name,
double value);
142 bool mPlotHypoTestResult;
145 bool mUseVectorStore;
146 bool mGenerateBinned;
150 bool mEnableDetOutput;
153 int mRebuildParamValues;
160 std::string mMassValue;
168RooStats::HypoTestInvTool::HypoTestInvTool()
169 : mPlotHypoTestResult(true), mWriteResult(false), mOptimize(true), mUseVectorStore(true), mGenerateBinned(false),
170 mUseProof(false), mEnableDetOutput(false), mRebuild(false), mReuseAltToys(false), mNWorkers(4),
171 mNToyToRebuild(100), mRebuildParamValues(0), mPrintLevel(0), mInitialFit(-1), mRandomSeed(-1), mNToysRatio(2),
172 mMaxPoi(-1), mAsimovBins(0), mMassValue(
""), mMinimizerType(
""), mResultFileName()
176void RooStats::HypoTestInvTool::SetParameter(
const char *
name,
bool value)
182 std::string s_name(
name);
184 if (s_name.find(
"PlotHypoTestResult") != std::string::npos)
185 mPlotHypoTestResult = value;
186 if (s_name.find(
"WriteResult") != std::string::npos)
187 mWriteResult = value;
188 if (s_name.find(
"Optimize") != std::string::npos)
190 if (s_name.find(
"UseVectorStore") != std::string::npos)
191 mUseVectorStore = value;
192 if (s_name.find(
"GenerateBinned") != std::string::npos)
193 mGenerateBinned = value;
194 if (s_name.find(
"UseProof") != std::string::npos)
196 if (s_name.find(
"EnableDetailedOutput") != std::string::npos)
197 mEnableDetOutput = value;
198 if (s_name.find(
"Rebuild") != std::string::npos)
200 if (s_name.find(
"ReuseAltToys") != std::string::npos)
201 mReuseAltToys = value;
206void RooStats::HypoTestInvTool::SetParameter(
const char *
name,
int value)
212 std::string s_name(
name);
214 if (s_name.find(
"NWorkers") != std::string::npos)
216 if (s_name.find(
"NToyToRebuild") != std::string::npos)
217 mNToyToRebuild = value;
218 if (s_name.find(
"RebuildParamValues") != std::string::npos)
219 mRebuildParamValues = value;
220 if (s_name.find(
"PrintLevel") != std::string::npos)
222 if (s_name.find(
"InitialFit") != std::string::npos)
224 if (s_name.find(
"RandomSeed") != std::string::npos)
226 if (s_name.find(
"AsimovBins") != std::string::npos)
232void RooStats::HypoTestInvTool::SetParameter(
const char *
name,
double value)
238 std::string s_name(
name);
240 if (s_name.find(
"NToysRatio") != std::string::npos)
242 if (s_name.find(
"MaxPOI") != std::string::npos)
248void RooStats::HypoTestInvTool::SetParameter(
const char *
name,
const char *value)
254 std::string s_name(
name);
256 if (s_name.find(
"MassValue") != std::string::npos)
257 mMassValue.assign(value);
258 if (s_name.find(
"MinimizerType") != std::string::npos)
259 mMinimizerType.assign(value);
260 if (s_name.find(
"ResultFileName") != std::string::npos)
261 mResultFileName = value;
266void StandardHypoTestInvDemo(
const char *infile = 0,
const char *wsName =
"combined",
267 const char *modelSBName =
"ModelConfig",
const char *modelBName =
"",
268 const char *dataName =
"obsData",
int calculatorType = 0,
int testStatType = 0,
269 bool useCLs =
true,
int npoints = 6,
double poimin = 0,
double poimax = 5,
270 int ntoys = 1000,
bool useNumberCounting =
false,
const char *nuisPriorName = 0)
319 if (filename.IsNull()) {
320 filename =
"results/example_combined_GaussExample_model.root";
325 cout <<
"HistFactory file cannot be generated on Windows - exit" << endl;
329 cout <<
"will run standard hist2workspace example" << endl;
330 gROOT->ProcessLine(
".! prepareHistFactory .");
331 gROOT->ProcessLine(
".! hist2workspace config/example.xml");
332 cout <<
"\n\n---------------------" << endl;
333 cout <<
"Done creating example input" << endl;
334 cout <<
"---------------------\n\n" << endl;
345 cout <<
"StandardRooStatsDemoMacro: Input file " << filename <<
" is not found" << endl;
349 HypoTestInvTool calc;
352 calc.SetParameter(
"PlotHypoTestResult", optHTInv.plotHypoTestResult);
353 calc.SetParameter(
"WriteResult", optHTInv.writeResult);
354 calc.SetParameter(
"Optimize", optHTInv.optimize);
355 calc.SetParameter(
"UseVectorStore", optHTInv.useVectorStore);
356 calc.SetParameter(
"GenerateBinned", optHTInv.generateBinned);
357 calc.SetParameter(
"NToysRatio", optHTInv.nToysRatio);
358 calc.SetParameter(
"MaxPOI", optHTInv.maxPOI);
359 calc.SetParameter(
"UseProof", optHTInv.useProof);
360 calc.SetParameter(
"EnableDetailedOutput", optHTInv.enableDetailedOutput);
361 calc.SetParameter(
"NWorkers", optHTInv.nworkers);
362 calc.SetParameter(
"Rebuild", optHTInv.rebuild);
363 calc.SetParameter(
"ReuseAltToys", optHTInv.reuseAltToys);
364 calc.SetParameter(
"NToyToRebuild", optHTInv.nToyToRebuild);
365 calc.SetParameter(
"RebuildParamValues", optHTInv.rebuildParamValues);
366 calc.SetParameter(
"MassValue", optHTInv.massValue.c_str());
367 calc.SetParameter(
"MinimizerType", optHTInv.minimizerType.c_str());
368 calc.SetParameter(
"PrintLevel", optHTInv.printLevel);
369 calc.SetParameter(
"InitialFit", optHTInv.initialFit);
370 calc.SetParameter(
"ResultFileName", optHTInv.resultFileName);
371 calc.SetParameter(
"RandomSeed", optHTInv.randomSeed);
372 calc.SetParameter(
"AsimovBins", optHTInv.nAsimovBins);
375 if (optHTInv.useNLLOffset)
380 std::cout << w <<
"\t" << filename << std::endl;
382 r = calc.RunInverter(w, modelSBName, modelBName, dataName, calculatorType, testStatType, useCLs, npoints, poimin,
383 poimax, ntoys, useNumberCounting, nuisPriorName);
385 std::cerr <<
"Error running the HypoTestInverter - Exit " << std::endl;
390 std::cout <<
"Reading an HypoTestInverterResult with name " << wsName <<
" from file " << filename << std::endl;
393 std::cerr <<
"File " << filename <<
" does not contain a workspace or an HypoTestInverterResult - Exit "
400 calc.AnalyzeResult(
r, calculatorType, testStatType, useCLs, npoints, infile);
406 bool useCLs,
int npoints,
const char *fileNameBase)
411 double lowerLimit = 0;
413#if defined ROOT_SVN_VERSION && ROOT_SVN_VERSION >= 44126
414 if (
r->IsTwoSided()) {
415 lowerLimit =
r->LowerLimit();
416 llError =
r->LowerLimitEstimatedError();
419 lowerLimit =
r->LowerLimit();
420 llError =
r->LowerLimitEstimatedError();
423 double upperLimit =
r->UpperLimit();
424 double ulError =
r->UpperLimitEstimatedError();
428 if (lowerLimit < upperLimit * (1. - 1.E-4) && lowerLimit != 0)
429 std::cout <<
"The computed lower limit is: " << lowerLimit <<
" +/- " << llError << std::endl;
430 std::cout <<
"The computed upper limit is: " << upperLimit <<
" +/- " << ulError << std::endl;
433 std::cout <<
"Expected upper limits, using the B (alternate) model : " << std::endl;
434 std::cout <<
" expected limit (median) " <<
r->GetExpectedUpperLimit(0) << std::endl;
435 std::cout <<
" expected limit (-1 sig) " <<
r->GetExpectedUpperLimit(-1) << std::endl;
436 std::cout <<
" expected limit (+1 sig) " <<
r->GetExpectedUpperLimit(1) << std::endl;
437 std::cout <<
" expected limit (-2 sig) " <<
r->GetExpectedUpperLimit(-2) << std::endl;
438 std::cout <<
" expected limit (+2 sig) " <<
r->GetExpectedUpperLimit(2) << std::endl;
441 if (mEnableDetOutput) {
443 Info(
"StandardHypoTestInvDemo",
"detailed output will be written in output result file");
447 if (
r != NULL && mWriteResult) {
450 const char *calcType = (calculatorType == 0) ?
"Freq" : (calculatorType == 1) ?
"Hybr" :
"Asym";
451 const char *limitType = (useCLs) ?
"CLs" :
"Cls+b";
452 const char *scanType = (npoints < 0) ?
"auto" :
"grid";
453 if (mResultFileName.IsNull()) {
454 mResultFileName =
TString::Format(
"%s_%s_%s_ts%d_", calcType, limitType, scanType, testStatType);
456 if (mMassValue.size() > 0) {
457 mResultFileName += mMassValue.c_str();
458 mResultFileName +=
"_";
463 mResultFileName +=
name;
467 TString uldistFile =
"RULDist.root";
473 ulDist = fileULDist->
Get(
"RULDist");
476 TFile *fileOut =
new TFile(mResultFileName,
"RECREATE");
480 Info(
"StandardHypoTestInvDemo",
"HypoTestInverterResult has been written in the file %s", mResultFileName.Data());
486 std::string typeName =
"";
487 if (calculatorType == 0)
488 typeName =
"Frequentist";
489 if (calculatorType == 1)
491 else if (calculatorType == 2 || calculatorType == 3) {
492 typeName =
"Asymptotic";
493 mPlotHypoTestResult =
false;
496 const char *resultName =
r->
GetName();
505 plot->
Draw(
"CLb 2CL");
512 const int nEntries =
r->ArraySize();
515 if (mPlotHypoTestResult) {
522 for (
int i = 0; i < nEntries; i++) {
535 const char *modelBName,
const char *dataName,
int type,
536 int testStatType,
bool useCLs,
int npoints,
537 double poimin,
double poimax,
int ntoys,
538 bool useNumberCounting,
const char *nuisPriorName)
541 std::cout <<
"Running HypoTestInverter on the workspace " << w->
GetName() << std::endl;
547 Error(
"StandardHypoTestDemo",
"Not existing data %s", dataName);
550 std::cout <<
"Using data set " << dataName << std::endl;
552 if (mUseVectorStore) {
563 Error(
"StandardHypoTestDemo",
"Not existing ModelConfig %s", modelSBName);
568 Error(
"StandardHypoTestDemo",
"Model %s has no pdf ", modelSBName);
572 Error(
"StandardHypoTestDemo",
"Model %s has no poi ", modelSBName);
576 Error(
"StandardHypoTestInvDemo",
"Model %s has no observables ", modelSBName);
580 Info(
"StandardHypoTestInvDemo",
"Model %s has no snapshot - make one using model poi", modelSBName);
586 if (optHTInv.noSystematics) {
588 if (nuisPar && nuisPar->
getSize() > 0) {
589 std::cout <<
"StandardHypoTestInvDemo"
590 <<
" - Switch off all systematics by setting them constant to their initial values" << std::endl;
600 if (!bModel || bModel == sbModel) {
601 Info(
"StandardHypoTestInvDemo",
"The background model %s does not exist", modelBName);
602 Info(
"StandardHypoTestInvDemo",
"Copy it from ModelConfig %s and set POI to zero", modelSBName);
608 double oldval = var->
getVal();
614 Info(
"StandardHypoTestInvDemo",
"Model %s has no snapshot - make one using model poi and 0 values ",
618 double oldval = var->
getVal();
623 Error(
"StandardHypoTestInvDemo",
"Model %s has no valid poi", modelBName);
634 if (hasNuisParam && !hasGlobalObs) {
638 Warning(
"StandardHypoTestInvDemo",
"Model %s has nuisance parameters but no global observables associated",
640 Warning(
"StandardHypoTestInvDemo",
641 "\tThe effect of the nuisance parameters will not be treated correctly ");
649 allParams->
snapshot(initialParameters);
657 std::cout <<
"StandardHypoTestInvDemo : POI initial value: " << poi->
GetName() <<
" = " << poi->
getVal()
663 bool doFit = mInitialFit;
664 if (testStatType == 0 && mInitialFit == -1)
666 if (
type == 3 && mInitialFit == -1)
670 if (mMinimizerType.size() == 0)
675 Info(
"StandardHypoTestInvDemo",
"Using %s as minimizer for computing the test statistic",
684 Info(
"StandardHypoTestInvDemo",
" Doing a first fit to the observed data ");
693 if (fitres->
status() != 0) {
694 Warning(
"StandardHypoTestInvDemo",
695 "Fit to the model failed - try with strategy 1 and perform first an Hesse computation");
700 if (fitres->
status() != 0)
701 Warning(
"StandardHypoTestInvDemo",
" Fit still failed - continue anyway.....");
704 std::cout <<
"StandardHypoTestInvDemo - Best Fit value : " << poi->
GetName() <<
" = " << poihat <<
" +/- "
706 std::cout <<
"Time for fitting : ";
711 std::cout <<
"StandardHypoTestInvo: snapshot of S+B Model " << sbModel->
GetName()
712 <<
" is set to the best fit value" << std::endl;
716 if (testStatType == 0) {
718 Info(
"StandardHypoTestInvDemo",
"Using LEP test statistic - an initial fit is not done and the TS will use "
719 "the nuisances at the model value");
721 Info(
"StandardHypoTestInvDemo",
"Using LEP test statistic - an initial fit has been done and the TS will use "
722 "the nuisances at the best fit value");
734 slrts.SetNullParameters(nullParams);
739 slrts.SetAltParameters(altParams);
740 if (mEnableDetOutput)
741 slrts.EnableDetailedOutput();
745 ropl.SetSubtractMLE(
false);
746 if (testStatType == 11)
747 ropl.SetSubtractMLE(
true);
748 ropl.SetPrintLevel(mPrintLevel);
749 ropl.SetMinimizer(mMinimizerType.c_str());
750 if (mEnableDetOutput)
751 ropl.EnableDetailedOutput();
754 if (testStatType == 3)
755 profll.SetOneSided(
true);
756 if (testStatType == 4)
757 profll.SetSigned(
true);
758 profll.SetMinimizer(mMinimizerType.c_str());
759 profll.SetPrintLevel(mPrintLevel);
760 if (mEnableDetOutput)
761 profll.EnableDetailedOutput();
763 profll.SetReuseNLL(mOptimize);
764 slrts.SetReuseNLL(mOptimize);
765 ropl.SetReuseNLL(mOptimize);
768 profll.SetStrategy(0);
779 AsymptoticCalculator::SetPrintLevel(mPrintLevel);
796 Error(
"StandardHypoTestInvDemo",
"Invalid - calculator type = %d supported values are only :\n\t\t\t 0 "
797 "(Frequentist) , 1 (Hybrid) , 2 (Asymptotic) ",
804 if (testStatType == 0)
806 if (testStatType == 1 || testStatType == 11)
808 if (testStatType == 2 || testStatType == 3 || testStatType == 4)
810 if (testStatType == 5)
812 if (testStatType == 6)
816 Error(
"StandardHypoTestInvDemo",
"Invalid - test statistic type = %d supported values are only :\n\t\t\t 0 (SLR) "
817 ", 1 (Tevatron) , 2 (PLR), 3 (PLR1), 4(MLE)",
823 if (toymcs && (
type == 0 ||
type == 1)) {
826 if (useNumberCounting)
827 Warning(
"StandardHypoTestInvDemo",
"Pdf is extended: but number counting flag is set: ignore it ");
830 if (!useNumberCounting) {
832 Info(
"StandardHypoTestInvDemo",
833 "Pdf is not extended: number of events to generate taken from observed data set is %d", nEvents);
836 Info(
"StandardHypoTestInvDemo",
"using a number counting pdf");
844 Info(
"StandardHypoTestInvDemo",
"Data set is weighted, nentries = %d and sum of weights = %8.1f but toy "
845 "generation is unbinned - it would be faster to set mGenerateBinned to true\n",
853 Warning(
"StandardHypoTestInvDemo",
"generate binned is activated but the number of observable is %d. Too much "
854 "memory could be needed for allocating all the bins",
859 if (mRandomSeed >= 0)
872 hhc->
SetToys(ntoys, ntoys / mNToysRatio);
883 ToyMCSampler::SetAlwaysUseMultiGen(
false);
887 nuisPdf = w->
pdf(nuisPriorName);
890 Info(
"StandardHypoTestInvDemo",
891 "No nuisance pdf given for the HybridCalculator - try to deduce pdf from the model");
900 Info(
"StandardHypoTestInvDemo",
901 "No nuisance pdf given - try to use %s that is defined as a prior pdf in the B model",
904 Error(
"StandardHypoTestInvDemo",
"Cannot run Hybrid calculator because no prior on the nuisance "
905 "parameter is specified or can be derived");
910 Info(
"StandardHypoTestInvDemo",
"Using as nuisance Pdf ... ");
917 Warning(
"StandardHypoTestInvDemo",
918 "Prior nuisance does not depend on nuisance parameters. They will be smeared in their full range");
925 }
else if (
type == 2 ||
type == 3) {
926 if (testStatType == 3)
928 if (testStatType != 2 && testStatType != 3)
929 Warning(
"StandardHypoTestInvDemo",
930 "Only the PL test statistic can be used with AsymptoticCalculator - use by default a two-sided PL");
931 }
else if (
type == 0) {
934 if (mEnableDetOutput)
936 }
else if (
type == 1) {
946 calc.SetConfidenceLevel(optHTInv.confLevel);
949 calc.SetVerbose(
true);
958 if (poimin > poimax) {
960 poimin =
int(poihat);
963 std::cout <<
"Doing a fixed scan in interval : " << poimin <<
" , " << poimax << std::endl;
964 calc.SetFixedScan(npoints, poimin, poimax);
967 std::cout <<
"Doing an automatic scan in interval : " << poi->
getMin() <<
" , " << poi->
getMax() << std::endl;
972 std::cout <<
"Time to perform limit scan \n";
977 std::cout <<
"\n***************************************************************\n";
978 std::cout <<
"Rebuild the upper limit distribution by re-generating new set of pseudo-experiment and re-compute "
979 "for each of them a new upper limit\n\n";
986 if (mRebuildParamValues != 0) {
988 *allParams = initialParameters;
990 if (mRebuildParamValues == 0 || mRebuildParamValues == 1) {
1000 if (mRebuildParamValues == 0) {
1008 std::cout <<
"rebuild using fitted parameter value for B-model snapshot" << std::endl;
1009 constrainParams.
Print(
"v");
1014 std::cout <<
"StandardHypoTestInvDemo: Initial parameters used for rebuilding: ";
1018 calc.SetCloseProof(1);
1021 std::cout <<
"Time to rebuild distributions " << std::endl;
1025 std::cout <<
"Expected limits after rebuild distribution " << std::endl;
1026 std::cout <<
"expected upper limit (median of limit distribution) " << limDist->
InverseCDF(0.5) << std::endl;
1027 std::cout <<
"expected -1 sig limit (0.16% quantile of limit dist) "
1029 std::cout <<
"expected +1 sig limit (0.84% quantile of limit dist) "
1031 std::cout <<
"expected -2 sig limit (.025% quantile of limit dist) "
1033 std::cout <<
"expected +2 sig limit (.975% quantile of limit dist) "
1041 new TCanvas(
"limPlot",
"Upper Limit Distribution");
1046 TFile *fileOut =
new TFile(
"RULDist.root",
"RECREATE");
1054 r = calc.GetInterval();
1057 std::cout <<
"ERROR : failed to re-build distributions " << std::endl;
1063void ReadResult(
const char *fileName,
const char *resultName =
"",
bool useCLs =
true)
1067 StandardHypoTestInvDemo(fileName, resultName,
"",
"",
"", 0, 0, useCLs);
1073 StandardHypoTestInvDemo();
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.
R__EXTERN TSystem * gSystem
static void SetDefaultMinimizer(const char *type, const char *algo=0)
static void SetDefaultStrategy(int strat)
static const std::string & DefaultMinimizerType()
RooArgSet * getObservables(const RooArgSet &set, Bool_t valueOnly=kTRUE) const
Given a set of possible observables, return the observables that this PDF depends on.
virtual void Print(Option_t *options=0) const
Print the object to the defaultPrintStream().
RooArgSet * getParameters(const RooAbsData *data, bool stripDisconnected=true) const
Create a list of leaf nodes in the arg tree starting with ourself as top node that don't match any of...
RooAbsArg * first() const
virtual void Print(Option_t *options=0) const
This method must be overridden when a class wants to print itself.
RooAbsData is the common abstract base class for binned and unbinned datasets.
static void setDefaultStorageType(StorageType s)
virtual Double_t sumEntries() const =0
Return effective number of entries in dataset, i.e., sum all weights.
virtual Bool_t isWeighted() const
void convertToVectorStore()
Convert tree-based storage to vector-based storage.
virtual Int_t numEntries() const
Return number of entries in dataset, i.e., count unweighted entries.
Bool_t canBeExtended() const
If true, PDF can provide extended likelihood term.
virtual RooFitResult * fitTo(RooAbsData &data, const RooCmdArg &arg1=RooCmdArg::none(), const RooCmdArg &arg2=RooCmdArg::none(), const RooCmdArg &arg3=RooCmdArg::none(), const RooCmdArg &arg4=RooCmdArg::none(), const RooCmdArg &arg5=RooCmdArg::none(), const RooCmdArg &arg6=RooCmdArg::none(), const RooCmdArg &arg7=RooCmdArg::none(), const RooCmdArg &arg8=RooCmdArg::none())
Fit PDF to given dataset.
virtual Double_t getMax(const char *name=0) const
Get maximum of currently defined range.
virtual Double_t getMin(const char *name=0) const
Get miniminum of currently defined range.
Double_t getVal(const RooArgSet *normalisationSet=nullptr) const
Evaluate object.
RooArgSet is a container object that can hold multiple RooAbsArg objects.
RooArgSet * snapshot(bool deepCopy=true) const
Use RooAbsCollection::snapshot(), but return as RooArgSet.
Bool_t add(const RooAbsArg &var, Bool_t silent=kFALSE) override
Add element to non-owning set.
RooFitResult is a container class to hold the input and output of a PDF fit to a dataset.
Int_t status() const
Return MINUIT status code.
static RooMsgService & instance()
Return reference to singleton instance.
StreamConfig & getStream(Int_t id)
static TRandom * randomGenerator()
Return a pointer to a singleton random-number generator implementation.
RooRealVar represents a variable that can be changed from the outside.
void setMax(const char *name, Double_t value)
Set maximum of name range to given value.
Double_t getError() const
virtual void setVal(Double_t value)
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.
virtual void ForcePriorNuisanceNull(RooAbsPdf &priorNuisance)
Override the distribution used for marginalizing nuisance parameters that is inferred from ModelConfi...
virtual void ForcePriorNuisanceAlt(RooAbsPdf &priorNuisance)
void SetToys(int toysNull, int toysAlt)
set number of toys
Common base class for the Hypothesis Test Calculators.
TestStatSampler * GetTestStatSampler(void) const
Returns instance of TestStatSampler.
void UseSameAltToys()
Set this for re-using always the same toys for alternate hypothesis in case of calls at different nul...
Class to plot a HypoTestInverterResult, the output of the HypoTestInverter calculator.
void Draw(Option_t *opt="")
Draw the scan result in the current canvas Possible options: "" (default): draw observed + expected w...
SamplingDistPlot * MakeTestStatPlot(int index, int type=0, int nbins=100)
Plot the test statistic distributions.
HypoTestInverterResult class holds the array of hypothesis test results and compute a confidence inte...
A class for performing a hypothesis test inversion by scanning the hypothesis test results of a HypoT...
MaxLikelihoodEstimateTestStat: TestStatistic that returns maximum likelihood estimate of a specified ...
ModelConfig is a simple class that holds configuration information specifying how a model should be u...
virtual void SetSnapshot(const RooArgSet &set)
Set parameter values for a particular hypothesis if using a common PDF by saving a snapshot in the wo...
virtual ModelConfig * Clone(const char *name="") const override
clone
const RooArgSet * GetGlobalObservables() const
get RooArgSet for global observables (return NULL if not existing)
const RooArgSet * GetParametersOfInterest() const
get RooArgSet containing the parameter of interest (return NULL if not existing)
const RooArgSet * GetNuisanceParameters() const
get RooArgSet containing the nuisance parameters (return NULL if not existing)
virtual void SetGlobalObservables(const RooArgSet &set)
Specify the global observables.
void LoadSnapshot() const
load the snapshot from ws if it exists
const RooArgSet * GetObservables() const
get RooArgSet for observables (return NULL if not existing)
const RooArgSet * GetSnapshot() const
get RooArgSet for parameters for a particular hypothesis (return NULL if not existing)
RooAbsPdf * GetPdf() const
get model PDF (return NULL if pdf has not been specified or does not exist)
RooAbsPdf * GetPriorPdf() const
get parameters prior pdf (return NULL if not existing)
NumEventsTestStat is a simple implementation of the TestStatistic interface used for simple number co...
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 provides simple and straightforward utilities to plot SamplingDistribution objects.
Double_t AddSamplingDistribution(const SamplingDistribution *samplingDist, Option_t *drawOptions="NORMALIZE HIST")
adds the sampling distribution and returns the scale factor
void SetLogYaxis(Bool_t ly)
changes plot to log scale on y axis
void Draw(Option_t *options=0)
Draw this plot and all of the elements it contains.
TH1F * GetTH1F(const SamplingDistribution *samplDist=NULL)
Returns the TH1F associated with the give SamplingDistribution.
void SetLineColor(Color_t color, const SamplingDistribution *samplDist=0)
Sets line color for given sampling distribution and fill color for the associated shaded TH1F.
This class simply holds a sampling distribution of some test statistic.
Double_t InverseCDF(Double_t pvalue)
get the inverse of the Cumulative distribution function
TestStatistic class that returns -log(L[null] / L[alt]) where L is the likelihood.
TestStatistic is an interface class to provide a facility for construction test statistics distributi...
ToyMCSampler is an implementation of the TestStatSampler interface.
void SetProofConfig(ProofConfig *pc=NULL)
virtual void SetTestStatistic(TestStatistic *testStatistic, unsigned int i)
void SetGenerateBinned(bool binned=true)
void SetUseMultiGen(Bool_t flag)
virtual void SetNEventsPerToy(const Int_t nevents)
Forces the generation of exactly n events even for extended PDFs.
The RooWorkspace is a persistable container for RooFit projects.
RooAbsData * data(const char *name) const
Retrieve dataset (binned or unbinned) with given name. A null pointer is returned if not found.
void Print(Option_t *opts=0) const
Print contents of the workspace.
TObject * obj(const char *name) const
Return any type of object (RooAbsArg, RooAbsData or generic object) with given name)
RooAbsPdf * pdf(const char *name) const
Retrieve p.d.f (RooAbsPdf) with given name. A null pointer is returned if not found.
TObject * Get(const char *namecycle) override
Return pointer to object identified by namecycle.
A ROOT file is a suite of consecutive data records (TKey instances) with a well defined format.
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.
void Close(Option_t *option="") override
Close a file.
virtual void SetStats(Bool_t stats=kTRUE)
Set statistics option on/off.
virtual void SetName(const char *name)
Set the name of the TNamed.
virtual const char * GetName() const
Returns name of object.
Mother of all ROOT objects.
virtual Int_t Write(const char *name=0, Int_t option=0, Int_t bufsize=0)
Write this object to the current directory.
virtual const char * GetName() const
Returns name of object.
virtual void SetSeed(ULong_t seed=0)
Set the random generator seed.
void Start(Bool_t reset=kTRUE)
Start the stopwatch.
void Print(Option_t *option="") const
Print the real and cpu time passed between the start and stop events.
TString & Replace(Ssiz_t pos, Ssiz_t n, const char *s)
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.
RooCmdArg Constrain(const RooArgSet ¶ms)
RooCmdArg Strategy(Int_t code)
RooCmdArg Hesse(Bool_t flag=kTRUE)
RooCmdArg InitialHesse(Bool_t flag=kTRUE)
RooCmdArg Save(Bool_t flag=kTRUE)
RooCmdArg PrintLevel(Int_t code)
RooCmdArg Offset(Bool_t flag=kTRUE)
RooCmdArg Minimizer(const char *type, const char *alg=0)
double normal_cdf(double x, double sigma=1, double x0=0)
Cumulative distribution function of the normal (Gaussian) distribution (lower tail).
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)
void RemoveConstantParameters(RooArgSet *set)
RooAbsPdf * MakeNuisancePdf(RooAbsPdf &pdf, const RooArgSet &observables, const char *name)
void UseNLLOffset(bool on)
Use an offset in NLL calculations.
bool IsNLLOffset()
Test of RooStats should by default offset NLL calculations.
void PrintListContent(const RooArgList &l, std::ostream &os=std::cout)
Double_t Sqrt(Double_t x)
Int_t CeilNint(Double_t x)
void removeTopic(RooFit::MsgTopic oldTopic)