Dear all,
I am quite new in roofit. I would like to fit some binned data with: a pdf obtained with GenericPdf, multiplied by a pdf (let’s call it “bkgProd”) obtained from a histogram.
I am using these lines to build the first pdf:
RooRealVar x0("x0","x0",-2.e-01,-1.e-01);
RooRealVar x1("x1","x1",0.2e-06,2.2e-06);
RooRealVar x2("x2","x2",-4.0e-05,-0.1e-05);
RooArgSet set(y,x0,x1,x2);
RooGenericPdf TF_func("TF_func","TF_func","x0+x1 * y+TMath::Exp(x2 * y)", RooArgSet(set));
However, since data are binned, I built the histograms and the binned pdf of the genericpdf with the following:
y.setBins(30);
RooDataHist* TF_func_histo=TF_func.generateBinned(y,2000000);
RooHistPdf TF_func_pdf("TF_func_pdf","TF_func_pdf",y,*TF_func_histo,0);
Last, I built the final pdf with:
RooProdPdf allProduct("allProduct","bkgProd*TF_func_pdf",bkgProd,TF_func_pdf);
In the fit I would like to find the best x0, x1 and x2 that fits data.
Now, if I fit data with allProduct, Roofit fixes x0, x1 and x2 to the mean value of the parameter range, that I put before the RooGenericPdf declaration, and the results have no errors.
So, it seems like it does not do the fit.
Do you know how can I build allProduct lefting x0, x1 and x2 free to vary in the fit? Is it correct to build allProduct directly with the RooGeneratedPdf, such as:
RooProdPdf allProduct(“allProduct”,“bkgProd*TF_func”,bkgProd,TF_func);?
I tried to do it but allProduct has a very strange shape due to the fact that TF_func is not binned.
Thank you,
Laura