Hi Anton,
Look at the small example stress1 in $ROOTSYS/test/stress.cxx
Rene Brun
Anton Fokin wrote:
>
> Hi Rene,
>
> One of TF1 constructors is to create TF1 from a user defined function
>
> TF1 TF1(const char* name, void* fcn, Float_t xmin, Float_t xmax, Int_t npar)
>
> It works fine in case of CINT
>
> Double_t myfunction(Double_t *x, Double_t *par)
> {
> Float_t xx =x[0];
> Double_t f = TMath::Abs(par[0]*sin(par[1]*xx)/xx);
> return f;
> }
> void myfunc()
> {
> TF1 *f1 = new TF1("myfunc",myfunction,0,10,2);
> f1->SetParameters(2,1);
> f1->SetParNames("constant","coefficient");
> f1->Draw();
> }
>
> Now if I want to create TF1 in my compiled code with myfunction defined in a
> macro loaded via gROOT->LoadMacro() ... where can I get a pointer (void*
> fcn) to myfunction for TF1 constructor?
>
> Best regards,
> Anton
This archive was generated by hypermail 2b29 : Tue Jan 02 2001 - 11:50:20 MET