RooHistPdf and derived variables

Dear Andreas,

I think the approach in the post by Wouter that you linked is also applicable here.

I took your Python code, converted it to C++ for my convenience and implemented that approach. The source is attached, with the command to compile it in the first line:

RooHistPdf_and_derived_variables_1.cc (1.9 KB)

One thing that’s different compared to your example is that I invented some values for px and py to fill the dataset.

Let me know if this helps of if you have further questions!

Cheers,
Jonas