Histogram2D
cern.hep.aida.ref

Class Histogram2D

  • All Implemented Interfaces:
    IHistogram, IHistogram2D, Serializable


    public class Histogram2Dextends Objectimplements IHistogram2D
    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
    • Constructor Summary

      Constructors 
      Constructor and Description
      Histogram2D(String title, double[] xEdges, double[] yEdges)
      Creates a variable-width histogram.
      Histogram2D(String title, IAxis xAxis, IAxis yAxis)
      Creates a histogram with the given axis binning.
      Histogram2D(String title, int xBins, double xMin, double xMax, int yBins, double yMin, double yMax)
      Creates a fixed-width histogram.
    • Method Summary

      Methods 
      Modifier and TypeMethod 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).
      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).
      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(double x, double y)
      Fill the histogram with weight 1.
      voidfill(double x, double y, double weight)
      Fill the histogram with specified weight.
      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[]minMaxBins()
      Indexes of the in-range bins containing the smallest and largest binHeight(), respectively.
      IHistogram1DprojectionX()
      Create a projection parallel to the X axis.
      IHistogram1DprojectionY()
      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.
      IHistogram1DsliceX(int indexY)
      Slice parallel to the Y axis at bin indexY and one bin wide.
      IHistogram1DsliceX(int indexY1, int indexY2)
      Create a slice parallel to the axis X axis, between "indexY1" and "indexY2" (inclusive).
      IHistogram1DsliceY(int indexX)
      Slice parallel to the X axis at bin indexX and one bin wide.
      IHistogram1DsliceY(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.
      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.
      Stringtitle()
      Title of the histogram (will be set only in the constructor).
      IAxisxAxis()
      Return the X axis.
      IAxisyAxis()
      Return the Y axis.
    • Constructor Detail

      • Histogram2D

        public Histogram2D(String title,           double[] xEdges,           double[] 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:
        IllegalArgumentException - if xEdges.length < 1 || yEdges.length < 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

        public Histogram2D(String title,           IAxis xAxis,           IAxis 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: IHistogram
        Number of all entries in all (both in-range and under/overflow) bins in the histogram.
        Specified by:
        allEntries in interface IHistogram
      • binEntries

        public int binEntries(int indexX,             int indexY)
        Description copied from interface: IHistogram2D
        The number of entries (ie the number of times fill was called for this bin).
        Specified by:
        binEntries in interface IHistogram2D
        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: IHistogram2D
        The error on this bin.
        Specified by:
        binError in interface IHistogram2D
        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: IHistogram2D
        Total height of the corresponding bin (ie the sum of the weights in this bin).
        Specified by:
        binHeight in interface IHistogram2D
        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: IHistogram
        Number of equivalent entries.
        Specified by:
        equivalentBinEntries in interface IHistogram
        Returns:
        SUM[ weight ] ^ 2 / SUM[ weight^2 ].
      • fill

        public void fill(double x,        double y)
        Description copied from interface: IHistogram2D
        Fill the histogram with weight 1.
        Specified by:
        fill in interface IHistogram2D
      • fill

        public void fill(double x,        double y,        double weight)
        Description copied from interface: IHistogram2D
        Fill the histogram with specified weight.
        Specified by:
        fill in interface IHistogram2D
      • meanX

        public double meanX()
        Description copied from interface: IHistogram2D
        Returns the mean of the histogram, as calculated on filling-time projected on the X axis.
        Specified by:
        meanX in interface IHistogram2D
      • meanY

        public double meanY()
        Description copied from interface: IHistogram2D
        Returns the mean of the histogram, as calculated on filling-time projected on the Y axis.
        Specified by:
        meanY in interface IHistogram2D
      • reset

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

        public double rmsX()
        Description copied from interface: IHistogram2D
        Returns the rms of the histogram as calculated on filling-time projected on the X axis.
        Specified by:
        rmsX in interface IHistogram2D
      • rmsY

        public double rmsY()
        Description copied from interface: IHistogram2D
        Returns the rms of the histogram as calculated on filling-time projected on the Y axis.
        Specified by:
        rmsY in interface IHistogram2D
      • sumAllBinHeights

        public double sumAllBinHeights()
        Description copied from interface: IHistogram
        Sum of all (both in-range and under/overflow) bin heights in the histogram.
        Specified by:
        sumAllBinHeights in interface IHistogram
      • binEntriesX

        public int binEntriesX(int indexX)
        Description copied from interface: IHistogram2D
        Equivalent to projectionX().binEntries(indexX).
        Specified by:
        binEntriesX in interface IHistogram2D
      • binEntriesY

        public int binEntriesY(int indexY)
        Description copied from interface: IHistogram2D
        Equivalent to projectionY().binEntries(indexY).
        Specified by:
        binEntriesY in interface IHistogram2D
      • binHeightX

        public double binHeightX(int indexX)
        Description copied from interface: IHistogram2D
        Equivalent to projectionX().binHeight(indexX).
        Specified by:
        binHeightX in interface IHistogram2D
      • binHeightY

        public double binHeightY(int indexY)
        Description copied from interface: IHistogram2D
        Equivalent to projectionY().binHeight(indexY).
        Specified by:
        binHeightY in interface IHistogram2D
      • dimensions

        public int dimensions()
        Description copied from interface: IHistogram
        Returns 1 for one-dimensional histograms, 2 for two-dimensional histograms, and so on.
        Specified by:
        dimensions in interface IHistogram
      • entries

        public int entries()
        Description copied from interface: IHistogram
        Number of in-range entries in the histogram.
        Specified by:
        entries in interface IHistogram
      • extraEntries

        public int extraEntries()
        Description copied from interface: IHistogram
        Number of under and overflow entries in the histogram.
        Specified by:
        extraEntries in interface IHistogram
      • minMaxBins

        public int[] minMaxBins()
        Description copied from interface: IHistogram2D
        Indexes of the in-range bins containing the smallest and largest binHeight(), respectively.
        Specified by:
        minMaxBins in interface IHistogram2D
        Returns:
        {minBinX,minBinY, maxBinX,maxBinY}.
      • sliceX

        public IHistogram1D sliceX(int indexY)
        Description copied from interface: IHistogram2D
        Slice parallel to the Y axis at bin indexY and one bin wide. Equivalent to sliceX(indexY,indexY).
        Specified by:
        sliceX in interface IHistogram2D
      • sliceX

        public IHistogram1D sliceX(int indexY1,                  int indexY2)
        Description copied from interface: IHistogram2D
        Create 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:
        sliceX in interface IHistogram2D
      • sliceY

        public IHistogram1D sliceY(int indexX)
        Description copied from interface: IHistogram2D
        Slice parallel to the X axis at bin indexX and one bin wide. Equivalent to sliceY(indexX,indexX).
        Specified by:
        sliceY in interface IHistogram2D
      • sliceY

        public IHistogram1D sliceY(int indexX1,                  int indexX2)
        Description copied from interface: IHistogram2D
        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.
        Specified by:
        sliceY in interface IHistogram2D
      • sumBinHeights

        public double sumBinHeights()
        Description copied from interface: IHistogram
        Sum of in-range bin heights in the histogram.
        Specified by:
        sumBinHeights in interface IHistogram
      • sumExtraBinHeights

        public double sumExtraBinHeights()
        Description copied from interface: IHistogram
        Sum of under/overflow bin heights in the histogram.
        Specified by:
        sumExtraBinHeights in interface IHistogram
      • title

        public String title()
        Description copied from interface: IHistogram
        Title of the histogram (will be set only in the constructor).
        Specified by:
        title in interface IHistogram

SCaVis 2.1 © jWork.ORG