Re: [ROOT] zero errors in profile and fit

From: Rene Brun (Rene.Brun@cern.ch)
Date: Tue Jan 30 2001 - 08:39:49 MET


Hi Miro,
I fixed a rounding problem affecting a test in TPfile::GetBinError
between versions 2.25/03 and version 3.00. See the two versions at:

http://root.cern.ch/root/html225/src/TProfile.cxx.html#TProfile:GetBinError
http://root.cern.ch/root/htmldoc/src/TProfile.cxx.html#TProfile:GetBinError

Note that points with zerro error are not taken into account in a fit.

Rene Brun


Miroslav Helbich wrote:
> 
> Hi,
> 
>  when I profile plots, I get sometimes zero errors for bins with just one
> entry. However, documentation says, this shouldn't happen for neither of
> options "","s","i". I looked at the source code of
> "TProfile::GetBinError(Int_t bin)" function on the web and this case
> seems not to be implemented there. Anyway, that causes the problem in the
> fits, because the zero error forces the function to go through the point
> and ignores the others. Would it be possible to have a Fit option to
> ignore points with zero errors?
> 
>                                         Miro
> 
> I'm working with version 2.25/03 on SuSe Linux
> 
> Macro demonstrating this feature:
> {
> TNtuple *ntuple = new TNtuple("ntuple","ntuple","x:y");
> for (Int_t i=0;i<11;i++) {
>   ntuple->Fill(gRandom->Rndm(),2*gRandom->Rndm());
> }
> TH2D *histo = new TH2D("histo","my histo",20,0.,2.,20,0.,2.);
> ntuple->Draw("x:y>>histo");
> TProfile *histo_pfx = histo->ProfileX();
> 
> for (Int_t i=0;i<=histo_pfx->GetNbinsX()+2;i++) {
>   printf("bin=%d, entries=%d, content=%f,
> error=%f\n",i,histo_pfx->GetBinEntries(i),histo_pfx->GetBinContent(i),histo_pfx->GetBinError(i));
> }
> histo_pfx->Draw();
> }
> 
> Output: (part only)
> bin=5, entries=0, content=0.000000, error=0.000000
> bin=6, entries=0, content=0.000000, error=0.000000
> bin=7, entries=1, content=0.850000, error=0.000000
> bin=8, entries=1, content=0.650000, error=0.000000
> bin=9, entries=1, content=0.050000, error=0.000000



This archive was generated by hypermail 2b29 : Fri Jun 08 2001 - 11:50:58 MEST