Passing RDataframe/RInterface as an argument in a pyROOT defined C++ function

Hi,

I’m not sure if my use case is possible but perhaps it is more for my own knowledge. I’m working with pyROOT and I am trying to define a new column in an RDataFrame/RInterface.

I have declared the following function using gInterpreter:

 void make_sWeight_column(RooStats::SPlot* sData, ROOT::RDF::RInterface frame, int nEntries){
        //create unordered map of event_id:{nsig_sw,nsig_bkg}
        std::unordered_map<int,std::vector<double>> sWeight_dict;
        for(int i = 0; i < nEntries;i++){
            std::cout << sData->GetSWeight(i,"nsig_deltam") << std::endl;
        }
    }

right now this function does nothing but I get this error when gInterpreter tries to compile it:
error: use of class template 'RInterface' requires template arguments; argument deduction not allowed in function prototype.

I’m not sure what kind of template arguments it expects.
The ultimate aim is to return another RDataFrame/RInterface which has the added columns. The input would either be a RDataFrame (which has no operations called i.e. Filter, Histo etc.) or a frame which has already been filtered.

Which class should I use as the argument and return type? Is this even possible in pyROOT?


_ROOT Version: v6.26.06

Hi @jcob ,

see the corresponding section of the RDF users guide: ROOT: ROOT::RDataFrame Class Reference , the type that represents a generic RDF node is ROOT::RDF::RNode.

Cheers,
Enrico

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