Hi rooters.

I looked at similar topics to find any answer but i couldn’t find one which worked. I’m trying to fit a distribution with a power law. I am starting from a TH2F which I project with TH2::ProfileX(). Then I define the fit function and I apply the fit

But nothing happens, even though lloking at the fit status there have been 120 iterations.

If some one has any idea bout if I would be glad to hear any advice

Thank you

Here is the code :

(part of compiled code)

[color=green]

//fit function

Double_t crit_exp_fit_function(Double_t *x, Double_t *par) {

Float_t temp = x[0]-Grid_Average;

if(temp<0) {

temp = -temp;

}

return par[0]*(1-TMath::Power(temp/par[1],par[2]));
}
[/color]
called in
[color=blue]
(…)
TH2F *Grid_size,100,T_mining->cont[0],max_T);

*sampler = new TH2F(“sampler”,“Data Sampler”,Grid_size*Grid_size+1,0,Grid_size

inf_peak->Project(“sampler”,“T:N”); // building my initial TH2F with various paramters. Everything is fine looking at draws

TProfile *sampler_proj = sampler->ProfileX();

TF1 *fit = new TF1(“fit”,crit_exp_fit_function,under_mean->get_last(),over_mean->get_last(),3);

fit->SetParNames(“Tc”,“Normalization”,"#alpha");

fit->SetParameters(max_T,100,2);

(…)

[/color]

And here is the output

[color=brown]

FCN=0 FROM MIGRAD STATUS=CONVERGED 119 CALLS 120 TOTAL

EDM=0 STRATEGY= 1 ERROR MATRIX UNCERTAINTY 100.0 per cent

EXT PARAMETER APPROXIMATE STEP FIRST

NO. NAME VALUE ERROR SIZE DERIVATIVE

1 Tc 3.50000e+00 1.41421e+00 0.00000e+00 0.00000e+00

2 Normalization 1.00000e+02 1.41421e+00 0.00000e+00 0.00000e+00

3 #alpha 2.00000e+00 1.41421e+00 0.00000e+00 0.00000e+00

[/color]

So not any parameter changed

I joined an attachement of the TProfile drawing and the initial fit function