Package hep.aida.ref

Class Histogram1D

  • All Implemented Interfaces:
    IHistogram, IHistogram1D, java.io.Serializable

    public class Histogram1D
    extends AbstractHistogram1D
    implements IHistogram1D
    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
    See Also:
    Serialized Form
    • Field Detail

      • errors

        private double[] errors
      • heights

        private double[] heights
      • entries

        private int[] entries
      • nEntry

        private int nEntry
      • sumWeight

        private double sumWeight
      • sumWeightSquared

        private double sumWeightSquared
      • mean

        private double mean
      • rms

        private double rms
    • Constructor Detail

      • Histogram1D

        public Histogram1D​(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.
      • Histogram1D

        public Histogram1D​(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.
      • Histogram1D

        public Histogram1D​(java.lang.String title,
                           IAxis axis)
        Creates a histogram with the given axis binning.
        Parameters:
        title - The histogram title.
        axis - The axis description to be used for binning.
    • Method Detail

      • binEntries

        public int binEntries​(int index)
        Description copied from interface: IHistogram1D
        Number of entries in the corresponding bin (ie the number of times fill was called for this bin).
        Specified by:
        binEntries in interface IHistogram1D
        Parameters:
        index - the bin number (0...N-1) or OVERFLOW or UNDERFLOW.
      • binError

        public double binError​(int index)
        Description copied from interface: IHistogram1D
        The error on this bin.
        Specified by:
        binError in interface IHistogram1D
        Parameters:
        index - the bin number (0...N-1) or OVERFLOW or UNDERFLOW.
      • binHeight

        public double binHeight​(int index)
        Description copied from interface: IHistogram1D
        Total height of the corresponding bin (ie the sum of the weights in this bin).
        Specified by:
        binHeight in interface IHistogram1D
        Parameters:
        index - the bin number (0...N-1) or OVERFLOW or UNDERFLOW.
      • equivalentBinEntries

        public double equivalentBinEntries()
        Description copied from interface: IHistogram
        Number of equivalent entries.
        Specified by:
        equivalentBinEntries in interface IHistogram
        Returns:
        SUM[ weight ] ^ 2 / SUM[ weight^2 ].
      • fill

        public void fill​(double x)
        Description copied from interface: IHistogram1D
        Fill histogram with weight 1.
        Specified by:
        fill in interface IHistogram1D
      • fill

        public void fill​(double x,
                         double weight)
        Description copied from interface: IHistogram1D
        Fill histogram with specified weight.
        Specified by:
        fill in interface IHistogram1D
      • mean

        public double mean()
        Description copied from interface: IHistogram1D
        Returns the mean of the whole histogram as calculated on filling-time.
        Specified by:
        mean in interface IHistogram1D
      • reset

        public void reset()
        Description copied from interface: IHistogram
        Reset contents; as if just constructed.
        Specified by:
        reset in interface IHistogram
      • rms

        public double rms()
        Description copied from interface: IHistogram1D
        Returns the rms of the whole histogram as calculated on filling-time.
        Specified by:
        rms in interface IHistogram1D
      • setContents

        void setContents​(int[] entries,
                         double[] heights,
                         double[] errors)
        Used internally for creating slices and projections