Dear rooter,
I have a question about the fitting by ROOT.
I have several Au+Au collision data and I have to fit these data by the function.
The function is integral [from 0.0, to 13.0] (func)
(func) function includes I0 and K1 (modified Bessel functions).
[code]example…
.
.
.
Double_t bwfitfunc(Double_t *x, Double_t *par)
{
// *x is Pt in this case.
// par[0] = alpha;
// par[1] = Tf;
// par[2] = beta;
Double_t arg = 0.0;
Double_t out;
Double_t mass = 0.1395679;
Double_t mt = x[0] + mass;
Double_t con = 1023.0;
Double_t rho = TMath::ATanH(par[2]*pow(x[0]/13.0, par[0]));
Double_t pt = sqrt(mt*mt - mass*mass);
// Double_t temp = param[5];
out = con * x[0]
* TMath::BesselI0(pt * TMath::SinH(rho)/par[1])
* TMath::BesselK1(mt * TMath::CosH(rho)/par[1]);
return out;
}
I could fit by bwfitfunc, but I need the integral of this bwfitfunc and fit it!
So, I created this function, integralfunc() including bwfitfunc().
.
.
Double_t integralfunc()
{
Double_t integral;
Double_t radius = 13.0; // radius = 13.0 fm (Rmax)
TF1 *funcx = new TF1("funcx", bwfitfunc, 0.0, radius+2.0, 3);
integral = funcx->Integral(0.0, radius);
return integral;
}
…
After that how to fit the data by this integralfunc()???
…
func->SetParameter(2, 0.75); // beta
func->SetParameter(1, 0.118); // temp.
func->SetParameter(0, 0.398); // alpha
//Need parameter limits. Otherwise I end up with negative Bessel
//functions.
func->SetParLimits(2, 0.2, 0.95); // beta
func->SetParLimits(1, 0.01, 0.2); // temp.
// func->SetParLimits(0, 0.398, 0.398); // alpha
func->SetParLimits(0, 0.390, 0.400); // alpha
gr->Fit("bwfitfunc");
// gr->Fit(“integralfunc”);
gr->Draw(“same”);
…[/code]
works, but
gr->Fit("integralfunc");
does not work. I think I am missing TF1 *func commands or other implementations. Would you help me by showing simple examples how to fit the function by integral functions?
Thank you!