I’m (ab)using RDataFrame to perform small calculations using the Define action taking 2 strings as input and saving it’s output in histograms/trees/workspaces. The reason I’m using this, rather that the functor-based action is that my executable reads json-like config files with boost property_tree, whose underlying data type can’t be easily casted to a functor (maybe there is a way to do this?).
Now I ran into a corner case where I tried to calculate an opening angle
This implementation raises errors from (what i think is) JIT compilation and then produces a seg-fault. The most relevant error message seems to be
error: cannot form a reference to 'void'
I can provide more information from this example if needed.
Of course the calculation can be done in various ways, but I thought it could be interesting for you to see this use-case. Do you have any suggestion how to do calculations like this? The more general question I would derive from this is: can one implement a multi-line functor using the string-only Define action?
Hi Marian, Define defines a new column. By design each expression passed to Define must define something, so it has to return something. There is another important reason why what you are doing won’t work: if nothing ever references the "dump" column anywhere, the computation will not even be triggered!
can one implement a multi-line functor using the string-only Define action?
Yes, there is no limitation, just add a return statement at the end.
I believe what you want is:
Hi Enrico,
Using Define with a return statement like this looks very natural. Shame on me to not having figured out this one. For this calculation I don’t really have a large enough benchmark sample at hand, but at first glance