Re: Need some advice

From: Nick van Eijndhoven (Nick@fys.ruu.nl)
Date: Wed Jun 04 1997 - 10:04:29 MEST


*** Nick van Eijndhoven wrote :
> 
> > 
> Hi Rene,
> Last night I found a solution for the problem which for me is elegant
> enough and provides all flexibility.
> Here follows the essential part of my code, which not only subtracts the
> histos but also determines the errors.
> Since this is a rather simple thing to do, I would say there is no need
> for a new member function.
> 
> 
>  siga1 = new TH1F("siga1","Signal A1",nbl,0.,2.);
>  fp_fit = new TF1("fp_fit","pol0",0.3,2.);
> 
>  float err1,val1;
>  float err2,val2;
>  float err,val;
>  float x,fx;
>  for (int i=0; i<nbl; i++)
>  {
>   val1=cnvtlgc->GetBinContent(i+1)/nclgc;
>   val2=pnvtlgc->GetBinContent(i+1)/nplgc;
>   x=cnvtlgc->GetBinCenter(i+1);
>   fx=fp_fit->Eval(x);
>   val=val1-fx*val2;
>   err1=cnvtlgc->GetBinError(i+1)/nclgc;
>   err2=pnvtlgc->GetBinError(i+1)/nplgc;
>   err=sqrt((err1*err1)+(err2*err2));
>   siga1->Fill(x,val);
>   siga1->SetBinError(i+1,err);
>  }
> 

I forgot to mention that of course the fp_fit represents a fit to another
histo, i.e. 'hist->Fit("fp_fit","rq0,"",0.3,2.)' which should of course
follow directly after the creation of fp_fit.

*----------------------------------------------------------------------*
 Dr. Nick van Eijndhoven                Department of Subatomic Physics
 email : nick@fys.ruu.nl                Utrecht University / NIKHEF
 tel. +31-30-2532331 (direct)           P.O. Box 80.000
 tel. +31-30-2531492 (secr.)            NL-3508 TA Utrecht
 fax. +31-30-2518689                    The Netherlands
 WWW : http://www.fys.ruu.nl/~nick      Office : Ornstein lab. 172
 ----------------------------------------------------------------------
 tel. +41-22-7679751 (direct)           CERN PPE Division / ALICE exp.
 tel. +41-22-7675857 (secr.)            CH-1211 Geneva 23
 fax. +41-22-7679480                    Switzerland
 CERN beep : 13+7294                    Office : B 160 1-012
*----------------------------------------------------------------------*



This archive was generated by hypermail 2b29 : Tue Jan 04 2000 - 00:26:19 MET