@@ -4,7 +4,7 @@ const version_id = 'dev',
4
4
5
5
/** @summary version date
6
6
* @desc Release date in format day/month/year like '14/04/2022' */
7
- version_date = '24 /09/2025' ,
7
+ version_date = '25 /09/2025' ,
8
8
9
9
/** @summary version id and date
10
10
* @desc Produced by concatenation of {@link version_id} and {@link version_date}
@@ -142,7 +142,8 @@ if ((typeof document !== 'undefined') && (typeof window !== 'undefined') && (typ
142
142
* @return {Number } 0 - not array, 1 - regular array, 2 - typed array
143
143
* @private */
144
144
function isArrayProto ( proto ) {
145
- if ( ( proto . length < 14 ) || proto . indexOf ( '[object ' ) ) return 0 ;
145
+ if ( ( proto . length < 14 ) || proto . indexOf ( '[object ' ) )
146
+ return 0 ;
146
147
const p = proto . indexOf ( 'Array]' ) ;
147
148
if ( ( p < 0 ) || ( p !== proto . length - 6 ) )
148
149
return 0 ;
@@ -165,9 +166,12 @@ const constants = {
165
166
/** @summary Use SVG rendering, slow, imprecise and not interactive, not recommended */
166
167
SVG : 3 ,
167
168
fromString ( s ) {
168
- if ( ( s === 'webgl' ) || ( s === 'gl' ) ) return this . WebGL ;
169
- if ( s === 'img' ) return this . WebGLImage ;
170
- if ( s === 'svg' ) return this . SVG ;
169
+ if ( ( s === 'webgl' ) || ( s === 'gl' ) )
170
+ return this . WebGL ;
171
+ if ( s === 'img' )
172
+ return this . WebGLImage ;
173
+ if ( s === 'svg' )
174
+ return this . SVG ;
171
175
return this . Default ;
172
176
}
173
177
} ,
@@ -186,8 +190,10 @@ const constants = {
186
190
EmbedSVG : 3 ,
187
191
/** @summary Convert string values into number */
188
192
fromString ( s ) {
189
- if ( s === 'embed' ) return this . Embed ;
190
- if ( s === 'overlay' ) return this . Overlay ;
193
+ if ( s === 'embed' )
194
+ return this . Embed ;
195
+ if ( s === 'overlay' )
196
+ return this . Overlay ;
191
197
return this . Default ;
192
198
}
193
199
} ,
@@ -577,13 +583,15 @@ function BIT(n) { return 1 << n; }
577
583
* @return {object } cloned object
578
584
* @private */
579
585
function clone ( src , map , nofunc ) {
580
- if ( ! src ) return null ;
586
+ if ( ! src )
587
+ return null ;
581
588
582
589
if ( ! map )
583
590
map = { obj : [ ] , clones : [ ] , nofunc } ;
584
591
else {
585
592
const i = map . obj . indexOf ( src ) ;
586
- if ( i >= 0 ) return map . clones [ i ] ;
593
+ if ( i >= 0 )
594
+ return map . clones [ i ] ;
587
595
}
588
596
589
597
const arr_kind = isArrayProto ( Object . prototype . toString . apply ( src ) ) ;
@@ -639,7 +647,8 @@ let addMethods = null;
639
647
* @param {object|string } json object where references will be replaced
640
648
* @return {object } parsed object */
641
649
function parse ( json ) {
642
- if ( ! json ) return null ;
650
+ if ( ! json )
651
+ return null ;
643
652
644
653
const obj = isStr ( json ) ? JSON . parse ( json ) : json , map = [ ] ;
645
654
let newfmt ;
@@ -771,7 +780,8 @@ function parse(json) {
771
780
* @param {string } json string to parse
772
781
* @return {Array } array of parsed elements */
773
782
function parseMulti ( json ) {
774
- if ( ! json ) return null ;
783
+ if ( ! json )
784
+ return null ;
775
785
const arr = JSON . parse ( json ) ;
776
786
if ( arr ?. length ) {
777
787
for ( let i = 0 ; i < arr . length ; ++ i )
@@ -793,13 +803,16 @@ function parseMulti(json) {
793
803
* obj.fTitle = 'New histogram title';
794
804
* let json = toJSON(obj); */
795
805
function toJSON ( obj , spacing ) {
796
- if ( ! isObject ( obj ) ) return '' ;
806
+ if ( ! isObject ( obj ) )
807
+ return '' ;
797
808
798
809
const map = [ ] , // map of stored objects
799
810
copy_value = value => {
800
- if ( isFunc ( value ) ) return undefined ;
811
+ if ( isFunc ( value ) )
812
+ return undefined ;
801
813
802
- if ( ( value === undefined ) || ( value === null ) || ! isObject ( value ) ) return value ;
814
+ if ( ( value === undefined ) || ( value === null ) || ! isObject ( value ) )
815
+ return value ;
803
816
804
817
// typed array need to be converted into normal array, otherwise looks strange
805
818
if ( isArrayProto ( Object . prototype . toString . apply ( value ) ) > 0 ) {
@@ -811,7 +824,8 @@ function toJSON(obj, spacing) {
811
824
812
825
// this is how reference is code
813
826
const refid = map . indexOf ( value ) ;
814
- if ( refid >= 0 ) return { $ref : refid } ;
827
+ if ( refid >= 0 )
828
+ return { $ref : refid } ;
815
829
816
830
const ks = Object . keys ( value ) , len = ks . length , tgt = { } ;
817
831
@@ -857,13 +871,15 @@ function decodeUrl(url) {
857
871
} ;
858
872
859
873
if ( ! url || ! isStr ( url ) ) {
860
- if ( settings . IgnoreUrlOptions || ( typeof document === 'undefined' ) ) return res ;
874
+ if ( settings . IgnoreUrlOptions || ( typeof document === 'undefined' ) )
875
+ return res ;
861
876
url = document . URL ;
862
877
}
863
878
res . url = url ;
864
879
865
880
const p1 = url . indexOf ( '?' ) ;
866
- if ( p1 < 0 ) return res ;
881
+ if ( p1 < 0 )
882
+ return res ;
867
883
url = decodeURI ( url . slice ( p1 + 1 ) ) ;
868
884
869
885
while ( url ) {
@@ -899,8 +915,10 @@ function decodeUrl(url) {
899
915
/** @summary Find function with given name
900
916
* @private */
901
917
function findFunction ( name ) {
902
- if ( isFunc ( name ) ) return name ;
903
- if ( ! isStr ( name ) ) return null ;
918
+ if ( isFunc ( name ) )
919
+ return name ;
920
+ if ( ! isStr ( name ) )
921
+ return null ;
904
922
const names = name . split ( '.' ) ;
905
923
let elem = globalThis ;
906
924
@@ -1537,11 +1555,15 @@ function create(typename, target) {
1537
1555
* h1.fXaxis.fLabelSize = 0.02; */
1538
1556
function createHistogram ( typename , nbinsx , nbinsy , nbinsz ) {
1539
1557
const histo = create ( typename ) ;
1540
- if ( ! histo . fXaxis || ! histo . fYaxis || ! histo . fZaxis ) return null ;
1558
+ if ( ! histo . fXaxis || ! histo . fYaxis || ! histo . fZaxis )
1559
+ return null ;
1541
1560
histo . fName = 'hist' ; histo . fTitle = 'title' ;
1542
- if ( nbinsx ) extend ( histo . fXaxis , { fNbins : nbinsx , fXmin : 0 , fXmax : nbinsx } ) ;
1543
- if ( nbinsy ) extend ( histo . fYaxis , { fNbins : nbinsy , fXmin : 0 , fXmax : nbinsy } ) ;
1544
- if ( nbinsz ) extend ( histo . fZaxis , { fNbins : nbinsz , fXmin : 0 , fXmax : nbinsz } ) ;
1561
+ if ( nbinsx )
1562
+ extend ( histo . fXaxis , { fNbins : nbinsx , fXmin : 0 , fXmax : nbinsx } ) ;
1563
+ if ( nbinsy )
1564
+ extend ( histo . fYaxis , { fNbins : nbinsy , fXmin : 0 , fXmax : nbinsy } ) ;
1565
+ if ( nbinsz )
1566
+ extend ( histo . fZaxis , { fNbins : nbinsz , fXmin : 0 , fXmax : nbinsz } ) ;
1545
1567
switch ( parseInt ( typename [ 2 ] ) ) {
1546
1568
case 1 : if ( nbinsx ) histo . fNcells = nbinsx + 2 ; break ;
1547
1569
case 2 : if ( nbinsx && nbinsy ) histo . fNcells = ( nbinsx + 2 ) * ( nbinsy + 2 ) ; break ;
@@ -1573,9 +1595,12 @@ function setHistogramTitle(histo, title) {
1573
1595
else {
1574
1596
const arr = title . split ( ';' ) ;
1575
1597
histo . fTitle = arr [ 0 ] ;
1576
- if ( arr . length > 1 ) histo . fXaxis . fTitle = arr [ 1 ] ;
1577
- if ( arr . length > 2 ) histo . fYaxis . fTitle = arr [ 2 ] ;
1578
- if ( arr . length > 3 ) histo . fZaxis . fTitle = arr [ 3 ] ;
1598
+ if ( arr . length > 1 )
1599
+ histo . fXaxis . fTitle = arr [ 1 ] ;
1600
+ if ( arr . length > 2 )
1601
+ histo . fYaxis . fTitle = arr [ 2 ] ;
1602
+ if ( arr . length > 3 )
1603
+ histo . fZaxis . fTitle = arr [ 3 ] ;
1579
1604
}
1580
1605
}
1581
1606
@@ -1660,7 +1685,8 @@ const methodsCache = {};
1660
1685
function getMethods ( typename , obj ) {
1661
1686
let m = methodsCache [ typename ] ;
1662
1687
const has_methods = ( m !== undefined ) ;
1663
- if ( ! has_methods ) m = { } ;
1688
+ if ( ! has_methods )
1689
+ m = { } ;
1664
1690
1665
1691
// Due to binary I/O such TObject methods may not be set for derived classes
1666
1692
// Therefore when methods requested for given object, check also that basic methods are there
@@ -1672,7 +1698,8 @@ function getMethods(typename, obj) {
1672
1698
}
1673
1699
}
1674
1700
1675
- if ( has_methods ) return m ;
1701
+ if ( has_methods )
1702
+ return m ;
1676
1703
1677
1704
if ( ( typename === clTList ) || ( typename === clTHashList ) ) {
1678
1705
m . Clear = function ( ) {
@@ -1728,10 +1755,11 @@ function getMethods(typename, obj) {
1728
1755
return ( this . fNames && this . fNames [ n ] ) ? this . fNames [ n ] : `p${ n } ` ;
1729
1756
} ;
1730
1757
m . GetParValue = function ( n ) {
1731
- if ( this . fParams ?. fParameters ) return this . fParams . fParameters [ n ] ;
1732
- if ( this . fFormula ?. fClingParameters ) return this . fFormula . fClingParameters [ n ] ;
1733
- if ( this . fParams ) return this . fParams [ n ] ;
1734
- return undefined ;
1758
+ if ( this . fParams ?. fParameters )
1759
+ return this . fParams . fParameters [ n ] ;
1760
+ if ( this . fFormula ?. fClingParameters )
1761
+ return this . fFormula . fClingParameters [ n ] ;
1762
+ return this . fParams ? this . fParams [ n ] : undefined ;
1735
1763
} ;
1736
1764
m . GetParError = function ( n ) {
1737
1765
return this . fParErrors ? this . fParErrors [ n ] : undefined ;
@@ -1820,11 +1848,12 @@ function getMethods(typename, obj) {
1820
1848
m . Divide = function ( nx , ny , xmargin = 0.01 , ymargin = 0.01 , color = 0 ) {
1821
1849
if ( ! ny ) {
1822
1850
const ndiv = nx ;
1823
- if ( ndiv < 2 ) return this ;
1851
+ if ( ndiv < 2 )
1852
+ return this ;
1824
1853
nx = ny = Math . round ( Math . sqrt ( ndiv ) ) ;
1825
1854
if ( nx * ny < ndiv ) nx += 1 ;
1826
1855
}
1827
- if ( nx * ny < 2 )
1856
+ if ( nx * ny < 2 )
1828
1857
return 0 ;
1829
1858
this . fPrimitives . Clear ( ) ;
1830
1859
const dy = 1 / ny , dx = 1 / nx ;
@@ -1873,7 +1902,8 @@ function getMethods(typename, obj) {
1873
1902
m . getBin = function ( x , y , z ) { return ( x + ( this . fXaxis . fNbins + 2 ) * ( y + ( this . fYaxis . fNbins + 2 ) * z ) ) ; } ;
1874
1903
m . getBinContent = function ( x , y , z ) {
1875
1904
const bin = this . getBin ( x , y , z ) ;
1876
- if ( bin < 0 || bin >= this . fNcells || this . fBinEntries [ bin ] < 1e-300 ) return 0 ;
1905
+ if ( bin < 0 || bin >= this . fNcells || this . fBinEntries [ bin ] < 1e-300 )
1906
+ return 0 ;
1877
1907
return this . fArray ? this . fArray [ bin ] / this . fBinEntries [ bin ] : 0 ;
1878
1908
} ;
1879
1909
m . getBinEntries = function ( x , y , z ) {
@@ -1884,7 +1914,8 @@ function getMethods(typename, obj) {
1884
1914
m . getBin = function ( x , y ) { return ( x + ( this . fXaxis . fNbins + 2 ) * y ) ; } ;
1885
1915
m . getBinContent = function ( x , y ) {
1886
1916
const bin = this . getBin ( x , y ) ;
1887
- if ( bin < 0 || bin >= this . fNcells || this . fBinEntries [ bin ] < 1e-300 ) return 0 ;
1917
+ if ( bin < 0 || bin >= this . fNcells || this . fBinEntries [ bin ] < 1e-300 )
1918
+ return 0 ;
1888
1919
return this . fArray ? this . fArray [ bin ] / this . fBinEntries [ bin ] : 0 ;
1889
1920
} ;
1890
1921
m . getBinEntries = function ( x , y ) {
@@ -1894,15 +1925,17 @@ function getMethods(typename, obj) {
1894
1925
} else {
1895
1926
m . getBin = function ( x ) { return x ; } ;
1896
1927
m . getBinContent = function ( bin ) {
1897
- if ( bin < 0 || bin >= this . fNcells || this . fBinEntries [ bin ] < 1e-300 ) return 0 ;
1928
+ if ( bin < 0 || bin >= this . fNcells || this . fBinEntries [ bin ] < 1e-300 )
1929
+ return 0 ;
1898
1930
return this . fArray ? this . fArray [ bin ] / this . fBinEntries [ bin ] : 0 ;
1899
1931
} ;
1900
1932
m . getBinEntries = function ( bin ) {
1901
1933
return ( bin < 0 ) || ( bin >= this . fNcells ) ? 0 : this . fBinEntries [ bin ] ;
1902
1934
} ;
1903
1935
}
1904
1936
m . getBinEffectiveEntries = function ( bin ) {
1905
- if ( bin < 0 || bin >= this . fNcells ) return 0 ;
1937
+ if ( bin < 0 || bin >= this . fNcells )
1938
+ return 0 ;
1906
1939
const sumOfWeights = this . fBinEntries [ bin ] ;
1907
1940
if ( ! this . fBinSumw2 || this . fBinSumw2 . length !== this . fNcells )
1908
1941
// this can happen when reading an old file
@@ -1911,28 +1944,32 @@ function getMethods(typename, obj) {
1911
1944
return ( sumOfWeightsSquare > 0 ) ? sumOfWeights * sumOfWeights / sumOfWeightsSquare : 0 ;
1912
1945
} ;
1913
1946
m . getBinError = function ( bin ) {
1914
- if ( bin < 0 || bin >= this . fNcells ) return 0 ;
1947
+ if ( bin < 0 || bin >= this . fNcells )
1948
+ return 0 ;
1915
1949
const cont = this . fArray [ bin ] , // sum of bin w *y
1916
1950
sum = this . fBinEntries [ bin ] , // sum of bin weights
1917
1951
err2 = this . fSumw2 [ bin ] , // sum of bin w * y^2
1918
1952
neff = this . getBinEffectiveEntries ( bin ) ; // (sum of w)^2 / (sum of w^2)
1919
- if ( sum < 1e-300 ) return 0 ; // for empty bins
1953
+ if ( sum < 1e-300 )
1954
+ return 0 ; // for empty bins
1920
1955
const EErrorType = { kERRORMEAN : 0 , kERRORSPREAD : 1 , kERRORSPREADI : 2 , kERRORSPREADG : 3 } ;
1921
1956
// case the values y are gaussian distributed y +/- sigma and w = 1/sigma^2
1922
1957
if ( this . fErrorMode === EErrorType . kERRORSPREADG )
1923
1958
return 1.0 / Math . sqrt ( sum ) ;
1924
1959
// compute variance in y (eprim2) and standard deviation in y (eprim)
1925
1960
const contsum = cont / sum , eprim = Math . sqrt ( Math . abs ( err2 / sum - contsum ** 2 ) ) ;
1926
1961
if ( this . fErrorMode === EErrorType . kERRORSPREADI ) {
1927
- if ( eprim ) return eprim / Math . sqrt ( neff ) ;
1962
+ if ( eprim )
1963
+ return eprim / Math . sqrt ( neff ) ;
1928
1964
// in case content y is an integer (so each my has an error +/- 1/sqrt(12)
1929
1965
// when the std(y) is zero
1930
1966
return 1.0 / Math . sqrt ( 12 * neff ) ;
1931
1967
}
1932
1968
// if approximate compute the sums (of w, wy and wy2) using all the bins
1933
1969
// when the variance in y is zero
1934
1970
// case option 'S' return standard deviation in y
1935
- if ( this . fErrorMode === EErrorType . kERRORSPREAD ) return eprim ;
1971
+ if ( this . fErrorMode === EErrorType . kERRORSPREAD )
1972
+ return eprim ;
1936
1973
// default case : fErrorMode = kERRORMEAN
1937
1974
// return standard error on the mean of y
1938
1975
return eprim / Math . sqrt ( neff ) ;
0 commit comments