|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.ObjectHistogram
public class Histogram
A simple histogram class. It can be used to accumulate a histogram and calculate statistical information about it.
Constructor Summary | |
---|---|
Histogram(java.lang.String name,
int nbins,
double min,
double max)
Constructor which sets name, number of bins, and range. |
Method Summary | |
---|---|
double |
area()
Calculate area of histogram, excluding over/underflows, by summing the contents of all the bins |
int |
entries()
Get number of entries in the histogram. |
void |
fill(double x)
Enter data into the histogram. |
double[] |
getArray()
This method gives you the bin contents in the form of an array. |
boolean |
getDebug()
Get debug flag. |
double |
max()
Get upper end of histogram range |
double |
mean()
The mean estimator is calculated from the average of the bin centres, weighted by their content. |
double |
min()
Get lower end of histogram range |
java.lang.String |
name()
Get the name of the histogram. |
int |
numberOfBins()
Get the number of bins in the histogram. |
double |
overflow()
Get the height of the overflow bin. |
void |
setDebug(boolean flag)
Set debug flag. |
void |
show()
Print the histogram data to the console. |
double |
underflow()
Get the height of the underflow bin. |
void |
writeToFile(java.lang.String fileName)
Save the histogram data to a file. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Histogram(java.lang.String name, int nbins, double min, double max)
name
- Give the histogram a text namenbins
- the number of bins the histogram should have. The
range specified by min and max will be divided up into this
many bins.min
- the minimum of the range covered by the histogram binsmax
- the maximum value of the range covered by the histogram binsMethod Detail |
---|
public void fill(double x)
x
- is the value to add in to the histogrampublic double mean()
public double area()
public void writeToFile(java.lang.String fileName) throws java.io.IOException
fileName
- name of the file to write the histogram to.
Note this must be valid for your operating system,
e.g. a unix filename might not work under windows
java.io.IOException
- if file cannot be opened or written to.public void show()
public int entries()
public java.lang.String name()
public int numberOfBins()
public double min()
public double max()
public double overflow()
public double underflow()
public double[] getArray()
public void setDebug(boolean flag)
flag
- debug flag (true or false)public boolean getDebug()
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |