I am facing the following problem. I want to convolve a Breit-Wigner function with the sum of two Gaussians with slightly different means and width, and fit this to my reconstructed mass distribution (I see that a model like this best describes the residuals of my simulated mass distribution and reconstructed mass distribution). However, so far I only have been able to get the fit to work with the convolution of a single Gaussian and a Breit-Wigner (using FCONV::cv(x, bw, gaus)). As soon as I introduce the double Gaussian model (as workspace.factory('SUM:: ')) the fit stops working. I already tried different starting parameters, but still it does not work. Anyone ever faced this problem?
The fit should work also in this second case. If it is not an issue with the initial parameters, I would need your macro showing this issue in order to investigate your problem
I have attached an example how I setup the fit. I hope it does not hurt that it is using pyroot.
In case of single Gaussian used in the convolution, I get no errors during the fit. In the case of the sum of two Gaussian I see a ton of errors about pdf smaller than zero during the fit.
you can try supplying Optimize(false) to your fit call pdf.fitTo(datahist, RooFit.Strategy(2), RooFit.Minimizer('Minuit2')). At least that suppressed those weird “smaller than zero” error messages in my code where I tried the same double Gaussian folding (funnily enough, Optimize(true) has the same effect…don’t ask me why). My current code can be found here (complete mess, sorry): EtapOmegaG_fit.cc
It appears that RooFit doesn’t see that this sum of the Gaussians enters as a detector resolution kernel, which is shifted such to be centered around zero (see RooFFTConvPdf::_shift2 initilization).
Still, my fit doesn’t converge properly. Hopefully you have more luck
so you’re the one I thought you were, hehe. Anyhow, did it work with Optimize(false)? Then some RooFit maintainers should investigate this. Also the strange behaviour that Optimize(true) helps as well should be looked at…