Hi Nicolas,
Instead of:
TF1 *xx=new TF1("xx","fun",0,2047,1)
do:
TF1 *xx=new TF1("xx",fun,0,2047,1)
Rene Brun
Nicolas Produit wrote:
>
> Hi,
>
> I have a problem with TF1 function using
> TF1 with user function (on linux Version 3.04/02):
>
> isdcpc3:toymc 112> cat fun.C
> Double_t fun(Double_t *x,Double_t *par){
> Double_t z;
> cout<<x[0]<<" "<<par[0]<<endl;
> z=TMath::Power(2.0,par[0]);
> z*=x[0]/1024.0+2.0;
> z-=2.0;
> return z;
> }
> isdcpc3:toymc 113> root
> *******************************************
> * *
> * W E L C O M E to R O O T *
> * *
> * Version 3.04/02 5 March 2003 *
> * *
> * You are welcome to visit our Web site *
> * http://root.cern.ch *
> * *
> *******************************************
>
> Compiled for linux with thread support.
>
> CINT/ROOT C/C++ Interpreter version 5.15.68, Dec 12 2002
> Type ? for help. Commands must be C++ statements.
> Enclose multiple statements between { }.
> root [0] .L fun.C
> root [1] TF1 *xx=new TF1("xx","fun",0,2047,1)
> Function:xx cannot be compiled
> root [2] xx->Draw()
> <TCanvas::MakeDefCanvas>: created default TCanvas with name c1
> root [3]
>
> What mean Function:xx cannot be compiled ?
>
> fucntion is identical 0, and I dont see any output from the cout
>
> Now trying a .L fun.C++:
> I first comment out the cout<< statement
> and then:
> isdcpc3:toymc 115> root
> *******************************************
> * *
> * W E L C O M E to R O O T *
> * *
> * Version 3.04/02 5 March 2003 *
> * *
> * You are welcome to visit our Web site *
> * http://root.cern.ch *
> * *
> *******************************************
>
> Compiled for linux with thread support.
>
> CINT/ROOT C/C++ Interpreter version 5.15.68, Dec 12 2002
> Type ? for help. Commands must be C++ statements.
> Enclose multiple statements between { }.
> root [0] .L fun.C++
> Info in <TUnixSystem::ACLiC>: creating shared library /home/isdc/produit/analysis/toymc/./fun_C.so
> root [1] TF1 *xx=new TF1("xx","fun",0,2047,1)
> Function:xx cannot be compiled
> root [2] double x=10,par=0
> root [3] fun(&x,&par)
> (Double_t)9.76562500000000000e-03
>
> Thanks
>
> --
> Nicolas Produit
> INTEGRAL Science Data Center Phone: +41 22 950 91 40
> 16, Chemin d'Ecogia Fax: +41 22 950 91 33
> CH-1290 Versoix www: http://isdc.unige.ch/
This archive was generated by hypermail 2b29 : Thu Jan 01 2004 - 17:50:15 MET