I am having some trouble importing objects into RooWorkspace using PyROOT that came with ROOT 6.02.05. The variable x is imported as a “generic object” with no name. Everything work with ROOT 5.34.25.
Both ROOT versions are the ones from ATLAS’s ALRB.
Any idea what could be wrong?
The code is as follows:
#!/usr/bin/env python
from ROOT import *
w=RooWorkspace('w','workspace')
x=RooRealVar("x","x",0,100)
getattr(w,'import')(x)
w.Print()
The ROOT 6 output is:
RooFit v3.60 -- Developed by Wouter Verkerke and David Kirkby
Copyright (C) 2000-2013 NIKHEF, University of California & Stanford University
All rights reserved, please read http://roofit.sourceforge.net/license.txt
RooWorkspace(w) workspace contents
generic objects
---------------
RooRealVar::
The ROOT 5 output is:
RooFit v3.60 -- Developed by Wouter Verkerke and David Kirkby
Copyright (C) 2000-2013 NIKHEF, University of California & Stanford University
All rights reserved, please read http://roofit.sourceforge.net/license.txt
[#1] INFO:ObjectHandling -- RooWorkspace::import(w) importing RooRealVar::x
RooWorkspace(w) workspace contents
variables
---------
(x)
Processing test.C...
RooFit v3.60 -- Developed by Wouter Verkerke and David Kirkby
Copyright (C) 2000-2013 NIKHEF, University of California & Stanford University
All rights reserved, please read http://roofit.sourceforge.net/license.txt
[#1] INFO:ObjectHandling -- RooWorkspace::import(w) importing RooRealVar::x
RooWorkspace(w) workspace contents
variables
---------
(x)
Also I did a quick check with a version of ROOT 6 that I compiled locally. I noticed that the PyROOT version calls the following import:
thanks a lot for your report: this looks like some kind of method resolution issue.
Could you attach the rootfile and script so that I can open a ticket for our pyroot expert?
I’ve attached the Python and C++ versions of the script.
There is no ROOT file. I create a RooRealVar x and RooWorkspace in the code, import the x variable into the workspace and print the contents of the workspace. test.py (138 Bytes) test.C (113 Bytes)
this has been filed: sft.its.cern.ch/jira/browse/ROOT-7166
It will be fixed soon.
Meanwhile, I tested the script also on the master branch of ROOT and that one is not affected by the issue.