Make a RooPlot survive after TFile::Close()

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?

Can you check in tutorial
seems to be discussed similar situation?


@oshadura, it is not the same. I am looking for something similar to SetDirectory(nullptr) on a RooPlot.

@moneta, probably you can help here please?


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