RooSimultaneous fit and Datasets in RooFit

Hello ROOT experts,

I have a question concerning RooFit and how to handle a RooSimultaneous fit. In particular I start with a FOOT file (datafile pointer below) containing 2 trees:

TTree *tree_A = (TTree*)datafile->Get("emumass");
TTree *tree_B = (TTree*)datafile->Get("mumumass");

and then I define 2 datasets as:

 RooDataSet data_A("data_emu","dataset with emu mass",tree_A,mass);
 RooDataSet data_B("data_mumu","dataset with mumu mass",tree_B,mass);

Then, I want to make a Simulatenous fit with these two datasets, so I create a RooCategory :

 RooCategory tagCat("tagCat","tagging Category");
  tagCat.defineType("data_emu");
  tagCat.defineType("data_mumu");

// Build PDFs for "data_emu" and "data_mumu" .... PDFA=bkg and PDFB=sig

  RooSimultaneous simPdf("simPdf", "simPdf", tagCat);
  simPdf.addPdf(sig, "data_mumu");
  simPdf.addPdf(bkg, "data_emu");

My question is , how am I supposed to use the “fitTo” command since I have 2 datasets and not 1:

simPdf.fitTo(data);

Should have I first appended the datasets A and B in one ? Or is there another way I miss here ?

Thank you very much!
Georgia

Hi Georgia,

There are two ways you can go about this

  1. Merge the data

    // First label all events in each dataset with a category label
    tagCat.setLabel(“data_emu”) ;
    dataA->addColumn(tagCat) ;
    tagCat.setLabel(“data_mumu”)
    dataB->addColumn(tagCat) ;

    // Now merge the data
    dataA->append(*dataB) ;

    Then proceed to fit the simPdf that you built to dataA

  2. Define the likelihoods for dataA and dataB separately

    RooNLLVar nllA(“nllA”,“nllA”,*sig,*dataA) ;
    RooNLLVar nllB(“nllB”,“nllB”,*bkg,*dataB) ;
    RooAddition nll(“nll”,“nll”,RooArgSet(nllA,nllB) ;

    And the fit your combined likelihood using the minuit interface

    RooMinuit m(nll) ;
    m.migrad() ;
    m.hesse() ;

Both approaches have their advantages. The first one is the most common though.

Wouter

Hi , ok thank you. It works now but I have another problem with plotting the results.

I have assigned the index 1 for the state “data_mumu” , and the index 0 for “data_emu”. Then I want to plot the data for state “data_mumu” and superimpose the PDF which corresponds to it. Please note that I am using per-event-errors “dm” below. So when I do :

data->plotOn(xframe,Cut("tagCat==tagCat::1"));
tagCat="1";
simPdf.plotSliceOn(xframe,ProjWData(RooArgSet(tagCat, dm),*data));

I get a syntax error which I cannot solve:

Error: Can’t call RooSimultaneous::plotSliceOn(xframe,ProjWData(RooArgSet(flag,dm_ll),*data)) in current scope simultaneousFit.C

I have actually seen this piece of code in a RooFit tutorial for plotting . Where am I doing wrong ?

Thanks again,
Georgia

Hi,

The method plotSliceOn is legacy code and its functionality has been included in plotOn. The old code also didn’t support the named arguments like ProjWData so what you have here indeed doesn’t work. The following
should work:

RooSimultaneous::plotOn(xframe,Slice(tagCat),ProjWData(RooArgSet(flag,dm_ll),*data))

In which tutorial did you find this example? (I’m currently updating the documentation)

Wouter

Hello,

I found it searching from google at:
roofit.sourceforge.net/docs/tuto … l_plot.pdf

In the meantime I have met another issue with plotting which I would like to ask about. I have tried to use the extended likelihood fit, apart from the simultaneous fit (for comparison purposes) . So, I tried to fit the “data_emu” dataset with a RooChebychev polynomial PDF “B1(x)” and I extracted its coefficients. The “data_mumu” dataset is composed by a signal part plus a background part . The latter has the shape of the “data_emu” with a normalization which is half the normalization factor in the “data_emu” fit.

So I considered another Chebychev pol PDF B2(x) with fixed coefficients taken from the B1(x) fit. The total PDF (extended PDF) for “data_mumu” is:
F(x,dx) = N_sig * S(x,dx) + N_bkg * B2(x)

wih N_bkg is initialized in half the entries in the “data_emu” dataset.
I perform the fit successfully but when I try to plot the component “bkg” superimposed with the “data_mumu”, the normalization is off (almost twice the data_mumu entries), although the fitted N_bkg parameter is correct. I have tried different things like:

 model.plotOn(xframe,Components("bkg"),Normalization(1.,RooAbsReal::RelativeExpected));

with no luck.

Thank you again for your help,
Georgia