73struct HypoTestInvOptions {
75bool plotHypoTestResult =
true;
76bool writeResult =
true;
77TString resultFileName;
79bool useVectorStore =
true;
80bool generateBinned =
false;
81bool noSystematics =
false;
87bool enableDetailedOutput =
false;
90int nToyToRebuild = 100;
91int rebuildParamValues=0;
101bool reuseAltToys =
false;
102double confLevel = 0.95;
106std::string minimizerType =
"";
107std::string massValue =
"";
110bool useNLLOffset =
false;
115HypoTestInvOptions optHTInv;
121 class HypoTestInvTool{
125 ~HypoTestInvTool(){};
129 const char * modelSBName,
const char * modelBName,
130 const char * dataName,
131 int type,
int testStatType,
133 int npoints,
double poimin,
double poimax,
int ntoys,
134 bool useNumberCounting =
false,
135 const char * nuisPriorName = 0);
145 const char * fileNameBase = 0 );
147 void SetParameter(
const char *
name,
const char * value);
148 void SetParameter(
const char *
name,
bool value);
149 void SetParameter(
const char *
name,
int value);
150 void SetParameter(
const char *
name,
double value);
154 bool mPlotHypoTestResult;
157 bool mUseVectorStore;
158 bool mGenerateBinned;
162 bool mEnableDetOutput;
165 int mRebuildParamValues;
172 std::string mMassValue;
173 std::string mMinimizerType;
174 TString mResultFileName;
179RooStats::HypoTestInvTool::HypoTestInvTool() : mPlotHypoTestResult(true),
182 mUseVectorStore(true),
183 mGenerateBinned(false),
185 mEnableDetOutput(false),
187 mReuseAltToys(false),
190 mRebuildParamValues(0),
205RooStats::HypoTestInvTool::SetParameter(
const char *
name,
bool value){
210 std::string s_name(
name);
212 if (s_name.find(
"PlotHypoTestResult") != std::string::npos) mPlotHypoTestResult = value;
213 if (s_name.find(
"WriteResult") != std::string::npos) mWriteResult = value;
214 if (s_name.find(
"Optimize") != std::string::npos) mOptimize = value;
215 if (s_name.find(
"UseVectorStore") != std::string::npos) mUseVectorStore = value;
216 if (s_name.find(
"GenerateBinned") != std::string::npos) mGenerateBinned = value;
217 if (s_name.find(
"UseProof") != std::string::npos) mUseProof = value;
218 if (s_name.find(
"EnableDetailedOutput") != std::string::npos) mEnableDetOutput = value;
219 if (s_name.find(
"Rebuild") != std::string::npos) mRebuild = value;
220 if (s_name.find(
"ReuseAltToys") != std::string::npos) mReuseAltToys = value;
228RooStats::HypoTestInvTool::SetParameter(
const char *
name,
int value){
233 std::string s_name(
name);
235 if (s_name.find(
"NWorkers") != std::string::npos) mNWorkers = value;
236 if (s_name.find(
"NToyToRebuild") != std::string::npos) mNToyToRebuild = value;
237 if (s_name.find(
"RebuildParamValues") != std::string::npos) mRebuildParamValues = value;
238 if (s_name.find(
"PrintLevel") != std::string::npos) mPrintLevel = value;
239 if (s_name.find(
"InitialFit") != std::string::npos) mInitialFit = value;
240 if (s_name.find(
"RandomSeed") != std::string::npos) mRandomSeed = value;
241 if (s_name.find(
"AsimovBins") != std::string::npos) mAsimovBins = value;
249RooStats::HypoTestInvTool::SetParameter(
const char *
name,
double value){
254 std::string s_name(
name);
256 if (s_name.find(
"NToysRatio") != std::string::npos) mNToysRatio = value;
257 if (s_name.find(
"MaxPOI") != std::string::npos) mMaxPoi = value;
265RooStats::HypoTestInvTool::SetParameter(
const char *
name,
const char * value){
270 std::string s_name(
name);
272 if (s_name.find(
"MassValue") != std::string::npos) mMassValue.assign(value);
273 if (s_name.find(
"MinimizerType") != std::string::npos) mMinimizerType.assign(value);
274 if (s_name.find(
"ResultFileName") != std::string::npos) mResultFileName = value;
282StandardHypoTestInvDemo(
const char * infile = 0,
283 const char * wsName =
"combined",
284 const char * modelSBName =
"ModelConfig",
285 const char * modelBName =
"",
286 const char * dataName =
"obsData",
287 int calculatorType = 0,
288 int testStatType = 0,
294 bool useNumberCounting =
false,
295 const char * nuisPriorName = 0){
344 TString filename(infile);
345 if (filename.IsNull()) {
346 filename =
"results/example_combined_GaussExample_model.root";
351 cout <<
"HistFactory file cannot be generated on Windows - exit" << endl;
355 cout <<
"will run standard hist2workspace example"<<endl;
356 gROOT->ProcessLine(
".! prepareHistFactory .");
357 gROOT->ProcessLine(
".! hist2workspace config/example.xml");
358 cout <<
"\n\n---------------------"<<endl;
359 cout <<
"Done creating example input"<<endl;
360 cout <<
"---------------------\n\n"<<endl;
372 cout <<
"StandardRooStatsDemoMacro: Input file " << filename <<
" is not found" << endl;
378 HypoTestInvTool calc;
381 calc.SetParameter(
"PlotHypoTestResult", optHTInv.plotHypoTestResult);
382 calc.SetParameter(
"WriteResult", optHTInv.writeResult);
383 calc.SetParameter(
"Optimize", optHTInv.optimize);
384 calc.SetParameter(
"UseVectorStore", optHTInv.useVectorStore);
385 calc.SetParameter(
"GenerateBinned", optHTInv.generateBinned);
386 calc.SetParameter(
"NToysRatio", optHTInv.nToysRatio);
387 calc.SetParameter(
"MaxPOI", optHTInv.maxPOI);
388 calc.SetParameter(
"UseProof", optHTInv.useProof);
389 calc.SetParameter(
"EnableDetailedOutput", optHTInv.enableDetailedOutput);
390 calc.SetParameter(
"NWorkers", optHTInv.nworkers);
391 calc.SetParameter(
"Rebuild", optHTInv.rebuild);
392 calc.SetParameter(
"ReuseAltToys", optHTInv.reuseAltToys);
393 calc.SetParameter(
"NToyToRebuild", optHTInv.nToyToRebuild);
394 calc.SetParameter(
"RebuildParamValues", optHTInv.rebuildParamValues);
395 calc.SetParameter(
"MassValue", optHTInv.massValue.c_str());
396 calc.SetParameter(
"MinimizerType", optHTInv.minimizerType.c_str());
397 calc.SetParameter(
"PrintLevel", optHTInv.printLevel);
398 calc.SetParameter(
"InitialFit", optHTInv.initialFit);
399 calc.SetParameter(
"ResultFileName", optHTInv.resultFileName);
400 calc.SetParameter(
"RandomSeed", optHTInv.randomSeed);
401 calc.SetParameter(
"AsimovBins", optHTInv.nAsimovBins);
408 std::cout << w <<
"\t" << filename << std::endl;
410 r = calc.RunInverter(w, modelSBName, modelBName,
411 dataName, calculatorType, testStatType, useCLs,
412 npoints, poimin, poimax,
413 ntoys, useNumberCounting, nuisPriorName );
415 std::cerr <<
"Error running the HypoTestInverter - Exit " << std::endl;
421 std::cout <<
"Reading an HypoTestInverterResult with name " << wsName <<
" from file " << filename << std::endl;
424 std::cerr <<
"File " << filename <<
" does not contain a workspace or an HypoTestInverterResult - Exit "
431 calc.AnalyzeResult(
r, calculatorType, testStatType, useCLs, npoints, infile );
444 const char * fileNameBase ){
449 double lowerLimit = 0;
451#if defined ROOT_SVN_VERSION && ROOT_SVN_VERSION >= 44126
452 if (
r->IsTwoSided()) {
453 lowerLimit =
r->LowerLimit();
454 llError =
r->LowerLimitEstimatedError();
457 lowerLimit =
r->LowerLimit();
458 llError =
r->LowerLimitEstimatedError();
461 double upperLimit =
r->UpperLimit();
462 double ulError =
r->UpperLimitEstimatedError();
466 if (lowerLimit < upperLimit*(1.- 1.E-4) && lowerLimit != 0)
467 std::cout <<
"The computed lower limit is: " << lowerLimit <<
" +/- " << llError << std::endl;
468 std::cout <<
"The computed upper limit is: " << upperLimit <<
" +/- " << ulError << std::endl;
472 std::cout <<
"Expected upper limits, using the B (alternate) model : " << std::endl;
473 std::cout <<
" expected limit (median) " <<
r->GetExpectedUpperLimit(0) << std::endl;
474 std::cout <<
" expected limit (-1 sig) " <<
r->GetExpectedUpperLimit(-1) << std::endl;
475 std::cout <<
" expected limit (+1 sig) " <<
r->GetExpectedUpperLimit(1) << std::endl;
476 std::cout <<
" expected limit (-2 sig) " <<
r->GetExpectedUpperLimit(-2) << std::endl;
477 std::cout <<
" expected limit (+2 sig) " <<
r->GetExpectedUpperLimit(2) << std::endl;
481 if (mEnableDetOutput) {
483 Info(
"StandardHypoTestInvDemo",
"detailed output will be written in output result file");
488 if (
r != NULL && mWriteResult) {
491 const char * calcType = (calculatorType == 0) ?
"Freq" : (calculatorType == 1) ?
"Hybr" :
"Asym";
492 const char * limitType = (useCLs) ?
"CLs" :
"Cls+b";
493 const char * scanType = (npoints < 0) ?
"auto" :
"grid";
494 if (mResultFileName.IsNull()) {
495 mResultFileName =
TString::Format(
"%s_%s_%s_ts%d_",calcType,limitType,scanType,testStatType);
497 if (mMassValue.size()>0) {
498 mResultFileName += mMassValue.c_str();
499 mResultFileName +=
"_";
502 TString
name = fileNameBase;
503 name.Replace(0,
name.Last(
'/')+1,
"");
504 mResultFileName +=
name;
508 TString uldistFile =
"RULDist.root";
513 if (fileULDist) ulDist= fileULDist->Get(
"RULDist");
517 TFile * fileOut =
new TFile(mResultFileName,
"RECREATE");
519 if (ulDist) ulDist->
Write();
520 Info(
"StandardHypoTestInvDemo",
"HypoTestInverterResult has been written in the file %s",mResultFileName.Data());
527 std::string typeName =
"";
528 if (calculatorType == 0 )
529 typeName =
"Frequentist";
530 if (calculatorType == 1 )
532 else if (calculatorType == 2 || calculatorType == 3) {
533 typeName =
"Asymptotic";
534 mPlotHypoTestResult =
false;
537 const char * resultName =
r->
GetName();
538 TString plotTitle =
TString::Format(
"%s CL Scan for workspace %s",typeName.c_str(),resultName);
546 plot->
Draw(
"CLb 2CL");
553 const int nEntries =
r->ArraySize();
556 if (mPlotHypoTestResult) {
563 for (
int i=0; i<nEntries; i++) {
564 if (nEntries > 1)
c2->cd(i+1);
579 const char * modelSBName,
const char * modelBName,
580 const char * dataName,
int type,
int testStatType,
581 bool useCLs,
int npoints,
double poimin,
double poimax,
583 bool useNumberCounting,
584 const char * nuisPriorName ){
586 std::cout <<
"Running HypoTestInverter on the workspace " << w->
GetName() << std::endl;
593 Error(
"StandardHypoTestDemo",
"Not existing data %s",dataName);
597 std::cout <<
"Using data set " << dataName << std::endl;
599 if (mUseVectorStore) {
601 data->convertToVectorStore() ;
611 Error(
"StandardHypoTestDemo",
"Not existing ModelConfig %s",modelSBName);
616 Error(
"StandardHypoTestDemo",
"Model %s has no pdf ",modelSBName);
620 Error(
"StandardHypoTestDemo",
"Model %s has no poi ",modelSBName);
624 Error(
"StandardHypoTestInvDemo",
"Model %s has no observables ",modelSBName);
628 Info(
"StandardHypoTestInvDemo",
"Model %s has no snapshot - make one using model poi",modelSBName);
634 if (optHTInv.noSystematics) {
636 if (nuisPar && nuisPar->
getSize() > 0) {
637 std::cout <<
"StandardHypoTestInvDemo" <<
" - Switch off all systematics by setting them constant to their initial values" << std::endl;
647 if (!bModel || bModel == sbModel) {
648 Info(
"StandardHypoTestInvDemo",
"The background model %s does not exist",modelBName);
649 Info(
"StandardHypoTestInvDemo",
"Copy it from ModelConfig %s and set POI to zero",modelSBName);
651 bModel->
SetName(TString(modelSBName)+TString(
"_with_poi_0"));
654 double oldval = var->
getVal();
661 Info(
"StandardHypoTestInvDemo",
"Model %s has no snapshot - make one using model poi and 0 values ",modelBName);
664 double oldval = var->
getVal();
670 Error(
"StandardHypoTestInvDemo",
"Model %s has no valid poi",modelBName);
681 if (hasNuisParam && !hasGlobalObs ) {
685 Warning(
"StandardHypoTestInvDemo",
"Model %s has nuisance parameters but no global observables associated",sbModel->
GetName());
686 Warning(
"StandardHypoTestInvDemo",
"\tThe effect of the nuisance parameters will not be treated correctly ");
694 allParams->
snapshot(initialParameters);
702 std::cout <<
"StandardHypoTestInvDemo : POI initial value: " << poi->
GetName() <<
" = " << poi->
getVal() << std::endl;
707 bool doFit = mInitialFit;
708 if (testStatType == 0 && mInitialFit == -1) doFit =
false;
709 if (
type == 3 && mInitialFit == -1) doFit =
false;
716 Info(
"StandardHypoTestInvDemo",
"Using %s as minimizer for computing the test statistic",
725 Info(
"StandardHypoTestInvDemo",
" Doing a first fit to the observed data ");
732 if (fitres->
status() != 0) {
733 Warning(
"StandardHypoTestInvDemo",
"Fit to the model failed - try with strategy 1 and perform first an Hesse computation");
737 if (fitres->
status() != 0)
738 Warning(
"StandardHypoTestInvDemo",
" Fit still failed - continue anyway.....");
742 std::cout <<
"StandardHypoTestInvDemo - Best Fit value : " << poi->
GetName() <<
" = "
743 << poihat <<
" +/- " << poi->
getError() << std::endl;
744 std::cout <<
"Time for fitting : "; tw.
Print();
748 std::cout <<
"StandardHypoTestInvo: snapshot of S+B Model " << sbModel->
GetName()
749 <<
" is set to the best fit value" << std::endl;
754 if (testStatType == 0) {
756 Info(
"StandardHypoTestInvDemo",
"Using LEP test statistic - an initial fit is not done and the TS will use the nuisances at the model value");
758 Info(
"StandardHypoTestInvDemo",
"Using LEP test statistic - an initial fit has been done and the TS will use the nuisances at the best fit value");
769 if (sbModel->
GetSnapshot()) slrts.SetNullParameters(nullParams);
772 if (bModel->
GetSnapshot()) slrts.SetAltParameters(altParams);
773 if (mEnableDetOutput) slrts.EnableDetailedOutput();
778 ropl.SetSubtractMLE(
false);
779 if (testStatType == 11) ropl.SetSubtractMLE(
true);
780 ropl.SetPrintLevel(mPrintLevel);
781 ropl.SetMinimizer(mMinimizerType.c_str());
782 if (mEnableDetOutput) ropl.EnableDetailedOutput();
785 if (testStatType == 3) profll.SetOneSided(
true);
786 if (testStatType == 4) profll.SetSigned(
true);
787 profll.SetMinimizer(mMinimizerType.c_str());
788 profll.SetPrintLevel(mPrintLevel);
789 if (mEnableDetOutput) profll.EnableDetailedOutput();
791 profll.SetReuseNLL(mOptimize);
792 slrts.SetReuseNLL(mOptimize);
793 ropl.SetReuseNLL(mOptimize);
796 profll.SetStrategy(0);
801 if (mMaxPoi > 0) poi->
setMax(mMaxPoi);
806 AsymptoticCalculator::SetPrintLevel(mPrintLevel);
817 Error(
"StandardHypoTestInvDemo",
"Invalid - calculator type = %d supported values are only :\n\t\t\t 0 (Frequentist) , 1 (Hybrid) , 2 (Asymptotic) ",
type);
823 if (testStatType == 0) testStat = &slrts;
824 if (testStatType == 1 || testStatType == 11) testStat = &ropl;
825 if (testStatType == 2 || testStatType == 3 || testStatType == 4) testStat = &profll;
826 if (testStatType == 5) testStat = &maxll;
827 if (testStatType == 6) testStat = &nevtts;
830 Error(
"StandardHypoTestInvDemo",
"Invalid - test statistic type = %d supported values are only :\n\t\t\t 0 (SLR) , 1 (Tevatron) , 2 (PLR), 3 (PLR1), 4(MLE)",testStatType);
836 if (toymcs && (
type == 0 ||
type == 1) ) {
839 if (useNumberCounting)
Warning(
"StandardHypoTestInvDemo",
"Pdf is extended: but number counting flag is set: ignore it ");
843 if (!useNumberCounting ) {
844 int nEvents =
data->numEntries();
845 Info(
"StandardHypoTestInvDemo",
"Pdf is not extended: number of events to generate taken from observed data set is %d",nEvents);
849 Info(
"StandardHypoTestInvDemo",
"using a number counting pdf");
856 if (
data->isWeighted() && !mGenerateBinned) {
857 Info(
"StandardHypoTestInvDemo",
"Data set is weighted, nentries = %d and sum of weights = %8.1f but toy generation is unbinned - it would be faster to set mGenerateBinned to true\n",
data->numEntries(),
data->sumEntries());
864 Warning(
"StandardHypoTestInvDemo",
"generate binned is activated but the number of observable is %d. Too much memory could be needed for allocating all the bins",sbModel->
GetObservables()->
getSize() );
881 hhc->
SetToys(ntoys,ntoys/mNToysRatio);
893 ToyMCSampler::SetAlwaysUseMultiGen(
false);
896 if (nuisPriorName) nuisPdf = w->
pdf(nuisPriorName);
899 Info(
"StandardHypoTestInvDemo",
"No nuisance pdf given for the HybridCalculator - try to deduce pdf from the model");
908 Info(
"StandardHypoTestInvDemo",
"No nuisance pdf given - try to use %s that is defined as a prior pdf in the B model",nuisPdf->
GetName());
911 Error(
"StandardHypoTestInvDemo",
"Cannot run Hybrid calculator because no prior on the nuisance parameter is specified or can be derived");
916 Info(
"StandardHypoTestInvDemo",
"Using as nuisance Pdf ... " );
922 Warning(
"StandardHypoTestInvDemo",
"Prior nuisance does not depend on nuisance parameters. They will be smeared in their full range");
934 if (testStatType != 2 && testStatType != 3)
935 Warning(
"StandardHypoTestInvDemo",
"Only the PL test statistic can be used with AsymptoticCalculator - use by default a two-sided PL");
937 else if (
type == 0 ) {
942 else if (
type == 1 ) {
954 calc.SetConfidenceLevel(optHTInv.confLevel);
958 calc.SetVerbose(
true);
968 if (poimin > poimax) {
970 poimin = int(poihat);
971 poimax = int(poihat + 4 * poi->
getError());
973 std::cout <<
"Doing a fixed scan in interval : " << poimin <<
" , " << poimax << std::endl;
974 calc.SetFixedScan(npoints,poimin,poimax);
978 std::cout <<
"Doing an automatic scan in interval : " << poi->
getMin() <<
" , " << poi->
getMax() << std::endl;
983 std::cout <<
"Time to perform limit scan \n";
988 std::cout <<
"\n***************************************************************\n";
989 std::cout <<
"Rebuild the upper limit distribution by re-generating new set of pseudo-experiment and re-compute for each of them a new upper limit\n\n";
999 if (mRebuildParamValues != 0) {
1001 *allParams = initialParameters;
1003 if (mRebuildParamValues == 0 || mRebuildParamValues == 1 ) {
1012 if (mRebuildParamValues == 0 ) {
1020 std::cout <<
"rebuild using fitted parameter value for B-model snapshot" << std::endl;
1021 constrainParams.
Print(
"v");
1026 std::cout <<
"StandardHypoTestInvDemo: Initial parameters used for rebuilding: ";
1030 calc.SetCloseProof(1);
1033 std::cout <<
"Time to rebuild distributions " << std::endl;
1037 std::cout <<
"Expected limits after rebuild distribution " << std::endl;
1038 std::cout <<
"expected upper limit (median of limit distribution) " << limDist->
InverseCDF(0.5) << std::endl;
1046 limPlot.AddSamplingDistribution(limDist);
1047 limPlot.GetTH1F()->SetStats(
true);
1048 limPlot.SetLineColor(
kBlue);
1049 new TCanvas(
"limPlot",
"Upper Limit Distribution");
1054 TFile * fileOut =
new TFile(
"RULDist.root",
"RECREATE");
1062 r = calc.GetInterval();
1066 std::cout <<
"ERROR : failed to re-build distributions " << std::endl;
1074void ReadResult(
const char * fileName,
const char * resultName=
"",
bool useCLs=
true) {
1077 StandardHypoTestInvDemo(fileName, resultName,
"",
"",
"",0,0,useCLs);
1083 StandardHypoTestInvDemo();
void Info(const char *location, const char *msgfmt,...)
void Error(const char *location, const char *msgfmt,...)
void Warning(const char *location, const char *msgfmt,...)
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
virtual void Print(Option_t *options=0) const
Print TNamed name and title.
RooArgSet * getParameters(const RooAbsData *data, Bool_t stripDisconnected=kTRUE) const
Create a list of leaf nodes in the arg tree starting with ourself as top node that don't match any of...
RooAbsCollection * snapshot(Bool_t deepCopy=kTRUE) const
Take a snap shot of current collection contents: An owning collection is returned containing clones o...
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)
RooAbsPdf is the abstract interface for all probability density functions The class provides hybrid a...
Bool_t canBeExtended() const
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
virtual Double_t getMin(const char *name=0) const
Double_t getVal(const RooArgSet *set=0) const
Evaluate object. Returns either cached value or triggers a recalculation.
RooArgSet is a container object that can hold multiple RooAbsArg objects.
virtual Bool_t add(const RooAbsCollection &col, Bool_t silent=kFALSE)
Add a collection of arguments to this collection by calling add() for each element in the source coll...
RooFitResult is a container class to hold the input and output of a PDF fit to a dataset.
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 fundamental (non-derived) real valued object.
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
void UseSameAltToys()
to re-use same toys for alternate hypothesis
Class to plot an HypoTestInverterResult, result 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...
HypoTestInverter class for performing an hypothesis test inversion by scanning the hypothesis test re...
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.
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.
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)
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.
static TFile * Open(const char *name, Option_t *option="", const char *ftitle="", Int_t compress=ROOT::RCompressionSetting::EDefaults::kUseGeneralPurpose, Int_t netopt=0)
Create / open a file.
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.
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).
int main(int argc, char **argv)
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)
@(#)root/roostats:$Id$ Author: George Lewis, Kyle Cranmer
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)
void PrintListContent(const RooArgList &l, std::ostream &os=std::cout)
static constexpr double pc
Double_t Sqrt(Double_t x)
Int_t CeilNint(Double_t x)
void removeTopic(RooFit::MsgTopic oldTopic)