Firstly, thank you for making a really neat, pythonic tool which can be used as an alternative for RooFit.
I have successfully defined a custom 2D PDF but I am not completely sure on how to register my function's analytic integral:
Analytic integral from WolframAlpha
The PDF is defined as below:
class PdfForDeltaW(zfit.pdf.ZPDF):
"""Pdf to calculate epsilon, w, and delta w, as a function of sig-flav and tag-flav"""
_N_OBS = 2
_PARAMS = "epsilon w delta_w mix_prob".split()
def _unnormalized_pdf(self, x):
"""Calculation of PDF value"""
sigflav, tagflav = zfit.ztf.unstack_x(x)
epsilon = self.params["epsilon"]
w = self.params["w"]
delta_w = self.params["delta_w"]
mix_prob = self.params["mix_prob"]
dilution = 1 - 2 * w
mixing = 1 - 2 * mix_prob
return (
0.5
* epsilon
* (1 - sigflav * tagflav * (sigflav * delta_w + dilution * mixing))
)
From looking at the example on github I am not sure on how I can access the fit observables for use in the calculation (i.e. x, sigflav and y, tagflav for my 2D case) in addition to the fit variables which can be accessed through the params attribute.
In addition, I am not sure how my limits should be defined. I know that both x and y must be in the range [-1, 1]. I think it would be nice to have a bit more clarity on how the zfit.Space.from_axes function should be used, and how this relates to the analytic integral.
Cheers, Colm