[quote=“dpiparo”]Hi,
I guess ROOT in this situation is just a tool, which is working quite well. You now have a way to carry out your fit, right (the minimisation converged)? The value of the reduced chi2 is a consequence of the error on the data and your fit model, ultimately on the physics problem you are trying to solve.[/quote]
Hi dpiparo, the set of data is simulated by CORSIKA. As sure you know, cosmic ray spectrum is a power law
dN/dE (proportional to) E^-gamma
where gamma depends by the range energy.
The author of simulations told me that simulations uses a power low E^-2, this is the reason because I’m fitting using a power low E^-2
[quote=“Pepe Le Pew”]Looking at the graphical results of your fits, I would try two fit options (for both types of your “fitspettro” functions):
hene->Fit(“fitspettro”, “L”); // Use Loglikelihood method (default is chisquare method)
and:
hene->Fit(“fitspettro”, “W”); // Set all weights to 1 for non empty bins; ignore error bars
and then choose the one that goes better through the data points.[/quote]
Hi pepe, for the case
TF1 *fitspettro = new TF1("fitspettro", "[0] / x / x", 1, 5e3);
fitspettro->SetParameter(0, 1.0e6);
this is
hene->Fit("fitspettro", "L");

and this is
hene->Fit("fitspettro", "W");

for the case
TF1 *fitspettro = new TF1("fitspettro", "TMath::Power([0] * x, [1])", 1, 5e3);
fitspettro->SetParameters(1.0e-3, -2.0);
this is
hene->Fit("fitspettro", "L");

and this is
hene->Fit("fitspettro", "W");

as you can see the hene->Fit("fitspettro", "L");
doesn’t work fine. The case hene->Fit("fitspettro", "W");
draws good lines, but there is still the problem of the parameter value…