Trying a simultaneous fit in RooFit

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.

Hi Eduardo,

You should be able to do this using the following construction. Declare
your observable M with the full range of allowed values.

In general (for simultaneous and regular fits) you can decide to only fit
to a subset of the data through first declaring a subrange

M.setRange(“fitRange”,m1_min,m1_max) ;

and then specifying in fitTo() that you only want to fit data in the range:

pdf.fitTo(data,Range(“fitRange”)) ;

Your situation is subtly different, but I wanted to explain this first to make
the concept clear. If you do a simultaneous fit where there range is different
you can handle that through a ‘split’ range. Again your first declare (now two)
ranges

M.setRange(“fitRange_A”,m1_min,m1_max) ;
M.setRange(“fitRange_N”,m2_min,m2_max) ;

Note the special names of the ranges in this case: they have an identical prefix
followed by a “_” and again followed by a state name of your category that
is the splitting category of your RooSimultaneousPdf.

If you now fit as follows

pdf.fitTo(data,Range(“fitRange”),SplitRange()) ;

you will not fit the subset of data contained in “FitRange” for each p.d.f, but rather
fit a different subset of the data for each p.d.f as specified by a fitrange named
FitRange_X, where X is the state name of the index category associated with the p.d.f.
This is exactly what you want as I understand this.

N.B. These options are documented under RooAbsPdf::fitTo() in Appendix A of the
Users Manual. The next iteration of the Manual will also include a description of
these features in the tutorial section.

Wouter

1 Like