140 using namespace RooFit;
141 using namespace RooStats;
154 wspace->
factory(
"Poisson::on(non[0,1000], sum::splusb(s[40,0,100],b[100,0,300]))");
155 wspace->
factory(
"Poisson::off(noff[0,5000], prod::taub(b,tau[5,3,7],rho[1,0,2]))");
156 wspace->
factory(
"Poisson::onbar(nonbar[0,10000], bbar[1000,500,2000])");
157 wspace->
factory(
"Poisson::offbar(noffbar[0,1000000], prod::lambdaoffbar(bbar, tau))");
158 wspace->
factory(
"Gaussian::mcCons(rhonom[1.,0,2], rho, sigma[.2])");
159 wspace->
factory(
"PROD::model(on,off,onbar,offbar,mcCons)");
160 wspace->
defineSet(
"obs",
"non,noff,nonbar,noffbar,rhonom");
162 wspace->
factory(
"Uniform::prior_poi({s})");
163 wspace->
factory(
"Uniform::prior_nuis({b,bbar,tau, rho})");
164 wspace->
factory(
"PROD::prior(prior_poi,prior_nuis)");
171 wspace->
defineSet(
"nuis",
"b,tau,rho,bbar");
198 modelConfig->
SetPdf(*wspace->
pdf(
"model"));
202 wspace->
import(*modelConfig);
226 if(doFeldmanCousins){
235 if(doBayesian && wspace->
set(
"poi")->
getSize() == 1) {
238 cout <<
"Bayesian Calc. only supports on parameter of interest" << endl;
259 MCMCInterval* mcInt =
NULL;
265 TCanvas*
c1 = (TCanvas*)
gROOT->Get(
"c1");
267 c1 =
new TCanvas(
"c1");
269 if(doBayesian && doMCMC){
273 else if (doBayesian || doMCMC){
281 if(doBayesian && wspace->
set(
"poi")->
getSize() == 1) {
291 if(doBayesian && wspace->
set(
"poi")->
getSize() == 1)
301 cout <<
"Profile Likelihood interval on s = [" <<
307 if(doBayesian && wspace->
set(
"poi")->
getSize() == 1) {
308 cout <<
"Bayesian interval on s = [" <<
313 if(doFeldmanCousins){
314 cout <<
"Feldman Cousins interval on s = [" <<
321 cout <<
"MCMC interval on s = [" <<
322 mcInt->LowerLimit(*wspace->
var(
"s") ) <<
", " <<
323 mcInt->UpperLimit(*wspace->
var(
"s") ) <<
"]" << endl;
RooPlot * GetPosteriorPlot(bool norm=false, double precision=0.01) const
get the plot with option to get it normalized
ProposalFunction is an interface for all proposal functions that would be used with a Markov Chain Mo...
void Print(Option_t *option="") const
Print the real and cpu time passed between the start and stop events.
ModelConfig is a simple class that holds configuration information specifying how a model should be u...
void Start(Bool_t reset=kTRUE)
Start the stopwatch.
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...
This class provides simple and straightforward utilities to plot a MCMCInterval object.
const RooArgList & floatParsFinal() const
LikelihoodInterval is a concrete implementation of the RooStats::ConfInterval interface.
virtual void SetWorkspace(RooWorkspace &ws)
void SetScanOfPosterior(int nbin=100)
use directly the approximate posterior function obtained by binning it in nbins by default the cdf is...
void FourBinInstructional(bool doBayesian=false, bool doFeldmanCousins=false, bool doMCMC=false)
friend class RooWorkspace
virtual ProposalFunction * GetProposalFunction()
virtual void SetUpdateProposalParameters(Bool_t updateParams)
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 SetNumBurnInSteps(Int_t numBurnInSteps)
set the number of steps in the chain to discard as burn-in, starting from the first ...
void Draw(const Option_t *options=NULL)
static RooMsgService & instance()
Return reference to singleton instance.
virtual void SetSeed(UInt_t seed=0)
Set the random generator seed.
Double_t LowerLimit(const RooRealVar ¶m)
return the lower bound of the interval on a given parameter
virtual LikelihoodInterval * GetInterval() const
Return a likelihood interval.
virtual SimpleInterval * GetInterval() const
compute the interval.
static struct mg_connection * fc(struct mg_context *ctx)
virtual void SetConfidenceLevel(Double_t cl)
set the confidence level for the interval (eg. 0.95 for a 95% Confidence Interval) ...
virtual void SetConfidenceLevel(Double_t cl)
set the confidence level for the interval (eg. 0.95 for a 95% Confidence Interval) ...
RooAbsPdf * pdf(const char *name) const
Retrieve p.d.f (RooAbsPdf) with given name. A null pointer is returned if not found.
virtual void SetPdf(const RooAbsPdf &pdf)
Set the Pdf, add to the the workspace if not already there.
static TRandom * randomGenerator()
Return a pointer to a singleton random-number generator implementation.
virtual Double_t LowerLimit()
virtual void SetConfidenceLevel(Double_t cl)
set the confidence level for the interval (eg. 0.95 for a 95% Confidence Interval) ...
RooFit::MsgLevel globalKillBelow() const
Double_t LowerLimit(RooRealVar ¶m)
return lower limit on a given parameter
Double_t UpperLimit(const RooRealVar ¶m)
return the upper bound of the interval on a given parameter
virtual void SetNumIters(Int_t numIters)
set the number of iterations to run the metropolis algorithm
virtual MCMCInterval * GetInterval() const
Main interface to get a ConfInterval.
virtual void SetNuisanceParameters(const RooArgSet &set)
specify the nuisance parameters (e.g. the rest of the parameters)
void SetNBins(Int_t bins)
virtual void SetCacheSize(Int_t size)
Bool_t defineSet(const char *name, const RooArgSet &aset, Bool_t importMissing=kFALSE)
Define a named RooArgSet with given constituents.
void FluctuateNumDataEntries(bool flag=true)
const TMatrixDSym & covarianceMatrix() const
Return covariance matrix.
void setGlobalKillBelow(RooFit::MsgLevel level)
Bool_t writeToFile(const char *fileName, Bool_t recreate=kTRUE)
Save this current workspace into given file.
RooDataSet is a container class to hold unbinned data.
RooRealVar * var(const char *name) const
Retrieve real-valued variable (RooRealVar) with given name. A null pointer is returned if not found...
Double_t UpperLimit(RooRealVar ¶m)
return upper limit on a given parameter
A RooPlot is a plot frame and a container for graphics objects within that frame. ...
The FeldmanCousins class (like the Feldman-Cousins technique) is essentially a specific configuration...
PointSetInterval is a concrete implementation of the ConfInterval interface.
virtual void SetProposalFunction(ProposalFunction &proposalFunction)
set the proposal function for suggesting new points for the MCMC
virtual void SetPriorPdf(const RooAbsPdf &pdf)
Set the Prior Pdf, add to the the workspace if not already there.
virtual PointSetInterval * GetInterval() const
Main interface to get a ConfInterval (will be a PointSetInterval)
virtual void SetCovMatrix(const TMatrixDSym &covMatrix)
virtual void SetConfidenceLevel(Double_t cl)
set the confidence level for the interval (eg. 0.95 for a 95% Confidence Interval) ...
RooFactoryWSTool & factory()
Return instance to factory tool.
RooCmdArg Save(Bool_t flag=kTRUE)
virtual Double_t UpperLimit()
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.
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())
Generate a new dataset containing the specified variables with events sampled from our distribution...
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...
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.
virtual void SetLeftSideTailFraction(Double_t a)
Set the left side tail fraction.
virtual void SetParametersOfInterest(const RooArgSet &set)
virtual void SetVariables(RooArgList &vars)
Bayesian Calculator estimating an interval or a credible region using the Markov-Chain Monte Carlo me...
BayesianCalculator is a concrete implementation of IntervalCalculator, providing the computation of a...
The RooWorkspace is a persistable container for RooFit projects.
void UseAdaptiveSampling(bool flag=true)
virtual void Draw(Option_t *options=0)
Draw this plot and all of the elements it contains.