Problem with RDataFrame

Hi everyone,

I have a problem when using RDataFrame. I was trying out the following easy example code:

RDataFrame d("Filtered", "test.root");
auto h = d.Histo1D("Probability");
h->Draw();

This gives me the following error message:

error: unknown type name 'h'

Any ideas what I am doing wrong?

_ROOT Version: 6.18/04
_Platform: Mac OS Monterey


It should work, I just tried with hsimple.root from ROOT tutorials:

root [0] ROOT::RDataFrame d("ntuple", "hsimple.root");
root [1] auto h = d.Histo1D("px");
root [2] h->Draw();
Info in <TCanvas::MakeDefCanvas>:  created default TCanvas with name c1
1 Like

Thank you, I found my mistake! I had put everything inside a .C file and ran that with .L, but forgot to create a void function to call “h->Draw()”. Now everything works fine.

1 Like