Package de.gsi.dataset.spi
Class AbstractHistogram
- java.lang.Object
-
- de.gsi.dataset.spi.AbstractStylable<D>
-
- de.gsi.dataset.spi.AbstractDataSet<AbstractHistogram>
-
- de.gsi.dataset.spi.AbstractHistogram
-
- All Implemented Interfaces:
DataSet,DataSetMetaData,EventSource,Histogram,java.io.Serializable
- Direct Known Subclasses:
Histogram,Histogram2
public abstract class AbstractHistogram extends AbstractDataSet<AbstractHistogram> implements Histogram
- Author:
- rstein
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected double[][]axisBinsprotected double[]dataprotected int[]nAxisBins-
Fields inherited from interface de.gsi.dataset.DataSetMetaData
TAG_GAIN_RANGE, TAG_OVERSHOOT, TAG_UNDERSHOOT
-
-
Constructor Summary
Constructors Constructor Description AbstractHistogram(java.lang.String name, double[] xBins)Creates histogram with name and range [minX, maxX]AbstractHistogram(java.lang.String name, int nBins, double minX, double maxX)Creates histogram with name and range [minX, maxX]AbstractHistogram(java.lang.String name, int nBinsX, double minX, double maxX, int nBinsY, double minY, double maxY)Creates 2D histogram with name and ranges [minX, maxX] and [minY, maxY]
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddBinContent(int bin)Increment bin content by 1.voidaddBinContent(int bin, double w)Increment bin content by a weight w.intfindBin(double x, double y)intfindBin(double x, double y, double z)intfindBin(int dimIndex, double x)protected intfindNextLargerIndex(double[] bin, double value)doublegetBinCenter(int dimIndex, int binIndex)doublegetBinContent(int bin)Return content of bin number bin.intgetDataCount(int dimIndex)Get the number of data points in the data set for a specific dimension.booleanisEquiDistant()voidreset()reset histogram content-
Methods inherited from class de.gsi.dataset.spi.AbstractDataSet
addDataLabel, addDataStyle, autoNotification, binarySearch, clearMetaInfo, equalDataLabels, equalEditConstraints, equalErrorValues, equalMetaData, equals, equals, equalValues, fireInvalidated, getAxisDescriptions, getDataLabel, getDataLabelMap, getDataStyleMap, getDimension, getEditConstraints, getErrorList, getIndex, getInfoList, getMetaInfo, getName, getStyle, getThis, getWarningList, hashCode, lock, minNeigbourSearchX, recomputeLimits, removeDataLabel, removeStyle, setEditConstraints, setName, toString, updateEventListener
-
Methods inherited from class de.gsi.dataset.spi.AbstractStylable
getStyle, setStyle
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface de.gsi.dataset.DataSet
get, getAxisDescription, getAxisDescriptions, getDataCount, getDataLabel, getDimension, getIndex, getName, getStyle, getStyle, getValue, getValues, lock, recomputeLimits, setStyle
-
Methods inherited from interface de.gsi.dataset.DataSetMetaData
getErrorList, getInfoList, getMetaInfo, getWarningList
-
Methods inherited from interface de.gsi.dataset.event.EventSource
addListener, autoNotification, invokeListener, invokeListener, invokeListener, isAutoNotification, removeListener, updateEventListener
-
-
-
-
Constructor Detail
-
AbstractHistogram
public AbstractHistogram(java.lang.String name, double[] xBins)Creates histogram with name and range [minX, maxX]- Parameters:
name- of the data setsxBins- the initial bin array (defines [minX, maxX] and nBins)
-
AbstractHistogram
public AbstractHistogram(java.lang.String name, int nBins, double minX, double maxX)Creates histogram with name and range [minX, maxX]- Parameters:
name- of the data setsnBins- number of binsminX- minimum of rangemaxX- maximum of range
-
AbstractHistogram
public AbstractHistogram(java.lang.String name, int nBinsX, double minX, double maxX, int nBinsY, double minY, double maxY)Creates 2D histogram with name and ranges [minX, maxX] and [minY, maxY]- Parameters:
name- of the data setsnBinsX- number of horizontal binsminX- minimum of horizontal rangemaxX- maximum of horizontal rangenBinsY- number of vertical binsminY- minimum of vertical rangemaxY- maximum of vertical range
-
-
Method Detail
-
addBinContent
public void addBinContent(int bin)
Description copied from interface:HistogramIncrement bin content by 1. More...- Specified by:
addBinContentin interfaceHistogram- Parameters:
bin- global bin ID
-
addBinContent
public void addBinContent(int bin, double w)Description copied from interface:HistogramIncrement bin content by a weight w. More...- Specified by:
addBinContentin interfaceHistogram- Parameters:
bin- global bin IDw- weight
-
findBin
public int findBin(double x, double y)
-
findBin
public int findBin(double x, double y, double z)
-
findBin
public int findBin(int dimIndex, double x)
-
findNextLargerIndex
protected int findNextLargerIndex(double[] bin, double value)
-
getBinCenter
public double getBinCenter(int dimIndex, int binIndex)- Specified by:
getBinCenterin interfaceHistogram- Parameters:
dimIndex- the dimension indexbinIndex- index- Returns:
- bin centre for axis with dimIndex
-
getBinContent
public double getBinContent(int bin)
Description copied from interface:HistogramReturn content of bin number bin. Convention for numbering bins For all histogram types: nbins, xlow, xup bin = 0; underflow bin bin = 1; first bin with low-edge xlow INCLUDED bin = nbins; last bin with upper-edge xup EXCLUDED bin = nbins+1; overflow bin- Specified by:
getBinContentin interfaceHistogram- Parameters:
bin- the index- Returns:
- numeric bin content
-
getDataCount
public int getDataCount(int dimIndex)
Description copied from interface:DataSetGet the number of data points in the data set for a specific dimension.- Specified by:
getDataCountin interfaceDataSet- Parameters:
dimIndex- the dimension index (ie. '0' equals 'X', '1' equals 'Y')- Returns:
- the number of data points
-
isEquiDistant
public boolean isEquiDistant()
- Specified by:
isEquiDistantin interfaceHistogram- Returns:
- true if bin sizes are equal
-
-