RE: How to register ROOT object read from python pickle

From: Fine, Valeri <fine_at_bnl.gov>
Date: Thu, 13 Jan 2011 15:07:55 -0500


> > ROOT objects are C++ objects.
>
> No, in python they are python objects and in ruby they are ruby
objects etc. ;)

ROOT object remains the C++ object even though PyRoot hides this fact. To use it you have to load PyRoot.
The PyRoot is to load the appropriated ROOT subsystem and C++ run-time environment for you behind the scene.
However, I agree I expressed some narrow view. I overlooked the "use case" when one wants to create the Python native container of the ROOT C++ objects.
ROOT I/O cannot handle it alone. One needs pickle (json?) ( backed by ROOT C++ object streamers to serialize /de-serialize the internal C++ objects )

Best regards , Valeri Fine



Brookhaven National Laboratory
Upton, NY 11973

> -----Original Message-----
> From: Benjamin Bannier [mailto:bbannier_at_gmail.com]
> Sent: Tuesday, January 11, 2011 9:52 PM
> To: Fine, Valeri
> Cc: ROOT Talk
> Subject: Re: [ROOT] How to register ROOT object read from python
pickle
>
> Dear Valeri,
>
> > > 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.
>
> > You should use the ROOT I/O (for example, TFile class) to read /
> > write ROOT objects.
>
> I could do that, and maybe my example simplified what I wanted to do
too much. I will be
> streaming more complicated objects (e.g. tuples or dictionaries
containing ROOT objects).
> Python's pickle is very nice for that since it requires minimal setup,
both for writing and
> reading.
>
> > ROOT objects are C++ objects.
>
> No, in python they are python objects and in ruby they are ruby
objects etc. ;)
>
>
> Benjamin
Received on Thu Jan 13 2011 - 21:08:03 CET

This archive was generated by hypermail 2.2.0 : Fri Jan 14 2011 - 17:50:01 CET