Basic 1D fitting using TMVA?

Hi all,

I am looking for a good way to fit a sum of close gaussians automatically, and the standard fitting routines in ROOT don’t seem to converge very well. I’ve read good things about simulated annealing and saw the TMVA has some sort of routine - but I’m totally lost as to using the package. So:

  1. has anyone had any experience using TMVA for simple 1D fitting?
  2. could some one point me to some simple code that would do the job? the users guide is totally above my head - the stuff they show is way more complicated then a simple 1D fit.
  3. If someone could point me to some other code that does annealing or any other global fitting method that would be great as well.



I don’t think TMVA is what you need for your problem - at least if you want a parametric fit (ie, if you want to fit a well-defined function). TMVA uses probability density functions and for this has a class TMVA::PDF, which provides non-parametric fitting either through polynomial functions or quasi-unbinned kernel functions. For intricate fitting problems TMVA has fitters such as a genetic algorithm and simulated annealing, but using these is overkill if you just want to fit a double Gaussian to a distribution.

Standard TMinuit should do a good job for your problem. The important thing when automatically fitting double Gaussians to distributions is:

  1. binned fits are usually more robust than unbinned fits (that’s why you probably don’t need to use RooFit).

  2. what really counts is a good choice of starting parameters, and to judiciously choose the parameter limits, in particular when statistics is scarce. For low statistics, a Gaussian, when fitted with a chi-squared minimisation, has the tendency to produce a very large sigma. Limit the sigmas of both Gaussians to a reasonable value, choose the histogram limits generously beyond the xmin/xmax of your data points, and limit also the faction of the integral of the core to the tail Gaussian, then the fits should just work fine.

If you are happy with a non-parametric fit, you can use the class TMVA::PDF, which is straightforward to construct.