Using RDataFrame in C++


I am trying to use RDataFrames in C++, but for some reason it does not exist in the ROOT namespace. More specifically in the sample code from the class reference neither EnableImplicitMT or RDataFrame can be found:

auto myHisto = d.Histo1D("Branch_A");

I am not sure what I am doing wrong, and Googling the issue does not give me any results. Note that besides this, ROOT appears to work just fine. Can you guys tell me what is wrong? I am sorry if it is something trivial.

Hi @Kristian ,
and welcome to the ROOT forum. What ROOT version are you on? Also the snippet you posted is not really valid C++, there are some function arguments missing.

You can try:

std::cout << ROOT::RDataFrame(1).Count().GetValue() << std::endl;

It should print 1.


I’m on version 6.22/07.

Your example doesn’t compile either, once again with the error message “no member named ‘RDataFrame’ in namespace ‘ROOT’.”

I don’t know if this information is relevant or not, but I can use the RDataFrames just fine in python.

Are you running that at the root prompt, or are you compiling a program? If you are compiling a program, you need to #include <ROOT/RDataFrame.hxx>

I could’ve sworn I’d already tried that, but it actually solved the issue. Thank you for the help.