stefan kluth wrote: > > 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 Hi Stefan, Thanks for reporting this problem with TF2::GetRandom2 when using an interpreted function. I have fixed this problem in 2.21/02 Rene Brun
This archive was generated by hypermail 2b29 : Tue Jan 04 2000 - 00:43:28 MET