Java Reference
In-Depth Information
public int getValue (int bin
-
num)
{
if (bin
-
num
<
0)
return fUnderflows;
else if (bin
-
num >= fNumBins)
return fOverflows;
else
return fBins[bin
-
num];
}
/**
* Get the average and standard deviation of the
* distribution of entries.
* @return double array
*/
public double [] getStats () {
int total
=
0;
double wt
-
total
=
0;
double wt
-
total2
=
0;
double [] stat
=
new double[2];
double bin
-
width
=
fRange/fNumBins;
for (int i
=
0; i
<
fNumBins; i++)
{
total +
=
fBins[i];
double bin
-
mid
=
(i - 0.5) * bin
-
width + fLo;
wt
-
total +
=
fBins[i] * bin
-
mid;
wt
-
total2 +
=
fBins[i] * bin
-
mid * bin
-
mid;
}
if (total > 0) {
stat[0] = wt
-
total / total;
double av2 = wt
-
total2 / total;
stat[1]
=
Math.sqrt (av2 - stat[0] * stat[0]);
}
else
{
stat[0]
=
0.0;
stat[1]
=
-1.0;
}
return stat;
} // getStats
/**
* Create the histogram from a user provided array
* along with the under and overflow values.
Search WWH ::
Custom Search