92 RooRealVar mu_obs(
"mu_obs",
"mu_obs", 1.0, -10, 10);
97 RooGaussian constraint(
"constraint",
"constraint", mu_obs, mu, 0.1);
100 RooProdPdf model(
"model",
"model", {gauss, constraint});
112 std::unique_ptr<RooDataSet> dataGlob{model.
generate({mu_obs}, 1)};
116 double mu_obs_orig_val = mu_obs.getVal();
123 std::unique_ptr<RooDataSet>
data{model.generate({
x}, 50)};
131 data->setGlobalObservables({mu_obs});
134 mu_obs.setVal(mu_obs_orig_val);
141 model.getParameters(
data->get(), modelParameters);
143 modelParameters.
snapshot(origParameters);
145 using FitRes = std::unique_ptr<RooFitResult>;
153 std::cout <<
"1. model.fitTo(*data, GlobalObservables(mu_obs))\n";
154 std::cout <<
"------------------------------------------------\n";
157 modelParameters.
assign(origParameters);
164 std::cout <<
"2. model.fitTo(*data)\n";
165 std::cout <<
"---------------------\n";
168 modelParameters.
assign(origParameters);
174 std::cout <<
"3. model.fitTo(*data, GlobalObservables(mu_obs), GlobalObservablesSource(\"model\"))\n";
175 std::cout <<
"------------------------------------------------\n";
178 modelParameters.
assign(origParameters);
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void data
void assign(const RooAbsCollection &other) const
Sets the value, cache and constant attribute of any argument in our set that also appears in the othe...
void Print(Option_t *options=nullptr) const override
This method must be overridden when a class wants to print itself.
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&,...
RooArgSet is a container object that can hold multiple RooAbsArg objects.
RooArgSet * snapshot(bool deepCopy=true) const
Use RooAbsCollection::snapshot(), but return as RooArgSet.
static RooMsgService & instance()
Return reference to singleton instance.
StreamConfig & getStream(Int_t id)
Efficient implementation of a product of PDFs of the form.
RooRealVar represents a variable that can be changed from the outside.
RooCmdArg Save(bool flag=true)
RooCmdArg GlobalObservables(Args_t &&... argsOrArgSet)
RooCmdArg GlobalObservablesSource(const char *sourceName)
RooCmdArg PrintLevel(Int_t code)
The namespace RooFit contains mostly switches that change the behaviour of functions of PDFs (or othe...
void removeTopic(RooFit::MsgTopic oldTopic)