# Unknown columns while drawing TH2D using RDataFrame

**URL:** <https://root-forum.cern.ch/t/unknown-columns-while-drawing-th2d-using-rdataframe/34793>\
**Category:** ROOT\
**Tags:** rdataframe\
**Created:** [June 24, 2019, 4:55pm UTC](https://root-forum.cern.ch/t/unknown-columns-while-drawing-th2d-using-rdataframe/34793 "2019-06-24T16:55:17Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![arkasantra](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/arkasantra/32/37646_2.png) [@arkasantra](https://root-forum.cern.ch/u/arkasantra)\
**Post date:** [June 24, 2019, 4:55pm UTC](https://root-forum.cern.ch/t/unknown-columns-while-drawing-th2d-using-rdataframe/34793/1 "2019-06-24T16:55:18Z")

</div>

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

> <https://github.com/asantra/FlavorSymPart3/blob/master/makeAlphaK.C#L297>

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:

> <https://github.com/asantra/FlavorSymPart3/blob/master/makeAlphaK.C#L276-L277>

  
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,  
Arka

* * *

\_ROOT Version:6.16/00  
\_Platform:x86\_64-slc6-gcc62-opt  
\_Compiler:linuxx8664gcc

* * *

---

<div class="post-metadata">

**Author:** ![Pnine](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/p/cc9497/32.png) [@Pnine](https://root-forum.cern.ch/u/Pnine)\
**Post date:** [June 24, 2019, 7:34pm UTC](https://root-forum.cern.ch/t/unknown-columns-while-drawing-th2d-using-rdataframe/34793/2 "2019-06-24T19:34:17Z")

</div>

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.

Cheers,  
P

---

<div class="post-metadata">

**Author:** ![jndrf](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/j/43a26b/32.png) [@jndrf](https://root-forum.cern.ch/u/jndrf)\
**Post date:** [June 27, 2019, 11:58am UTC](https://root-forum.cern.ch/t/unknown-columns-while-drawing-th2d-using-rdataframe/34793/3 "2019-06-27T11:58:58Z")

</div>

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

Cheers,

Jonas

---

<div class="post-metadata">

**Author:** ![eguiraud](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/eguiraud/32/32217_2.png) [@eguiraud](https://root-forum.cern.ch/u/eguiraud)\
**Post date:** [June 27, 2019, 12:16pm UTC](https://root-forum.cern.ch/t/unknown-columns-while-drawing-th2d-using-rdataframe/34793/4 "2019-06-27T12:16:19Z")

</div>

Hi,  
see the discussion [here](https://root-forum.cern.ch/t/rdataframe-syntax-more-like-ttree-draw/31778/2).

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 😃 ) but as I discuss in the discussion linked above it’s not completely trivial.

Cheers,  
Enrico

---

<div class="post-metadata">

**Author:** ![system](https://root-forum.cern.ch/uploads/default/original/3X/e/f/efe4f24398fd8ffeb76bccb6ecc46d9d9c003376.png) [@system](https://root-forum.cern.ch/u/system)\
**Post date:** [July 11, 2019, 12:16pm UTC](https://root-forum.cern.ch/t/unknown-columns-while-drawing-th2d-using-rdataframe/34793/5 "2019-07-11T12:16:21Z")

</div>

Closed on July 11, 2019, 12:16pm UTC

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