Package hep.aida.ref
Class Histogram1D
java.lang.Object
hep.aida.ref.Histogram1D
- All Implemented Interfaces:
IHistogram,IHistogram1D,Serializable
A reference implementation of hep.aida.IHistogram1D.
The goal is to provide a clear implementation rather than the most efficient implementation.
However, performance seems fine - filling 1.2 * 10^6 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
ConstructorsConstructorDescriptionHistogram1D(String title, double[] edges) Creates a variable-width histogram.Histogram1D(String title, int bins, double min, double max) Creates a fixed-width histogram.Histogram1D(String title, IAxis axis) 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 index) Number of entries in the corresponding bin (ie the number of times fill was called for this bin).doublebinError(int index) The error on this bin.doublebinHeight(int index) Total height of the corresponding bin (ie the sum of the weights in this bin).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) Fill histogram with weight 1.voidfill(double x, double weight) Fill histogram with specified weight.doublemean()Returns the mean of the whole histogram as calculated on filling-time.int[]Indexes of the in-range bins containing the smallest and largest binHeight(), respectively.voidreset()Reset contents; as if just constructed.doublerms()Returns the rms of the whole histogram as calculated on filling-time.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()Returns the X 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, sumAllBinHeights, sumBinHeights, sumExtraBinHeights, titleMethods inherited from interface hep.aida.IHistogram1D
minMaxBins, xAxis
-
Field Details
-
xAxis
-
-
Constructor Details
-
Histogram1D
Creates a variable-width histogram. Example: edges = (0.2, 1.0, 5.0) yields an axis with 2 in-range bins [0.2,1.0), [1.0,5.0) and 2 extra bins [-inf,0.2), [5.0,inf].- Parameters:
title- The histogram title.edges- the bin boundaries the axis shall have; must be sorted ascending and must not contain multiple identical elements.- Throws:
IllegalArgumentException- if edges.length invalid input: '<' 1.
-
Histogram1D
Creates a fixed-width histogram.- Parameters:
title- The histogram title.bins- The number of bins.min- The minimum value on the X axis.max- The maximum value on the X axis.
-
Histogram1D
Creates a histogram with the given axis binning.- Parameters:
title- The histogram title.axis- The 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 index) Description copied from interface:IHistogram1DNumber of entries in the corresponding bin (ie the number of times fill was called for this bin).- Specified by:
binEntriesin interfaceIHistogram1D- Parameters:
index- the bin number (0...N-1) or OVERFLOW or UNDERFLOW.
-
binError
public double binError(int index) Description copied from interface:IHistogram1DThe error on this bin.- Specified by:
binErrorin interfaceIHistogram1D- Parameters:
index- the bin number (0...N-1) or OVERFLOW or UNDERFLOW.
-
binHeight
public double binHeight(int index) Description copied from interface:IHistogram1DTotal height of the corresponding bin (ie the sum of the weights in this bin).- Specified by:
binHeightin interfaceIHistogram1D- Parameters:
index- the bin number (0...N-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) Description copied from interface:IHistogram1DFill histogram with weight 1.- Specified by:
fillin interfaceIHistogram1D
-
fill
public void fill(double x, double weight) Description copied from interface:IHistogram1DFill histogram with specified weight.- Specified by:
fillin interfaceIHistogram1D
-
mean
public double mean()Description copied from interface:IHistogram1DReturns the mean of the whole histogram as calculated on filling-time.- Specified by:
meanin interfaceIHistogram1D
-
reset
public void reset()Description copied from interface:IHistogramReset contents; as if just constructed.- Specified by:
resetin interfaceIHistogram
-
rms
public double rms()Description copied from interface:IHistogram1DReturns the rms of the whole histogram as calculated on filling-time.- Specified by:
rmsin interfaceIHistogram1D
-
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:IHistogram1DIndexes of the in-range bins containing the smallest and largest binHeight(), respectively.- Specified by:
minMaxBinsin interfaceIHistogram1D- Returns:
- {minBin,maxBin}.
-
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
-
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:IHistogram1DReturns the X Axis.- Specified by:
xAxisin interfaceIHistogram1D
-
title
Description copied from interface:IHistogramTitle of the histogram (will be set only in the constructor).- Specified by:
titlein interfaceIHistogram
-