Re: Fit options in ROOT

From: Paolo Risso <paolo.risso_at_ge.infn.it>
Date: Fri, 6 Nov 2009 12:58:01 +0100


Hi all,

Sorry to add myself in the question, but Is there any guided example about it ?

Thanks

Paolo

Il giorno 06/nov/09, alle ore 12:12, Lorenzo Moneta ha scritto:

> Hi,
>
> you cannot change with a simple option the errors in the chi2
> calculations. You would need to write yourself the chi2 function and
> pass to the fit,
> using for example the option "U".
> You can however use the option "L" to perform a binned likelihood
> fit. In this case you will have the correct treatment of the bins
> statistics in particular if you have empty bins
>
> Best Regards
>
> Lorenzo
> On Nov 5, 2009, at 5:20 PM, Jordi Nadal Serrano wrote:
>
>> Hello guys,
>>
>> I am trying to fit a function to a histogram. Like this:
>>
>> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
>>
>> Double_t myfunction (Double_t *x, Double_t *par){
>> int bin = data_8175->GetXaxis()->FindBin(x[0]);
>> Double_t f = 0;
>> f= par[0] * ttbar->GetBinContent(bin) + par[1] * h_w_jets-
>> >GetBinContent(bin) + par[2] * h_others->GetBinContent(bin);
>> return f;
>>
>> }
>>
>>
>> void myfunc(){
>>
>> TF1 *f1 = new TF1("myfunc",myfunction,minBin_fit,maxBin_fit,3);
>>
>> f1->SetParLimits(0,0,2);
>> f1->SetParLimits(1,0,2);
>> f1->FixParameter(2,1);
>> f1->Draw();
>> }
>> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
>>
>> Once my histograms are filled. I do the fit this way:
>>
>> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
>> myfunc();
>> TF1 *f1= (TF1*)gROOT->GetFunction("myfunc");
>> data_8175->Fit("myfunc","ER0");
>> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
>>
>>
>> I wonder what are the errors that are entered in the chi square. I
>> believe that the errors are the sqrt( number of entries in a bin )
>>
>> Can I change these errors to be the theoretical ones, i.e, the sqrt
>> of the value of myfunction per bin .
>>
>>
>> Many thanks in advance,
>>
>> Jordi
>>
>

Paolo Risso
Universita' di Genova
INFN sezione di Genova
Via Dodecaneso 33
16146 - Genoa - Italy
tel +390103536452 (office)
paolo.risso_at_ge.infn.it Received on Fri Nov 06 2009 - 12:58:09 CET

This archive was generated by hypermail 2.2.0 : Fri Nov 06 2009 - 17:50:03 CET