Simultaneous fits

Dear RooFit experts,

I would like to perform a simultaneous fit of a signal + background model in an “analysis” plus a “control” region.

For the model, I have constructed a RooSimultaneous object with two categories (“analysis” and “control”).
For the data, I tried to construct a RooDataHist.

What I am having difficulties with is that in the analysis region, I would like to fit variable X in the range xMin…xMax, while in the control region, I would like to fit another variable Y in the range yMin…yMax.

I passed a std::map (two entries: “analysis” and “control”, each pointing to a one-dimensional histogram), a RooCategory object (in which the “analysis” and “control” regions are defined) and a RooArgList containing the variables X and Y.

I seem to be missing something, though - once I try to run that code, I get an error message:

[#0] ERROR:InputArguments – RooDataHist::ctor(fitData) ERROR: dimension of input histogram must match number of continuous variables
cmsRun: roofit/roofitcore/src/RooDataHist.cxx:354: void RooDataHist::importTH1Set(const RooArgList&, RooCategory&, std::map<std::string, TH1*, std::lessstd::string, std::allocator<std::pair<const std::string, TH1*> > >, Double_t): Assertion `0’ failed.

and my program aborts.

I believe my problem is due to the fact that I am using one-dimensional histograms, but two variables (X and Y) for the fit (?)

Hmh, what would be the best way to simultaneously fit the distribution of X in the analysis region and the distribution of Y in the control region ?

Thank you very much,


Hi Christian,

You have a scenario that I did not work in detail yet for joint datasets.

A general point of datasets that they must have a single
set of defined observables, i.e. it can not vary from event to event,
which is where your examples runs into problems.

If you would make your example with unbinned datasets, it would
work fine, as a dummy X/Y value would automatically be inserted
to complete each event to a (X,Y) record.

For binned datasets this does not happen automatically and also
has big memory consumption implications (for 2 observable in the unbinned case memory use simply doubles, for
a binned dataset it would square)

The new concepts of virtual composite datasets (introduced in ROOT 5.26,
but not complete yet) should be able to handle this without needless
memory consumption, but is not yet complete.

In the mean time, I suggest you solve your problem by constructing
the likelihood components individually and then make the combined
fit by minimizing the sum. Concretely

RooAbsReal* nll1 = pdf1.createNLL(dataX,Range(…)) ;
RooAbsReal* nll2 = pdf2.createNLL(dataY,Range(…)) ;
RooAddition nll(“nll”,“nll”,RooArgSet(*nll1,*nll2)) ;
RooMinuit m(nll) ;
m.migrad() ;
m.hesse() ;

and you are done.


Hi, I’m running into a similar situation, what’s the current best solution for simultaneous fits to channels with different binnings ?

1 Like