Problem with TF2::Integral(...)

Hello,
I am having problems when I try to perform an integral of a TF2 function.

I defined a function:
TF2* f = new TF2(“f”,func, xmin , xmax, ymin, ymax, 0 )
where func is a C function with no parameters:
Double_t func(Double_t x, Double_t par)
{…}

When I call f->Integral(x1, x2, y1, y2) I get a segmentation violation.

But if I call f->Eval(any value) first, and then f->Integral(a1,a2,y1,y2) I get a result!!!
But it is wrong!!!

Do you know if there is any problem with TF2::Integral for C functions??

Thanks!!
pilar

Could you post the shortest possible RUNNING script reproducing your problem? and indicate your ROOT version

Rene

Hello,
I am using ROOT version 5.21/01

this is the macro macro.C :

const Double_t M = 0.5;

Double_t a(Double_t *x, Double_t *par) // <- the C function
{
Double_t Q2 = x[0];
Double_t Ev = x[1];

if (Ev<=0.)
return 0.;

Double_t aa = MQ2Ev; // a simple function to test

return aa;
}
TF2 *fa = new TF2(“fa”, a, 0., 30., 0., 30., 0);

void main(Double_t a1, Double_t a2, Double_t b1, Double_t b2)
{
printf(“fa->eval() = %e\n”, fa->Eval(a1, b1)); // (**)
printf(“fa->integral() = %e\n”, fa->Integral(a1,a2,b1,b2));
}

In root:
root> .L macro.C
root> main(0.5, 0.53, 0.4, 0.48 )
…segmentation violation

But, if I comment line (**) and I execute the same as above:
root> .L macro.C
root> main(0.5, 0.53, 0.4, 0.48 )
fa->Eval() = 1.0000E-1
fa->integral() = 0.0000E+00

The integral is called but the result is 0!!

Thanks,
pilar

I cannot reproduce this problem using 5.22 or 5.23

root [0] .x test.C(0.5,0.53,0.4,0.48) fa->eval() = 1.000000e-01 fa->integral() = 2.719200e-04
Rene

I installed version 5.22 and everything works ok now. :smiley:

Thanks!!
pilar