Re: Fitting of functions, folding of histos
Rene Brun (Rene.Brun@cern.ch)
Thu, 08 Oct 1998 16:33:45 +0200
Tadeusz Pytlos wrote:
>
> Dear Rooters,
> I've got a histo (hin) with small statistics. Before
> fitting my own function (func) I'd like to smooth the
> histo using pol9. So in fact I want to fit pol9 by
> my own function.
> What is the right way to do it?
> I tried for example:
> TF1 *hpol=new TF1("hpol","pol9(0)",0,m_max,npar);
> hin->Fit("hpol","be");
> TF1 *fpol=gROOT->GetFunction("hpol");
> fpol->Fit("func","be");
> TF1 *fun=gROOT->GetFunction("func");
>
> but I received
> Function:hpol cannot be compiled
>
> *** Break *** segmentation violation
>
In your 3 statements above, when you fpol->Fit("func","be"), func
is not defined at this point. In case of basic expressions such as
polynomials, you do not need to create yourself a function. They are
already known from Root.
You can do directly:
hin->Fit("pol9");
Please, next time, send a short working macro.
>
> Next question - Is the folding of histos implemented in ROOT?
No
Rene Brun