I’m trying to fit a RooChebychev to 2 ranges. Code snippets: RooRealVar *mass = new RooRealVar("Bs_LOKI_MASS_JpsiConstr","m(#Lambda_{b})",4300,5950,"MeV");
mass->setRange("bkg1",4300,4800);
mass->setRange("bkg2",5700,5950);
RooAbsReal * nll = totalPdf.createNLL(*data,Extended(kTRUE),Range("bkg1,bkg2"));
RooMinuit m(*nll);
m.setVerbose(kFALSE);
m.migrad();
m.minos();
m.minos();
RooPlot *framex = mass->frame();
data->plotOn(framex,Binning(330),Name("Hist"),MarkerColor(kBlack),LineColor(kBlack),DataError(RooAbsData::SumW2));
totalPdf.plotOn(framex,Name("curvetot"),LineColor(kBlue));
But this results in only the the “bkg2” range fit being plotted, see attached pdf (you may have to zoom in to see the fit line drawn over the data; the dashed red background line in the picture is drawn in a different part of my code). What am I missing?
fittestbkg2.pdf (45.3 KB)
Oh, and I should have said it appears to be fitting only the second range as well. At least, the chi2/ndof was identical when I used Range(“bkg2”) to when I used Range(“bkg1,bkg2”).
Not entirely sure what was wrong, but the problem went away.