[ROOT] Re: Removing points from the fit

From: Rene Brun (Rene.Brun@cern.ch)
Date: Sat Jun 08 2002 - 21:54:43 MEST


Hi Yuri,

An example exclude.C:
//file exclude.C
Double_t fline(Double_t *x, Double_t *par)
{
    if (x[0] > 2.5 && x[0] < 3.5) {
      TF1::RejectPoint();
      return 0;
   }
   return par[0] + par[1]*x[0];
}

void exclude() {
   TF1 *f1 = new TF1("f1","[0] +[1]*x +gaus(2)",0,5);
   f1->SetParameters(6,-1,5,3,0.2);
   TH1F *h = new TH1F("h","background + signal",100,0,5);
   h->FillRandom("f1",2000);
   TF1 *fline = new TF1("fline",fline,0,5,2);
   fline->SetParameters(2,-1);
   h->Fit("fline","l");
}


Rene Brun

On Sat, 8 Jun 2002, Yuri Gershtein wrote:

> Hi,
> 
> so I have a peak which sits on a low statistics background, so
> I should use log likelihood.
> I want to fit just background without the peak, say with [1]*x+[0].
> 
> Can I define a non-contiguos range for the fit?
> Setting errors to zero doesn't seem to work for the log likelihood (I
> think in PAW it used to work, i.e. non-zero bin with zero error was
> excluded from the fit).
> 
> Also, in PAW I knew how to control the FCN calculation, and though this
> was not graceful, it worked...
> 
> Thanks for your help,
> Yuri
> 
> 
> ----------
> Dr. Yuri Gershtein, Physics, Brown University.
> Based at Fermilab. Tel: (630)-840-3784. Fax: (630)-840-8886
> E-Mail: Gerstein@fnal.gov
> 



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