Using KDE in a 2D fit with other PDFs

Dear Experts,

I am trying to do a 2D fit and the two variables involved are: DeltaM and max_significance.
There are 3 components to the fit: signal ,peaking background and non peaking components.

For each of the 3 components, the DeltaM is modelled using a usual PDF (eg: RooJohnson), while the max_significance is modelled using Kernel Density Estimation (KDE) and I am using RooProdPdf for the 2D model. I am not getting any error while I do this but in the parameters that I get after the fit apart from the free parameters are: max_significance_kspipi, max_significance_non_peaking and max_significance_sig, which are not free parameters but the RooKeysPdf that I am using.

Is it expected to get this? Also, I am not getting the correct fit plots/results as well. Am I making a mistake in understanding how KDE works ? Will you please have a look ? Here’s my working directory: (4.2 KB). The input root file can be downloaded from for_fit_all_components.root - Google Drive and the code is ksks_2dfit.C

@jonas could you have a look here, please?


The problem is that you are using different names for the observables in the KDE pdfs. You should always use the same observable name, which is simply max_significance.

Since the names of the observables in the template datasets are indeed different, you have the use the RooKeysPdf constructor that takes different RooRealVars for the observable in the model and in the data.

That would mean your constructor calls should look like this:

RooKeysPdf kde_sig("kde_sig","kde_sig",max_significance,max_significance_sig,data_sig,RooKeysPdf::MirrorBoth);

RooKeysPdf kde_kspipi("kde_kspipi","kde_kspipi",max_significance,max_significance_kspipi,data_kspipi,RooKeysPdf::MirrorBoth);

RooKeysPdf kde_non_peaking("kde_non_peaking","kde_non_peaking",max_significance,max_significance_non_peaking,data_non_peaking,RooKeysPdf::MirrorBoth);

I hope that’s already a step forward, good luck with your analysis and don’t hesitate to ask more questions!


1 Like

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