Re: [ROOT] TF1

From: Rene Brun (Rene.Brun@cern.ch)
Date: Thu Feb 20 2003 - 18:46:44 MET


Hi Alessio,

TF1::GetHistogram returns a pointer to the internal TH1 object used to
draw the function. This object is only created when you paint the TF1.

If you want to map a TF1 to a TH1, do, eg:

 root > TF1 *f1 = new TF1("f1","sin(x)/x",0,10);
 root > TH1F h("h","",100,0,10);
 root > h.Eval(f1);

Rene Brun

Alessio PICCIOLI wrote:
> 
> How can i use TF1::GetHistogram() without drawing the function (using
> TF1::Draw()) ?
> 
> If i do not use draw() i get the following error:
> 
> root [13] TF1 *func = new TF1 ( "func" , "x" , 0 , 1 ) ;
> root [14] TH1D *histo = func -> GetHistogram ( ) ;
> root [15] histo -> Draw ( ) ;
> Error: illegal pointer to class object histo 0x0 148  FILE:(tmpfile) LINE:1
> *** Interpreter error recovered ***
> 
>     Alessio



This archive was generated by hypermail 2b29 : Thu Jan 01 2004 - 17:50:09 MET