Benjamin Bannier
2011-01-11 21:33:31 UTC
Dear ROOT experts,
I am trying to get a ROOT object loaded from a python pickle via name
from some global registry like gDirectory or gROOT, but somehow cannot
make it work.
If I write an object like
----(out.py)
import ROOT as r
import pickle
h = r.TH1D('h_test','', 100, -10, 10)
pickle.dump(h, file('h.pkl', 'w'))
----
and try to get it from gDirectory or gROOT like
----(in.py)
import ROOT as r
import pickle
h = pickle.load(file('h.pkl'))
for t in (r.gDirectory, r.gROOT):
print t.FindObjectAny('h_test')
print t.Get('h_test')
----
I get nothing:
----
$ python in.py
<ROOT.TObject object at 0x(nil)>
<ROOT.TObject object at 0x(nil)>
<ROOT.TObject object at 0x(nil)>
<ROOT.TObject object at 0x(nil)>
----
How would I make these objects known to the usual suspects or if they
are already know how do I get them?
Thanks,
Benjamin
I am trying to get a ROOT object loaded from a python pickle via name
from some global registry like gDirectory or gROOT, but somehow cannot
make it work.
If I write an object like
----(out.py)
import ROOT as r
import pickle
h = r.TH1D('h_test','', 100, -10, 10)
pickle.dump(h, file('h.pkl', 'w'))
----
and try to get it from gDirectory or gROOT like
----(in.py)
import ROOT as r
import pickle
h = pickle.load(file('h.pkl'))
for t in (r.gDirectory, r.gROOT):
print t.FindObjectAny('h_test')
print t.Get('h_test')
----
I get nothing:
----
$ python in.py
<ROOT.TObject object at 0x(nil)>
<ROOT.TObject object at 0x(nil)>
<ROOT.TObject object at 0x(nil)>
<ROOT.TObject object at 0x(nil)>
----
How would I make these objects known to the usual suspects or if they
are already know how do I get them?
Thanks,
Benjamin