Composition of Two Pdf, problem at x = 0

Hi guys.

I am trying to add three distributions. One of them is taken from an histogram directly with RooHistPdf, for the others I have a formula and I have simply implemented it.

I found out that a divergenze at zero appear when I sum up the analytic pdfs with the pdf from the histogram. I have prepared a macro that you can run.

the pdf from the histogram is defined at line 18

RooHistPdf PdfMixing("mixingpdf", "mixingpdf", x, mix_h, 0);

the other pdf defined at line 23 and 27

RooGenericPdf Rayleigh("line", "linear model", " x/(sigRay*sigRay) * TMath::Exp(-(x*x)/(2*sigRay*sigRay))", RooArgSet(x,sigRay));
RooGenericPdf linearFit("linearFit", "linear model", "(0.125)*x", RooArgSet(x));

ForForum.cpp (2.2 KB)
CosmicCut1.root (44.8 KB)
MixCut1.root (169.0 KB)
UWCut1.root (23.5 KB)

Dear @Adrianodelvincio ,

Thank you for the question and the nicely layed out reproducer, this is extremely useful for us! I will invite @jonas to take a look so we can understand better the situation.

Cheers,
Vincenzo

Hi, thanks indeed for the reproducer!

What do you mean by the problem at x = 0? If I run your script, things look fine:

   ------------------------------------------------------------------
  | Welcome to ROOT 6.28/04                        https://root.cern |
  | (c) 1995-2022, The ROOT Team; conception: R. Brun, F. Rademakers |
  | Built for linuxx8664gcc on May 08 2023, 02:44:07                 |
  | From tags/v6-28-04@v6-28-04                                      |
  | With c++ (GCC) 13.1.1 20230429                                   |
  | Try '.help'/'.?', '.demo', '.license', '.credits', '.quit'/'.q'  |
   ------------------------------------------------------------------

root [0]
Processing ForForum.cpp...
[#1] INFO:NumericIntegration -- RooRealIntegral::init(line_Int[x]) using numeric integrator RooIntegrator1D to calculate Int(x)
[#1] INFO:NumericIntegration -- RooRealIntegral::init(linearFit_Int[x]) using numeric integrator RooIntegrator1D to calculate Int(x)
[#1] INFO:NumericIntegration -- RooRealIntegral::init(line_Int[x]) using numeric integrator RooIntegrator1D to calculate Int(x)
[#1] INFO:NumericIntegration -- RooRealIntegral::init(line_Int[x]) using numeric integrator RooIntegrator1D to calculate Int(x)
[#1] INFO:NumericIntegration -- RooRealIntegral::init(linearFit_Int[x]) using numeric integrator RooIntegrator1D to calculate Int(x)
root [1]

Which version of ROOT are you using? Maybe you’re using an old version, and it’s a problem that got fixed by 6.28.04, which is what I was using?

Cheers,
Jonas

1 Like

Hi Jonas

I am using 6.26/10.
Just now I have found the issue: I changed the definitions of the analitic distribution adding an absolute value. I do not know why the divergence appear only when I try to add the analitic + the histo derived distribution, anyway now the problem is fixed. However, the problem looked like this:

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