Re: [ROOT] fitting problem

From: Rene Brun (Rene.Brun@cern.ch)
Date: Wed Oct 10 2001 - 22:18:18 MEST


Hi Matthieu,

Currently, you can only defined a region with a gap where the function
value is 0. Here is an example:

Rene Brun

{
   TCanvas c1("c1","fit with gap",10,10,600,900);
   c1.Divide(1,3);
   c1.cd(1);
   TF1 fgap("fgap","(1+x+x*x)*(abs(x-3)>0.5)",0,5);
   fgap.Draw();
   fgap.SetNpx(1000);
   c1.cd(2);
   TF1 f1("f1","[0]*exp(-0.5*((x-[1])/[2])**2)+([3]+[4]*x+[5]*x*x)",0,5);
   f1.SetParameters(60,3,.3,1,1,1);
   f1.Draw();
   c1.cd(3);
   TH1F h("h","test",100,0,5);
   h.FillRandom("f1",10000); 
   TF1
f2("f2","[0]*exp(-0.5*((x-[1])/[2])**2)*(abs(x-3)<0.5)+([3]+[4]*x+[5]*x*x)*(abs(x-3)>0.5)",0,5);
   f2.SetParameters(60,3,.7,1,1,1);
   h->Fit("f2");
}

On Wed, 10 Oct 2001, Matthieu Guillo wrote:

> Hello Rooters,
> 
> I have an histogram with a signal on a top of some background. I would
> like to fit the signal with a Breit-Wigner and the background with a 2nd
> ordere polynomial.
> What I would like to do more precisely is to fit the background
> SIMULTNEOUSLY to the region below and above the signal. So either I need
> to know how to create a discontinuous function (not defined in the signal
> region: putting values to 0 will not do it), either I need to know how to
> fit 2 regions of the same function at the same time.
> I really want to fit the regions below and above at the same time, not
> doing a kind of averaging.
> 
> Does anybody know how to do that?
> 
> Thanks 
> 
> Matthieu Guillo
> University of South Carolina
> Thomas Jefferson National Laboratory
> Office 71 trailer 16
> Phone: 757-269-5551
> 



This archive was generated by hypermail 2b29 : Tue Jan 01 2002 - 17:51:02 MET