Is it possible to merge two or more RooWorkspace together?

Hi, I create two RooWorkspaces to contain pdfs, vars and sets, one for signal and another for background. Now I want to merge all the components of the two workspaces into one. Is there some shortcut to do that?
I tried the “merge” function in RooWorkspace class, but it didn’t work.

Hello @Chen_Chen,

The merge function is unfortunately empty. It seems that someone wanted to implement it, but never got to it.

You can do it using the import function. You can either import objects that are accessible in your scope (because you have a reference or pointer to them) or you can directly import from workspaces in a file.
RooWorkspace documentation

The direct importing from a file would work like this:

RooWorkspace w("w", "new combined workspace");
w.import("fileS:w1:pdfA", <optional RenameAllVariablesExcept("A","mHiggs") >);
w.import("fileB:w5:pdfB", <optional RenameVariable("m","mHiggs") >);

Thanks! I’m doing it in the same way as yours now.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.