 ROOT   Reference Guide rs801_HypoTestInverterOriginal.C File Reference

## Detailed Description  An example of using the HypoTestInverterOriginal class [1mRooFit v3.60 -- Developed by Wouter Verkerke and David Kirkby[0m
Copyright (C) 2000-2013 NIKHEF, University of California & Stanford University
All rights reserved, please read http://roofit.sourceforge.net/license.txt
Target matches upper limit: de-activate interpolation in HypoTestInverterResult
Running for r = 3
Test statistics has been evaluated for data
HybridCalculatorOriginal: run 1000 toy-MC experiments
with test statistics index: 2
....... toy number 0 / 1000
....... toy number 500 / 1000
computed: 0.34252
Running for r = 5
Test statistics has been evaluated for data
HybridCalculatorOriginal: run 1000 toy-MC experiments
with test statistics index: 2
....... toy number 0 / 1000
....... toy number 500 / 1000
computed: 0.0669145
The confidence level at both boundaries are both too large ( 0.34252 and 0.0669145
Run again with other boundaries or larger toy-MC statistics
The computed upper limit is: 5
an estimated error on this upper limit is: 0
#include "RooRealVar.h"
#include "RooConstVar.h"
#include "RooProdPdf.h"
#include "RooWorkspace.h"
#include "RooDataSet.h"
#include "RooPolynomial.h"
#include "RooAddPdf.h"
#include "RooExtendPdf.h"
#include "TGraphErrors.h"
using namespace RooFit;
using namespace RooStats;
void rs801_HypoTestInverterOriginal()
{
// prepare the model
RooRealVar lumi("lumi", "luminosity", 1);
RooRealVar r("r", "cross-section ratio", 3.74, 0, 50);
RooFormulaVar ns("ns", "1*r*lumi", RooArgList(lumi, r));
RooRealVar nb("nb", "background yield", 1);
RooRealVar x("x", "dummy observable", 0, 1);
RooPolynomial flatPdf("flatPdf", "flat PDF", x, p0);
RooAddPdf totPdf("totPdf", "S+B model", RooArgList(flatPdf, flatPdf), RooArgList(ns, nb));
RooExtendPdf bkgPdf("bkgPdf", "B-only model", flatPdf, nb);
RooDataSet *data = totPdf.generate(x, 1);
// prepare the calculator
HybridCalculatorOriginal myhc(*data, totPdf, bkgPdf, 0, 0);
myhc.SetTestStatistic(2);
myhc.SetNumberOfToys(1000);
myhc.UseNuisance(false);
// run the hypothesis-test inversion
HypoTestInverterOriginal myInverter(myhc, r);
myInverter.SetTestSize(0.10);
myInverter.UseCLs(true);
// myInverter.RunFixedScan(5,1,6);
// scan for a 95% UL
myInverter.RunAutoScan(3., 5, myInverter.Size() / 2, 0.005);
// run an alternative autoscan algorithm
// myInverter.RunAutoScan(1,6,myInverter.Size()/2,0.005,1);
// myInverter.RunOnePoint(3.9);
HypoTestInverterResult *results = myInverter.GetInterval();
HypoTestInverterPlot myInverterPlot("myInverterPlot", "", results);
TGraphErrors *gr1 = myInverterPlot.MakePlot();
gr1->Draw("ALP");
double ulError = results->UpperLimitEstimatedError();
double upperLimit = results->UpperLimit();
std::cout << "The computed upper limit is: " << upperLimit << std::endl;
std::cout << "an estimated error on this upper limit is: " << ulError << std::endl;
// expected result: 4.10
}
int main()
{
rs801_HypoTestInverterOriginal();
}

Definition in file rs801_HypoTestInverterOriginal.C.

RooWorkspace.h
HybridCalculatorOriginal.h
TGraph::Draw
virtual void Draw(Option_t *chopt="")
Draw this graph with its current attributes.
Definition: TGraph.cxx:769
RooAddPdf
RooAddPdf is an efficient implementation of a sum of PDFs of the form.
Definition: RooAddPdf.h:32
RooExtendPdf.h
r
ROOT::R::TRInterface & r
Definition: Object.C:4
HypoTestInverterOriginal.h
RooArgList
RooArgList is a container object that can hold multiple RooAbsArg objects.
Definition: RooArgList.h:21
RooStats::HypoTestInverterResult
HypoTestInverterResult class holds the array of hypothesis test results and compute a confidence inte...
Definition: HypoTestInverterResult.h:26
RooExtendPdf
RooExtendPdf is a wrapper around an existing PDF that adds a parameteric extended likelihood term to ...
Definition: RooExtendPdf.h:22
x
Double_t x[n]
Definition: legend1.C:17
RooAddPdf.h
HypoTestInverterPlot.h
RooConstVar
RooConstVar represent a constant real-valued object.
Definition: RooConstVar.h:26
RooDataSet.h
RooStats::HypoTestInverterResult::UpperLimitEstimatedError
Double_t UpperLimitEstimatedError()
Estimate of lower limit error function evaluates only a rough error on the lower limit.
Definition: HypoTestInverterResult.cxx:1097
RooStats::HypoTestInverterPlot
Class to plot a HypoTestInverterResult, the output of the HypoTestInverter calculator.
Definition: HypoTestInverterPlot.h:26
RooPolynomial.h
RooFormulaVar
A RooFormulaVar is a generic implementation of a real-valued object, which takes a RooArgList of serv...
Definition: RooFormulaVar.h:30
RooProdPdf.h
RooFit
The namespace RooFit contains mostly switches that change the behaviour of functions of PDFs (or othe...
Definition: RooCFunction1Binding.h:29
RooPolynomial
RooPolynomial implements a polynomial p.d.f of the form.
Definition: RooPolynomial.h:28
TGeant4Unit::ns
static constexpr double ns
Definition: TGeant4SystemOfUnits.h:161
RooRealVar.h
RooConstVar.h
TGraphErrors
A TGraphErrors is a TGraph with error bars.
Definition: TGraphErrors.h:26
RooStats
Namespace for the RooStats classes.
Definition: Asimov.h:19
RooStats::HypoTestInverterOriginal
This class is now deprecated and to be replaced by the HypoTestInverter.
Definition: HypoTestInverterOriginal.h:27
RooStats::HypoTestInverterResult::UpperLimit
Double_t UpperLimit()
Definition: HypoTestInverterResult.cxx:956
RooDataSet
RooDataSet is a container class to hold unbinned data.
Definition: RooDataSet.h:33
TGraphErrors.h
RooRealVar
RooRealVar represents a variable that can be changed from the outside.
Definition: RooRealVar.h:39
HypoTestInverterResult.h
RooStats::HybridCalculatorOriginal
HybridCalculatorOriginal class.
Definition: HybridCalculatorOriginal.h:34
main
int main(int argc, char *argv[])
Definition: cef_main.cxx:54
RooFit::RooConst
RooConstVar & RooConst(Double_t val)
Definition: RooGlobalFunc.cxx:347