TH1::Fit Doesn't Seem to Use All Parameters

I’m having a problem with histogram fitting. My histogram is essentially a propagator in position space, and just by eyeballing the histograms, it seems like they should fit well to the TF1 function:

root [0] TF1 f1(“fit”, “[0]*((cos([1]*x+[2])+[3])^[4])*exp(-[5]*x)/x^[6] + [7]”, 1, 128)

The sinusoidal part is important – there are certain clear features in the histograms that indicate some long wavelength fluctuations. However, when I try to fit to this function, the fitting algorithm seems to ignore parameters 1-4 entirely (i.e., those dealing with the sinusoidal part). The output from TH1::Fit is, for example:

root [1] myHist->Fit(“fit”, “R”)

FCN=0.289994 FROM MIGRAD STATUS=CONVERGED 829 CALLS 830 TOTAL
EDM=8.71362e-11 STRATEGY= 1 ERROR MATRIX UNCERTAINTY 0.3 per cent
EXT PARAMETER STEP FIRST
NO. NAME VALUE ERROR SIZE DERIVATIVE
1 p0 8.35807e-01 9.89969e-01 6.11083e-05 3.71399e-05
2 p1 0.00000e+00 1.84346e+00 -0.00000e+00 0.00000e+00
3 p2 0.00000e+00 1.84346e+00 -0.00000e+00 0.00000e+00
4 p3 0.00000e+00 1.84346e+00 -0.00000e+00 0.00000e+00
5 p4 0.00000e+00 1.84346e+00 -0.00000e+00 0.00000e+00
6 p5 5.24897e-02 9.21890e-02 -1.76725e-05 -5.42536e-04
7 p6 1.70477e-01 8.81161e-01 1.05471e-04 -7.63447e-05
8 p7 5.26325e-02 6.94328e-02 -1.41878e-05 4.61086e-04
TCanvas::MakeDefCanvas: created default TCanvas with name c1
(Int_t)0

The fit is actually pretty poor – not surprisingly, it completely misses the sinusoidal behavior. I’ve also tried calling Fit with the “M” option and there is no improvement. I’ve also tried changing some of the free parameters in question to constants, and it still ignores whatever free paremters are left among 1-4.

Please send a concrete running short script demonstrating your problem.
Also indicate the ROOT version and OS.

Rene

I’ve attached a ROOT file containing a histogram that I’m using. The only commands I’m running within CINT are:

root [0] TFile f(“myHist.root”)
root [1] TF1 f1(“fit”, “[0]*((cos([1]*x+[2])+[3])^[4])*exp(-[5]*x)/x^[6] + [7]”, 1, 64)
root [2] myHist->Fit(“fit”, “R”)

Again, the output for me is:

FCN=0.0410351 FROM MIGRAD STATUS=CONVERGED 1147 CALLS 1148 TOTAL
EDM=1.82698e-10 STRATEGY= 1 ERROR MATRIX UNCERTAINTY 100.0 per cent
EXT PARAMETER APPROXIMATE STEP FIRST
NO. NAME VALUE ERROR SIZE DERIVATIVE
1 p0 1.06575e+00 1.99276e-01 9.93493e-05 1.54536e-05
2 p1 0.00000e+00 1.41421e+00 -0.00000e+00 0.00000e+00
3 p2 0.00000e+00 1.41421e+00 -0.00000e+00 0.00000e+00
4 p3 0.00000e+00 1.41421e+00 -0.00000e+00 0.00000e+00
5 p4 0.00000e+00 1.41421e+00 -0.00000e+00 0.00000e+00
6 p5 1.23087e-02 5.46338e-03 -2.65930e-05 -1.77000e-03
7 p6 3.11355e-01 5.93659e-02 1.67651e-05 -6.85080e-05
8 p7 -9.04015e-02 4.38810e-02 -2.65478e-04 1.91369e-04
TCanvas::MakeDefCanvas: created default TCanvas with name c1
(Int_t)0

The ROOT version is 4.04/02, and OS is Cygwin.

Thanks!
myHist.root (6.02 KB)

When fitting this formula, you should
-either specify correct errors for each bin
-or provide better initial values for the parameters (by default they are 0)

Rene