Re: [ROOT] Saving a function

From: Rene Brun (Rene.Brun@cern.ch)
Date: Wed May 21 2003 - 17:31:08 MEST


Hi Kalen,

TF1::Write evaluates the function at two more points than Draw.
The 2 points at the extreme sides are computed to optimize
the interpolation process in the reading program when evaluating
again the function without the original code for the function.

Rene

On Wed, 21 
May 2003, Kalen Martens wrote:

> Hi Rene,
> 
> Indeed, there is a division by zero in my function when evaluated at the
> lower bound. I guess I was confused as to what ROOT did when it saved a
> TF1 object. Readjusting the lower bound slightly fixes everything. 
> 
> But this brings up another issue, though. Certainly a TF1 object is
> evaluated in the Draw() method. It seems inconsistent that Write()
> complains (as it should, I guess) and Draw() gives no warnings.
> 
> Maybe Write() and Draw() decide to evaluate the function at differing sets
> of points?
> 
> Anyway, thanks for your help. I appreciate it.
> 
> 	-Kalen 
> 
> -----------------------------------------------------------------
> 
> On Wed, 21 May 2003, Rene Brun wrote:
> 
> > Hi Kalen,
> > 
> > What you do should work. Could you send me a copy of your function?
> > 
> > When writing a TF1 referencing an interpreted or compiled function,
> > the function is tabulated at fNpx values in such a way that you can 
> > always draw the function in the reading program even if the code
> > of the function is not available.
> > In your case, it looks like the function is being evaluated with a 
> > division by 0.
> > 
> > Rene Brun
> > 
> > On Wed, 
> > 21 May 2003, Kalen Martens wrote:
> > 
> > > Hi again,
> > > 
> > > Is it possible to save a function (a TF1 object, for example) to a .root
> > > file? I am having difficulties when I try:
> > > 
> > > root [14] TFile f("DeltaNLR_functions.root","recreate");
> > > 
> > > root [15] TF1 *qq_mh100 = new TF1("qq_mh100", DeltaNLR_qq_1D_mh100, 350.,
> > > 1200., 0);
> > > 
> > > ...define more functions...
> > > 
> > > root [26] qq_mh100 -> Write();
> > > Error: operator '/' divided by zero FILE:/tmp/sxAeOo_cint LINE:17
> > > *** Interpreter error recovered ***
> > > 
> > > It looks like the function is being evaluated. The Draw() method works
> > > just fine and without any errors, but the Write() is doing something
> > > strange. 
> > > 
> > > Thanks,
> > > 
> > > 	-Kalen
> > > 
> > > -----------------------------------------------------------------
> > > - Kalen Martens			 	     Ph:(416)-978-6632  -
> > > - Dept. of Physics						-
> > > - University of Toronto, Toronto, Canada			-
> > > -----------------------------------------------------------------
> > > 
> > 
> 



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