File tree Expand file tree Collapse file tree 3 files changed +15
-23
lines changed Expand file tree Collapse file tree 3 files changed +15
-23
lines changed Original file line number Diff line number Diff line change 24672467 res . meanx = stat_sumx1 / stat_sum0 ;
24682468 res . meany = stat_sumy1 / stat_sum0 ;
24692469 res . meanz = stat_sumz1 / stat_sum0 ;
2470- res . rmsx = Math . sqrt ( stat_sumx2 / stat_sum0 - res . meanx * res . meanx ) ;
2471- res . rmsy = Math . sqrt ( stat_sumy2 / stat_sum0 - res . meany * res . meany ) ;
2472- res . rmsz = Math . sqrt ( stat_sumz2 / stat_sum0 - res . meanz * res . meanz ) ;
2470+ res . rmsx = Math . sqrt ( Math . max ( 0 , stat_sumx2 / stat_sum0 - res . meanx * res . meanx ) ) ;
2471+ res . rmsy = Math . sqrt ( Math . max ( 0 , stat_sumy2 / stat_sum0 - res . meany * res . meany ) ) ;
2472+ res . rmsz = Math . sqrt ( Math . max ( 0 , stat_sumz2 / stat_sum0 - res . meanz * res . meanz ) ) ;
24732473 }
24742474
24752475 res . integral = stat_sum0 ;
Original file line number Diff line number Diff line change 70947094 if ( stat_sumw > 0 ) {
70957095 res . meanx = stat_sumwx / stat_sumw ;
70967096 res . meany = stat_sumwy / stat_sumw ;
7097- res . rmsx = Math . sqrt ( stat_sumwx2 / stat_sumw - res . meanx * res . meanx ) ;
7098- res . rmsy = Math . sqrt ( stat_sumwy2 / stat_sumw - res . meany * res . meany ) ;
7097+ res . rmsx = Math . sqrt ( Math . max ( 0 , stat_sumwx2 / stat_sumw - res . meanx * res . meanx ) ) ;
7098+ res . rmsy = Math . sqrt ( Math . max ( 0 , stat_sumwy2 / stat_sumw - res . meany * res . meany ) ) ;
70997099 }
71007100
71017101 if ( xmax != null ) {
71447144 if ( print_entries > 0 )
71457145 pave . AddText ( "Entries = " + stat . Format ( data . entries , "entries" ) ) ;
71467146
7147- if ( print_mean > 0 ) {
7147+ if ( print_mean > 0 )
71487148 pave . AddText ( "Mean = " + stat . Format ( data . meanx ) ) ;
7149- }
71507149
7151- if ( print_rms > 0 ) {
7150+ if ( print_rms > 0 )
71527151 pave . AddText ( "Std Dev = " + stat . Format ( data . rmsx ) ) ;
7153- }
71547152
7155- if ( print_under > 0 ) {
7156- var res = ( this . histo . fArray . length > 0 ) ? this . histo . fArray [ 0 ] : 0 ;
7157- pave . AddText ( "Underflow = " + stat . Format ( res , "entries" ) ) ;
7158- }
7153+ if ( print_under > 0 )
7154+ pave . AddText ( "Underflow = " + stat . Format ( ( this . histo . fArray . length > 0 ) ? this . histo . fArray [ 0 ] : 0 , "entries" ) ) ;
71597155
7160- if ( print_over > 0 ) {
7161- var res = ( this . histo . fArray . length > 0 ) ? this . histo . fArray [ this . histo . fArray . length - 1 ] : 0 ;
7162- pave . AddText ( "Overflow = " + stat . Format ( res , "entries" ) ) ;
7163- }
7156+ if ( print_over > 0 )
7157+ pave . AddText ( "Overflow = " + stat . Format ( ( this . histo . fArray . length > 0 ) ? this . histo . fArray [ this . histo . fArray . length - 1 ] : 0 , "entries" ) ) ;
71647158
7165- if ( print_integral > 0 ) {
7159+ if ( print_integral > 0 )
71667160 pave . AddText ( "Integral = " + stat . Format ( data . integral , "entries" ) ) ;
7167- }
71687161
71697162 if ( print_skew > 0 )
71707163 pave . AddText ( "Skew = <not avail>" ) ;
Original file line number Diff line number Diff line change 33083308 if ( stat_sum0 > 0 ) {
33093309 res . meanx = stat_sumx1 / stat_sum0 ;
33103310 res . meany = stat_sumy1 / stat_sum0 ;
3311- res . rmsx = Math . sqrt ( stat_sumx2 / stat_sum0 - res . meanx * res . meanx ) ;
3312- res . rmsy = Math . sqrt ( stat_sumy2 / stat_sum0 - res . meany * res . meany ) ;
3311+ res . rmsx = Math . sqrt ( Math . max ( 0 , stat_sumx2 / stat_sum0 - res . meanx * res . meanx ) ) ;
3312+ res . rmsy = Math . sqrt ( Math . max ( 0 , stat_sumy2 / stat_sum0 - res . meany * res . meany ) ) ;
33133313 }
33143314
33153315 if ( res . wmax === null ) res . wmax = 0 ;
33513351 pave . AddText ( "Std Dev y = " + stat . Format ( data . rmsy ) ) ;
33523352 }
33533353
3354- if ( print_integral > 0 ) {
3354+ if ( print_integral > 0 )
33553355 pave . AddText ( "Integral = " + stat . Format ( data . matrix [ 4 ] , "entries" ) ) ;
3356- }
33573356
33583357 if ( print_skew > 0 ) {
33593358 pave . AddText ( "Skewness x = <undef>" ) ;
You can’t perform that action at this time.
0 commit comments