Re: A ROOT Problem:How to use TF1 to do function integration

From: Feng Xiong (fxiong@mit.edu)
Date: Fri Aug 27 1999 - 18:33:09 MEST


Thanks! I also solved this problem in a similar way following Rene Brun's
advice, for 2D function. First declare a global pointer and make it
accessible to all the member functions via constructor: 


static PRCHe3 *gHe3;

PRCHe3::PRCHe3(..)
{ 
   ...

   gHe3 = this; 
 
}

Then I can define

Double_t (*func)(Double_t *, Double_t *);

Double_t func1(Double_t *x, Double_t *p)
{
  Double_t t = x[0];
  Double_t v = x[1];

  return gHe3->IntegrandQR(t,v);
}

func = func1;
TF2 *f2 = new TF2("quasielastic", func, -10, 10, -20, 20, 0);
 
  ...

I agree it's a little painful to do this all the time. And it will be very
interesting to understand why TF1 can not call directly a member function.

Best regards,
Feng 



This archive was generated by hypermail 2b29 : Tue Jan 04 2000 - 00:43:38 MET