# P.d.f value is Not-a-Number in self-made Gaussian pdf

Dear Expert,

I want to do a 2D fit using a self-made Gaussian pdf (myRooGaussian1stbin) which is normalized in the fitting range. But with free any of the parameters, this pdf value is pushed to nan (below).

p.d.f value is Not-a-Number (-nan), forcing value to zero @ x=pi0_m_prefit=0.1788, a_mu=a_mu=-0.873702, b_mu=b_mu=1.02511, c_mu=c_mu=3.36042e+08, d_mu=d_mu=4197.5, p0_sigma=p0_sigma=-nan, p1_sigma=p1_sigma=-nan, y=pi0_errm=0.00993388

Here is the code that I am using:
2D_fit_withselfpdf.zip (79.8 KB)

Can you please suggest where I am wrong?

Regards
Chanchal

Hi

You should check that both the pdf un-normalized value is not zero and also that its integral is not zero. If they are this will cause a NaN when evaluating the pdf

Lorenzo

Hi @moneta,

Yes, I have checked this with a free parameter of sigma but pdf un-normalized value (value) and its integral (norm) both are also pushed to nan.
I donâ€™t understand why this happens.

Code are attached here:
2D_fit_selfpdf_new.zip (79.8 KB)

Regards
Chanchal

Hi,
The problem is exactly what I have said before, you are having zero integral and zero pdf.
Running your code you can see this message:

``````RooAbsPdf::gauss[ x=pi0_m_prefit a_mu=a_mu b_mu=b_mu c_mu=c_mu d_mu=d_mu p0_sigma=p0_sigma p1_sigma=p1_sigma y=pi0_errm ]
p.d.f normalization integral is zero or negative: 0.000000 @ x=pi0_m_prefit=0.1796, a_mu=a_mu=-0.873702, b_mu=b_mu=1.02511, c_mu=c_mu=3.36042e+08, d_mu=d_mu=4197.5, p0_sigma=p0_sigma=1.34232 +/- 0.0732578, p1_sigma=p1_sigma=-56.3534, y=pi0_errm=0.0052062
``````

Probably the parameter values above do not make sense. You should maybe add bounds on some of the parameter values to exclude them.

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