Unknown columns while drawing TH2D using RDataFrame

I am trying to make some 2D histograms using RDataFrame class. This is the line where I am trying to get the 2D histogram:

But this is the error I am getting:

Error in TRint::HandleTermInput(): std::runtime_error caught: Unknown columns: fabs(lep_eta[0]),lep_pT[0]

I defined those columns here:

yet I am getting this error.
May I know what I am doing wrong? Is there any solution to my problem?

Thank you very much,

_ROOT Version:6.16/00

Hi Arka,

I think the problem is that you are not listing columns to fill your histo2d with, but rather expressions, e.g. fabs(lep_eta[0]).
I think you should go through a Define first, e.g. Define("abs_lep_eta_0","fabs(lep_eta[0])") and then fill the Histo2D accordingly.


1 Like

I just stumbled upon the same problem, apparently this is not possible yet to access elements of a vector in the Histogram creation, but in filters you can access elements of a vector branch.

I’ve opened up a feature request on JIRA for this: ROOT-10212



see the discussion here.

With current RDF, df.Histo1D("vec[0]") is written df.Define("vec0", "vec[0]").Histo1D("vec0").

The reason you can write "vec[0]" in Filter and Define is that they take an expression as argument (either as a string or as a C++ callable), while Histo1D just takes column names. It is in principle possible to add a df.Histo1D("vec[0]") shortcut (PRs are welcome :smiley: ) but as I discuss in the discussion linked above it’s not completely trivial.


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