53 void rs101_limitexample()
66 wspace->
factory(
"Poisson::countingModel(obs[150,0,300], sum(s[50,0,120]*ratioSigEff[1.,0,3.],b[100]*ratioBkgEff[1.,0.,3.]))");
69 wspace->
factory(
"Gaussian::sigConstraint(gSigEff[1,0,3],ratioSigEff,0.05)");
70 wspace->
factory(
"Gaussian::bkgConstraint(gSigBkg[1,0,3],ratioBkgEff,0.2)");
71 wspace->
factory(
"PROD::modelWithConstraints(countingModel,sigConstraint,bkgConstraint)");
74 RooAbsPdf* modelWithConstraints = wspace->
pdf(
"modelWithConstraints");
82 RooArgSet constrainedParams(*ratioSigEff, *ratioBkgEff);
94 RooArgSet all(*s, *ratioBkgEff, *ratioSigEff);
103 modelConfig.SetPdf(*modelWithConstraints);
104 modelConfig.SetParametersOfInterest(paramOfInterest);
105 modelConfig.SetNuisanceParameters(constrainedParams);
106 modelConfig.SetObservables(*obs);
107 modelConfig.SetGlobalObservables(
RooArgSet(*gSigEff,*gSigBkg));
108 modelConfig.SetName(
"ModelConfig");
109 wspace->
import(modelConfig);
119 plc.SetTestSize(.05);
128 plotInt.SetTitle(
"Profile Likelihood Ratio and Posterior for S");
133 fc.UseAdaptiveSampling(
true);
134 fc.FluctuateNumDataEntries(
false);
139 fcint =
fc.GetInterval();
154 mc.SetNumIters(20000);
156 mc.SetNumBurnInSteps(40);
157 mc.SetProposalFunction(*pdfProp);
158 mc.SetLeftSideTailFraction(0.5);
164 cout <<
"Profile upper limit on s = " << ((
LikelihoodInterval*) lrinterval)->UpperLimit(*s) << endl;
170 cout <<
"FC lower limit on s = " << fcll << endl;
171 cout <<
"FC upper limit on s = " << fcul << endl;
172 TLine* fcllLine =
new TLine(fcll, 0, fcll, 1);
173 TLine* fculLine =
new TLine(fcul, 0, fcul, 1);
176 fcllLine->
Draw(
"same");
177 fculLine->
Draw(
"same");
184 mcPlot.SetLineWidth(2);
187 double mcul = mcInt->UpperLimit(*s);
188 double mcll = mcInt->LowerLimit(*s);
189 cout <<
"MCMC lower limit on s = " << mcll << endl;
190 cout <<
"MCMC upper limit on s = " << mcul << endl;
191 cout <<
"MCMC Actual confidence level: " 192 << mcInt->GetActualConfidenceLevel() << endl;
197 RooDataSet * chainData = mcInt->GetChainAsDataSet();
200 std::cout <<
"plotting the chain data - nentries = " << chainData->
numEntries() << std::endl;
203 chain->SetMarkerStyle(6);
204 chain->SetMarkerColor(
kRed);
206 chain->Draw(
"s:ratioSigEff:ratioBkgEff",
"nll_MarkovChain_local_",
"box");
211 std::cout <<
"plotting the scanned points used in the frequentist construction - npoints = " << parScanData->
numEntries() << std::endl;
217 for (
int ievt = 0; ievt < parScanData->
numEntries(); ++ievt) {
ProposalFunction is an interface for all proposal functions that would be used with a Markov Chain Mo...
ModelConfig is a simple class that holds configuration information specifying how a model should be u...
const RooArgList & floatParsFinal() const
void Start(Bool_t reset=kTRUE)
Start the stopwatch.
This class provides simple and straightforward utilities to plot a MCMCInterval object.
void Print(Option_t *option="") const
Print the real and cpu time passed between the start and stop events.
LikelihoodInterval is a concrete implementation of the RooStats::ConfInterval interface.
const TMatrixDSym & covarianceMatrix() const
Return covariance matrix.
virtual void SetName(const char *name)
Set the name of the TNamed.
virtual ProposalFunction * GetProposalFunction()
virtual void SetUpdateProposalParameters(Bool_t updateParams)
TVirtualPad * cd(Int_t subpadnumber=0)
Set current canvas & pad.
This class provides simple and straightforward utilities to plot a LikelihoodInterval object...
ProfileLikelihoodCalculator is a concrete implementation of CombinedCalculator (the interface class f...
virtual void Draw(Option_t *option="P0")
Specific drawing options can be used to paint a TGraph2D:
virtual void Draw(Option_t *option="")
Default Draw method for all objects.
TTree * GetAsTTree(TString name, TString desc, const RooDataSet &data)
static struct mg_connection * fc(struct mg_context *ctx)
void Stop()
Stop the stopwatch.
RooRealVar represents a fundamental (non-derived) real valued object.
virtual void setVal(Double_t value)
Set value of variable to 'value'.
virtual void SetLineColor(Color_t lcolor)
Set the line color.
void setConstant(Bool_t value=kTRUE)
virtual void SetCacheSize(Int_t size)
Bool_t writeToFile(const char *fileName, Bool_t recreate=kTRUE)
Save this current workspace into given file.
virtual void SetMarkerStyle(Style_t mstyle=1)
Set the marker style.
RooDataSet is a container class to hold unbinned data.
virtual const RooArgSet * get(Int_t index) const
Return RooArgSet with coordinates of event 'index'.
virtual void add(const RooArgSet &row, Double_t weight=1.0, Double_t weightError=0)
Add a data point, with its coordinates specified in the 'data' argset, to the data set...
The FeldmanCousins class (like the Feldman-Cousins technique) is essentially a specific configuration...
ConfInterval is an interface class for a generic interval in the RooStats framework.
Namespace for the RooStats classes.
PointSetInterval is a concrete implementation of the ConfInterval interface.
virtual void SetPoint(Int_t point, Double_t x, Double_t y, Double_t z)
Sets point number n.
RooAbsPdf * pdf(const char *name) const
Retrieve p.d.f (RooAbsPdf) with given name. A null pointer is returned if not found.
virtual Double_t LowerLimit(RooRealVar ¶m)
get the lowest value of param that is within the confidence interval
static constexpr double s
virtual void SetCovMatrix(const TMatrixDSym &covMatrix)
RooRealVar * var(const char *name) const
Retrieve real-valued variable (RooRealVar) with given name. A null pointer is returned if not found...
you should not use this method at all Int_t Int_t z
RooFactoryWSTool & factory()
Return instance to factory tool.
RooCmdArg Save(Bool_t flag=kTRUE)
RooAbsPdf is the abstract interface for all probability density functions The class provides hybrid a...
virtual void Divide(Int_t nx=1, Int_t ny=1, Float_t xmargin=0.01, Float_t ymargin=0.01, Int_t color=0)
Automatic pad generation by division.
Bool_t import(const RooAbsArg &arg, const RooCmdArg &arg1=RooCmdArg(), const RooCmdArg &arg2=RooCmdArg(), const RooCmdArg &arg3=RooCmdArg(), const RooCmdArg &arg4=RooCmdArg(), const RooCmdArg &arg5=RooCmdArg(), const RooCmdArg &arg6=RooCmdArg(), const RooCmdArg &arg7=RooCmdArg(), const RooCmdArg &arg8=RooCmdArg(), const RooCmdArg &arg9=RooCmdArg())
Import a RooAbsArg object, e.g.
Double_t getRealValue(const char *name, Double_t defVal=0, Bool_t verbose=kFALSE) const
Get value of a RooAbsReal stored in set with given name.
you should not use this method at all Int_t Int_t Double_t Double_t Double_t Int_t Double_t Double_t Double_t Double_t b
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.
MCMCInterval is a concrete implementation of the RooStats::ConfInterval interface.
virtual void SetVariables(RooArgList &vars)
virtual void Update()
Update canvas pad buffers.
Graphics object made of three arrays X, Y and Z with the same number of points each.
Bayesian Calculator estimating an interval or a credible region using the Markov-Chain Monte Carlo me...
void Print(Option_t *opts=0) const
Print contents of the workspace.
RooCmdArg Constrain(const RooArgSet ¶ms)
The RooWorkspace is a persistable container for RooFit projects.
virtual Int_t numEntries() const