Help! Cannot Fit 'Overlapping' Gaussian Peaks

Hello. I need help getting RooFit to fit simulated data with two gaussian peaks with a very small separation (almost overlapping…the Gaussian’s would vaguely resemble the letter “M” if fully fit). I have tried everything from changing my bin number, to shortening my fit window, to varying my guesses, changing my range…nothing has worked.

I have a total of 4 peaks to fit, but RooFit treats the two overlaping peaks as one and has a lot of trouble separating. We have 80fb-1 of data… so it should pick out the peaks fairly well, plus, the simulation file shows that we should have two distinct peaks where the fit is.

I also am having an issue with the statistics box: I shows statistics for all 4 Nsig values, but doesn’t spit out the mean or the sigma value for the 4th peak.

I need help fixing both issues. Here is a copy of the code I am running in RooFit.

double *Nfactor(TH1F *shist,double *D0fw,double Ns){

  RooRealVar M("M","Mass (Gev)",D0fw[0],D0fw[1]);
  //create a plot for the fitting
  RooPlot* frame = M.frame(Title("D Mass Spectrum"));
  //use the histogram to build the  
  RooDataHist D0M("D0M","D0M",RooArgList(M),shist);

  //set up the variables for the fitting 
  RooRealVar Mean1("Mean1","Mean mass of D Candidates",1.75,1.7,1.9);
  RooRealVar Sigma1("Sigma1","Sigma for D0 candidate Masses",.043,.03,.05);
  RooRealVar Mean2("Mean2","Mean mass of D Candidates",2.01,2.0,2.015);
  RooRealVar Sigma2("Sigma2","Sigma for D0 candidate Masses",.042,.03,.05);
    RooRealVar Mean3("Mean3","Mean mass of D Candidates",2.427,2.42,2.46);
    RooRealVar Sigma3("Sigma3","Sigma for D0 candidate Masses",.028,.027,.029);
  RooRealVar Mean4("Mean3","Mean mass of D Candidates",2.459,2.42,2.46);
  RooRealVar Sigma4("Sigma3","Sigma for D0 candidate Masses",.025,.024,.028);
    RooFormulaVar var2("var2", "", "Mean3*Mean4",RooArgList(Mean3,Mean4));
  RooRealVar a("a","Exponential Constant Variable",1,0,2);
  RooRealVar b("b","Exponential Growth Factor",2.47,0,6);

  //set up the fit functions 
  RooExponential bg("bg", "The background fitting",M,b);
  RooGaussian sig1("sig1","The signal fitting function",M,Mean1,Sigma1);
  RooGaussian sig2("sig2","The signal fitting function",M,Mean2,Sigma2);
  RooGaussian sig3("sig3","The signal fitting function",M,Mean3,Sigma3);
 RooGaussian sig4("sig4","The signal fitting function",M,Mean4,Sigma4);

  //set up the number fit variables 
  RooRealVar Nsig1("Nsig1","Signal number",Ns,0,Ns*3);
  RooRealVar Nsig2("Nsig2","Signal number",Ns,0,Ns*3);
  RooRealVar Nsig3("Nsig3","Signal number",40,0,300);
RooRealVar Nsig4("Nsig4","Signal number",60,0,300);
  RooRealVar Nbg("Nbg","Background number",Ns*42,0,Ns*84);
//third argument will be large if large bkd; once we have a data sample, we need Ns scaled automatically.  If "even" number of Nbg on plot, scale larger (indicates hit a threshhold) (...,...,guess,lower bound, upper bound)
  RooAddPdf model("model","combined signal and background",RooArgList(sig1,sig2,sig3,sig4,bg),RooArgList(Nsig1,Nsig2,Nsig3,Nsig4,Nbg));

Please…Help!

Hi,

Fitting multiple gaussian peaks can be tricky because the likelihood contains local minima which can be very close if the peaks overlap. The only think I suggest is to try to guess initial fit parameter values as close as possible to their final values.

If you have a large amount of data, you might try to use instead also a smaller binning or an unbinned fit for the mass observable M

Lorenzo

One more option might be to constrain one of the means to a specific point such that they don’t overlap too much.

For the statistics box, giving it a Layout might help. Maybe it’s just too small to show all parameters. You could also leave out parameters you are not interested in. You can find all the options here:
https://root.cern.ch/doc/master/classRooAbsPdf.html#aa43b2556a1b419bad2b020ba9b808c1b

Thank you so much! I will give this a try (this seems promising)!

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