I just have one question about how to apply the weight for different data sample when I use the Roofit to build the templates. The issue is that I have 3 different data samples and give different weights to them and then combine together, since the weights are really small(0.0001), then when I use the correct templates to fit to this data , it seems have really huge error like 100% or more of the fitting variables, which should not be since I just put weight for the fitting, there should still decent statistics in the data. I am using the unbinned log likelihood fitting method and using the kernal estimation building the template. Could I know why? Thanks a lot. If need I could copy some of the code for the fitting.
If you are using weighted data set, you should use the fitting option RooFit::SumW2Error(true) in RooAbsPdf::fitTo. This option will make the error calculation correct.
If this is not sufficient, I would need your code (including the data) to understand better your problem. You could also attach the RooWorkspace with the model and the data set.
// build MC weighted data set
RooDataSet *mcSet_inclusive= new RooDataSet("mcSet_inclusive","mcSet_inclusive",JetArgSet,"weight");
// Fill data set with weighted event
for(int i = 0; i< EventEnries; i++)
//Set signal and bkg pdfs
RooKeysPdf* mcSigPdf = (RooKeysPdf*)w->pdf("mcSigPdf");
RooKeysPdf* mcBkgPdf= (RooKeysPdf*)w->pdf("mcBkgPdf");
RooAddPdf modelPdf("modelPdf","sig +bkg", RooArgList(*mcSigPdf,*mcBkgPdf), sigRatio);
//Fit to data
RooFitResult* roofitResult = modelPdf.fitTo(*mcSet_inclusive, Hesse(true), SumW2Error(true),Save(true),PrintLevel(-1),Warnings(false),PrintEvalErrors(0) );
Here I am doing closure test which uses the template built from MC sample to fit to MC distribution to check whether the fitting works well, it seems when I give really small scale factor to the MC sample(0.0001), it would mess up the fitting error estimation, if the signal fraction is 0.15, the error could reach up to 0.50. That is not reasonable and could you kindly help me with this? Thanks a lot.
We would need a fully running macro with the data (e.g. a RooFit workspace), reproducing the problem you are having.