Package hep.aida.ref

Class Histogram3D

java.lang.Object
hep.aida.ref.Histogram3D
All Implemented Interfaces:
IHistogram, IHistogram3D, Serializable

public class Histogram3D extends Object implements IHistogram3D
A reference implementation of hep.aida.IHistogram3D. The goal is to provide a clear implementation rather than the most efficient implementation. However, performance seems fine - filling 3 * 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

    Fields
    Modifier and Type
    Field
    Description
    protected IAxis
     
    protected IAxis
     
    protected IAxis
     

    Fields inherited from interface hep.aida.IHistogram

    OVERFLOW, serialVersionUID, UNDERFLOW
  • Constructor Summary

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

    Modifier and Type
    Method
    Description
    int
    Number of all entries in all (both in-range and under/overflow) bins in the histogram.
    int
    binEntries(int indexX, int indexY, int indexZ)
    The number of entries (ie the number of times fill was called for this bin).
    double
    binError(int indexX, int indexY, int indexZ)
    The error on this bin.
    double
    binHeight(int indexX, int indexY, int indexZ)
    Total height of the corresponding bin (ie the sum of the weights in this bin).
    int
    Returns 1 for one-dimensional histograms, 2 for two-dimensional histograms, and so on.
    int
    Number of in-range entries in the histogram.
    double
    Number of equivalent entries.
    int
    Number of under and overflow entries in the histogram.
    void
    fill(double x, double y, double z)
    Fill the histogram with weight 1; equivalent to fill(x,y,z,1)..
    void
    fill(double x, double y, double z, double weight)
    Fill the histogram with specified weight.
    protected IHistogram2D
    internalSliceXY(String title, int indexZ1, int indexZ2)
    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 IHistogram2D
    internalSliceXZ(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 IHistogram2D
    internalSliceYZ(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.
    double
    Returns the mean of the histogram, as calculated on filling-time projected on the X axis.
    double
    Returns the mean of the histogram, as calculated on filling-time projected on the Y axis.
    double
    Returns the mean of the histogram, as calculated on filling-time projected on the Z axis.
    int[]
    Indexes of the in-range bins containing the smallest and largest binHeight(), respectively.
    Create a projection parallel to the XY plane.
    Create a projection parallel to the XZ plane.
    Create a projection parallel to the YZ plane.
    void
    Reset contents; as if just constructed.
    double
    Returns the rms of the histogram as calculated on filling-time projected on the X axis.
    double
    Returns the rms of the histogram as calculated on filling-time projected on the Y axis.
    double
    Returns the rms of the histogram as calculated on filling-time projected on the Z axis.
    sliceXY(int indexZ)
    Create a slice parallel to the XY plane at bin indexZ and one bin wide.
    sliceXY(int indexZ1, int indexZ2)
    Create a slice parallel to the XY plane, between "indexZ1" and "indexZ2" (inclusive).
    sliceXZ(int indexY)
    Create a slice parallel to the XZ plane at bin indexY and one bin wide.
    sliceXZ(int indexY1, int indexY2)
    Create a slice parallel to the XZ plane, between "indexY1" and "indexY2" (inclusive).
    sliceYZ(int indexX)
    Create a slice parallel to the YZ plane at bin indexX and one bin wide.
    sliceYZ(int indexX1, int indexX2)
    Create a slice parallel to the YZ plane, between "indexX1" and "indexX2" (inclusive).
    double
    Sum of all (both in-range and under/overflow) bin heights in the histogram.
    double
    Sum of in-range bin heights in the histogram.
    double
    Sum of under/overflow bin heights in the histogram.
    Title of the histogram (will be set only in the constructor).
    Return the X axis.
    Return the Y axis.
    Return the Z axis.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface hep.aida.IHistogram

    dimensions, entries, extraEntries, sumBinHeights, sumExtraBinHeights, title
  • Field Details

    • xAxis

      protected IAxis xAxis
    • yAxis

      protected IAxis yAxis
    • zAxis

      protected IAxis zAxis
  • Constructor Details

    • Histogram3D

      public Histogram3D(String title, double[] xEdges, double[] yEdges, double[] zEdges)
      Creates a variable-width histogram. Example: xEdges = (0.2, 1.0, 5.0, 6.0), yEdges = (-5, 0, 7), zEdges = (-5, 0, 7) yields 3*2*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.
      zEdges - the bin boundaries the z-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|| zEdges.length invalid input: '<' 1.
    • Histogram3D

      public Histogram3D(String title, int xBins, double xMin, double xMax, int yBins, double yMin, double yMax, int zBins, double zMin, double zMax)
      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.
      zBins - The number of bins on the Z axis.
      zMin - The minimum value on the Z axis.
      zMax - The maximum value on the Z axis.
    • Histogram3D

      public Histogram3D(String title, IAxis xAxis, IAxis yAxis, IAxis zAxis)
      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.
      zAxis - The z-axis description to be used for binning.
  • Method Details

    • 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, int indexZ)
      Description copied from interface: IHistogram3D
      The number of entries (ie the number of times fill was called for this bin).
      Specified by:
      binEntries in interface IHistogram3D
      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.
      indexZ - the z bin number (0...Nz-1) or OVERFLOW or UNDERFLOW.
    • binError

      public double binError(int indexX, int indexY, int indexZ)
      Description copied from interface: IHistogram3D
      The error on this bin.
      Specified by:
      binError in interface IHistogram3D
      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.
      indexZ - the z bin number (0...Nz-1) or OVERFLOW or UNDERFLOW.
    • binHeight

      public double binHeight(int indexX, int indexY, int indexZ)
      Description copied from interface: IHistogram3D
      Total height of the corresponding bin (ie the sum of the weights in this bin).
      Specified by:
      binHeight in interface IHistogram3D
      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.
      indexZ - the z bin number (0...Nz-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, double z)
      Description copied from interface: IHistogram3D
      Fill the histogram with weight 1; equivalent to fill(x,y,z,1)..
      Specified by:
      fill in interface IHistogram3D
    • fill

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

      protected IHistogram2D internalSliceXY(String title, int indexZ1, int indexZ2)
      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)

    • internalSliceXZ

      protected IHistogram2D internalSliceXZ(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.

      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)

    • internalSliceYZ

      protected IHistogram2D internalSliceYZ(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.

      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: IHistogram3D
      Returns the mean of the histogram, as calculated on filling-time projected on the X axis.
      Specified by:
      meanX in interface IHistogram3D
    • meanY

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

      public double meanZ()
      Description copied from interface: IHistogram3D
      Returns the mean of the histogram, as calculated on filling-time projected on the Z axis.
      Specified by:
      meanZ in interface IHistogram3D
    • 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: IHistogram3D
      Returns the rms of the histogram as calculated on filling-time projected on the X axis.
      Specified by:
      rmsX in interface IHistogram3D
    • rmsY

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

      public double rmsZ()
      Description copied from interface: IHistogram3D
      Returns the rms of the histogram as calculated on filling-time projected on the Z axis.
      Specified by:
      rmsZ in interface IHistogram3D
    • 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
    • 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: IHistogram3D
      Indexes of the in-range bins containing the smallest and largest binHeight(), respectively.
      Specified by:
      minMaxBins in interface IHistogram3D
      Returns:
      {minBinX,minBinY,minBinZ, maxBinX,maxBinY,maxBinZ}.
    • projectionXY

      public IHistogram2D projectionXY()
      Description copied from interface: IHistogram3D
      Create a projection parallel to the XY plane. Equivalent to sliceXY(UNDERFLOW,OVERFLOW).
      Specified by:
      projectionXY in interface IHistogram3D
    • projectionXZ

      public IHistogram2D projectionXZ()
      Description copied from interface: IHistogram3D
      Create a projection parallel to the XZ plane. Equivalent to sliceXZ(UNDERFLOW,OVERFLOW).
      Specified by:
      projectionXZ in interface IHistogram3D
    • projectionYZ

      public IHistogram2D projectionYZ()
      Description copied from interface: IHistogram3D
      Create a projection parallel to the YZ plane. Equivalent to sliceYZ(UNDERFLOW,OVERFLOW).
      Specified by:
      projectionYZ in interface IHistogram3D
    • sliceXY

      public IHistogram2D sliceXY(int indexZ)
      Description copied from interface: IHistogram3D
      Create a slice parallel to the XY plane at bin indexZ and one bin wide. Equivalent to sliceXY(indexZ,indexZ).
      Specified by:
      sliceXY in interface IHistogram3D
    • sliceXY

      public IHistogram2D sliceXY(int indexZ1, int indexZ2)
      Description copied from interface: IHistogram3D
      Create a slice parallel to the XY plane, between "indexZ1" and "indexZ2" (inclusive). The returned IHistogram2D represents an instantaneous snapshot of the histogram at the time the slice was created.
      Specified by:
      sliceXY in interface IHistogram3D
    • sliceXZ

      public IHistogram2D sliceXZ(int indexY)
      Description copied from interface: IHistogram3D
      Create a slice parallel to the XZ plane at bin indexY and one bin wide. Equivalent to sliceXZ(indexY,indexY).
      Specified by:
      sliceXZ in interface IHistogram3D
    • sliceXZ

      public IHistogram2D sliceXZ(int indexY1, int indexY2)
      Description copied from interface: IHistogram3D
      Create a slice parallel to the XZ plane, between "indexY1" and "indexY2" (inclusive). The returned IHistogram2D represents an instantaneous snapshot of the histogram at the time the slice was created.
      Specified by:
      sliceXZ in interface IHistogram3D
    • sliceYZ

      public IHistogram2D sliceYZ(int indexX)
      Description copied from interface: IHistogram3D
      Create a slice parallel to the YZ plane at bin indexX and one bin wide. Equivalent to sliceYZ(indexX,indexX).
      Specified by:
      sliceYZ in interface IHistogram3D
    • sliceYZ

      public IHistogram2D sliceYZ(int indexX1, int indexX2)
      Description copied from interface: IHistogram3D
      Create a slice parallel to the YZ plane, between "indexX1" and "indexX2" (inclusive). The returned IHistogram2D represents an instantaneous snapshot of the histogram at the time the slice was created.
      Specified by:
      sliceYZ in interface IHistogram3D
    • 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
    • xAxis

      public IAxis xAxis()
      Description copied from interface: IHistogram3D
      Return the X axis.
      Specified by:
      xAxis in interface IHistogram3D
    • yAxis

      public IAxis yAxis()
      Description copied from interface: IHistogram3D
      Return the Y axis.
      Specified by:
      yAxis in interface IHistogram3D
    • zAxis

      public IAxis zAxis()
      Description copied from interface: IHistogram3D
      Return the Z axis.
      Specified by:
      zAxis in interface IHistogram3D
    • 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