My fitting process is like followed:
(1). Generate a histogram with 1000 Monte Carlo entries and fit it with my
function.
(2). Generate a second histogram with another 1000 entries and do the
same fitting.
(3). repeat this process 200 times.
Specifically, the code is more or less like followed. During the
loop from 0 to 200, when i=0, everything is OK but when i>0, ROOT
start to give messages:
>>>> Function: myfunction cannot be compiled.
please do some help for this problem !
Sincerely, Xie
----------
The code |
-------------------------
Double_t myfunction(Double_t *x, Double_t *par) // Fitting function.
{ .........................................}
void fit()
{
...................
for(int i=0;i<=200;i++) //*****> repeat fitting 200 times
{ ...................
fpx = new TH1F("fpx","",BinNum, Xmin,Xmax);
for(int j=0;j<1000;j++)
fpx->Fill(....); //****> 1000 Monte Carlo Events
FitFunc = new TF1("myfunction",myfunction,-10,20,2);
FitFunc->SetParameter(0.5,0.1);
FitFunc->SetParNames("Normalize","Most Probable");
fpx->Fit("myfunction","r");
delete fpx;
delete FitFunc;
}
}