Hi,
I tried increasing the order of the polynomial (9 coefficients) and ended up this fit:
What I want to do is limit the fit range to x ~170. I tried
x.setRange("Range1",10.,170.) ;
RooAddPdf fullModel("fullModel", "Signal + bg_bern", RooArgList(signal, bg_bern), RooArgList(s, b));
RooFitResult* r = fullModel.fitTo(dh,Range("Range1"),Save(kTRUE)) ;
But that doesn’t work
Additionally, I cannot seem to add arbitrarily many coefficients to the RooArgList. The moment I add the tenth coefficient it spits out an error :
RooRealVar a1("a1","a1",-50,400);
RooRealVar a2("a2","a2",-50,400);
RooRealVar a3("a3","a3",-50,400);
RooRealVar a4("a4","a4",-500,1000);
RooRealVar a5("a5","a5",-50,1000);
RooRealVar a6("a6","a6",-50,100);
RooRealVar a7("a7","a7",-50,100);
RooRealVar a8("a8","a8",-50,100);
RooRealVar a9("a9","a9",-50,100);
RooRealVar aa("aa","aa",-50,100);
RooDataHist dh("dh","e-e+ peak histo",x,Import(*h1)) ;
RooRealVar lambda("lambda", "slope", -0.01, -1., 1.);
RooExponential expo("expo", "expo", x, lambda);
RooRealVar mass("mass","Central value of Gaussian",90.,80.,100.);
RooRealVar sigma("sigma","Width of Gaussian",20,0,100);
RooGaussian signal("gaus", "The signal distribution", x, mass, sigma);
RooRealVar b("b", "Number of background events", 0, 40000);
RooRealVar s("s", "Number of signal events", 0, 40000);
RooBernstein bg_bern("bg_bern","background",x, RooArgList(a1,a2,a3,a4,a5,a6,a7,a8,a9,aa));
In file included from input_line_10:1:
D:\debajyoti_project\zdecay.C:166:57: error: no matching constructor for initialization of 'RooArgList'
RooBernstein bg_bern("bg_bern","background",x, RooArgList(a1,a2,a3,a4,a5,a6,a7,a8,a9,aa));
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
D:\buildroot\include\RooArgList.h:57:3: note: candidate constructor not viable: no known conversion from 'RooRealVar' to 'const char *' for 10th argument
RooArgList(const RooAbsArg& var1, const RooAbsArg& var2
But this works for 9 coefficients