# RooFit: compose recursively with the Extended Formalism

Hi,

I have a PyROOT program which fits a mass peak by using 2 gaussians and an exponential background. To make things easier, I compose the 2 Gaussians with RooAddPdf using the extended formalism, so I get 2 numbers for the expected value (n_gaussian1, n_gaussian2). Afterwards, I compose this “signal” pdf with the background, again using the Extended formalism, so in the end I end up with one composite pdf and 2 expected numbers, the expected signal (n_signal) and expected background (n_expo).

The fit performs nicely, and the numbers of n_signal and n_expo look coherent, with coherent errors. My problem is that if I look at n_gaussian1 and n_gaussian2, which I would suppose they should sum n_signal, their results don’t add up and they have huge errors. For example,

``````  1) 0x9cc200 RooRealVar::      lambda = -0.000588637 +/- 7.19075e-05  L(-10 - 0)  "slope"
2) 0x9b3800 RooRealVar::         mb0 = 5344.95 +/- 15.8273  L(5000 - 5500) // [MeV] "B0 mass"
3) 0xc0aa00 RooRealVar::      n_expo = 867.629 +/- 46.7728  L(1.14 - 1140)  "n_expo"
4) 0xa72200 RooRealVar::  n_gaussian = 379.774 +/- 877.475  L(1.14 - 1140)  "n_gaussian"
5) 0xbce400 RooRealVar:: n_gaussian2 = 119.741 +/- 671.151  L(1.14 - 1140)  "n_gaussian2"
6) 0xbea000 RooRealVar::    n_signal = 270.487 +/- 39.9256  L(1.14 - 1140)  "n_{signal}"
7) 0x9bf200 RooRealVar::    peakmass = 4635.24 +/- 15.3633  L(4000 - 5200) // [MeV] "peakmass"
8) 0x9b3400 RooRealVar::       width = 128.445 +/- 15.9643  L(40 - 200) // [MeV] "Mass width"
9) 0x9bee00 RooRealVar::      width2 = 54.7942 +/- 26.2366  L(10 - 100) // [MeV] "masswidth2"``````

I think I am understanding wrong how the extended formalism works. Could somebody enlighten me?

Thanks!
Albert