Re: [ROOT] Base class ambiguity

From: miha.puc@marvin.fmf.uni-lj.si
Date: Fri Mar 01 2002 - 14:15:10 MET


Thank you, Rene.
But this solves only the problem with FillRandom since it accasses 
function via gROOT->GetListOfFunctions()->FindObject("functionname").

The problem with TH1::Fit remains since in uses gF1 defined in TH1.cxx. In 
TH1::Fit also gF1->GetParameter(i) is called and because 
TFormula::GetParameter(...) in NOT virtual I cant't 
override it and provide 
my own.

Would it be feasible to make TFormula::GetParameter virtual. 
The same is true for TFormula::GetNpar, TFormula::GetParNumber, 
TF1::GetParError, TF1::GetParErrors and others that do not deal with 
parameters?

Regards, Miha.


On Wed, 27 Feb 2002, Rene Brun wrote:

> Hi Miha,
> 
> In your TModelFunction constructor, add the following statement:
>    gROOT->GetListOfFunctions()->Add(this);
> 
> see example in:
> TF1::TF1(const char *name, Double_t xmin, Double_t xmax, Int_t npar)
> 
> Rene Brun
> 
> 
> On Wed, 27 Feb 2002 miha.puc@marvin.fmf.uni-lj.si wrote:
> 
> > Hi!
> > 
> > Ok. Thank you. And here is another problem:
> > In TModelFunction I override TF1's EvalPar and some other methods. But 
> > when I fit or FillRandom a histogram with a TModelFunction the 
> > TF1::EvalPar is called which is not what I want. 
> > 
> > Is there a solution?
> > 
> > When I call TH1's Add, Divide or Multipy with TModelFunction::EvalPar is 
> > called which is OK.
> > Also Draw() method works well for TModelFunction objects.
> > 
> > I use Version   3.03/00   6 February 2002. 
> > 
> > Miha
> > 
> > 
> > On Tue, 26 Feb 2002, Rene Brun wrote:
> > 
> > > Hi Miha,
> > > 
> > > The message from the compiler is clear. Both TF1 and TDataSet
> > > derive from TObject. Do not mix apples and oranges.
> > > Use TDataSet as a member of your class instead.
> > > 
> > > Rene Brun
> > > 
> > > On Tue, 26 Feb 2002 miha.puc@marvin.fmf.uni-lj.si wrote:
> > > 
> > > > Hi!
> > > > I have a class 
> > > > class TModelFunction : public TF1, public TDataSet { .....
> > > > 
> > > > and when compiling I get messages like
> > > > 
> > > > TModelFunction.cxx:121: type `TObject' is ambiguous base class for type 
> > > > `TModelFunction'
> > > > TModelFunction.cxx:121: type `TModelFunction' is ambiguous baseclass of 
> > > > `TObject'
> > > > 
> > > > line 121 is:
> > > > _Foo = (TModelFunction *) (fList->After(_Foo));
> > > > where _Foo is a pointer to TModelFunction object.
> > > > 
> > > > What shall I do?
> > > > 
> > > > Regards,
> > > > Miha
> > > > -- 
> > > > 
> > > > 
> > > 
> > > 
> > 
> > -- 
> > 
> 
> 

-- 



This archive was generated by hypermail 2b29 : Sat Jan 04 2003 - 23:50:43 MET