RDataFrame::Histo1D from PyROOT

Hi @eguiraud,

I thought I’d ask it here rather than in a private e-mail.

I’m playing with RDataFrame since a few days. After some struggle I was able to make it work in C++, so now I’m looking at doing some simple things in Python. And I’m having a lot of problems with the Histo1D function. Whenever I try to use it in a very simple manner, I get:

Traceback (most recent call last):
  File "test.py", line 18, in <module>
    hist = df.Histo1D( "ElectronsPt" )
TypeError: can not resolve method template call for 'Histo1D'

Looking at Doxygen I see that this function is heavily overloaded.


Still, I would’ve hoped that it would be possible to call it in such a simple way… (In this example “ElectronsPt” is an std::vector<float> variable.)

Is there something I forgot about? Or is it really a case of PyROOT not being able to find which overload to use here?


ROOT Version: 6.14/04
Platform: x86_64-mac1013-clang100-opt
Compiler: Apple Clang 10.0

Aaaargh… Never mind.

The problem was that I tried to call this function on a “state” of the object that did not have “ElectronsPt” defined yet. Weird that it would fail in this way though…

Still, once I call the function correctly after the Define(...) call, it now runs.


Ah weekend had this report already, in this case in which it is trying to figure out the right template overload to call PyROOT ends up hiding the exception that the c++ is throwing and gives a vague message instead.

Maybe @etejedor can comment further.

Let us know if you missed something that would have made your first steps with RDF smoother.


This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.