Cling and pyroot/python

I am not very clear on the integration between cling and python. I have read the docs I can find, have learned about pyRoot…but much of the information is somewhat old and points to CINT as opposed to cling. Would like to understand the basic interplay between cling and the python interpreter…have seen the google video where the python shell shell is invoked, but am not certain what is necessary in terms of integration.

How does one set up this relationship? Is there a particular doc I may be missing that provides some background in setting up and the cross invocations?

Best,
Gregory

Hi,
Python and cling are independent there is no bridge between them. PyROOT is build on top of ROOT’s reflection layer (cling is the engine providing c++ information to ROOT) and communicate via ROOT objects from python to c++ back and forth.
Vassil

Hi,

perhaps more direct use would be possible in the future, see http://article.gmane.org/gmane.comp.compilers.clang.devel/38411.

Until then, PyROOT relies heavily on the wrapper generators in ROOT.

From within ROOT, it’s easy to move back and forth. For example:[code]$ root
root [0] TPython::Prompt()

l = ROOT.TLorentzVector(1,2,3,4)
^D
root [1] TLorentzVector* l2 = (TLorentzVector*)void*)TPython::Eval(“l”)
(class TLorentzVector *) 0x2a773b0
root [2] l2->Print()
(x,y,z,t)=(1.000000,2.000000,3.000000,4.000000) (P,eta,phi,E)=(3.741657,1.103587,1.107149,4.000000)
root [3] l2->SetE(42.)
root [4] l2->Print()
(x,y,z,t)=(1.000000,2.000000,3.000000,42.000000) (P,eta,phi,E)=(3.741657,1.103587,1.107149,42.000000)
root [5] TPython::Prompt()

l.Print()
(x,y,z,t)=(1.000000,2.000000,3.000000,42.000000) (P,eta,phi,E)=(3.741657,1.103587,1.107149,42.000000)

^D
root [7][/code]
Cheers,
Wim

Hi,
Thanks Wim! So in general, it is doable but you will have to have an extra layer of reflection objects on top of cling, which I think Wim can estimate how compex and laborous it is to implement.
Cheers,
Vassil