Hello
I want to do something that looks to be very simple, but I got problems when I used RooSimultaneous class in RooFit. I have two data samples S1 and S2, in what I want to fit a gaussian to a signal mass peak and a polynomial to the background, this for each sample. The problem is that my samples have different mass windows. S1 is from m1_min to m1_max, and S2 is from m2_min to m2_max, with m1_min<m2_min and m1_max<m2_max. What I did was to declare the variable M (for mass), put both data samples in one single data set with the flags “A” and “B”, for each sample. I mean:
RooRealVar M(“M”,“Invariant mass”,m1_min,m2_max);
RooCategory tp(“tp”,“tp”);
tp.defineType(“A”);
tp.defineType(“B”);
RooDataSet data(“data”,“data”,RooArgSet(M,tp));
I define the models (Gaussian+polynomial) for each case, and then I try a simultaneous fit:
RooSimultaneous simPdf(“simPdf”,“simPdf”,tp);
simPdf.addPdf(MassModelA,“A”);
simPdf.addPdf(MassModelB,“B”);
RooFitResult* fitres = simPdf.fitTo(data);
This never gives the correct results, which I can get by fitting one by one the mass distributions. The problem seems to be in the mass window, since when I do the fit using only data from m2_min to m1_max, the fit works, but I need to use the whole mass windows. Is there any solution to tells to RooFit that the mass limits are different for different subsets?.
Thanks,
Eduard
P.S. The width of the two signals is what I would like to use as the common variable for both peaks.