hep.aida.tdouble.ref
Class DoubleHistogram1D
- java.lang.Object
-
- hep.aida.tdouble.ref.DoubleHistogram1D
-
- All Implemented Interfaces:
- DoubleIHistogram, DoubleIHistogram1D, java.io.Serializable
public class DoubleHistogram1D extends java.lang.Object implements DoubleIHistogram1D
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.- See Also:
- Serialized Form
-
-
Field Summary
-
Fields inherited from interface hep.aida.tdouble.DoubleIHistogram
OVERFLOW, UNDERFLOW
-
-
Constructor Summary
Constructors Constructor and Description DoubleHistogram1D(java.lang.String title, double[] edges)Creates a variable-width histogram.DoubleHistogram1D(java.lang.String title, DoubleIAxis axis)Creates a histogram with the given axis binning.DoubleHistogram1D(java.lang.String title, int bins, double min, double max)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 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).intdimensions()Returns 1 for one-dimensional histograms, 2 for two-dimensional histograms, and so on.intentries()Number of in-range entries in the histogram.doubleequivalentBinEntries()Number of equivalent entries.intextraEntries()Number of under and overflow entries in the histogram.voidfill_2D(double[] data, double[] weights, int rows, int columns, int zero, int rowStride, int columnStride)Fill histogram with specified data and weights.voidfill_2D(double[] data, int rows, int columns, int zero, int rowStride, int columnStride)Fill histogram with specified data and weight 1.voidfill(double x)Fill histogram with weight 1.voidfill(double x, double weight)Fill histogram with specified weight.DoubleHistogram1DContentsgetContents()Returns the contents of this histogram.doublemean()Returns the mean of the whole histogram as calculated on filling-time.int[]minMaxBins()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.voidsetContents(DoubleHistogram1DContents contents)Sets the contents of this histogram.doublesumAllBinHeights()Sum of all (both in-range and under/overflow) bin heights in the histogram.doublesumBinHeights()Sum of in-range bin heights in the histogram.doublesumExtraBinHeights()Sum of under/overflow bin heights in the histogram.java.lang.Stringtitle()Title of the histogram (will be set only in the constructor).DoubleIAxisxAxis()Returns the X Axis.-
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface hep.aida.tdouble.DoubleIHistogram1D
minMaxBins, xAxis
-
Methods inherited from interface hep.aida.tdouble.DoubleIHistogram
dimensions, entries, extraEntries, sumAllBinHeights, sumBinHeights, sumExtraBinHeights, title
-
-
-
-
Constructor Detail
-
DoubleHistogram1D
public DoubleHistogram1D(java.lang.String title, double[] edges)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:
java.lang.IllegalArgumentException- if edges.length < 1.
-
DoubleHistogram1D
public DoubleHistogram1D(java.lang.String title, DoubleIAxis axis)Creates a histogram with the given axis binning.- Parameters:
title- The histogram title.axis- The axis description to be used for binning.
-
DoubleHistogram1D
public DoubleHistogram1D(java.lang.String title, int bins, double min, double max)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.
-
-
Method Detail
-
allEntries
public int allEntries()
Description copied from interface:DoubleIHistogramNumber of all entries in all (both in-range and under/overflow) bins in the histogram.- Specified by:
allEntriesin interfaceDoubleIHistogram
-
binEntries
public int binEntries(int index)
Description copied from interface:DoubleIHistogram1DNumber of entries in the corresponding bin (ie the number of times fill was called for this bin).- Specified by:
binEntriesin interfaceDoubleIHistogram1D- Parameters:
index- the bin number (0...N-1) or OVERFLOW or UNDERFLOW.
-
binError
public double binError(int index)
Description copied from interface:DoubleIHistogram1DThe error on this bin.- Specified by:
binErrorin interfaceDoubleIHistogram1D- Parameters:
index- the bin number (0...N-1) or OVERFLOW or UNDERFLOW.
-
binHeight
public double binHeight(int index)
Description copied from interface:DoubleIHistogram1DTotal height of the corresponding bin (ie the sum of the weights in this bin).- Specified by:
binHeightin interfaceDoubleIHistogram1D- Parameters:
index- the bin number (0...N-1) or OVERFLOW or UNDERFLOW.
-
equivalentBinEntries
public double equivalentBinEntries()
Description copied from interface:DoubleIHistogramNumber of equivalent entries.- Specified by:
equivalentBinEntriesin interfaceDoubleIHistogram- Returns:
- SUM[ weight ] ^ 2 / SUM[ weight^2 ].
-
fill
public void fill(double x)
Description copied from interface:DoubleIHistogram1DFill histogram with weight 1.- Specified by:
fillin interfaceDoubleIHistogram1D
-
fill
public void fill(double x, double weight)Description copied from interface:DoubleIHistogram1DFill histogram with specified weight.- Specified by:
fillin interfaceDoubleIHistogram1D
-
fill_2D
public void fill_2D(double[] data, int rows, int columns, int zero, int rowStride, int columnStride)Description copied from interface:DoubleIHistogram1DFill histogram with specified data and weight 1.- Specified by:
fill_2Din interfaceDoubleIHistogram1D
-
fill_2D
public void fill_2D(double[] data, double[] weights, int rows, int columns, int zero, int rowStride, int columnStride)Description copied from interface:DoubleIHistogram1DFill histogram with specified data and weights.- Specified by:
fill_2Din interfaceDoubleIHistogram1D
-
getContents
public DoubleHistogram1DContents getContents()
Returns the contents of this histogram.- Returns:
- the contents of this histogram
-
mean
public double mean()
Description copied from interface:DoubleIHistogram1DReturns the mean of the whole histogram as calculated on filling-time.- Specified by:
meanin interfaceDoubleIHistogram1D
-
reset
public void reset()
Description copied from interface:DoubleIHistogramReset contents; as if just constructed.- Specified by:
resetin interfaceDoubleIHistogram
-
rms
public double rms()
Description copied from interface:DoubleIHistogram1DReturns the rms of the whole histogram as calculated on filling-time.- Specified by:
rmsin interfaceDoubleIHistogram1D
-
setContents
public void setContents(DoubleHistogram1DContents contents)
Sets the contents of this histogram.- Parameters:
contents-
-
dimensions
public int dimensions()
Description copied from interface:DoubleIHistogramReturns 1 for one-dimensional histograms, 2 for two-dimensional histograms, and so on.- Specified by:
dimensionsin interfaceDoubleIHistogram
-
entries
public int entries()
Description copied from interface:DoubleIHistogramNumber of in-range entries in the histogram.- Specified by:
entriesin interfaceDoubleIHistogram
-
extraEntries
public int extraEntries()
Description copied from interface:DoubleIHistogramNumber of under and overflow entries in the histogram.- Specified by:
extraEntriesin interfaceDoubleIHistogram
-
minMaxBins
public int[] minMaxBins()
Description copied from interface:DoubleIHistogram1DIndexes of the in-range bins containing the smallest and largest binHeight(), respectively.- Specified by:
minMaxBinsin interfaceDoubleIHistogram1D- Returns:
- {minBin,maxBin}.
-
sumAllBinHeights
public double sumAllBinHeights()
Description copied from interface:DoubleIHistogramSum of all (both in-range and under/overflow) bin heights in the histogram.- Specified by:
sumAllBinHeightsin interfaceDoubleIHistogram
-
sumBinHeights
public double sumBinHeights()
Description copied from interface:DoubleIHistogramSum of in-range bin heights in the histogram.- Specified by:
sumBinHeightsin interfaceDoubleIHistogram
-
sumExtraBinHeights
public double sumExtraBinHeights()
Description copied from interface:DoubleIHistogramSum of under/overflow bin heights in the histogram.- Specified by:
sumExtraBinHeightsin interfaceDoubleIHistogram
-
xAxis
public DoubleIAxis xAxis()
Description copied from interface:DoubleIHistogram1DReturns the X Axis.- Specified by:
xAxisin interfaceDoubleIHistogram1D
-
title
public java.lang.String title()
Description copied from interface:DoubleIHistogramTitle of the histogram (will be set only in the constructor).- Specified by:
titlein interfaceDoubleIHistogram
-
-
DMelt 3.0 © DataMelt by jWork.ORG