Hi experts,
I’m trying to develop some code above rdataframe with compiled C++ and interacting via jupyROOT and having an issue where I can’t convert RDataframe into RNode in a function/class constructor as anticipated in the doxygen (see RNode section on RDataFrame page)
Here’s a minimal example of this.
I define the following C++ code. MinimalPyRDataframe.cxx
#ifndef RNodeTest
#define RNodeTest
ROOT::RDF::RNode FilterMethod(ROOT::RDF::RNode df,std::string str){
return df.Filter(str);
}
#endif
I then want to interact with this via jupyROOT. This is my attempt:
import ROOT
ROOT.gInterpreter.ProcessLine('#include "MinimalPyRDataframe.cxx"')
df = ROOT.RDataFrame("HFntupleNONE",yourfavouritefilepath)
df = ROOT.FilterMethod(df,"BL_LepIsSignal.at(1)")
Which throws:
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
/tmp/ipykernel_1510/435248629.py in <module>
1 ROOT.gInterpreter.ProcessLine('#include "MinimalPyRDataframe.cxx"')
2 df = ROOT.RDataFrame("HFntupleNONE",yourfavouritefilepath)
----> 3 df = ROOT.FilterMethod(df,"BL_LepIsSignal.at(1)")
TypeError: ROOT::RDF::RInterface<ROOT::Detail::RDF::RNodeBase,void> ::FilterMethod(ROOT::RDF::RInterface<ROOT::Detail::RDF::RNodeBase,void> df, string str) =>
TypeError: could not convert argument 1
However running the equivalent C++ line in a jupyter ROOT C++ kernel appears to work fine
#include "MinimalPyRDataframe.cxx"
ROOT::RDataFrame df("HFntupleNONE",yourfavouritefilepath);
auto df_filter = FilterMethod(df,"BL_LepIsSignal.at(1)");
Have I missed something? Is there another trick to get types to convert correctly for pyROOT here?
Let me know if you need any extra information.
Thanks,
Gareth
ROOT Version: 6.24/06
Platform: SWAN (CentOS Linux release 7.9.2009 )
Compiler: g++ (GCC) 8.3.0