63ROOT.RooMsgService.instance().getStream(1).removeTopic(ROOT.RooFit.Minimization)
64ROOT.RooMsgService.instance().getStream(1).removeTopic(ROOT.RooFit.Fitting)
72x = ROOT.RooRealVar(
"x",
"x", -10, 10)
75mu = ROOT.RooRealVar(
"mu",
"mu", 0.0, -10, 10)
76sigma = ROOT.RooRealVar(
"sigma",
"sigma", 1.0, 0.1, 2.0)
79gauss = ROOT.RooGaussian(
"gauss",
"gauss", x, mu, sigma)
82mu_obs = ROOT.RooRealVar(
"mu_obs",
"mu_obs", 1.0, -10, 10)
87constraint = ROOT.RooGaussian(
"constraint",
"constraint", mu_obs, mu, 0.1)
90model = ROOT.RooProdPdf(
"model",
"model", [gauss, constraint])
102dataGlob = model.generate({mu_obs}, 1)
106mu_obs_orig_val = mu_obs.getVal()
108ROOT.RooArgSet(mu_obs).assign(dataGlob.get(0))
113data = model.generate({x}, 50)
121data.setGlobalObservables({mu_obs})
124mu_obs.setVal(mu_obs_orig_val)
130modelParameters = model.getParameters(data.get())
131origParameters = modelParameters.snapshot()
139print(
"1. model.fitTo(*data, GlobalObservables(mu_obs))")
140print(
"------------------------------------------------")
141model.fitTo(data, GlobalObservables=mu_obs, PrintLevel=-1, Save=
True).
Print()
142modelParameters.assign(origParameters)
149print(
"2. model.fitTo(*data)")
150print(
"---------------------")
151model.fitTo(data, PrintLevel=-1, Save=
True).
Print()
152modelParameters.assign(origParameters)
158print(
'3. model.fitTo(*data, GlobalObservables(mu_obs), GlobalObservablesSource("model"))')
159print(
"------------------------------------------------")
160model.fitTo(data, GlobalObservables=mu_obs, GlobalObservablesSource=
"model", PrintLevel=-1, Save=
True).
Print()
161modelParameters.assign(origParameters)
void Print(GNN_Data &d, std::string txt="")