RDataFrame JIT code with python like operations for ```var**2```

Dear experts,

In the last few weeks I encountered a non issue but it might be good if there would be a simple way to get it working.

Basically if you try to JIT compile expressions containing things like


It throws an error trying to dereference some variable due to the “**” symbol
However I noticed that in Draw or CopyTree the TTreeFormula seems to be able to interpret it and in general I feel like have such behaviour working would be a good thing for the future to avoid users to write always TMath::Sq or pow(X,2) in expressions.

Is ‘**’ valid C++ for power? I’ve only ever used pow(X, 2).

But if auto-numbafied expressions are integrated soon, then at least python-RDF users will have this.


I am not sure, but I suspect **2 is not C++ valid, as probably other typical syntax one is using in python operations or pandas one. I just wondered whether aligning this on ROOT interpreter side given the growing usage I have seen of RDF inside python would be a big deal. I repeatedly have to face in my analysis framework imported through pyROOT for other analysis mostly based on pandas/uproot the necessity of dealing with such kind of things when it comes to apply filters / define columns etc.


indeed C++ does not have a ** operator, that’s the problem.

However you can also inject Python functions into RDF through Numba, maybe that helps. See here under “Python code”: ROOT: ROOT::RDataFrame Class Reference .


1 Like

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