I would like to know if it is possible to calculate the probability that a TF1 fits a histogram even if you don’t actually perform the fit.
In my case I have calculated the values of my TF1 from a fit to other data however I want to calculate how well the function that I have drawn on the histogram fits the data. At the moment in order to do this I have to unfix one of the parameters, perform the fit, check that the parameter I have allowed to vary hasn’t changed significantly and then print the probability of the fit.
So currently my code looks a bit like this:
for (int i=0; i<12; ++i){
// Getting the results from the other fit
gMinuit->GetParameter(i, fitResults[i].mean, fitResults[i].eparab);
// Fixing the parameters of my function
func1->FixParameter(i, fitResults[i].mean);
}
// Allowing one of the parameters to vary
func1->SetParameter(12, 0.1);
// Performing the fit so I can see what the probability is
h1->Fit("func1");
cout << "Probability of fit = " << func1->GetProb() << endl;
If I fix all the parameters I get an abnormal termination of the fit. What I would like to do is just fix all the parameters draw my func1 on the histogram and then calculate the probability that this function describes the data. Is this possible?