Hi,
I’m processing data with a RDF framework using PyROOT. I need to have a Define using a function of a preexisting column and an external ROOT object (a TSpline3) doing something like that:
reweight_code = '''
double Func(TSpline3 spline, Double_t oldCol){
return spline.Eval(oldCol);
};
'''
ROOT.gInterpreter.Declare(reweight_code)
file= ROOT.TFile.Open("externalFile.root")
splineObj= file.Get("spline")
d = d.Define('NewColName', 'Func(splineObj,oldCol)')
It is not working because in the Define root is not seeing splineObj
, probably the sintax is not correct: how can I give to a function of the Define a non-column parameter like that?
A workaround solution is to open the ROOT file and do the Get("spline")
inside the C++ function (and it works), but I prefer to avoid that if it is possible (it is not clear to me how many time the ROOT file will be opened in this case).
The use of C++ code for Func is not needed, if there are easier solution are welcome.
Thank you very much in advance.
ROOT Version: /cvmfs/sft-nightlies.cern.ch/lcg/views/dev3/latest/x86_64-centos7-gcc62-opt/setup.sh
Platform: CentOS Linux release 7.4.1708 (Core)
Compiler: gcc version 6.2.0 (GCC