Package cnuphys.splot.pdata
Class HistoData
java.lang.Object
cnuphys.splot.pdata.HistoData
Xontainer class for histogram data
- Author:
- heddle
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
add
(double value) Add a value to the histogramvoid
clear()
Clear the databoolean
Check whether we draw sqrt(n) statistical errorsdouble[]
Get the means and standard deviationint
getBin
(double val) Get the bin for a given value.double
getBinMaxX
(int bin) Get the "x" value of the right side of the bindouble
getBinMidValue
(int bin) Get the "x" value of the middle of the bindouble
getBinMinX
(int bin) Get the "x" value of the left side of the binlong
getCount
(int bin) Get the count for a given binlong[]
Get the countslong
Get the number on entries in the histogram (excluding underflows and overflows)double
getMaxX()
Get the minimum value.double
getMaxY()
Get the maximum "y" value.double
getMinX()
Get the minimum "x" value.double
getMinY()
Get the minimum "y" value.getName()
Get the name of the histogramint
Get the number of binslong
Get the number on entries in the histogram that were above the maximum valuestatic Polygon
GetPolygon
(PlotCanvas canvas, HistoData histo) Get the drawing polygonlong
Get the total count, including the unders and overslong
Get the number on entries in the histogram that were below the minimum valuevoid
setCount
(double val, int count) Set a bin to a given countvoid
setDrawStatisticalErrors
(boolean statErr) Set whether we draw sqrt(n) statistical errorsvoid
Set the namevoid
setRmsInHistoLegend
(boolean useRMS) Set whether we use rms or sigma in histogram legendsstatStr()
A string displaying some statisticsstatic String
statusString
(PlotCanvas canvas, HistoData histo, Point mousePoint, Point2D.Double wp) Get the status stringboolean
Check whether we use rms or sigma in histogram legends
-
Field Details
-
XmlRootElementName
The XML root element name- See Also:
-
-
Constructor Details
-
HistoData
The data for a 1D histogram where the bin spacing is uniform.- Parameters:
name
- the curve name of the histogramvalMin
- the data minvalMax
- the data maxnumBins
- the number of bins
-
HistoData
The data for a 1D histogram where the bin spacing is arbitrary (i.e., not uniform)- Parameters:
name
- the curve name of the histogramgrid
- the binning grid. It must be in ascending order but is otherwise arbitrary.
-
-
Method Details
-
getName
Get the name of the histogram- Returns:
- the name of the histogram
-
setName
Set the name- Parameters:
name
- the name of the histogram
-
getCount
public long getCount(int bin) Get the count for a given bin- Parameters:
bin
- the bin- Returns:
- the count for that bin
-
clear
public void clear()Clear the data -
getBasicStatistics
public double[] getBasicStatistics()Get the means and standard deviation- Returns:
- an array with the mean in the 0 index, standard deviation is the 1 index, and rms in the 2 index
-
statStr
A string displaying some statistics- Parameters:
useRms
- iftrue
use rms, else use sigma- Returns:
- a string with statistics info
-
getCounts
public long[] getCounts()Get the counts- Returns:
- the counts array
-
getGoodCount
public long getGoodCount()Get the number on entries in the histogram (excluding underflows and overflows)- Returns:
- the number of entries
-
getTotalCount
public long getTotalCount()Get the total count, including the unders and overs- Returns:
- the total count, including the unders and overs
-
getUnderCount
public long getUnderCount()Get the number on entries in the histogram that were below the minimum value- Returns:
- the number of entries below the minimum value
-
getOverCount
public long getOverCount()Get the number on entries in the histogram that were above the maximum value- Returns:
- the number of entries above the maximum value
-
getMinX
public double getMinX()Get the minimum "x" value. This is the minimum of the range being binned.- Returns:
- the minimum "x" value
-
getMaxX
public double getMaxX()Get the minimum value. This is the maximum of the range being binned.- Returns:
- the minimum "x" value
-
getMinY
public double getMinY()Get the minimum "y" value. The y axis corresponds to "counts", so this always returns 0 -
getMaxY
public double getMaxY()Get the maximum "y" value. The y axis corresponds to "counts", so this always returns the count of the bin with the most counts. -
add
public void add(double value) Add a value to the histogram- Parameters:
value
- the value to ad
-
setCount
public void setCount(double val, int count) Set a bin to a given count- Parameters:
val
- the x val will determine bincount
- the count
-
getNumberBins
public int getNumberBins()Get the number of bins- Returns:
- the number of bins
-
getBinMidValue
public double getBinMidValue(int bin) Get the "x" value of the middle of the bin- Parameters:
bin
- the bin in question- Returns:
- the mid value
-
getBinMaxX
public double getBinMaxX(int bin) Get the "x" value of the right side of the bin- Parameters:
bin
- the bin in question- Returns:
- the x value of the right side
-
getBinMinX
public double getBinMinX(int bin) Get the "x" value of the left side of the bin- Parameters:
bin
- the bin in question- Returns:
- the x value of the left side
-
getBin
public int getBin(double val) Get the bin for a given value. Will return the zero-based bin number or UNDERFLOW or OVERFLOW.- Parameters:
val
- the value.- Returns:
- return the bin: [0..(numBin-1)] or an error
-
statusString
public static String statusString(PlotCanvas canvas, HistoData histo, Point mousePoint, Point2D.Double wp) Get the status string- Parameters:
canvas
- the plot canvashisto
- the histo data objectmousePoint
- where the mouse iswp
- the data coordinates of the mouse- Returns:
- a status string
-
GetPolygon
Get the drawing polygon- Parameters:
canvas
- the drawing canvashisto
- the histo data- Returns:
- the polygon
-
setRmsInHistoLegend
public void setRmsInHistoLegend(boolean useRMS) Set whether we use rms or sigma in histogram legends- Parameters:
useRMS
- iftrue
use rms, else use sigma
-
useRmsInHistoLegend
public boolean useRmsInHistoLegend()Check whether we use rms or sigma in histogram legends- Returns:
true
use rms, else use sigma
-
setDrawStatisticalErrors
public void setDrawStatisticalErrors(boolean statErr) Set whether we draw sqrt(n) statistical errors- Parameters:
statErr
- iftrue
draw statistical errors
-
drawStatisticalErrors
public boolean drawStatisticalErrors()Check whether we draw sqrt(n) statistical errors- Returns:
true
iftrue
draw statistical errors
-
maxBinString
-