hep.aida.tfloat.ref
Class FloatHistogram2D
- java.lang.Object
-
- hep.aida.tfloat.ref.FloatHistogram2D
-
- All Implemented Interfaces:
- FloatIHistogram, FloatIHistogram2D, java.io.Serializable
public class FloatHistogram2D extends java.lang.Object implements FloatIHistogram2D
A reference implementation of hep.aida.IHistogram2D. The goal is to provide a clear implementation rather than the most efficient implementation. However, performance seems fine - filling 6 * 10^5 points/sec, both using FixedAxis or VariableAxis.- See Also:
- Serialized Form
-
-
Field Summary
-
Fields inherited from interface hep.aida.tfloat.FloatIHistogram
OVERFLOW, UNDERFLOW
-
-
Constructor Summary
Constructors Constructor and Description FloatHistogram2D(java.lang.String title, float[] xEdges, float[] yEdges)Creates a variable-width histogram.FloatHistogram2D(java.lang.String title, FloatIAxis xAxis, FloatIAxis yAxis)Creates a histogram with the given axis binning.FloatHistogram2D(java.lang.String title, int xBins, float xMin, float xMax, int yBins, float yMin, float yMax)Creates a fixed-width histogram.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description intallEntries()Number of all entries in all (both in-range and under/overflow) bins in the histogram.intbinEntries(int indexX, int indexY)The number of entries (ie the number of times fill was called for this bin).intbinEntriesX(int indexX)Equivalent to projectionX().binEntries(indexX).intbinEntriesY(int indexY)Equivalent to projectionY().binEntries(indexY).floatbinError(int indexX, int indexY)The error on this bin.floatbinHeight(int indexX, int indexY)Total height of the corresponding bin (ie the sum of the weights in this bin).floatbinHeightX(int indexX)Equivalent to projectionX().binHeight(indexX).floatbinHeightY(int indexY)Equivalent to projectionY().binHeight(indexY).intdimensions()Returns 1 for one-dimensional histograms, 2 for two-dimensional histograms, and so on.intentries()Number of in-range entries in the histogram.floatequivalentBinEntries()Number of equivalent entries.intextraEntries()Number of under and overflow entries in the histogram.voidfill(float x, float y)Fill the histogram with weight 1.voidfill(float x, float y, float weight)Fill the histogram with specified weight.floatmeanX()Returns the mean of the histogram, as calculated on filling-time projected on the X axis.floatmeanY()Returns the mean of the histogram, as calculated on filling-time projected on the Y axis.int[]minMaxBins()Indexes of the in-range bins containing the smallest and largest binHeight(), respectively.FloatIHistogram1DprojectionX()Create a projection parallel to the X axis.FloatIHistogram1DprojectionY()Create a projection parallel to the Y axis.voidreset()Reset contents; as if just constructed.floatrmsX()Returns the rms of the histogram as calculated on filling-time projected on the X axis.floatrmsY()Returns the rms of the histogram as calculated on filling-time projected on the Y axis.FloatIHistogram1DsliceX(int indexY)Slice parallel to the Y axis at bin indexY and one bin wide.FloatIHistogram1DsliceX(int indexY1, int indexY2)Create a slice parallel to the axis X axis, between "indexY1" and "indexY2" (inclusive).FloatIHistogram1DsliceY(int indexX)Slice parallel to the X axis at bin indexX and one bin wide.FloatIHistogram1DsliceY(int indexX1, int indexX2)Create a slice parallel to the axis Y axis, between "indexX1" and "indexX2" (inclusive) The returned IHistogram1D represents an instantaneous snapshot of the histogram at the time the slice was created.floatsumAllBinHeights()Sum of all (both in-range and under/overflow) bin heights in the histogram.floatsumBinHeights()Sum of in-range bin heights in the histogram.floatsumExtraBinHeights()Sum of under/overflow bin heights in the histogram.java.lang.Stringtitle()Title of the histogram (will be set only in the constructor).FloatIAxisxAxis()Return the X axis.FloatIAxisyAxis()Return the Y axis.-
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface hep.aida.tfloat.FloatIHistogram2D
binEntriesX, binEntriesY, binHeightX, binHeightY, minMaxBins, projectionX, projectionY, sliceX, sliceX, sliceY, sliceY, xAxis, yAxis
-
Methods inherited from interface hep.aida.tfloat.FloatIHistogram
dimensions, entries, extraEntries, sumBinHeights, sumExtraBinHeights, title
-
-
-
-
Constructor Detail
-
FloatHistogram2D
public FloatHistogram2D(java.lang.String title, float[] xEdges, float[] yEdges)Creates a variable-width histogram. Example: xEdges = (0.2, 1.0, 5.0, 6.0), yEdges = (-5, 0, 7) yields 3*2 in-range bins.- Parameters:
title- The histogram title.xEdges- the bin boundaries the x-axis shall have; must be sorted ascending and must not contain multiple identical elements.yEdges- the bin boundaries the y-axis shall have; must be sorted ascending and must not contain multiple identical elements.- Throws:
java.lang.IllegalArgumentException- if xEdges.length < 1 || yEdges.length < 1.
-
FloatHistogram2D
public FloatHistogram2D(java.lang.String title, int xBins, float xMin, float xMax, int yBins, float yMin, float yMax)Creates a fixed-width histogram.- Parameters:
title- The histogram title.xBins- The number of bins on the X axis.xMin- The minimum value on the X axis.xMax- The maximum value on the X axis.yBins- The number of bins on the Y axis.yMin- The minimum value on the Y axis.yMax- The maximum value on the Y axis.
-
FloatHistogram2D
public FloatHistogram2D(java.lang.String title, FloatIAxis xAxis, FloatIAxis yAxis)Creates a histogram with the given axis binning.- Parameters:
title- The histogram title.xAxis- The x-axis description to be used for binning.yAxis- The y-axis description to be used for binning.
-
-
Method Detail
-
allEntries
public int allEntries()
Description copied from interface:FloatIHistogramNumber of all entries in all (both in-range and under/overflow) bins in the histogram.- Specified by:
allEntriesin interfaceFloatIHistogram
-
binEntries
public int binEntries(int indexX, int indexY)Description copied from interface:FloatIHistogram2DThe number of entries (ie the number of times fill was called for this bin).- Specified by:
binEntriesin interfaceFloatIHistogram2D- Parameters:
indexX- the x bin number (0...Nx-1) or OVERFLOW or UNDERFLOW.indexY- the y bin number (0...Ny-1) or OVERFLOW or UNDERFLOW.
-
binError
public float binError(int indexX, int indexY)Description copied from interface:FloatIHistogram2DThe error on this bin.- Specified by:
binErrorin interfaceFloatIHistogram2D- Parameters:
indexX- the x bin number (0...Nx-1) or OVERFLOW or UNDERFLOW.indexY- the y bin number (0...Ny-1) or OVERFLOW or UNDERFLOW.
-
binHeight
public float binHeight(int indexX, int indexY)Description copied from interface:FloatIHistogram2DTotal height of the corresponding bin (ie the sum of the weights in this bin).- Specified by:
binHeightin interfaceFloatIHistogram2D- Parameters:
indexX- the x bin number (0...Nx-1) or OVERFLOW or UNDERFLOW.indexY- the y bin number (0...Ny-1) or OVERFLOW or UNDERFLOW.
-
equivalentBinEntries
public float equivalentBinEntries()
Description copied from interface:FloatIHistogramNumber of equivalent entries.- Specified by:
equivalentBinEntriesin interfaceFloatIHistogram- Returns:
- SUM[ weight ] ^ 2 / SUM[ weight^2 ].
-
fill
public void fill(float x, float y)Description copied from interface:FloatIHistogram2DFill the histogram with weight 1.- Specified by:
fillin interfaceFloatIHistogram2D
-
fill
public void fill(float x, float y, float weight)Description copied from interface:FloatIHistogram2DFill the histogram with specified weight.- Specified by:
fillin interfaceFloatIHistogram2D
-
meanX
public float meanX()
Description copied from interface:FloatIHistogram2DReturns the mean of the histogram, as calculated on filling-time projected on the X axis.- Specified by:
meanXin interfaceFloatIHistogram2D
-
meanY
public float meanY()
Description copied from interface:FloatIHistogram2DReturns the mean of the histogram, as calculated on filling-time projected on the Y axis.- Specified by:
meanYin interfaceFloatIHistogram2D
-
reset
public void reset()
Description copied from interface:FloatIHistogramReset contents; as if just constructed.- Specified by:
resetin interfaceFloatIHistogram
-
rmsX
public float rmsX()
Description copied from interface:FloatIHistogram2DReturns the rms of the histogram as calculated on filling-time projected on the X axis.- Specified by:
rmsXin interfaceFloatIHistogram2D
-
rmsY
public float rmsY()
Description copied from interface:FloatIHistogram2DReturns the rms of the histogram as calculated on filling-time projected on the Y axis.- Specified by:
rmsYin interfaceFloatIHistogram2D
-
sumAllBinHeights
public float sumAllBinHeights()
Description copied from interface:FloatIHistogramSum of all (both in-range and under/overflow) bin heights in the histogram.- Specified by:
sumAllBinHeightsin interfaceFloatIHistogram
-
binEntriesX
public int binEntriesX(int indexX)
Description copied from interface:FloatIHistogram2DEquivalent to projectionX().binEntries(indexX).- Specified by:
binEntriesXin interfaceFloatIHistogram2D
-
binEntriesY
public int binEntriesY(int indexY)
Description copied from interface:FloatIHistogram2DEquivalent to projectionY().binEntries(indexY).- Specified by:
binEntriesYin interfaceFloatIHistogram2D
-
binHeightX
public float binHeightX(int indexX)
Description copied from interface:FloatIHistogram2DEquivalent to projectionX().binHeight(indexX).- Specified by:
binHeightXin interfaceFloatIHistogram2D
-
binHeightY
public float binHeightY(int indexY)
Description copied from interface:FloatIHistogram2DEquivalent to projectionY().binHeight(indexY).- Specified by:
binHeightYin interfaceFloatIHistogram2D
-
dimensions
public int dimensions()
Description copied from interface:FloatIHistogramReturns 1 for one-dimensional histograms, 2 for two-dimensional histograms, and so on.- Specified by:
dimensionsin interfaceFloatIHistogram
-
entries
public int entries()
Description copied from interface:FloatIHistogramNumber of in-range entries in the histogram.- Specified by:
entriesin interfaceFloatIHistogram
-
extraEntries
public int extraEntries()
Description copied from interface:FloatIHistogramNumber of under and overflow entries in the histogram.- Specified by:
extraEntriesin interfaceFloatIHistogram
-
minMaxBins
public int[] minMaxBins()
Description copied from interface:FloatIHistogram2DIndexes of the in-range bins containing the smallest and largest binHeight(), respectively.- Specified by:
minMaxBinsin interfaceFloatIHistogram2D- Returns:
- {minBinX,minBinY, maxBinX,maxBinY}.
-
projectionX
public FloatIHistogram1D projectionX()
Description copied from interface:FloatIHistogram2DCreate a projection parallel to the X axis. Equivalent to sliceX(UNDERFLOW,OVERFLOW).- Specified by:
projectionXin interfaceFloatIHistogram2D
-
projectionY
public FloatIHistogram1D projectionY()
Description copied from interface:FloatIHistogram2DCreate a projection parallel to the Y axis. Equivalent to sliceY(UNDERFLOW,OVERFLOW).- Specified by:
projectionYin interfaceFloatIHistogram2D
-
sliceX
public FloatIHistogram1D sliceX(int indexY)
Description copied from interface:FloatIHistogram2DSlice parallel to the Y axis at bin indexY and one bin wide. Equivalent to sliceX(indexY,indexY).- Specified by:
sliceXin interfaceFloatIHistogram2D
-
sliceX
public FloatIHistogram1D sliceX(int indexY1, int indexY2)
Description copied from interface:FloatIHistogram2DCreate a slice parallel to the axis X axis, between "indexY1" and "indexY2" (inclusive). The returned IHistogram1D represents an instantaneous snapshot of the histogram at the time the slice was created.- Specified by:
sliceXin interfaceFloatIHistogram2D
-
sliceY
public FloatIHistogram1D sliceY(int indexX)
Description copied from interface:FloatIHistogram2DSlice parallel to the X axis at bin indexX and one bin wide. Equivalent to sliceY(indexX,indexX).- Specified by:
sliceYin interfaceFloatIHistogram2D
-
sliceY
public FloatIHistogram1D sliceY(int indexX1, int indexX2)
Description copied from interface:FloatIHistogram2DCreate a slice parallel to the axis Y axis, between "indexX1" and "indexX2" (inclusive) The returned IHistogram1D represents an instantaneous snapshot of the histogram at the time the slice was created.- Specified by:
sliceYin interfaceFloatIHistogram2D
-
sumBinHeights
public float sumBinHeights()
Description copied from interface:FloatIHistogramSum of in-range bin heights in the histogram.- Specified by:
sumBinHeightsin interfaceFloatIHistogram
-
sumExtraBinHeights
public float sumExtraBinHeights()
Description copied from interface:FloatIHistogramSum of under/overflow bin heights in the histogram.- Specified by:
sumExtraBinHeightsin interfaceFloatIHistogram
-
xAxis
public FloatIAxis xAxis()
Description copied from interface:FloatIHistogram2DReturn the X axis.- Specified by:
xAxisin interfaceFloatIHistogram2D
-
yAxis
public FloatIAxis yAxis()
Description copied from interface:FloatIHistogram2DReturn the Y axis.- Specified by:
yAxisin interfaceFloatIHistogram2D
-
title
public java.lang.String title()
Description copied from interface:FloatIHistogramTitle of the histogram (will be set only in the constructor).- Specified by:
titlein interfaceFloatIHistogram
-
-
DMelt 3.0 © DataMelt by jWork.ORG