In the following code:
int myfunc()
{
TFile * fw = TFile::Open("workspace.root");
RooWorkspace *w = (RooWorkspace *) fw -> Get("w");
RooRealVar * x = w -> var("x");
RooPlot * frame = x -> frame();
RooAbsData *dataw = w -> data("data_obs");
fw -> Close();
x -> Print();
dataw -> Print();
frame -> Print();
return 0;
}
the object frame
(unlike x
and dataw
) does not survive after fw -> Close()
. How to fix?