Re: [ROOT] TF1 (New)

From: Rene Brun (Rene.Brun@cern.ch)
Date: Sat Oct 27 2001 - 12:48:24 MEST


Hi Matthieu,

I have made a few changes to TF1, TH1 and TGraph that will help
in your situation with a function defined only in some non
contiguous areas. These changes are already in CVS.

I just copy below what I have written in the CVS log:

Add new static global member fgRejectPoint with the new static functions:
  void TF1::RejectPoint(Bool_t reject=kTRUE)
  Bool_t TF1::RejectedPoint()

===>
The function TF1::RejectPoint may be used in a user fitting function
to reject points. The fgRejectPoint is automatically reset by Root.

A new member function TF1::IsInside has been added. 
Currently it returns kTRUE if the point is inside the function limits.
This function is redefined in TF2 and TF3.
The main purpose of this function is to give additional possibilities
in functions deriving from TF1. For example, if a function is only
defined in some specific non-contiguous ranges, this could be
implemented in a class deriving from TF1 and simply redefining
the function TF1::IsInside.

TH1::Fit (chisquare and likelihood methods) changed to support
the new functions in TF1::RejectPoint and IsInside.

TGraph::Fit changed to support the new functions in TF1::RejectPoint 
and IsInside.
===>

In your case, simply call TF1::RejectPoint() in your fitting function
when you want to reject a point.
Also note that the user fitting function is only called if the point
is inside the function range.

Note that these changes will work for 1,2 and 3-D functions.

Rene Brun


On Fri, 26 Oct 2001, Matthieu Guillo wrote:

> Hello Rooters,
> 
> For fitting purpose I need to use some functions defined per intervall and
> not defined in others. The function is not defined in some interval (or
> points), setting the values to 0 (as some suggested) is not an option
> since it is a other mathematical function. 
> 
> How hard is it to implement this? The constructor could take some TList
> as argument to define the intervals where the function is defined. When
> evaluating the function where it is not defined, it can throw an
> exception. And Minuit could catch it using a try / catch block. This could
> be also useful for overflow, underflow, division per 0... Is it a goood
> C++ approach to define such functions?
> 
> Thanks
> 
> Matthieu Guillo
> University of South Carolina
> Thomas Jefferson National Laboratory
> Office 71 trailer 16
> Phone: 757-269-5551
> 



This archive was generated by hypermail 2b29 : Tue Jan 01 2002 - 17:51:04 MET