Empty bin content in ahistogram

I s there a way to “empty” the bin content and its associate error of a histogram?

The problem is the following… My histogram is the output of some calculations. In these calculations it’s possible to have NaN’s and inf’s. So far to overcome this I am doing the follwing

if ( isfinite(x) && isfinite(errx) ){ histo->SetBinContent(i, x); histo->SetBinError(i, errx); } else{ histo->SetBinContent(i, 1.e-15); histo->SetBinError(i, 1e.-15); }

The problem is that you can’t always be sure about that 1.e-15 is the right value. If For instance the values in the histogram are in the order of 1.e-16 then you set a bin content with a bigger value…

So I was wondering whether there is smarter way, something like “deleting” or “emptying” the bin.


why not to set it exactly to zero?

Because if your histogram contains negative values, you will get fake spike-like structures!

The way to do it is setting the bin content to 0.

Yes, along the Y axis. However, you seem to have a 1D histogram. Even if it has negative X values, setting bin content to 0 should do the trick, shouldn’t it?