I am trying to develop a general framework to address the following common problem:
- given a model (black box) and a set of input parameters, I can generate a set of data described by a certain set of observables;
- given an (experimental) dataset, I want to find the best distribution of the input parameters to describe the data with the model
My first attempt at the framework looks a lot like RooFit, and so I have been studying RooFit and RooStats which seem the best starting point for this work. The problem is that every model in RooFit is based on PDF or combinations of PDF. I want to have the same functionality as RooFit, but replace RooAbsPDF (or RooMCStudy? RooStats::ModelConfig ???) by an interface to some generic MonteCarlo event generator (there are several possibilities).
Could you please advise me whether this would be possible, deriving a class from one of those mentioned above, and if so, what methods would absolutely need to be overridden for e.g. parameter optimisation to work using one of the many algorithms implemented in the package?
Thanks for any help
I am not sure I have understood your use case. You would like to replace a PDF, i.e. a probability density function describing a model, with an event generator ?
To have a model usable in RooFit/RooStats, you would need to define the function describing your statistical model as a RooAbsPdf and the corresponding data set, used to compute the likelihood function, as a RooAbsData.
In addition you would need to create (for RooStats) a ModelConfig class describing what variables are th observables of the models and what are the parameters.
You can implement as a RooAbsPdf whatever function you want. You would probably need to implement only the evaluate() method and the clone. You can also use some of the Binding classes to bin any free function, or TF1 objects or functor objects using ROOT::Math::Functor and RooFunctorBinding in a RooAbsPdf
Thanks a lot for the answer. I have now got a working version of my idea
using RooNDKeysPdf to ‘import’ the sets of unbinned data produced by the model
for different parameter value ranges, then building a RooAddPdf which combines
the datasets with variable weights which can be fitted to data…at least in one
dimension it works!
If your model is based on some data (i.e. you have an empirical PDF) using the RooKeys (for unbinned data) or the RooHistPdf (for binned data) is the correct way to do it