Error bars in histogram


_ROOT Version:5.34

Hi, How can I fill a two dimensional histogram with error bars (x,y,dy)?
I can not use TGraph because I need to re-bin it.

Thanks


Hi,

with the Fill method, which also has a signature with 2 values.

Best,
P

Thanks, you mean I can not have a histogram with the error values?

Hi,

I think all histograms store the error on the bin content.

Best,
P

Thanks, I have a graph filled with x,y and the error of y. The graph has fluctuation. Is it possible to have less fluctuation? (For histogram I decrease the fluctuation with re-bin but for graph I don’t know what should I do).

Hi,

I don’t think it’s possible unless you develop a smoothing procedure yourself.

Cheers,
P

Hi,
you talk about " two dimensional histogram"
I guess you want either:

TH2F * h2 =...
Int_t bin = h2->FindBin(x,y);
h2->SetBinContent(bin, cont);
h2->SetBinError(bin, dy);

or may be 1 dim only?

TH1F *h1 = ...
Int_t bin = h1->FindBin(x);
h1->SetBinContent(bin, y);
h1->SetBinError(bin,dy);

Be careful about choosing the binning!
Otto

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.