Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
StandardHypoTestDemo.C
Go to the documentation of this file.
1/// \file
2/// \ingroup tutorial_roostats
3/// \notebook
4/// Standard tutorial macro for hypothesis test (for computing the discovery significance) using all
5/// RooStats hypothesis tests calculators and test statistics.
6///
7/// Usage:
8///
9/// ~~~{.cpp}
10/// root>.L StandardHypoTestDemo.C
11/// root> StandardHypoTestDemo("fileName","workspace name","S+B modelconfig name","B model name","data set
12/// name",calculator type, test statistic type, number of toys)
13///
14/// type = 0 Freq calculator
15/// type = 1 Hybrid calculator
16/// type = 2 Asymptotic calculator
17/// type = 3 Asymptotic calculator using nominal Asimov data sets (not using fitted parameter values but nominal ones)
18///
19/// testStatType = 0 LEP
20/// = 1 Tevatron
21/// = 2 Profile Likelihood
22/// = 3 Profile Likelihood one sided (i.e. = 0 if mu_hat < 0)
23/// ~~~
24///
25/// \macro_image
26/// \macro_output
27/// \macro_code
28///
29/// \author Lorenzo Moneta
30
31#include "TFile.h"
32#include "RooWorkspace.h"
33#include "RooAbsPdf.h"
34#include "RooRealVar.h"
35#include "RooDataSet.h"
37#include "RooRandom.h"
38#include "TGraphErrors.h"
39#include "TGraphAsymmErrors.h"
40#include "TCanvas.h"
41#include "TLine.h"
42#include "TSystem.h"
43#include "TROOT.h"
44
50
56
60
61#include <cassert>
62
63using namespace RooFit;
64using namespace RooStats;
65
66struct HypoTestOptions {
67
68 bool noSystematics = false; // force all systematics to be off (i.e. set all nuisance parameters as constant)
69 double nToysRatio = 4; // ratio Ntoys Null/ntoys ALT
70 double poiValue = -1; // change poi snapshot value for S+B model (needed for expected p0 values)
71 int printLevel = 0;
72 bool generateBinned = false; // for binned generation
73 bool useProof = false; // use Proof
74 bool enableDetailedOutput = false; // for detailed output
75};
76
77HypoTestOptions optHT;
78
79void StandardHypoTestDemo(const char *infile = "", const char *workspaceName = "combined",
80 const char *modelSBName = "ModelConfig", const char *modelBName = "",
81 const char *dataName = "obsData", int calcType = 0, /* 0 freq 1 hybrid, 2 asymptotic */
82 int testStatType = 3, /* 0 LEP, 1 TeV, 2 LHC, 3 LHC - one sided*/
83 int ntoys = 5000, bool useNC = false, const char *nuisPriorName = 0)
84{
85
86 bool noSystematics = optHT.noSystematics;
87 double nToysRatio = optHT.nToysRatio; // ratio Ntoys Null/ntoys ALT
88 double poiValue = optHT.poiValue; // change poi snapshot value for S+B model (needed for expected p0 values)
89 int printLevel = optHT.printLevel;
90 bool generateBinned = optHT.generateBinned; // for binned generation
91 bool useProof = optHT.useProof; // use Proof
92 bool enableDetOutput = optHT.enableDetailedOutput;
93
94 // Other Parameter to pass in tutorial
95 // apart from standard for filename, ws, modelconfig and data
96
97 // type = 0 Freq calculator
98 // type = 1 Hybrid calculator
99 // type = 2 Asymptotic calculator
100
101 // testStatType = 0 LEP
102 // = 1 Tevatron
103 // = 2 Profile Likelihood
104 // = 3 Profile Likelihood one sided (i.e. = 0 if mu < mu_hat)
105
106 // ntoys: number of toys to use
107
108 // useNumberCounting: set to true when using number counting events
109
110 // nuisPriorName: name of prior for the nuisance. This is often expressed as constraint term in the global model
111 // It is needed only when using the HybridCalculator (type=1)
112 // If not given by default the prior pdf from ModelConfig is used.
113
114 // extra options are available as global parameters of the macro. They major ones are:
115
116 // generateBinned generate binned data sets for toys (default is false) - be careful not to activate with
117 // a too large (>=3) number of observables
118 // nToyRatio ratio of S+B/B toys (default is 2)
119 // printLevel
120
121 // disable - can cause some problems
122 // ToyMCSampler::SetAlwaysUseMultiGen(true);
123
124 SimpleLikelihoodRatioTestStat::SetAlwaysReuseNLL(true);
125 ProfileLikelihoodTestStat::SetAlwaysReuseNLL(true);
126 RatioOfProfiledLikelihoodsTestStat::SetAlwaysReuseNLL(true);
127
128 // RooRandom::randomGenerator()->SetSeed(0);
129
130 // to change minimizers
131 // ~~~{.bash}
132 // ROOT::Math::MinimizerOptions::SetDefaultStrategy(0);
133 // ROOT::Math::MinimizerOptions::SetDefaultMinimizer("Minuit2");
134 // ROOT::Math::MinimizerOptions::SetDefaultTolerance(1);
135 // ~~~
136
137 // -------------------------------------------------------
138 // First part is just to access a user-defined file
139 // or create the standard example file if it doesn't exist
140 const char *filename = "";
141 if (!strcmp(infile, "")) {
142 filename = "results/example_combined_GaussExample_model.root";
143 bool fileExist = !gSystem->AccessPathName(filename); // note opposite return code
144 // if file does not exists generate with histfactory
145 if (!fileExist) {
146 // Normally this would be run on the command line
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;
153 }
154
155 } else
156 filename = infile;
157
158 // Try to open the file
159 TFile *file = TFile::Open(filename);
160
161 // if input file was specified but not found, quit
162 if (!file) {
163 cout << "StandardRooStatsDemoMacro: Input file " << filename << " is not found" << endl;
164 return;
165 }
166
167 // -------------------------------------------------------
168 // Tutorial starts here
169 // -------------------------------------------------------
170
171 // get the workspace out of the file
172 RooWorkspace *w = (RooWorkspace *)file->Get(workspaceName);
173 if (!w) {
174 cout << "workspace not found" << endl;
175 return;
176 }
177 w->Print();
178
179 // get the modelConfig out of the file
180 ModelConfig *sbModel = (ModelConfig *)w->obj(modelSBName);
181
182 // get the modelConfig out of the file
183 RooAbsData *data = w->data(dataName);
184
185 // make sure ingredients are found
186 if (!data || !sbModel) {
187 w->Print();
188 cout << "data or ModelConfig was not found" << endl;
189 return;
190 }
191 // make b model
192 ModelConfig *bModel = (ModelConfig *)w->obj(modelBName);
193
194 // case of no systematics
195 // remove nuisance parameters from model
196 if (noSystematics) {
197 const RooArgSet *nuisPar = sbModel->GetNuisanceParameters();
198 if (nuisPar && nuisPar->getSize() > 0) {
199 std::cout << "StandardHypoTestInvDemo"
200 << " - Switch off all systematics by setting them constant to their initial values" << std::endl;
201 RooStats::SetAllConstant(*nuisPar);
202 }
203 if (bModel) {
204 const RooArgSet *bnuisPar = bModel->GetNuisanceParameters();
205 if (bnuisPar)
206 RooStats::SetAllConstant(*bnuisPar);
207 }
208 }
209
210 if (!bModel) {
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);
213 bModel = (ModelConfig *)sbModel->Clone();
214 bModel->SetName(TString(modelSBName) + TString("B_only"));
215 RooRealVar *var = dynamic_cast<RooRealVar *>(bModel->GetParametersOfInterest()->first());
216 if (!var)
217 return;
218 double oldval = var->getVal();
219 var->setVal(0);
220 // bModel->SetSnapshot( RooArgSet(*var, *w->var("lumi")) );
221 bModel->SetSnapshot(RooArgSet(*var));
222 var->setVal(oldval);
223 }
224
225 if (!sbModel->GetSnapshot() || poiValue > 0) {
226 Info("StandardHypoTestDemo", "Model %s has no snapshot - make one using model poi", modelSBName);
227 RooRealVar *var = dynamic_cast<RooRealVar *>(sbModel->GetParametersOfInterest()->first());
228 if (!var)
229 return;
230 double oldval = var->getVal();
231 if (poiValue > 0)
232 var->setVal(poiValue);
233 // sbModel->SetSnapshot( RooArgSet(*var, *w->var("lumi") ) );
234 sbModel->SetSnapshot(RooArgSet(*var));
235 if (poiValue > 0)
236 var->setVal(oldval);
237 // sbModel->SetSnapshot( *sbModel->GetParametersOfInterest() );
238 }
239
240 // part 1, hypothesis testing
241 SimpleLikelihoodRatioTestStat *slrts = new SimpleLikelihoodRatioTestStat(*bModel->GetPdf(), *sbModel->GetPdf());
242 // null parameters must include snapshot of poi plus the nuisance values
243 RooArgSet nullParams(*bModel->GetSnapshot());
244 if (bModel->GetNuisanceParameters())
245 nullParams.add(*bModel->GetNuisanceParameters());
246
247 slrts->SetNullParameters(nullParams);
248 RooArgSet altParams(*sbModel->GetSnapshot());
249 if (sbModel->GetNuisanceParameters())
250 altParams.add(*sbModel->GetNuisanceParameters());
251 slrts->SetAltParameters(altParams);
252
254
256 new RatioOfProfiledLikelihoodsTestStat(*bModel->GetPdf(), *sbModel->GetPdf(), sbModel->GetSnapshot());
257 ropl->SetSubtractMLE(false);
258
259 if (testStatType == 3)
260 profll->SetOneSidedDiscovery(1);
261 profll->SetPrintLevel(printLevel);
262
263 if (enableDetOutput) {
264 slrts->EnableDetailedOutput();
265 profll->EnableDetailedOutput();
266 ropl->EnableDetailedOutput();
267 }
268
269 /* profll.SetReuseNLL(mOptimize);*/
270 /* slrts.SetReuseNLL(mOptimize);*/
271 /* ropl.SetReuseNLL(mOptimize);*/
272
273 AsymptoticCalculator::SetPrintLevel(printLevel);
274
275 HypoTestCalculatorGeneric *hypoCalc = 0;
276 // note here Null is B and Alt is S+B
277 if (calcType == 0)
278 hypoCalc = new FrequentistCalculator(*data, *sbModel, *bModel);
279 else if (calcType == 1)
280 hypoCalc = new HybridCalculator(*data, *sbModel, *bModel);
281 else if (calcType == 2)
282 hypoCalc = new AsymptoticCalculator(*data, *sbModel, *bModel);
283
284 if (calcType == 0) {
285 ((FrequentistCalculator *)hypoCalc)->SetToys(ntoys, ntoys / nToysRatio);
286 if (enableDetOutput)
287 ((FrequentistCalculator *)hypoCalc)->StoreFitInfo(true);
288 }
289 if (calcType == 1) {
290 ((HybridCalculator *)hypoCalc)->SetToys(ntoys, ntoys / nToysRatio);
291 // n. a. yetif (enableDetOutput) ((HybridCalculator*) hypoCalc)->StoreFitInfo(true);
292 }
293 if (calcType == 2) {
294 if (testStatType == 3)
295 ((AsymptoticCalculator *)hypoCalc)->SetOneSidedDiscovery(true);
296 if (testStatType != 2 && testStatType != 3)
297 Warning("StandardHypoTestDemo",
298 "Only the PL test statistic can be used with AsymptoticCalculator - use by default a two-sided PL");
299 }
300
301 // check for nuisance prior pdf in case of nuisance parameters
302 if (calcType == 1 && (bModel->GetNuisanceParameters() || sbModel->GetNuisanceParameters())) {
303 RooAbsPdf *nuisPdf = 0;
304 if (nuisPriorName)
305 nuisPdf = w->pdf(nuisPriorName);
306 // use prior defined first in bModel (then in SbModel)
307 if (!nuisPdf) {
308 Info("StandardHypoTestDemo",
309 "No nuisance pdf given for the HybridCalculator - try to deduce pdf from the model");
310 if (bModel->GetPdf() && bModel->GetObservables())
311 nuisPdf = RooStats::MakeNuisancePdf(*bModel, "nuisancePdf_bmodel");
312 else
313 nuisPdf = RooStats::MakeNuisancePdf(*sbModel, "nuisancePdf_sbmodel");
314 }
315 if (!nuisPdf) {
316 if (bModel->GetPriorPdf()) {
317 nuisPdf = 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",
320 nuisPdf->GetName());
321 } else {
322 Error("StandardHypoTestDemo", "Cannot run Hybrid calculator because no prior on the nuisance parameter is "
323 "specified or can be derived");
324 return;
325 }
326 }
327 assert(nuisPdf);
328 Info("StandardHypoTestDemo", "Using as nuisance Pdf ... ");
329 nuisPdf->Print();
330
331 const RooArgSet *nuisParams =
332 (bModel->GetNuisanceParameters()) ? bModel->GetNuisanceParameters() : sbModel->GetNuisanceParameters();
333 std::unique_ptr<RooArgSet> np{nuisPdf->getObservables(*nuisParams)};
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");
337 }
338
339 ((HybridCalculator *)hypoCalc)->ForcePriorNuisanceAlt(*nuisPdf);
340 ((HybridCalculator *)hypoCalc)->ForcePriorNuisanceNull(*nuisPdf);
341 }
342
343 /* hypoCalc->ForcePriorNuisanceAlt(*sbModel->GetPriorPdf());*/
344 /* hypoCalc->ForcePriorNuisanceNull(*bModel->GetPriorPdf());*/
345
346 ToyMCSampler *sampler = (ToyMCSampler *)hypoCalc->GetTestStatSampler();
347
348 if (sampler && (calcType == 0 || calcType == 1)) {
349
350 // look if pdf is number counting or extended
351 if (sbModel->GetPdf()->canBeExtended()) {
352 if (useNC)
353 Warning("StandardHypoTestDemo", "Pdf is extended: but number counting flag is set: ignore it ");
354 } else {
355 // for not extended pdf
356 if (!useNC) {
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);
361 } else {
362 Info("StandardHypoTestDemo", "using a number counting pdf");
363 sampler->SetNEventsPerToy(1);
364 }
365 }
366
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());
371 }
372 if (generateBinned)
373 sampler->SetGenerateBinned(generateBinned);
374
375 // use PROOF
376 if (useProof) {
377 ProofConfig pc(*w, 0, "", kFALSE);
378 sampler->SetProofConfig(&pc); // enable proof
379 }
380
381 // set the test statistic
382 if (testStatType == 0)
383 sampler->SetTestStatistic(slrts);
384 if (testStatType == 1)
385 sampler->SetTestStatistic(ropl);
386 if (testStatType == 2 || testStatType == 3)
387 sampler->SetTestStatistic(profll);
388 }
389
390 HypoTestResult *htr = hypoCalc->GetHypoTest();
391 htr->SetPValueIsRightTail(true);
392 htr->SetBackgroundAsAlt(false);
393 htr->Print(); // how to get meaningful CLs at this point?
394
395 delete sampler;
396 delete slrts;
397 delete ropl;
398 delete profll;
399
400 if (calcType != 2) {
401 HypoTestPlot *plot = new HypoTestPlot(*htr, 100);
402 plot->SetLogYaxis(true);
403 plot->Draw();
404 } else {
405 std::cout << "Asymptotic results " << std::endl;
406 }
407
408 // look at expected significances
409 // found median of S+B distribution
410 if (calcType != 2) {
411
413 HypoTestResult htExp("Expected Result");
414 htExp.Append(htr);
415 // find quantiles in alt (S+B) distribution
416 double p[5];
417 double q[5];
418 for (int i = 0; i < 5; ++i) {
419 double sig = -2 + i;
420 p[i] = ROOT::Math::normal_cdf(sig, 1);
421 }
422 std::vector<double> values = altDist->GetSamplingDistribution();
423 TMath::Quantiles(values.size(), 5, &values[0], q, p, false);
424
425 for (int i = 0; i < 5; ++i) {
426 htExp.SetTestStatisticData(q[i]);
427 double sig = -2 + i;
428 std::cout << " Expected p -value and significance at " << sig << " sigma = " << htExp.NullPValue()
429 << " significance " << htExp.Significance() << " sigma " << std::endl;
430 }
431 } else {
432 // case of asymptotic calculator
433 for (int i = 0; i < 5; ++i) {
434 double sig = -2 + i;
435 // sigma is inverted here
436 double pval = AsymptoticCalculator::GetExpectedPValues(htr->NullPValue(), htr->AlternatePValue(), -sig, false);
437 std::cout << " Expected p -value and significance at " << sig << " sigma = " << pval << " significance "
438 << ROOT::Math::normal_quantile_c(pval, 1) << " sigma " << std::endl;
439 }
440 }
441
442 // write result in a file in case of toys
443 bool writeResult = (calcType != 2);
444
445 if (enableDetOutput) {
446 writeResult = true;
447 Info("StandardHypoTestDemo", "Detailed output will be written in output result file");
448 }
449
450 if (htr != NULL && writeResult) {
451
452 // write to a file the results
453 const char *calcTypeName = (calcType == 0) ? "Freq" : (calcType == 1) ? "Hybr" : "Asym";
454 TString resultFileName = TString::Format("%s_HypoTest_ts%d_", calcTypeName, testStatType);
455 // strip the / from the filename
456
457 TString name = infile;
458 name.Replace(0, name.Last('/') + 1, "");
459 resultFileName += name;
460
461 TFile *fileOut = new TFile(resultFileName, "RECREATE");
462 htr->Write();
463 Info("StandardHypoTestDemo", "HypoTestResult has been written in the file %s", resultFileName.Data());
464
465 fileOut->Close();
466 }
467}
constexpr Bool_t kFALSE
Definition RtypesCore.h:101
void Info(const char *location, const char *msgfmt,...)
Use this function for informational messages.
Definition TError.cxx:218
void Error(const char *location, const char *msgfmt,...)
Use this function in case an error occurred.
Definition TError.cxx:185
void Warning(const char *location, const char *msgfmt,...)
Use this function in warning situations.
Definition TError.cxx:229
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 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
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void data
char name[80]
Definition TGX11.cxx:110
float * q
#define gROOT
Definition TROOT.h:406
R__EXTERN TSystem * gSystem
Definition TSystem.h:555
void Print(Option_t *options=nullptr) const override
Print the object to the defaultPrintStream().
Definition RooAbsArg.h:320
RooFit::OwningPtr< RooArgSet > getObservables(const RooArgSet &set, bool valueOnly=true) const
Given a set of possible observables, return the observables that this PDF depends on.
Int_t getSize() const
Return the number of elements in the collection.
RooAbsArg * first() const
Abstract base class for binned and unbinned datasets.
Definition RooAbsData.h:57
Abstract interface for all probability density functions.
Definition RooAbsPdf.h:40
bool canBeExtended() const
If true, PDF can provide extended likelihood term.
Definition RooAbsPdf.h:219
double getVal(const RooArgSet *normalisationSet=nullptr) const
Evaluate object.
Definition RooAbsReal.h:103
RooArgSet is a container object that can hold multiple RooAbsArg objects.
Definition RooArgSet.h:55
Variable that can be changed from the outside.
Definition RooRealVar.h:37
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.
HypoTestResult * GetHypoTest() const override
inherited methods from HypoTestCalculator interface
TestStatSampler * GetTestStatSampler(void) const
Returns instance of TestStatSampler.
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.
void Print(const Option_t *="") const override
Print out some information about the results Note: use Alt/Null labels for the hypotheses here as the...
void SetBackgroundAsAlt(bool l=true)
virtual double AlternatePValue() const
Return p-value for alternate hypothesis.
virtual double NullPValue() const
Return p-value for null hypothesis.
SamplingDistribution * GetAltDistribution(void) const
ModelConfig is a simple class that holds configuration information specifying how a model should be u...
Definition ModelConfig.h:35
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...
ModelConfig * Clone(const char *name="") const override
clone
Definition ModelConfig.h:57
const RooArgSet * GetParametersOfInterest() const
get RooArgSet containing the parameter of interest (return nullptr if not existing)
const RooArgSet * GetNuisanceParameters() const
get RooArgSet containing the nuisance parameters (return nullptr if not existing)
const RooArgSet * GetObservables() const
get RooArgSet for observables (return nullptr if not existing)
const RooArgSet * GetSnapshot() const
get RooArgSet for parameters for a particular hypothesis (return nullptr if not existing)
RooAbsPdf * GetPdf() const
get model PDF (return nullptr if pdf has not been specified or does not exist)
RooAbsPdf * GetPriorPdf() const
get parameters prior pdf (return nullptr if not existing)
ProfileLikelihoodTestStat is an implementation of the TestStatistic interface that calculates the pro...
virtual void EnableDetailedOutput(bool e=true, bool withErrorsAndPulls=false)
Holds configuration options for proof and proof-lite.
Definition ProofConfig.h:45
TestStatistic that returns the ratio of profiled likelihoods.
This class simply holds a sampling distribution of some test statistic.
const std::vector< double > & GetSamplingDistribution() const
Get test statistics values.
TestStatistic class that returns -log(L[null] / L[alt]) where L is the likelihood.
void SetNullParameters(const RooArgSet &nullParameters)
void SetAltParameters(const RooArgSet &altParameters)
ToyMCSampler is an implementation of the TestStatSampler interface.
void SetProofConfig(ProofConfig *pc=nullptr)
calling with argument or nullptr deactivates proof
virtual void SetTestStatistic(TestStatistic *testStatistic, unsigned int i)
Set the TestStatistic (want the argument to be a function of the data & parameter points.
void SetGenerateBinned(bool binned=true)
control to use bin data generation (=> see RooFit::AllBinned() option)
virtual void SetNEventsPerToy(const Int_t nevents)
Forces the generation of exactly n events even for extended PDFs.
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...
Definition TFile.h:53
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.
Definition TFile.cxx:4089
const char * GetName() const override
Returns name of object.
Definition TNamed.h:47
virtual void SetName(const char *name)
Set the name of the TNamed.
Definition TNamed.cxx:140
virtual Int_t Write(const char *name=nullptr, Int_t option=0, Int_t bufsize=0)
Write this object to the current directory.
Definition TObject.cxx:880
virtual void Draw(Option_t *option="")
Default Draw method for all objects.
Definition TObject.cxx:274
virtual void Print(Option_t *option="") const
This method must be overridden when a class wants to print itself.
Definition TObject.cxx:636
Basic string class.
Definition TString.h:139
TString & Replace(Ssiz_t pos, Ssiz_t n, const char *s)
Definition TString.h:694
const char * Data() const
Definition TString.h:376
static TString Format(const char *fmt,...)
Static method which formats a string using a printf style format descriptor and return a TString.
Definition TString.cxx:2378
virtual Bool_t AccessPathName(const char *path, EAccessMode mode=kFileExists)
Returns FALSE if one can access a file using the specified access mode.
Definition TSystem.cxx:1296
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...
Definition JSONIO.h:26
Namespace for the RooStats classes.
Definition Asimov.h:19
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.
Definition TMath.cxx:1207