Hello! I’ve run into an issue using the basic TH1::Fit() with a TF1 that has all fixed parameters. My idea is to try a Gaussian with known amplitude/sigma at various mean values in a TH1, extract the chi2, and store them away for histogramming later. In principle this is easy to do:
root [1] TF1 *fGauss = new TF1(“fGauss”, “gaus”)
root [2] TH1D *hTest = new TH1D(“Test”, “Test Hist”, 10, 0.0, 1.0)
root [3] hTest->FillRandom(“gaus”, 5000)
Fitting this histogram yields the expected result, but since I’m doing many fits at different means (~10000 times per event), I don’t want it to draw or output fit information, so I call Fit() quietly:
root [4] hTest->Fit(“fGauss”, “Q”)
and this fits as expected. However, the whole point is fitting with entirely fixed parameters so that I may easily extract the chi2. However using “B” to fix the parameters,
root [5] hTest->Fit(“fGauss”, “BQ”)
Info in TMinuitMinimizer::Minimize: There are no free parameter - just compute the function value
I can’t find a way to suppress this…warning? without changing the ROOT source. I understand that in this case, it is simply computing the TF1 value at the point, which I can do on my own, however that won’t give me the chi2 (easily at least). Am I approaching this in the wrong way, or should Q be suppressing these messages?
Thanks