Re: [ROOT] TF3 bug

From: Rene Brun (Rene.Brun@cern.ch)
Date: Thu Aug 07 2003 - 11:52:08 MEST


Hi Maksim,

Thanks for reporting this problem with TF3. Now fixed in CVS.

Rene Brun

On Thu, 7 Aug 
2003, Maksim A. Nikulin wrote:

> Hi,
> I found that the TF3 class constructor
> TF3::TF3(const char* name, const char* formula, Double_t xmin = 0,
> Double_t xmax = 1, Double_t ymin = 0, Double_t ymax = 1, Double_t zmin =
> 0, Double_t zmax = 1)
> doesn't work in root-3.05.07:
> 
> <root-session>
> root [0] f3 = new TF3("f3", "x + y + z")
> Error in <TF1::TF1>: function: f3/x + y + z has 3 parameters instead of 1
> (class TF3*)0x88f7a18
> root [1] f3_2 = new TF3("f3_2", "x + y")
> Error in <TF1::TF1>: function: f3_2/x + y has 2 parameters instead of 1
> Error in <TF3::TF3>: function: f3_2/x + y has 2 parameters instead of 3
> (class TF3*)0x88fc040root [2] f3_1 = new TF3("f3_1", "x")
> Error in <TF3::TF3>: function: f3_1/x has 1 parameters instead of 3
> (class TF3*)0x88ee978root [3] f3_0 = new TF3("f3_0", "1")
> Error in <TF3::TF3>: function: f3_0/1 has 1 parameters instead of 3
> (class TF3*)0x88fc6a0
> </root-session>
> 
> There is a note in the file
> http://root.cern.ch/root/html/examples/V3.05.txt.html
> possible related to the problem
> 
> 2003-07-08 08:56  brun
> 
> 	* hist/src/: TF1.cxx, TF2.cxx, TF3.cxx:
> 	Add protections in the constructors with a formula in case the dimension
> 	of the formula does not match the class. The object is declared Zombie.
> 
> I think TF1 design conflicts with the TF1 <- TF2 <- TF3 inheritance
> sequence. TF1 depends on relation between xmin and xmax:
> 
> <file name="hist/src/TF1.cxx">
> // ...
> // line 156
> TF1::TF1(const char *name,const char *formula, Double_t xmin, Double_t xmax)
>        :TFormula(name,formula), TAttLine(), TAttFill(), TAttMarker()
> // ...
> // line 171
>     if (xmin < xmax ) {
>        fXmin      = xmin;
>        fXmax      = xmax;
>     } else {
>        fXmin = xmax; //when called from TF2,TF3
>        fXmax = xmin;
>     }
> // ...
> </file>
> 
> First xmin <-> xmax exchange:
> 
> <file name="hist/src/TF2.cxx">
> // ...
> // line 52
> TF2::TF2(const char *name,const char *formula, Double_t xmin, Double_t
> xmax, Double_t ymin, Double_t ymax)
>        :TF1(name,formula,xmax,xmin)
> // ...
> </file>
> 
> Second swap xmin and xmax:
> 
> <file name="hist/src/TF3.cxx">
> // ...
> // line 38
> TF3::TF3(const char *name,const char *formula, Double_t xmin, Double_t
> xmax, Double_t ymin, Double_t ymax, Double_t zmin, Double_t zmax)
>        :TF2(name,formula,xmax,xmin,ymin,ymax)
> // ...
> </file>
> 
> Now xmin < xmax again. The TF1 constructor emits a warning message 
> because it arguments look like in 1D case.
> 
> Maksim Nikulin
> 
> 



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