Skip to content

Commit 6bdf060

Browse files
committed
Fix - do not account inf/nan values in histogram statistic in tree draw
1 parent 8aaf3ea commit 6bdf060

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

modules/tree.mjs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1227,7 +1227,7 @@ class TDrawSelector extends TSelector {
12271227
let bin = this.x.GetBin(xvalue);
12281228
this.hist.fArray[bin] += weight;
12291229

1230-
if (!this.x.lbls) {
1230+
if (!this.x.lbls && Number.isFinite(xvalue)) {
12311231
this.hist.fTsumw += weight;
12321232
this.hist.fTsumwx += weight * xvalue;
12331233
this.hist.fTsumwx2 += weight * xvalue * xvalue;
@@ -1240,7 +1240,7 @@ class TDrawSelector extends TSelector {
12401240
ybin = this.y.GetBin(yvalue);
12411241

12421242
this.hist.fArray[xbin + (this.x.nbins + 2) * ybin] += weight;
1243-
if (!this.x.lbls && !this.y.lbls) {
1243+
if (!this.x.lbls && !this.y.lbls && Number.isFinite(xvalue) && Number.isFinite(yvalue)) {
12441244
this.hist.fTsumw += weight;
12451245
this.hist.fTsumwx += weight * xvalue;
12461246
this.hist.fTsumwy += weight * yvalue;
@@ -1253,11 +1253,11 @@ class TDrawSelector extends TSelector {
12531253
/** @summary Fill 3D histogram */
12541254
fill3DHistogram(xvalue, yvalue, zvalue, weight) {
12551255
let xbin = this.x.GetBin(xvalue),
1256-
ybin = this.y.GetBin(yvalue),
1257-
zbin = this.z.GetBin(zvalue);
1256+
ybin = this.y.GetBin(yvalue),
1257+
zbin = this.z.GetBin(zvalue);
12581258

12591259
this.hist.fArray[xbin + (this.x.nbins + 2) * (ybin + (this.y.nbins + 2) * zbin)] += weight;
1260-
if (!this.x.lbls && !this.y.lbls && !this.z.lbls) {
1260+
if (!this.x.lbls && !this.y.lbls && !this.z.lbls && Number.isFinite(xvalue) && Number.isFinite(yvalue) && Number.isFinite(zvalue)) {
12611261
this.hist.fTsumw += weight;
12621262
this.hist.fTsumwx += weight * xvalue;
12631263
this.hist.fTsumwy += weight * yvalue;

0 commit comments

Comments
 (0)