Package hep.aida.ref
Class Histogram2D
java.lang.Object
hep.aida.ref.Histogram2D
- All Implemented Interfaces:
IHistogram,IHistogram2D,Serializable
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.
- Version:
- 1.0, 23/03/2000
- Author:
- Wolfgang Hoschek, Tony Johnson, and others.
- See Also:
-
Field Summary
FieldsFields inherited from interface hep.aida.IHistogram
OVERFLOW, serialVersionUID, UNDERFLOW -
Constructor Summary
ConstructorsConstructorDescriptionHistogram2D(String title, double[] xEdges, double[] yEdges) Creates a variable-width histogram.Histogram2D(String title, int xBins, double xMin, double xMax, int yBins, double yMin, double yMax) Creates a fixed-width histogram.Histogram2D(String title, IAxis xAxis, IAxis yAxis) Creates a histogram with the given axis binning. -
Method Summary
Modifier and TypeMethodDescriptionintNumber 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).doublebinError(int indexX, int indexY) The error on this bin.doublebinHeight(int indexX, int indexY) Total height of the corresponding bin (ie the sum of the weights in this bin).doublebinHeightX(int indexX) Equivalent to projectionX().binHeight(indexX).doublebinHeightY(int indexY) Equivalent to projectionY().binHeight(indexY).intReturns 1 for one-dimensional histograms, 2 for two-dimensional histograms, and so on.intentries()Number of in-range entries in the histogram.doubleNumber of equivalent entries.intNumber of under and overflow entries in the histogram.voidfill(double x, double y) Fill the histogram with weight 1.voidfill(double x, double y, double weight) Fill the histogram with specified weight.protected IHistogram1DinternalSliceX(String title, int indexY1, int indexY2) The precise meaning of the arguments to the public slice methods is somewhat ambiguous, so we define this internal slice method and clearly specify its arguments.protected IHistogram1DinternalSliceY(String title, int indexX1, int indexX2) The precise meaning of the arguments to the public slice methods is somewhat ambiguous, so we define this internal slice method and clearly specify its arguments.doublemeanX()Returns the mean of the histogram, as calculated on filling-time projected on the X axis.doublemeanY()Returns the mean of the histogram, as calculated on filling-time projected on the Y axis.int[]Indexes of the in-range bins containing the smallest and largest binHeight(), respectively.Create a projection parallel to the X axis.Create a projection parallel to the Y axis.voidreset()Reset contents; as if just constructed.doublermsX()Returns the rms of the histogram as calculated on filling-time projected on the X axis.doublermsY()Returns the rms of the histogram as calculated on filling-time projected on the Y axis.sliceX(int indexY) Slice parallel to the Y axis at bin indexY and one bin wide.sliceX(int indexY1, int indexY2) Create a slice parallel to the axis X axis, between "indexY1" and "indexY2" (inclusive).sliceY(int indexX) Slice parallel to the X axis at bin indexX and one bin wide.sliceY(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.doubleSum of all (both in-range and under/overflow) bin heights in the histogram.doubleSum of in-range bin heights in the histogram.doubleSum of under/overflow bin heights in the histogram.title()Title of the histogram (will be set only in the constructor).xAxis()Return the X axis.yAxis()Return the Y axis.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface hep.aida.IHistogram
dimensions, entries, extraEntries, sumBinHeights, sumExtraBinHeights, titleMethods inherited from interface hep.aida.IHistogram2D
binEntriesX, binEntriesY, binHeightX, binHeightY, minMaxBins, projectionX, projectionY, sliceX, sliceX, sliceY, sliceY, xAxis, yAxis
-
Field Details
-
xAxis
-
yAxis
-
-
Constructor Details
-
Histogram2D
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:
IllegalArgumentException- if xEdges.length invalid input: '<' 1 || yEdges.length invalid input: '<' 1.
-
Histogram2D
public Histogram2D(String title, int xBins, double xMin, double xMax, int yBins, double yMin, double 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.
-
Histogram2D
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 Details
-
allEntries
public int allEntries()Description copied from interface:IHistogramNumber of all entries in all (both in-range and under/overflow) bins in the histogram.- Specified by:
allEntriesin interfaceIHistogram
-
binEntries
public int binEntries(int indexX, int indexY) Description copied from interface:IHistogram2DThe number of entries (ie the number of times fill was called for this bin).- Specified by:
binEntriesin interfaceIHistogram2D- 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 double binError(int indexX, int indexY) Description copied from interface:IHistogram2DThe error on this bin.- Specified by:
binErrorin interfaceIHistogram2D- 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 double binHeight(int indexX, int indexY) Description copied from interface:IHistogram2DTotal height of the corresponding bin (ie the sum of the weights in this bin).- Specified by:
binHeightin interfaceIHistogram2D- 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 double equivalentBinEntries()Description copied from interface:IHistogramNumber of equivalent entries.- Specified by:
equivalentBinEntriesin interfaceIHistogram- Returns:
- SUM[ weight ] ^ 2 / SUM[ weight^2 ].
-
fill
public void fill(double x, double y) Description copied from interface:IHistogram2DFill the histogram with weight 1.- Specified by:
fillin interfaceIHistogram2D
-
fill
public void fill(double x, double y, double weight) Description copied from interface:IHistogram2DFill the histogram with specified weight.- Specified by:
fillin interfaceIHistogram2D
-
internalSliceX
The precise meaning of the arguments to the public slice methods is somewhat ambiguous, so we define this internal slice method and clearly specify its arguments.Note 0indexY1 and indexY2 use our INTERNAL bin numbering scheme Note 1The slice is done between indexY1 and indexY2 INCLUSIVE Note 2indexY1 and indexY2 may include the use of under and over flow bins Note 3There is no note 3 (yet)
-
internalSliceY
The precise meaning of the arguments to the public slice methods is somewhat ambiguous, so we define this internal slice method and clearly specify its arguments.Note 0indexX1 and indexX2 use our INTERNAL bin numbering scheme Note 1The slice is done between indexX1 and indexX2 INCLUSIVE Note 2indexX1 and indexX2 may include the use of under and over flow bins Note 3There is no note 3 (yet)
-
meanX
public double meanX()Description copied from interface:IHistogram2DReturns the mean of the histogram, as calculated on filling-time projected on the X axis.- Specified by:
meanXin interfaceIHistogram2D
-
meanY
public double meanY()Description copied from interface:IHistogram2DReturns the mean of the histogram, as calculated on filling-time projected on the Y axis.- Specified by:
meanYin interfaceIHistogram2D
-
reset
public void reset()Description copied from interface:IHistogramReset contents; as if just constructed.- Specified by:
resetin interfaceIHistogram
-
rmsX
public double rmsX()Description copied from interface:IHistogram2DReturns the rms of the histogram as calculated on filling-time projected on the X axis.- Specified by:
rmsXin interfaceIHistogram2D
-
rmsY
public double rmsY()Description copied from interface:IHistogram2DReturns the rms of the histogram as calculated on filling-time projected on the Y axis.- Specified by:
rmsYin interfaceIHistogram2D
-
sumAllBinHeights
public double sumAllBinHeights()Description copied from interface:IHistogramSum of all (both in-range and under/overflow) bin heights in the histogram.- Specified by:
sumAllBinHeightsin interfaceIHistogram
-
binEntriesX
public int binEntriesX(int indexX) Description copied from interface:IHistogram2DEquivalent to projectionX().binEntries(indexX).- Specified by:
binEntriesXin interfaceIHistogram2D
-
binEntriesY
public int binEntriesY(int indexY) Description copied from interface:IHistogram2DEquivalent to projectionY().binEntries(indexY).- Specified by:
binEntriesYin interfaceIHistogram2D
-
binHeightX
public double binHeightX(int indexX) Description copied from interface:IHistogram2DEquivalent to projectionX().binHeight(indexX).- Specified by:
binHeightXin interfaceIHistogram2D
-
binHeightY
public double binHeightY(int indexY) Description copied from interface:IHistogram2DEquivalent to projectionY().binHeight(indexY).- Specified by:
binHeightYin interfaceIHistogram2D
-
dimensions
public int dimensions()Description copied from interface:IHistogramReturns 1 for one-dimensional histograms, 2 for two-dimensional histograms, and so on.- Specified by:
dimensionsin interfaceIHistogram
-
entries
public int entries()Description copied from interface:IHistogramNumber of in-range entries in the histogram.- Specified by:
entriesin interfaceIHistogram
-
extraEntries
public int extraEntries()Description copied from interface:IHistogramNumber of under and overflow entries in the histogram.- Specified by:
extraEntriesin interfaceIHistogram
-
minMaxBins
public int[] minMaxBins()Description copied from interface:IHistogram2DIndexes of the in-range bins containing the smallest and largest binHeight(), respectively.- Specified by:
minMaxBinsin interfaceIHistogram2D- Returns:
- {minBinX,minBinY, maxBinX,maxBinY}.
-
projectionX
Description copied from interface:IHistogram2DCreate a projection parallel to the X axis. Equivalent to sliceX(UNDERFLOW,OVERFLOW).- Specified by:
projectionXin interfaceIHistogram2D
-
projectionY
Description copied from interface:IHistogram2DCreate a projection parallel to the Y axis. Equivalent to sliceY(UNDERFLOW,OVERFLOW).- Specified by:
projectionYin interfaceIHistogram2D
-
sliceX
Description copied from interface:IHistogram2DSlice parallel to the Y axis at bin indexY and one bin wide. Equivalent to sliceX(indexY,indexY).- Specified by:
sliceXin interfaceIHistogram2D
-
sliceX
Description copied from interface:IHistogram2DCreate 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 interfaceIHistogram2D
-
sliceY
Description copied from interface:IHistogram2DSlice parallel to the X axis at bin indexX and one bin wide. Equivalent to sliceY(indexX,indexX).- Specified by:
sliceYin interfaceIHistogram2D
-
sliceY
Description copied from interface:IHistogram2DCreate 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 interfaceIHistogram2D
-
sumBinHeights
public double sumBinHeights()Description copied from interface:IHistogramSum of in-range bin heights in the histogram.- Specified by:
sumBinHeightsin interfaceIHistogram
-
sumExtraBinHeights
public double sumExtraBinHeights()Description copied from interface:IHistogramSum of under/overflow bin heights in the histogram.- Specified by:
sumExtraBinHeightsin interfaceIHistogram
-
xAxis
Description copied from interface:IHistogram2DReturn the X axis.- Specified by:
xAxisin interfaceIHistogram2D
-
yAxis
Description copied from interface:IHistogram2DReturn the Y axis.- Specified by:
yAxisin interfaceIHistogram2D
-
title
Description copied from interface:IHistogramTitle of the histogram (will be set only in the constructor).- Specified by:
titlein interfaceIHistogram
-