168void FourBinInstructional(
bool doBayesian =
false,
bool doFeldmanCousins =
false,
bool doMCMC =
false)
180 wspace->
factory(
"Poisson::on(non[0,1000], sum::splusb(s[40,0,100],b[100,0,300]))");
181 wspace->
factory(
"Poisson::off(noff[0,5000], prod::taub(b,tau[5,3,7],rho[1,0,2]))");
182 wspace->
factory(
"Poisson::onbar(nonbar[0,10000], bbar[1000,500,2000])");
183 wspace->
factory(
"Poisson::offbar(noffbar[0,1000000], prod::lambdaoffbar(bbar, tau))");
184 wspace->
factory(
"Gaussian::mcCons(rhonom[1.,0,2], rho, sigma[.2])");
185 wspace->
factory(
"PROD::model(on,off,onbar,offbar,mcCons)");
186 wspace->
defineSet(
"obs",
"non,noff,nonbar,noffbar,rhonom");
188 wspace->
factory(
"Uniform::prior_poi({s})");
189 wspace->
factory(
"Uniform::prior_nuis({b,bbar,tau, rho})");
190 wspace->
factory(
"PROD::prior(prior_poi,prior_nuis)");
197 wspace->
defineSet(
"nuis",
"b,tau,rho,bbar");
224 modelConfig->
SetPdf(*wspace->
pdf(
"model"));
228 wspace->
import(*modelConfig);
237 plc.SetConfidenceLevel(0.95);
246 fc.SetConfidenceLevel(0.95);
248 fc.FluctuateNumDataEntries(
false);
249 fc.UseAdaptiveSampling(
true);
252 if (doFeldmanCousins) {
258 bc.SetConfidenceLevel(0.95);
260 if (doBayesian && wspace->
set(
"poi")->
getSize() == 1) {
261 bInt = bc.GetInterval();
263 cout <<
"Bayesian Calc. only supports on parameter of interest" << endl;
278 mc.SetConfidenceLevel(0.95);
279 mc.SetProposalFunction(*pf);
280 mc.SetNumBurnInSteps(500);
281 mc.SetNumIters(50000);
282 mc.SetLeftSideTailFraction(0.5);
285 mcInt = mc.GetInterval();
293 if (doBayesian && doMCMC) {
296 }
else if (doBayesian || doMCMC) {
304 if (doBayesian && wspace->
set(
"poi")->
getSize() == 1) {
308 bc.SetScanOfPosterior(20);
309 RooPlot *bplot = bc.GetPosteriorPlot();
314 if (doBayesian && wspace->
set(
"poi")->
getSize() == 1)
324 cout <<
"Profile Likelihood interval on s = [" << plInt->
LowerLimit(*wspace->
var(
"s")) <<
", "
328 if (doBayesian && wspace->
set(
"poi")->
getSize() == 1) {
329 cout <<
"Bayesian interval on s = [" << bInt->
LowerLimit() <<
", " << bInt->
UpperLimit() <<
"]" << endl;
332 if (doFeldmanCousins) {
333 cout <<
"Feldman Cousins interval on s = [" << fcInt->
LowerLimit(*wspace->
var(
"s")) <<
", "
339 cout <<
"MCMC interval on s = [" << mcInt->
LowerLimit(*wspace->
var(
"s")) <<
", "
static struct mg_connection * fc(struct mg_context *ctx)
RooDataSet * generate(const RooArgSet &whatVars, Int_t nEvents, const RooCmdArg &arg1, const RooCmdArg &arg2=RooCmdArg::none(), const RooCmdArg &arg3=RooCmdArg::none(), const RooCmdArg &arg4=RooCmdArg::none(), const RooCmdArg &arg5=RooCmdArg::none())
See RooAbsPdf::generate(const RooArgSet&,const RooCmdArg&,const RooCmdArg&,const RooCmdArg&,...
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.
RooArgSet is a container object that can hold multiple RooAbsArg objects.
RooDataSet is a container class to hold unbinned data.
RooFitResult is a container class to hold the input and output of a PDF fit to a dataset.
const TMatrixDSym & covarianceMatrix() const
Return covariance matrix.
const RooArgList & floatParsFinal() const
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.
virtual void Draw(Option_t *options=0)
Draw this plot and all of the elements it contains.
static TRandom * randomGenerator()
Return a pointer to a singleton random-number generator implementation.
BayesianCalculator is a concrete implementation of IntervalCalculator, providing the computation of a...
The FeldmanCousins class (like the Feldman-Cousins technique) is essentially a specific configuration...
This class provides simple and straightforward utilities to plot a LikelihoodInterval object.
void Draw(const Option_t *options=0)
draw the likelihood interval or contour for the 1D case a RooPlot is drawn by default of the profiled...
LikelihoodInterval is a concrete implementation of the RooStats::ConfInterval interface.
Double_t LowerLimit(const RooRealVar ¶m)
return the lower bound of the interval on a given parameter
Double_t UpperLimit(const RooRealVar ¶m)
return the upper bound of the interval on a given parameter
Bayesian Calculator estimating an interval or a credible region using the Markov-Chain Monte Carlo me...
This class provides simple and straightforward utilities to plot a MCMCInterval object.
MCMCInterval is a concrete implementation of the RooStats::ConfInterval interface.
virtual Double_t UpperLimit(RooRealVar ¶m)
get the highest value of param that is within the confidence interval
virtual Double_t LowerLimit(RooRealVar ¶m)
get the lowest value of param that is within the confidence interval
ModelConfig is a simple class that holds configuration information specifying how a model should be u...
virtual void SetPriorPdf(const RooAbsPdf &pdf)
Set the Prior Pdf, add to the the workspace if not already there.
virtual void SetWorkspace(RooWorkspace &ws)
virtual void SetParametersOfInterest(const RooArgSet &set)
virtual void SetNuisanceParameters(const RooArgSet &set)
specify the nuisance parameters (e.g. the rest of the parameters)
virtual void SetPdf(const RooAbsPdf &pdf)
Set the Pdf, add to the the workspace if not already there.
PointSetInterval is a concrete implementation of the ConfInterval interface.
Double_t UpperLimit(RooRealVar ¶m)
return upper limit on a given parameter
Double_t LowerLimit(RooRealVar ¶m)
return lower limit on a given parameter
The ProfileLikelihoodCalculator is a concrete implementation of CombinedCalculator (the interface cla...
ProposalFunction is an interface for all proposal functions that would be used with a Markov Chain Mo...
virtual void SetCovMatrix(const TMatrixDSym &covMatrix)
virtual void SetUpdateProposalParameters(Bool_t updateParams)
virtual ProposalFunction * GetProposalFunction()
virtual void SetVariables(RooArgList &vars)
virtual void SetCacheSize(Int_t size)
SimpleInterval is a concrete implementation of the ConfInterval interface.
virtual Double_t UpperLimit()
virtual Double_t LowerLimit()
The RooWorkspace is a persistable container for RooFit projects.
Bool_t writeToFile(const char *fileName, Bool_t recreate=kTRUE)
Save this current workspace into given file.
Bool_t defineSet(const char *name, const RooArgSet &aset, Bool_t importMissing=kFALSE)
Define a named RooArgSet with given constituents.
RooRealVar * var(const char *name) const
Retrieve real-valued variable (RooRealVar) with given name. A null pointer is returned if not found.
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.
RooFactoryWSTool & factory()
Return instance to factory tool.
const RooArgSet * set(const char *name)
Return pointer to previously defined named set with given nmame If no such set is found a null pointe...
RooAbsPdf * pdf(const char *name) const
Retrieve p.d.f (RooAbsPdf) with given name. A null pointer is returned if not found.
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.
Template specialisation used in RooAbsArg:
RooCmdArg Save(Bool_t flag=kTRUE)
Namespace for the RooStats classes.