Hello ROOT experts,
I am trying to test a model with some data. The equation representing the model has the following approximate form for the distribution of c:
Q(a,b,c) = c!*integral(exp(-x)/exp(ax^2+bx^3)) divided by integral(exp(ax^2+bx^3))
Where the integrals are from 0 to infinity. I had success in making a fit for a form in the numerator in the model using the logic in this post: https://root-forum.cern.ch/t/fitting-an-integral-function/8517/8
Trying to make the code for my current purpose with this in mind, I wrote the following fit function
Double_t FitFunction(Double_t *x, Double_t *p)
{
TF2 *main = new TF2("main","[0]*TMath::Factorial(x[0]))*(exp(-y)/exp([1]*pow(y,2)+[2]*pow(y,3)))");
main->SetParameters(p[0],p[1],p[2],p[3]);
TF12 *f12A = new TF12("f12A",main,x[0],"y");
Double_t mainsum = f12A->Integral(0.0,TMath::Infinity());
TF2 *deno = new TF2("deno","exp([1]*pow(y,2)+[2]*pow(y,3))" );
main->SetParameters(p[1],p[2],p[3]);
TF12 *f12B = new TF12("f12B",deno,x[0],"y");
Double_t part = f12B->Integral(0.0,TMath::Infinity());
delete main; delete deno;
delete f12A; delete f12B;
return mainsum/deno;
}
which I will use to fit with the following lines of code
TF1 *MyFit=new TF1("MyFit",FitFunction,30,40,4);
MyFit->SetParameter(0,1.0);
MyFit->SetParameter(1,1.0);
MyFit->SetParameter(2,1.0);
MyFit->SetParameter(3,1.0);
MyFit->SetParNames("N","#alpha","#beta","#gamma");
MyFit->SetLineColor(1);
gr->Fit(MyFit,"RME");//gr is the TGraphErrors instance with the c distribution.
Is this line of thought correct? I am however getting errors like this when I try to perform the fit:
Warning in <ROOT::Math::ROOT::Math::GausIntegrator>: Failed to reach the desired tolerance ; maxtol = 1e-12
I am not yet sure of the possible success of the model but would be grateful to get some suggestions and comments on the way in which I am trying to implement it with ROOT from its experts.
Thank you and regards
Rahul