MINUIT Parameter Transformation

I am using MINUIT to fit experimental histograms using simulation histograms as components. All of the scripts attached here work fine, and do not contain any problems or errors. My problem is that I want to somehow work with a “normalized” version of the parameters used by MINUIT. I have made the following minimal example to show my problem.

Running the simple script make_histograms.C,
root [0] .L make_histograms.C++g
root [1] make_histograms()
produces two simulation component histograms that are used to create a pseudo experimental histogram to be fit with MINUIT. The pseudo experimental histogram was made by adding component_000 once and component_001 twice. Therefore, when I try to fit the pseudo experimental histogram with the two simulation components, I would expect MINUIT to tell me that I need to use component_000 once and component_001 twice.
Running the simple script fit_spectra.cpp (just uses MINUIT and chi-squared minimization),
root [0] .L fit_spectra.cpp++g
root [1] fit_spectra(1,2)
prints the following to the screen:
Par 000 0.999995
Par 001 2
normalized Par 000 0.333332
normalized Par 001 0.666668
This result is exactly as expected. I need component_000 once (parameter value of 0.999995 = 1) and component_001 twice (parameter value of 2). I then normalized the parameters to unity:
normalized Par 000 = 1 / (1 + 2) = 0.333
normalized Par 001 = 2 / (1 + 2) = 0.666
The normalized parameters are the ones that actually have physical meaning. So I would like to be able to place a minimum and maximum value on the normalized parameter value. For example, I might want the normalized parameter 000 to be between 0.4 and 0.5. However, I have no idea what the unnormalized parameters (which are needed to calculate the normalized parameters) are before the fit is performed! Is there a way to apply some transformation to the histograms so that the parameters MINUIT will use are already normalized to unity? That way, the unnormalized and normalized parameters will be the same. That is, the expected output would be:
Par 000 0.333332
Par 001 0.666668
normalized Par 000 0.333332
normalized Par 001 0.666668
Is this possible? I realize this is not technically a ROOT problem, but I have been having trouble with this issue for some time and would appreciate any help.

One possible solution I tried by am not a fan of is to add the following code in the function fitting_function (I suppose this is some sort of a penalty function):

for (int i=0; i<global_num_components; i++){
  parameter_sum += *(parameters + i);
if ((*parameters / parameter_sum >= 0.25) &&
    (*parameters / parameter_sum <= 0.35)) {
  return global_chi2;
return 1e14;

Where in the above snippet I am only worried about setting a constraint on the first component to be between a normalized value of 0.25 and 0.35. This sometimes works and sometimes does not (on the real data set I am analyzing, not necessarily in the minimal example above). So I would like to try to apply some transformation to the histograms instead. Is this possible?

make_histograms.C (1.9 KB)

fit_spectra.cpp (5.2 KB)

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