Skip to content

Commit 7e8d8e9

Browse files
committed
Build with fit pars fixes
1 parent 765a8d8 commit 7e8d8e9

File tree

2 files changed

+20
-16
lines changed

2 files changed

+20
-16
lines changed

build/jsroot.js

Lines changed: 19 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -69007,6 +69007,9 @@ ensureTCanvas: ensureTCanvas
6900769007
* @private
6900869008
*/
6900969009

69010+
const kTakeStyle = BIT(17);
69011+
69012+
6901069013
class TPavePainter extends ObjectPainter {
6901169014

6901269015
/** @summary constructor
@@ -69179,15 +69182,15 @@ class TPavePainter extends ObjectPainter {
6917969182

6918069183
if (isFunc(main?.fillStatistic)) {
6918169184
let dostat = parseInt(pt.fOptStat), dofit = parseInt(pt.fOptFit);
69182-
if (!Number.isInteger(dostat)) dostat = gStyle.fOptStat;
69183-
if (!Number.isInteger(dofit)) dofit = gStyle.fOptFit;
69185+
if (!Number.isInteger(dostat) || pt.TestBit(kTakeStyle)) dostat = gStyle.fOptStat;
69186+
if (!Number.isInteger(dofit)|| pt.TestBit(kTakeStyle)) dofit = gStyle.fOptFit;
6918469187

6918569188
// we take statistic from main painter
6918669189
if (main.fillStatistic(this, dostat, dofit)) {
6918769190
// adjust the size of the stats box with the number of lines
6918869191
const nlines = pt.fLines?.arr.length || 0;
6918969192
if ((nlines > 0) && !this.moved_interactive && ((gStyle.fStatFontSize <= 0) || (gStyle.fStatFont % 10 === 3)))
69190-
pt.fY1NDC = pt.fY2NDC - nlines * 0.25 * gStyle.fStatH;
69193+
pt.fY1NDC = Math.max(0.02, pt.fY2NDC - ((nlines < 8) ? nlines * 0.25 * gStyle.fStatH : nlines * 0.025));
6919169194
}
6919269195
}
6919369196
}
@@ -70167,19 +70170,19 @@ class TPavePainter extends ObjectPainter {
7016770170
}
7016870171

7016970172
/** @summary Fill function parameters */
70170-
fillFunctionStat(f1, dofit) {
70173+
fillFunctionStat(f1, dofit, ndim = 1) {
7017170174
if (!dofit || !f1) return false;
7017270175

70173-
const print_fval = dofit % 10,
70174-
print_ferrors = Math.floor(dofit/10) % 10,
70175-
print_fchi2 = Math.floor(dofit/100) % 10,
70176-
print_fprob = Math.floor(dofit/1000) % 10;
70176+
const print_fval = (ndim === 1) ? dofit % 10 : 1,
70177+
print_ferrors = (ndim === 1) ? Math.floor(dofit/10) % 10 : 1,
70178+
print_fchi2 = (ndim === 1) ? Math.floor(dofit/100) % 10 : 1,
70179+
print_fprob = (ndim === 1) ? Math.floor(dofit/1000) % 10 : 0;
7017770180

70178-
if (print_fchi2 > 0)
70179-
this.addText('#chi^2 / ndf = ' + this.format(f1.fChisquare, 'fit') + ' / ' + f1.fNDF);
70180-
if (print_fprob > 0)
70181+
if (print_fchi2)
70182+
this.addText('#chi^{2} / ndf = ' + this.format(f1.fChisquare, 'fit') + ' / ' + f1.fNDF);
70183+
if (print_fprob)
7018170184
this.addText('Prob = ' + this.format(Prob(f1.fChisquare, f1.fNDF)));
70182-
if (print_fval > 0) {
70185+
if (print_fval) {
7018370186
for (let n = 0; n < f1.GetNumPars(); ++n) {
7018470187
const parname = f1.GetParName(n);
7018570188
let parvalue = f1.GetParValue(n), parerr = f1.GetParError(n);
@@ -70191,7 +70194,7 @@ class TPavePainter extends ObjectPainter {
7019170194
parerr = this.format(f1.GetParError(n), '4.2g');
7019270195
}
7019370196

70194-
if ((print_ferrors > 0) && parerr)
70197+
if (print_ferrors && parerr)
7019570198
this.addText(`${parname} = ${parvalue} #pm ${parerr}`);
7019670199
else
7019770200
this.addText(`${parname} = ${parvalue}`);
@@ -73908,7 +73911,7 @@ let TH2Painter$2 = class TH2Painter extends THistPainter {
7390873911
stat.addText(`${get(0)} | ${get(1)} | ${get(2)}`);
7390973912
}
7391073913

73911-
if (dofit) stat.fillFunctionStat(this.findFunction(clTF2), dofit);
73914+
if (dofit) stat.fillFunctionStat(this.findFunction(clTF2), dofit, 2);
7391273915

7391373916
return true;
7391473917
}
@@ -78373,7 +78376,7 @@ let TH1Painter$2 = class TH1Painter extends THistPainter {
7837378376
stat.addText(`Kurtosis = ${stat.format(data.kurtx)}`);
7837478377
}
7837578378

78376-
if (dofit) stat.fillFunctionStat(this.findFunction(clTF1), dofit);
78379+
if (dofit) stat.fillFunctionStat(this.findFunction(clTF1), dofit, 1);
7837778380

7837878381
return true;
7837978382
}
@@ -79877,7 +79880,7 @@ class TH3Painter extends THistPainter {
7987779880
}
7987879881

7987979882

79880-
if (dofit) stat.fillFunctionStat(this.findFunction('TF3'), dofit);
79883+
if (dofit) stat.fillFunctionStat(this.findFunction('TF3'), dofit, 3);
7988179884

7988279885
return true;
7988379886
}

changes.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
3. Introduce "logv" draw option for TH3, use logarithmic scale for box volume
77
4. Support color palette drawing for TH3
88
5. Support "[cutg]" draw option for TH2/TF2 surface plots
9+
6. Fix - fit pars in stats box, correct #chi^{2} symbol
910

1011

1112
## Changes in 7.5.1

0 commit comments

Comments
 (0)