assignValueOnly not working with set in workspace

Hi,

I’ve found the following behaviour counter-intuitive in roofit.

I am effectively taking a snapshot, but instead of using “saveSnapshot” of the workspace, I was just trying to save resulting RooArgSet. But then when I use this argset directly from the workspace, the assignValueOnly method doesn’t behave. Here’s a simple code example:

RooWorkspace w;
w.factory("n[10,0,20]");
w.defineSet("myset","n");
RooArgSet* snapshot = w.set("myset")->snapshot();
w.defineSet("mysnapshot",*snapshot);

w.var("n")->setVal(5);

w.set("myset")->Print("v"); //shows n=5
w.set("myset")->assignValueOnly(*snapshot);
w.set("myset")->Print("v"); //shows n=10, GOOD!

w.set("myset")->setVal(5);
w.set("myset")->assignValueOnly(*w.set("mysnapshot"));
w.set("myset")->Print("v"); //still shows n=5, UNEXPECTED!

Is there a way to make this sort of behaviour work (other than loadSnapshot saveSnapshot), or otherwise can it be fixed in RooFit future versions? Are snapshots to be imported into the workspace differently?

Thanks

Will