33const int n_samples = 1000;
55 std::vector<int> parampoints = {0, 1, 2, 3, 4};
57 for (
auto i : parampoints) {
65 std::unique_ptr<RooDataHist> hist1{
66 dynamic_cast<RooDataHist *
>(ws.
pdf(
Form(
"g%d", i))->generateBinned(*x_var, 100 * n_samples))};
69 for (
int i_bin = 0; i_bin < hist1->numEntries(); ++i_bin) {
70 const RooArgSet *binContent = hist1->get(i_bin);
71 hist1->add(*binContent, 1.0);
89 morph_func.setPdfMode();
101std::unique_ptr<RooWorkspace> build_ws(
double mu_observed,
double sigma)
103 auto ws = std::make_unique<RooWorkspace>();
104 ws->
factory(
Form(
"Gaussian::gauss(x[-5,15],mu[%f,0,4], %f)", mu_observed,
sigma));
112 double mu_observed = 2.5;
116 std::unique_ptr<RooWorkspace> ws = build_ws(mu_observed,
sigma);
129 RooAbsReal *nll_morph = ws->pdf(
"morph")->createNLL(*obs_data);
136 TCanvas *
c =
new TCanvas(
"rf616_morphing",
"rf616_morphing", 800, 400);
139 gPad->SetLeftMargin(0.15);
143 gPad->SetLeftMargin(0.15);
148 std::vector<RooAbsReal *> nlls = {nll_gauss, nll_morph};
149 for (
auto nll : nlls) {
151 minimizer.setPrintLevel(-1);
152 minimizer.minimize(
"Minuit2");
char * Form(const char *fmt,...)
Formats a string in a circular formatting buffer.
Abstract interface for all probability density functions.
RooPlot * plotOn(RooPlot *frame, const RooCmdArg &arg1={}, const RooCmdArg &arg2={}, const RooCmdArg &arg3={}, const RooCmdArg &arg4={}, const RooCmdArg &arg5={}, const RooCmdArg &arg6={}, const RooCmdArg &arg7={}, const RooCmdArg &arg8={}, const RooCmdArg &arg9={}, const RooCmdArg &arg10={}) const override
Helper calling plotOn(RooPlot*, RooLinkedList&) const.
RooFit::OwningPtr< RooAbsReal > createNLL(RooAbsData &data, CmdArgs_t const &... cmdArgs)
Construct representation of -log(L) of PDF with given dataset.
RooFit::OwningPtr< RooDataSet > generate(const RooArgSet &whatVars, Int_t nEvents, const RooCmdArg &arg1, const RooCmdArg &arg2={}, const RooCmdArg &arg3={}, const RooCmdArg &arg4={}, const RooCmdArg &arg5={})
See RooAbsPdf::generate(const RooArgSet&,const RooCmdArg&,const RooCmdArg&,const RooCmdArg&,...
RooPlot * frame(const RooCmdArg &arg1, const RooCmdArg &arg2={}, const RooCmdArg &arg3={}, const RooCmdArg &arg4={}, const RooCmdArg &arg5={}, const RooCmdArg &arg6={}, const RooCmdArg &arg7={}, const RooCmdArg &arg8={}) const
Create a new RooPlot on the heap with a drawing frame initialized for this object,...
Abstract base class for objects that represent a real value and implements functionality common to al...
virtual RooPlot * plotOn(RooPlot *frame, const RooCmdArg &arg1={}, const RooCmdArg &arg2={}, const RooCmdArg &arg3={}, const RooCmdArg &arg4={}, const RooCmdArg &arg5={}, const RooCmdArg &arg6={}, const RooCmdArg &arg7={}, const RooCmdArg &arg8={}, const RooCmdArg &arg9={}, const RooCmdArg &arg10={}) const
Plot (project) PDF on specified frame.
RooArgList is a container object that can hold multiple RooAbsArg objects.
RooArgSet is a container object that can hold multiple RooAbsArg objects.
Implements a RooAbsBinning in terms of an array of boundary values, posing no constraints on the choi...
Container class to hold N-dimensional binned data.
Container class to hold unbinned data.
RooFitResult is a container class to hold the input and output of a PDF fit to a dataset.
void Print(Option_t *options=nullptr) const override
This method must be overridden when a class wants to print itself.
A probability density function sampled from a multidimensional histogram.
Wrapper class around ROOT::Math::Minimizer that provides a seamless interface between the minimizer f...
static RooMsgService & instance()
Return reference to singleton instance.
void setGlobalKillBelow(RooFit::MsgLevel level)
Plot frame and a container for graphics objects within that frame.
void Draw(Option_t *options=nullptr) override
Draw this plot and all of the elements it contains.
Variable that can be changed from the outside.
void setBins(Int_t nBins, const char *name=nullptr, bool shared=true)
Create a uniform binning under name 'name' for this variable.
Persistable container for RooFit projects.
RooAbsPdf * pdf(RooStringView name) const
Retrieve p.d.f (RooAbsPdf) with given name. A null pointer is returned if not found.
RooFactoryWSTool & factory()
Return instance to factory tool.
RooRealVar * var(RooStringView name) const
Retrieve real-valued variable (RooRealVar) with given name. A null pointer is returned if not found.
bool import(const RooAbsArg &arg, const RooCmdArg &arg1={}, const RooCmdArg &arg2={}, const RooCmdArg &arg3={}, const RooCmdArg &arg4={}, const RooCmdArg &arg5={}, const RooCmdArg &arg6={}, const RooCmdArg &arg7={}, const RooCmdArg &arg8={}, const RooCmdArg &arg9={})
Import a RooAbsArg object, e.g.
The RooWrapperPdf is a class that can be used to convert a function into a PDF.
virtual void SetTitleOffset(Float_t offset=1)
Set distance between the axis and the axis title.
RooCmdArg Title(const char *name)
RooCmdArg Silence(bool flag=true)
RooCmdArg LineColor(TColorNumber color)
RooCmdArg Name(const char *name)
The namespace RooFit contains mostly switches that change the behaviour of functions of PDFs (or othe...