I want to open TFile, read histogram from it and than close TFile, having histogram still in the memory (than I’ll open another TFile etc.). I thought that Clone() should do the job, but my code is crashing:
{
TFile *f = new TFile("par_histo/par20_rad.root");
TH2D *tmp_histo = (TH2D*)(f->Get("par_histo"));
TH2D *par_histo = (TH2D*)tmp_histo->Clone("aaa");
delete f;
par_histo->Draw("colz");
}
What am I doing wrong?