91 BinCountTestStat(
void) : fColumnName(
"tmp") {}
92 BinCountTestStat(
string columnName) : fColumnName(columnName) {}
98 for (
int i = 0; i <
data.numEntries(); i++) {
99 value +=
data.get(i)->getRealValue(fColumnName.c_str());
103 virtual const TString GetVarName()
const {
return fColumnName; }
117 void HybridInstructional()
147 w->factory(
"Poisson::px(x[150,0,500],sum::splusb(s[0,0,100],b[100,0,300]))");
148 w->factory(
"Poisson::py(y[100,0,500],prod::taub(tau[1.],b))");
149 w->factory(
"PROD::model(px,py)");
150 w->factory(
"Uniform::prior_b(b)");
176 w->factory(
"PROJ::averagedModel(PROD::foo(px|b,py,prior_b),b)");
183 w->var(
"s")->setVal(50.);
187 w->var(
"s")->setVal(0.);
194 w->var(
"y")->setVal(100);
195 w->var(
"x")->setVal(150);
196 std::unique_ptr<RooAbsReal> cdf{
w->pdf(
"averagedModel")->createCdf(*
w->var(
"x"))};
198 cout <<
"-----------------------------------------" << endl;
199 cout <<
"Part 2" << endl;
200 cout <<
"Hybrid p-value from direct integration = " << 1 - cdf->getVal() << endl;
211 double p_Bi = NumberCountingUtils::BinomialWithTauObsP(150, 100, 1);
212 double Z_Bi = NumberCountingUtils::BinomialWithTauObsZ(150, 100, 1);
213 cout <<
"-----------------------------------------" << endl;
214 cout <<
"Part 3" << endl;
215 std::cout <<
"Z_Bi p-value (analytic): " << p_Bi << std::endl;
216 std::cout <<
"Z_Bi significance (analytic): " << Z_Bi << std::endl;
240 w->defineSet(
"obs",
"x");
241 w->defineSet(
"poi",
"s");
245 data->add(*
w->set(
"obs"));
251 b_model.SetPdf(*
w->pdf(
"px"));
252 b_model.SetObservables(*
w->set(
"obs"));
253 b_model.SetParametersOfInterest(*
w->set(
"poi"));
254 w->var(
"s")->setVal(0.0);
255 b_model.SetSnapshot(*
w->set(
"poi"));
259 sb_model.SetPdf(*
w->pdf(
"px"));
260 sb_model.SetObservables(*
w->set(
"obs"));
261 sb_model.SetParametersOfInterest(*
w->set(
"poi"));
262 w->var(
"s")->setVal(50.0);
263 sb_model.SetSnapshot(*
w->set(
"poi"));
273 BinCountTestStat binCount(
"x");
295 w->factory(
"Gaussian::gauss_prior(b,y, expr::sqrty('sqrt(y)',y))");
299 w->factory(
"Lognormal::lognorm_prior(b,y, expr::kappa('1+1./sqrt(y)',y))");
321 hc1.SetToys(20000, 1000);
322 hc1.ForcePriorNuisanceAlt(*
w->pdf(
"py"));
323 hc1.ForcePriorNuisanceNull(*
w->pdf(
"py"));
345 cout <<
"-----------------------------------------" << endl;
346 cout <<
"Part 4" << endl;
366 slrts.SetNullParameters(*b_model.GetSnapshot());
367 slrts.SetAltParameters(*sb_model.GetSnapshot());
374 hc2.SetToys(20000, 1000);
375 hc2.ForcePriorNuisanceAlt(*
w->pdf(
"py"));
376 hc2.ForcePriorNuisanceNull(*
w->pdf(
"py"));
396 cout <<
"-----------------------------------------" << endl;
397 cout <<
"Part 5" << endl;
422 w->defineSet(
"obsXY",
"x,y");
425 w->var(
"x")->setVal(150.);
426 w->var(
"y")->setVal(100.);
428 dataXY->
add(*
w->set(
"obsXY"));
432 b_modelXY.SetPdf(*
w->pdf(
"model"));
433 b_modelXY.SetObservables(*
w->set(
"obsXY"));
434 b_modelXY.SetParametersOfInterest(*
w->set(
"poi"));
435 w->var(
"s")->setVal(0.0);
436 b_modelXY.SetSnapshot(*
w->set(
"poi"));
440 sb_modelXY.SetPdf(*
w->pdf(
"model"));
441 sb_modelXY.SetObservables(*
w->set(
"obsXY"));
442 sb_modelXY.SetParametersOfInterest(*
w->set(
"poi"));
443 w->var(
"s")->setVal(50.0);
444 sb_modelXY.SetSnapshot(*
w->set(
"poi"));
459 ropl.SetSubtractMLE(
false);
474 w->factory(
"y0[100]");
475 w->factory(
"Gamma::gamma_y0(b,sum::temp0(y0,1),1,0)");
476 w->factory(
"Gaussian::gauss_prior_y0(b,y0, expr::sqrty0('sqrt(y0)',y0))");
483 hc3.SetToys(30000, 1000);
484 hc3.ForcePriorNuisanceAlt(*
w->pdf(
"gamma_y0"));
485 hc3.ForcePriorNuisanceNull(*
w->pdf(
"gamma_y0"));
505 cout <<
"-----------------------------------------" << endl;
506 cout <<
"Part 6" << endl;
515 c->GetPad(4)->SetLogy();
519 c->SaveAs(
"zbi.pdf");
#define ClassDef(name, id)
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 value
RooAbsData is the common abstract base class for binned and unbinned datasets.
RooArgSet is a container object that can hold multiple RooAbsArg objects.
RooDataSet is a container class to hold unbinned data.
void add(const RooArgSet &row, double weight=1.0, double weightError=0.0) override
Add one ore more rows of data.
static RooMsgService & instance()
Return reference to singleton instance.
void setGlobalKillBelow(RooFit::MsgLevel level)
RooFit::MsgLevel globalKillBelow() const
A RooPlot is a plot frame and a container for graphics objects within that frame.
static RooPlot * frame(const RooAbsRealLValue &var, double xmin, double xmax, Int_t nBins)
Create a new frame for a given variable in x.
void Draw(Option_t *options=nullptr) override
Draw this plot and all of the elements it contains.
Same purpose as HybridCalculatorOriginal, but different implementation.
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...
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...
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.
void Draw(Option_t *options=nullptr) override
Draw this plot and all of the elements it contains.
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=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.
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.
void Divide(Int_t nx=1, Int_t ny=1, Float_t xmargin=0.01, Float_t ymargin=0.01, Int_t color=0) override
Automatic pad generation by division.
void Start(Bool_t reset=kTRUE)
Start the stopwatch.
void Stop()
Stop the stopwatch.
void Print(Option_t *option="") const override
Print the real and cpu time passed between the start and stop events.
RooCmdArg LineColor(Color_t color)
The namespace RooFit contains mostly switches that change the behaviour of functions of PDFs (or othe...
MsgLevel
Verbosity level for RooMsgService::StreamConfig in RooMsgService.
Namespace for the RooStats classes.
double PValueToSignificance(double pvalue)
returns one-sided significance corresponding to a p-value