Fit options in ROOT

From: Jordi Nadal Serrano <jnadal_at_ifae.es>
Date: Thu, 5 Nov 2009 17:20:09 +0100


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 Received on Thu Nov 05 2009 - 17:20:26 CET

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