RooFit: fit multiple RooDataHist

Dear RooFit users,
I have data in form of N histograms, where each histogram is a cross-section computed in a certain kinematic range. N is not fixed, i.e. it may vary from different executions of my code (clearly, for a given N I do have the N histograms I want to process). All cross sections are referred to the same variable.

My task is the following:

  • Import the N histograms as RooDataHists
  • Perform a simultaneous fit to all the RooDataHists: each RooDataHist is fitted with its own PDF (depending on the same kinematic variable), but some of the parameters are shared.

In the examples I looked at, I see that the way to do so is to create a joint RooDataHist from each individual RooDataHist read from an histogram, differentiating them via a RooCategory.

However, the instruction:

RooDataHist joint(“data”,“data”,x,Index(category),Import(…),Import(…))

where each “Import” is called on a different RooDataSet with its own value of the RooCategory, is not what I need, since it requires to know “N” when writing the code.


Hi Andrea,

what you need is the other constructor:

You can define as many categories as you like, and dump them all in a map. This map can be used to create the data.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.