Dear Experts,
I want to perform simultaneous fit using two data samples, where each data sample contains two weighted RooDataSets. Here is a sample code;
#two fitting variables
Mbc = ROOT.RooRealVar("Mbc", 'M_{bc} [GeV/c^{2}]', 5.2,5.29)
deltaE = ROOT.RooRealVar("deltaE", "#DeltaE [GeV]", -0.15,0.1)
roo_data1 = df2roo(A1, {'Mbc': Mbc, 'deltaE':deltaE}) #first data set
roo_data2 = df2roo(A2, {'Mbc': Mbc, 'deltaE':deltaE}) #second data set
weightA1 = ROOT.RooRealVar( "weightA1", "weightA1",1) #weight factor for roo_data1
roo_dataA1 = ROOT.RooDataSet("roo_dataA1", "roo_dataA1", roo_data1, ROOT.RooArgSet(Mbc, deltaE, weightA1), "", "weightA1" ) #weighted data set A1
weightA2 = ROOT.RooRealVar( "weightA2", "weightA2",0.12) #weight factor for roo_data2
roo_dataA2 = ROOT.RooDataSet("roo_dataA2", "roo_dataA2", roo_data2, ROOT.RooArgSet(Mbc, deltaE, weightA2), "", "weightA2" ) #weighted data set A2
roo_dataA1.append(roo_dataA2) #appending A1 with A2
roo_dataA1.Print() ##this will be input as the first data set in a simultaneous fit
roo_data3 = df2roo(A3, {'Mbc': Mbc, 'deltaE':deltaE})
weightA3 = ROOT.RooRealVar( "weightA3", "weightA3",1)
roo_dataA3 = ROOT.RooDataSet("roo_dataA3", "roo_dataA3", roo_data3, ROOT.RooArgSet(Mbc, deltaE, weightA3), "", "weightA3" )
roo_data4 = df2roo(A4, {'Mbc': Mbc, 'deltaE':deltaE})
weightA4 = ROOT.RooRealVar( "weightA4", "weightA4",0.12)
roo_dataA4 = ROOT.RooDataSet("roo_dataA4", "roo_dataA4", roo_data4, ROOT.RooArgSet(Mbc, deltaE, weightA4), "", "weightA4" )
roo_dataA3.append(roo_dataA4)
roo_dataA3.Print() ##this will be input as second data set in simultaneous fit
Let’s assume, roo_data1 and roo_data2 each contain 100 events. So, the weighted data set (roo_dataA1) should have 112 events and this is what I obtain. But, when I perform simultaneous fit for roo_dataA1 and roo_dataA3, the roo_dataA1 or roo_dataA3 is not weighted anymore, instead the fit show 200 events in each sample instead of 112 events. Here is a sample, how I am doing simultaneous fit;
sample = ROOT.RooCategory("sample", "sample")
sample.defineType("mumu")
sample.defineType("ee")
combData = ROOT.RooDataSet("combData","combined data",ROOT.RooArgSet(Mbc,deltaE),ROOT.RooFit.Index(sample),ROOT.RooFit.Import("mumu",roo_dataA1),ROOT.RooFit.Import("ee",roo_dataA3))
simPdf = ROOT.RooSimultaneous("simPdf", "simultaneous pdf", sample)
simPdf.addPdf(model_mumu,"mumu")
simPdf.addPdf(model_ee,"ee")
I can’t think of why the weighting doesn’t work for simultaneous fit, but if I perform fit separately for each case (mumu, ee), I am getting the result as expected.
Waiting for some valuable feedback!
Thanks