Error saving TH1F histogram in TDirectory

ROOT Version:JupyROOT 6.30/02_

Hello experts,
I am trying to save a TH1F histogram in a TDirectory of a .root file. When I then try to open this .root file with TBrowser for example, I get these error lines:
Error in TList::Clear: A list is accessing an object (0x288d9f0) already deleted (list name = TList)
Error in TList::Clear: A list is accessing an object (0x288de70) already deleted (list name = TList)
… (many more lines)

This is the code to produce this:

outfile = ROOT.TFile("data.root", "RECREATE")
nomi = outfile.mkdir("nominal")
nomi.cd()
reco_ttbar = ROOT.TH1F("reco_ttbar_m", "data_ttbar_m", 87, 0, 2001)
for v in pred:
    reco_ttbar.Fill(v)
reco_ttbar.Write()
outfile.cd()
outfile.Close()

When I dont do .Close() these errors disapear, but then of course I get the warning about not properly closing the file. Hope someone can help me out.
Cheers

Hello,

This seem to be the technical issue cause by the difference in ROOT version.
If you create the root file by any version >= 6.30, then you read the same file using any version < 6.30, this error will show up.

You may want to try reading it by ROOT 6.3X or above.

Cheers,
Hoa.

Hello Hoa,

indeed this was the problem. Thanks!
Cheers

1 Like