Simultaneous fit of a two variable function

I want to do a simultaneous fit of a two variable function that looks like:

f(r,t)=C®e^(a-b/r+cr)*t

I want to fit it in terms of the parameters C® and a,b,c. The problem is that I don’t now how C® looks like and this is why I want to fit it as a parameter (if r takes N distinct values then I will determine N parameters C). So at the end of the fit I want to have the N C® parameters and a,b,c.

(I was able to fit it separately, first as a function of t: f(t)=Ce^(mt), and after this I fitted m=a-b/r+c*r. However I really want to do also a simultaneous fit).

I don’t now how to call Minuit to do this. I tried to use C as a vector parameter, so my chi square function and function I wanted to fit looked like:

void fcn(Int_t &npar, Double_t *gin, Double_t &f, Double_t par, Int_t iflag)
{
const Int_t nbins = 9,max=34;
Int_t i,j;
Double_t chisq = 0;
Double_t delta;
for (j=0;j<max;j ++)
{
for (i=0;i<nbins; i++)
{
delta = (z[i][j]-func(x[i],y[j],par))/error[i][j];
chisq += delta
delta;
}
}
f = chisq;
}

Double_t func(Double32_t x, Double32_t y, Double32_t par)
{
Double_t arg = 0;
arg = (-x
(par[0]-par[1]/y+par[2]*y)));
Double_t value = par[3][j]*TMath::Exp(arg);
return value;
}
where par[3] is a vector in j with j from 0 to max. However this didn’t work.

Could you help me with any ideas?