Re: [ROOT] Fitting problems

From: Rene Brun (Rene.Brun@cern.ch)
Date: Fri Mar 15 2002 - 23:25:02 MET


Hi Emily,



On Thu, 14 Mar 2002, Emily Nurse wrote:

> Hello,
> I have a couple of questions involving the Fit function.
> Firstly when I use it it normalises my user defined function for me to
> give the loest possible chisquared value when fitted to my data points. I
> was wandering if I could switch this action off and just get a straight
> forward chisquared value as I will be fitting different ranges seperately
> that need to be normalised by the same amount even though this may not
> give the lowest chi-squared value.

If you use the fit option "w" (all weights equal to 1), you should obtain 
what you want.

>
Secondly I am getting an error message when I run my macro which includes
> the function:
> 
>  Double_t norm ( Double_t *x, Double_t *par)
>             {
> 	    Double_t xx=x[0];
>             Int_t bin = w_pte1->GetXaxis()->FindBin(xx);
>             return par[0]*(w_pte1->GetBinContent(bin));
>             }
> 
> (where w_pte1 is a TH1D object). Then at the root prompt I type:

But where do you define it ?
If the code above is in a macro, declare your TH1D object as global.

Rene Brun

> 
> root [3] TF1 *f1 = new TF1("norm",norm,0.,50.,1)
> root [5] f1->SetParameter(0,1)
> root [6] f1->Draw()
> <TCanvas::MakeDefCanvas>: created default TCanvas with name c1
> Error: non class,struct,union object $w_pte1 used with . or ->Error: non
> class,struct,union object $w_pte1 used with . or ->Error: non
> class,struct,union object $w_pte1 used with . or ->root [7]
> 
> Things do seem to work but I was wandering what I was doing wrong,
> thanks for your help,
> Emily.
> 



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