bug in root/cint with TF2::GetRandom2 and user defined function

stefan kluth (skluth@mh1.lbl.gov)
Fri, 15 Jan 1999 11:30:20 -0800 (PST)


Hi,

I have found a problem when using TF2::GetRandom2 with a user defined
function. I use root 2.20/06. I get a " *** Break *** segmentation
violation " in root, when I try to call TF2::GetRandom2 from a TF2 object
constructed with a pointer to a user defined function. Other member
functions like TF2::Draw work fine. The following macro demonstrates the
problem:

double gausxy( double* x, double* par ) {

double dxds= (x[0]-par[0])/par[2];
double dyds= (x[1]-par[1])/par[3];
double rho= par[4];
return exp( -0.5*( dxds*dxds + dyds*dyds
- 2.0*dxds*dyds*rho )/( 1.0-rho*rho) );

}
void myfunc2() {

TF2* f2= new TF2( "myfunc2", gausxy, -10, 10, -10, 10, 5 );
f2->SetParameter( 0, 0.0 );
f2->SetParameter( 1, 0.0 );
f2->SetParameter( 2, 2.0 );
f2->SetParameter( 3, 2.0 );
f2->SetParameter( 4, 0.1 );
f2->Draw();
Float_t xmf, ymf;
printf( "Now calling GetRandom2\n" );
f2->GetRandom2( xmf, ymf );

}

The same call to TF2::GetRandom2 works fine when the function is given
at the costruction of the TF2 object by a formula string.

cheers, Stefan

---Stefan Kluth---------------Lynen Fellow----------------|\--|\-------
- LBNL, MS 50A 2160 - phone: +1 510 495 2376 - |/ |/ -
- 1 Cyclotron Rd. - fax: +1 510 495 2957 - |\/\|\/\|' -
---Berkeley, CA94720, USA-----e-mail: SKluth@lbl.gov------|/\/|/\/|----