Fixed bug where ProjectionX includes an extra bin #1
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hi,
I noticed a bug where ParticleNetSF may produce one-dimensional histograms from different pT ranges that can overlap and cause double-counting.
According to this documentation, the method
TH2::ProjectionX
projectsTH2
histograms from the first bin to the last bin, inclusive. This means if the end pT range is at the boundary of a bin,h2d->GetYaxis()->FindBin(ymax)
will return the next bin and introduces extra bins to the projection.For example, if the X axis on the 2D template is separated into 50 bins from 200 - 1200 GeV, the bins will be 20 GeV wide. Based on the original code, if we set the pT range for 1D histogram to be 300 - 400,
ProjectionX
will include bins 6 (300-320) to 10 (380-400) and bin 11 (400-420), which is undesired.In this fix, I reduced the bin number so that the excess bin would not be included by the projection by accident. Should you have any questions about this PR please let me know.
Thanks!
Vichayanun