Simultaneous fit of a RooDataSet and a RooDataHist

Hello,

This is a question for Wouter on RooFit: is it possible to do a simultaneous fit of a RooDataSet and a RooDataHist? If yes, how?

In case of 2 RooDataSet, I would add the category vairable ina new column, merge the data and do the fit with a RooSimultaneousPdf with 2 categories corresponding to the 2 datasets…

Regards,

– Gregory

Hi Gregory,

That’s possible. At the likelihood level it is of course trivial, but the data implementation is hidden, e.g.

RooAbsReal* nll1 = pdf1->createNLL(unbinnedData,...) ;
RooAbsReal* nll2 = pdf2->createNLL(binnedData,...) ;
RooAddition nllsum("nllsum","nllsum",RooArgSet(*nll1,*nll2)) ;
RooMinuit m(nllsum) ; // etc

At the p.d.f/dataset level, it is possible by first converting the binned dataset into
an unbinned weighted dataset

// Example pdfs to generate input data
RooWorkspace w(“w”,1) ;
w.factory(“Gaussian::g(x[-10,10],0,3)”) ;
w.factory(“Uniform::u(x)”) ;

// Make binned and unbined input data
RooDataSet* d = w::g.generate(w::x,1000) ;
RooDataHist* h = w::u.generateBinned(w::x,1000) ;

// Convert both d and h into unbinned weighted datasets
// ----------------------------------------------------
w.factory(“wgt[1,0,1000000]”) ;
d->addColumn(w::wgt) ;
d->setWeightVar(“wgt”) ;

RooDataSet* hw = d->emptyClone() ;
for (Int_t i=0 ; inumEntries() ; i++) {
hw->add(*h->get(i),h->weight()) ;
}
// ---------------------------------------------------

// Make joint dataset
w.factory(“index[a,b]”) ;
RooDataSet* joint = new RooDataSet(“joint”,“joint”,RooArgSet(w::x,w::wgt),Index(w::index),Import(“a”,*d),Import(“b”,*hw),WeightVar(w::wgt)) ;

A higher level interface for such procedures is forthcoming in the next release in
in RooWorkspace

Wouter