Use Root wihtin Sage notebook

Hi,

I would like to use some of the root functions within a sage notebook.
I have found an older thread on this and tried to make it work.
As i use:

import sys
sys.path.append('path/to/root/lib')
import ROOT

it seems to work, at least I don’t get an error message.
Then I simply try to create a canvas:

c = ROOT.TCanvas("c", "c", 800, 600)

which fails with the error message:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "_sage_input_7.py", line 10, in <module>
    exec compile(u'open("___code___.py","w").write("# -*- coding: utf-8 -*-\\n" + _support_.preparse_worksheet_cell(base64.b64decode("YyA9IFJPT1QuVENhbnZhcygibXlDYW52YXNOYW1lIiwiVGhlIENhbnZhcyBUaXRsZSIsODAwLDYwMCk="),globals())+"\\n"); execfile(os.path.abspath("___code___.py"))
  File "", line 1, in <module>
    
  File "/tmp/tmpXEBcNL/___code___.py", line 3, in <module>
    exec compile(u'c = ROOT.TCanvas("myCanvasName","The Canvas Title",_sage_const_800 ,_sage_const_600 )
  File "", line 1, in <module>
    
TypeError: none of the 5 overloaded methods succeeded. Full details:
  TCanvas::TCanvas(bool build = kTRUE) =>
    takes at most 1 arguments (4 given)
  TCanvas::TCanvas(const char* name, const char* title = "", int form = 1) =>
    takes at most 3 arguments (4 given)
  TCanvas::TCanvas(const char* name, const char* title, int ww, int wh) =>
    could not convert argument 3
  TCanvas::TCanvas(const char* name, const char* title, int wtopx, int wtopy, int ww, int wh) =>
    takes at least 6 arguments (4 given)
  TCanvas::TCanvas(const char* name, int ww, int wh, int winid) =>
    could not convert argument 2

Any idea what I am doing wrong or missing?

Best regards
Jo

Hi Jo,

sagemath notebooks are not supported.
Jupyter technology has been integrated with ROOT though, starting from release 6.06.

Cheers,
Danilo

Hi Danilo,

thanks for your reply, I have read about that and thought it might also work with other notebooks based on python.

Cheers
Jo

Hi Jo,

not at the moment.
What is possible with the present version of ROOT is to use in the context of Jupyter a ROOT Kernel to directly type in the cells C++ code or ROOT as a Python module in a Python notebook.

Cheers,
D