50 using namespace RooFit ;
51 using namespace RooStats ;
68 wspace->
factory(
"Poisson::countingModel(obs[150,0,300], sum(s[50,0,120]*ratioSigEff[1.,0,3.],b[100]*ratioBkgEff[1.,0.,3.]))");
71 wspace->
factory(
"Gaussian::sigConstraint(gSigEff[1,0,3],ratioSigEff,0.05)");
72 wspace->
factory(
"Gaussian::bkgConstraint(gSigBkg[1,0,3],ratioBkgEff,0.2)");
73 wspace->
factory(
"PROD::modelWithConstraints(countingModel,sigConstraint,bkgConstraint)");
76 RooAbsPdf* modelWithConstraints = wspace->
pdf(
"modelWithConstraints");
84 RooArgSet constrainedParams(*ratioSigEff, *ratioBkgEff);
105 modelConfig.
SetPdf(*modelWithConstraints);
110 modelConfig.
SetName(
"ModelConfig");
111 wspace->
import(modelConfig);
125 TCanvas* dataCanvas =
new TCanvas(
"dataCanvas");
126 dataCanvas->Divide(2,1);
130 plotInt.
SetTitle(
"Profile Likelihood Ratio and Posterior for S");
161 MCMCInterval* mcInt = (MCMCInterval*)mc.
GetInterval();
165 cout <<
"Profile lower limit on s = " << ((
LikelihoodInterval*) lrint)->LowerLimit(*s) << endl;
166 cout <<
"Profile upper limit on s = " << ((
LikelihoodInterval*) lrint)->UpperLimit(*s) << endl;
172 cout <<
"FC lower limit on s = " << fcll << endl;
173 cout <<
"FC upper limit on s = " << fcul << endl;
174 TLine* fcllLine =
new TLine(fcll, 0, fcll, 1);
175 TLine* fculLine =
new TLine(fcul, 0, fcul, 1);
176 fcllLine->SetLineColor(
kRed);
177 fculLine->SetLineColor(
kRed);
178 fcllLine->Draw(
"same");
179 fculLine->Draw(
"same");
180 dataCanvas->Update();
189 double mcul = mcInt->UpperLimit(*s);
190 double mcll = mcInt->LowerLimit(*s);
191 cout <<
"MCMC lower limit on s = " << mcll << endl;
192 cout <<
"MCMC upper limit on s = " << mcul << endl;
193 cout <<
"MCMC Actual confidence level: "
194 << mcInt->GetActualConfidenceLevel() << endl;
199 RooDataSet * chainData = mcInt->GetChainAsDataSet();
202 std::cout <<
"plotting the chain data - nentries = " << chainData->
numEntries() << std::endl;
208 chain->
Draw(
"s:ratioSigEff:ratioBkgEff",
"nll_MarkovChain_local_",
"box");
213 std::cout <<
"plotting the scanned points used in the frequentist construction - npoints = " << parScanData->
numEntries() << std::endl;
219 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...
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...
virtual void Draw(Option_t *option="")
Specific drawing options can be used to paint a TGraph2D:
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 SetTestSize(Double_t size)
set the size of the test (rate of Type I error) ( Eg. 0.05 for a 95% Confidence Interval) ...
virtual void SetTestSize(Double_t size)
set the size of the test (rate of Type I error) ( Eg. 0.05 for a 95% Confidence Interval) ...
virtual void SetName(const char *name)
Change (i.e.
void rs101_limitexample()
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)
TTree * GetAsTTree(TString name, TString desc, const RooDataSet &data)
virtual void SetObservables(const RooArgSet &set)
specify the observables
virtual LikelihoodInterval * GetInterval() const
Return a likelihood interval.
RooAbsData * GetPointsToScan()
static struct mg_connection * fc(struct mg_context *ctx)
void Stop()
Stop the stopwatch.
RooAbsPdf * pdf(const char *name) const
Retrieve p.d.f (RooAbsPdf) with given name. A null pointer is returned if not found.
virtual void SetMarkerColor(Color_t mcolor=1)
virtual void SetPdf(const RooAbsPdf &pdf)
Set the Pdf, add to the the workspace if not already there.
RooRealVar represents a fundamental (non-derived) real valued object.
virtual void setVal(Double_t value)
Set value of variable to 'value'.
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 SetTestSize(Double_t size)
set the size of the test (rate of Type I error) ( Eg. 0.05 for a 95% Confidence Interval) ...
virtual void SetNuisanceParameters(const RooArgSet &set)
specify the nuisance parameters (e.g. the rest of the parameters)
void setConstant(Bool_t value=kTRUE)
void SetNBins(Int_t bins)
virtual void SetCacheSize(Int_t size)
virtual Int_t numEntries() const
void FluctuateNumDataEntries(bool flag=true)
void SetLineColor(Color_t color)
const TMatrixDSym & covarianceMatrix() const
Return covariance matrix.
void SetLineWidth(Int_t width)
Bool_t writeToFile(const char *fileName, Bool_t recreate=kTRUE)
Save this current workspace into given file.
virtual void SetMarkerStyle(Style_t mstyle=1)
RooDataSet is a container class to hold unbinned data.
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...
RooRealVar * var(const char *name) const
Retrieve real-valued variable (RooRealVar) with given name. A null pointer is returned if not found...
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.
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 SetPoint(Int_t point, Double_t x, Double_t y, Double_t z)
Sets point number n.
virtual void Draw(Option_t *opt)
Default Draw method for all objects.
virtual PointSetInterval * GetInterval() const
Main interface to get a ConfInterval (will be a PointSetInterval)
virtual void SetCovMatrix(const TMatrixDSym &covMatrix)
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...
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.
void Print(Option_t *opts=0) const
Print contents of the workspace.
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)
A TTree object has a header with a name and a title.
virtual void SetVariables(RooArgList &vars)
virtual void SetGlobalObservables(const RooArgSet &set)
specify the global observables
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...
virtual void SetTitle(const char *title="")
Change (i.e. set) the title of the TNamed.
virtual const RooArgSet * get(Int_t index) const
Return RooArgSet with coordinates of event 'index'.
RooCmdArg Constrain(const RooArgSet ¶ms)
The RooWorkspace is a persistable container for RooFit projects.
void UseAdaptiveSampling(bool flag=true)
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.