Component(s) ... already in the workspace when using PROD

Hello, I have the simple on/off workspace (attached), without any systematics, and I want to extend it adding one systematics using EDIT. I don’t understand the message I receive:

[#0] ERROR:ObjectHandling -- RooWorkSpace::import(ws_onoff) ERROR object named model_constrained: component(s) (N_CR_model_with_sys,alpha_x_b_model_with_sys) already in the workspace and no conflict resolution protocol specified
[#0] ERROR:ObjectHandling -- RooFactoryWSTool::processExpression() ERRORS detected, transaction to workspace aborted, no objects committed

on the last line:

import ROOT
f = ROOT.TFile.Open("onoff.root")
ws = f.Get("ws_onoff")

# create the term kalpha = (1 + sigma * theta)
ws.factory('expr:kalpha("1 + @0 * @1", {sigma_alpha[0.1], theta_alpha[0, -5, 5]})')
# create new pdf model replacing alpha -> kalpha
model_with_sys = ws.factory('EDIT:model_with_sys(model, alpha=kalpha)')
# create the constraint
ws.factory("Gaussian:constraint_alpha(global_alpha[0, -5, 5], theta_alpha, 1)")
ws.var("global_alpha").setConstant(True)
# final pdf
ws.factory("PROD:model_constrained(model_with_sys, constraint_alpha)")

I don’t see the problem: it is true that (N_CR_model_with_sys,alpha_x_b_model_with_sys) are already in the workspace, but why it is a problem? I am using ROOT 6.04/02.
onoff.root (10.2 KB)

Hi,

I can reproduce this problem. It is probably a bug inside the EDIT function. If you have time, please report this issue in JIRA. As a workaround, I would re-create a new pdf instead of using EDIT.

Best Regards

Lorenzo

[quote=“moneta”]Hi,

I can reproduce this problem. It is probably a bug inside the EDIT function. If you have time, please report this issue in JIRA. As a workaround, I would re-create a new pdf instead of using EDIT.

Best Regards

Lorenzo[/quote]

Here: sft.its.cern.ch/jira/browse/ROOT-7921