ROOT Version: 6.22/00
Built for linuxx8664gcc on Jun 14 2020, 15:54:05
From tags/v6-22-00@v6-22-00
Recently I am trying to use rdataframe with tree which contains custom class. And I found that I can’t use define and filter with literay string. Take tree2.root which is generated by $ROOTSYS/tutorials/tree/tree2a.C for example, the following code can’t work.
const auto entries = ROOT::RDataFrame("t2", "/tmp/tree2.root")
.Define("tot", "track.getot")
.Count()
.GetValue();
std::cout << entries << std::endl;
The output is
Error in TTreeReaderValueBase::CreateProxy(): The branch track.getot contains data of type float. It cannot be accessed by a TTreeReaderValue
It would be a little troublesome, if the rdataframe and custom class can only be combined with lambda function.