Hi all
I got the following problem with the script I attached in the end:
It works fine but when I place the cursor on top of the pad then a message
appears "Error: operator '/' divided by zero FILE:like.C LINE:10"
The weird thing is that 0 shouldn't be in the range for any parameter so
how come root is evaluating the function there?
In case you are interested:
root version 3.05/03
Thanks
Javier
P.s.: here goes the file (copy pasted)
Float_t loglike(Double_t* x, Double_t* par)
{
Float_t loglikelihood = 0;
Float_t level[5] = {0.7,0.8,0.9,1.0,1.2};
Float_t time[5] = {38.36,41.63,45.33,49.97,55.39};
if(x[1] == 0) cout << "x[1] is zero!!" << endl;
for(int i = 0; i != 5; i++)
{
Float_t calcul = (0.3066/x[1] + 0.1749*(1-x[0])*(level[i]+0.2838) +
0.003522);
loglikelihood += pow( (time[i] - calcul),2.0)/2;
}
return loglikelihood;
}
void like()
{
// x_range is (0.8,0.98) y_range is (1000.0,10000.0)
TF2* chi2 = new TF2("chi2",loglike,0.8,0.98,1000.0,10000.0,0);
TCanvas* micanvas = new TCanvas();
chi2->Draw();
}
This archive was generated by hypermail 2b29 : Thu Jan 01 2004 - 17:50:14 MET